Commit d3e8feeb authored by Sylvain Berfini's avatar Sylvain Berfini 🐮
Browse files

JNI wrapper for lime methods

parent 5dc6c5cb
......@@ -2475,6 +2475,27 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryptionMandat
linphone_core_set_media_encryption_mandatory((LinphoneCore*)lc, yesno);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isLimeEncryptionAvailable (JNIEnv* env
,jobject thiz
,jlong lc
) {
return (jboolean) linphone_core_lime_available((LinphoneCore*)lc);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getLimeEncryption(JNIEnv* env
,jobject thiz
,jlong lc
) {
return (jint)linphone_core_lime_enabled((LinphoneCore*)lc);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setLimeEncryption(JNIEnv* env
,jobject thiz
,jlong lc
,jint menc) {
linphone_core_enable_lime((LinphoneCore*)lc,(LinphoneLimeState)menc);
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: disableChat
......
......@@ -561,6 +561,42 @@ public interface LinphoneCore {
return mStringValue;
}
}
static public final class LinphoneLimeState {
static private Vector<LinphoneLimeState> values = new Vector<LinphoneLimeState>();
/**
* Disabled
*/
static public final LinphoneLimeState Disabled = new LinphoneLimeState(0, "None");
/**
* Mandatory
*/
static public final LinphoneLimeState Mandatory = new LinphoneLimeState(1,"Mandatory");
/**
* Preferred
*/
static public final LinphoneLimeState Preferred = new LinphoneLimeState(2,"Preferred");
protected final int mValue;
private final String mStringValue;
private LinphoneLimeState(int value, String stringValue) {
mValue = value;
values.addElement(this);
mStringValue = stringValue;
}
public static LinphoneLimeState fromInt(int value) {
for (int i=0; i<values.size();i++) {
LinphoneLimeState menc = (LinphoneLimeState) values.elementAt(i);
if (menc.mValue == value) return menc;
}
throw new RuntimeException("LinphoneLimeState not found ["+value+"]");
}
public String toString() {
return mStringValue;
}
}
/**
* Set the context of creation of the LinphoneCore.
......@@ -2340,4 +2376,10 @@ public interface LinphoneCore {
* @param path The path from where plugins are to be loaded.
**/
public void reloadMsPlugins(String path);
public boolean isLimeEncryptionAvailable();
public void setLimeEncryption(LinphoneLimeState lime);
public LinphoneLimeState getLimeEncryption();
}
......@@ -1678,4 +1678,19 @@ class LinphoneCoreImpl implements LinphoneCore {
public void reloadMsPlugins(String path) {
reloadMsPlugins(nativePtr, path);
}
private native boolean isLimeEncryptionAvailable(long nativePtr);
public synchronized boolean isLimeEncryptionAvailable() {
return isLimeEncryptionAvailable(nativePtr);
}
private native void setLimeEncryption(long nativePtr, int value);
public synchronized void setLimeEncryption(LinphoneLimeState lime) {
setLimeEncryption(nativePtr, lime.mValue);
}
private native int getLimeEncryption(long nativePtr);
public synchronized LinphoneLimeState getLimeEncryption() {
return LinphoneLimeState.fromInt(getLimeEncryption(nativePtr));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment