mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Add key ref for friend
This commit is contained in:
parent
9ec6bda1c4
commit
04abb57606
3 changed files with 39 additions and 0 deletions
|
|
@ -2892,6 +2892,21 @@ extern "C" jobject Java_org_linphone_core_LinphoneFriendImpl_getCore(JNIEnv* en
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setRefKey(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jstring jkey) {
|
||||
const char* key = env->GetStringUTFChars(jkey, NULL);
|
||||
linphone_friend_set_ref_key((LinphoneFriend*)ptr,key);
|
||||
env->ReleaseStringUTFChars(jkey, key);
|
||||
}
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneFriendImpl_getRefKey(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
const char * key = linphone_friend_get_ref_key((LinphoneFriend *)ptr);
|
||||
return key ? env->NewStringUTF(key) : NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_linphone_core_LinphoneFriendImpl
|
||||
|
|
|
|||
|
|
@ -133,4 +133,16 @@ public interface LinphoneFriend {
|
|||
* Return the native pointer for this object
|
||||
*/
|
||||
long getNativePtr();
|
||||
|
||||
/**
|
||||
* Set the reference key of a friend.
|
||||
* @param key The reference key to use for the friend.
|
||||
**/
|
||||
void setRefKey(String key);
|
||||
|
||||
/**
|
||||
* Get the reference key of a friend.
|
||||
* @return The reference key of the friend.
|
||||
**/
|
||||
String getRefKey();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
|
|||
private native void done(long nativePtr);
|
||||
private native void delete(long ptr);
|
||||
private native Object getCore(long ptr);
|
||||
private native void setRefKey(long nativePtr, String key);
|
||||
private native String getRefKey(long nativePtr);
|
||||
|
||||
boolean ownPtr = false;
|
||||
protected LinphoneFriendImpl() {
|
||||
|
|
@ -103,4 +105,14 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
|
|||
if (core!=null) return core;
|
||||
else return this;
|
||||
}
|
||||
|
||||
public void setRefKey(String key){
|
||||
synchronized(getSyncObject()){
|
||||
setRefKey(nativePtr,key);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRefKey(){
|
||||
return getRefKey(nativePtr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue