mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 13:48:09 +00:00
Updated JNI interface and LinphoneAuthInfo java class
This commit is contained in:
parent
7a07ad2446
commit
c344f32c1e
4 changed files with 42 additions and 1 deletions
|
|
@ -814,6 +814,22 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv*
|
|||
return (jint)linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc);
|
||||
}
|
||||
|
||||
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getAuthInfosList(JNIEnv* env, jobject thiz,jlong lc) {
|
||||
const MSList* authInfos = linphone_core_get_auth_info_list((LinphoneCore*)lc);
|
||||
int listCount = ms_list_size(authInfos);
|
||||
jlongArray jAuthInfos = env->NewLongArray(listCount);
|
||||
jlong *jInternalArray = env->GetLongArrayElements(jAuthInfos, NULL);
|
||||
|
||||
for (int i = 0; i < listCount; i++ ) {
|
||||
jInternalArray[i] = (unsigned long) (authInfos->data);
|
||||
authInfos = authInfos->next;
|
||||
}
|
||||
|
||||
env->ReleaseLongArrayElements(jAuthInfos, jInternalArray, 0);
|
||||
|
||||
return jAuthInfos;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) {
|
||||
linphone_core_clear_all_auth_info((LinphoneCore*)lc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,6 +384,11 @@ public interface LinphoneCore {
|
|||
*/
|
||||
public LinphoneProxyConfig getDefaultProxyConfig() ;
|
||||
|
||||
/**
|
||||
* Returns an array with all the auth infos stored in LinphoneCore
|
||||
*/
|
||||
LinphoneAuthInfo[] getAuthInfosList();
|
||||
|
||||
/**
|
||||
* clear all the added auth info
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo {
|
|||
private native String getUserId(long ptr);
|
||||
private native String getHa1(long ptr);
|
||||
|
||||
boolean ownPtr = false;
|
||||
protected LinphoneAuthInfoImpl(String username,String password, String realm) {
|
||||
this(username,null,password,null,null);
|
||||
}
|
||||
|
|
@ -42,9 +43,14 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo {
|
|||
this.setUserId(userid);
|
||||
this.setPassword(passwd);
|
||||
this.setHa1(ha1);
|
||||
ownPtr = true;
|
||||
}
|
||||
protected LinphoneAuthInfoImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
ownPtr = false;
|
||||
}
|
||||
protected void finalize() throws Throwable {
|
||||
delete(nativePtr);
|
||||
if (ownPtr) delete(nativePtr);
|
||||
}
|
||||
public String getPassword() {
|
||||
return getPassword (nativePtr);
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native void setRootCA(long nativePtr, String path);
|
||||
private native long[] listVideoPayloadTypes(long nativePtr);
|
||||
private native long[] getProxyConfigList(long nativePtr);
|
||||
private native long[] getAuthInfosList(long nativePtr);
|
||||
private native long[] listAudioPayloadTypes(long nativePtr);
|
||||
private native void enableKeepAlive(long nativePtr,boolean enable);
|
||||
private native boolean isKeepAliveEnabled(long nativePtr);
|
||||
|
|
@ -1007,4 +1008,17 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
|
||||
return proxies;
|
||||
}
|
||||
@Override
|
||||
public LinphoneAuthInfo[] getAuthInfosList() {
|
||||
long[] typesPtr = getAuthInfosList(nativePtr);
|
||||
if (typesPtr == null) return null;
|
||||
|
||||
LinphoneAuthInfo[] authInfos = new LinphoneAuthInfo[typesPtr.length];
|
||||
|
||||
for (int i=0; i < authInfos.length; i++) {
|
||||
authInfos[i] = new LinphoneAuthInfoImpl(typesPtr[i]);
|
||||
}
|
||||
|
||||
return authInfos;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue