Update JNI one more time.

This commit is contained in:
Ghislain MARY 2013-09-10 13:07:55 +02:00
parent 5c7159d87f
commit 480144c98f
4 changed files with 13 additions and 9 deletions

View file

@ -3621,13 +3621,15 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceActivityImpl_setDescriptio
/*
* Class: org_linphone_core_PresenceServiceImpl
* Method: newPresenceServiceImpl
* Signature: (Ljava/lang/String;)J
* Signature: (Ljava/lang/String;ILjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceServiceImpl_newPresenceServiceImpl(JNIEnv *env, jobject jobj, jstring id) {
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceServiceImpl_newPresenceServiceImpl(JNIEnv *env, jobject jobj, jstring id, jint basic_status, jstring contact) {
LinphonePresenceService *service;
const char *cid = id ? env->GetStringUTFChars(id, NULL) : NULL;
service = linphone_presence_service_new(cid);
const char *ccontact = contact ? env->GetStringUTFChars(contact, NULL) : NULL;
service = linphone_presence_service_new(cid, (LinphonePresenceBasicStatus)basic_status, ccontact);
if (cid) env->ReleaseStringUTFChars(id, cid);
if (ccontact) env->ReleaseStringUTFChars(contact, ccontact);
return (jlong)service;
}

View file

@ -120,9 +120,11 @@ abstract public class LinphoneCoreFactory {
/**
* Create a PresenceService object.
* @param id The id of the presence service. Can be null to generate it automatically.
* @param status The PresenceBasicStatus to set for the PresenceService object.
* @param contact The contact to set for the PresenceService object. Can be null.
* @return A new PresenceService object.
*/
abstract public PresenceService createPresenceService(String id);
abstract public PresenceService createPresenceService(String id, PresenceBasicStatus status, String contact);
/**
* Create a PresenceModel object.

View file

@ -186,8 +186,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
}
@Override
public PresenceService createPresenceService(String id) {
return new PresenceServiceImpl(id);
public PresenceService createPresenceService(String id, PresenceBasicStatus status, String contact) {
return new PresenceServiceImpl(id, status, contact);
}
@Override

View file

@ -26,9 +26,9 @@ public class PresenceServiceImpl implements PresenceService {
mNativePtr = nativePtr;
}
private native long newPresenceServiceImpl(String id);
protected PresenceServiceImpl(String id) {
mNativePtr = newPresenceServiceImpl(id);
private native long newPresenceServiceImpl(String id, int status, String contact);
protected PresenceServiceImpl(String id, PresenceBasicStatus status, String contact) {
mNativePtr = newPresenceServiceImpl(id, status.toInt(), contact);
}
private native void unref(long nativePtr);