Added LinphoneFriend setName/getName APIs to JNI layer

This commit is contained in:
Sylvain Berfini 2015-12-29 11:26:46 +01:00
parent 4d454fdfd5
commit f0428f5c86
3 changed files with 40 additions and 0 deletions

View file

@ -3096,12 +3096,22 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* en
linphone_friend_set_address((LinphoneFriend*)ptr,(LinphoneAddress*)linphoneAddress);
}
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setName(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jname) {
const char* name = env->GetStringUTFChars(jname, NULL);
linphone_friend_set_name((LinphoneFriend*)ptr, name);
env->ReleaseStringUTFChars(jname, name);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setRLSUri(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jrlsUri) {
const char* uri = env->GetStringUTFChars(jrlsUri, NULL);
linphone_friend_list_set_rls_uri((LinphoneFriendList*)ptr,uri);
env->ReleaseStringUTFChars(jrlsUri, uri);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_addFriend(JNIEnv* env
@ -3127,6 +3137,14 @@ extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv* e
,jlong ptr) {
return (jlong)linphone_friend_get_address((LinphoneFriend*)ptr);
}
extern "C" jstring Java_org_linphone_core_LinphoneFriendImpl_getName(JNIEnv* env
,jobject thiz
,jlong ptr) {
const char *name = linphone_friend_get_name((LinphoneFriend*)ptr);
return name ? env->NewStringUTF(name) : NULL;
}
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(JNIEnv* env
,jobject thiz
,jlong ptr

View file

@ -145,4 +145,14 @@ public interface LinphoneFriend {
* @return The reference key of the friend.
**/
String getRefKey();
/**
* Set a name for this friend
* @param name
*/
void setName(String name);
/**
* get name of this friend
* @return
*/
String getName();
}

View file

@ -118,4 +118,16 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
public String getRefKey(){
return getRefKey(nativePtr);
}
private native void setName(long nativePtr, String name);
@Override
public void setName(String name) {
setName(nativePtr, name);
}
private native String getName(long nativePtr);
@Override
public String getName() {
return getName(nativePtr);
}
}