From cd00cc8355afcca86926c1b5beb68ea0cae121ff Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Mon, 9 Feb 2015 16:57:14 +0100 Subject: [PATCH] Add LinphoneCore.setPrimaryContact() with address --- coreapi/linphonecore_jni.cc | 12 ++++++++++++ java/common/org/linphone/core/LinphoneCore.java | 10 ++++++++++ java/common/org/linphone/core/VideoSize.java | 8 ++++++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 10 ++++++++++ 4 files changed, 40 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index b4a929a07..8448e56fc 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1220,6 +1220,18 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setChatDatabasePath(JNIE env->ReleaseStringUTFChars(jpath, path); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact2(JNIEnv* env, jobject thiz, jlong lc, jstring jcontact) { + const char* contact = env->GetStringUTFChars(jcontact, NULL); + linphone_core_set_primary_contact((LinphoneCore*)lc, contact); + env->ReleaseStringUTFChars(jcontact, contact); +} + +extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getPrimaryContact(JNIEnv* env, jobject thiz, jlong lc) { + LinphoneAddress* identity = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc); + return identity ? env->NewStringUTF(linphone_address_as_string(identity)) : NULL; +} + + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) { const char* displayname = jdisplayname ? env->GetStringUTFChars(jdisplayname, NULL) : NULL; const char* username = jusername ? env->GetStringUTFChars(jusername, NULL) : NULL; diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 98e9226eb..7c23cb9bb 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -1576,6 +1576,16 @@ public interface LinphoneCore { **/ void setMicrophoneGain(float gain); + /** + * Set address to use if no LinphoneProxyConfig configured + */ + void setPrimaryContact(String address); + + /** + * Returns the address used if no LinphoneProxyConfig configured + */ + String getPrimaryContact(); + /** * Set username and display name to use if no LinphoneProxyConfig configured */ diff --git a/java/common/org/linphone/core/VideoSize.java b/java/common/org/linphone/core/VideoSize.java index 6bba95e74..7685e20a0 100644 --- a/java/common/org/linphone/core/VideoSize.java +++ b/java/common/org/linphone/core/VideoSize.java @@ -26,6 +26,13 @@ public final class VideoSize { public static final int CIF = 1; public static final int HVGA = 2; public static final int QVGA = 3; + public static final VideoSize VIDEO_SIZE_QCIF = new VideoSize(176,144); + public static final VideoSize VIDEO_SIZE_CIF = new VideoSize(352,288); + public static final VideoSize VIDEO_SIZE_QVGA = new VideoSize(320,240); + public static final VideoSize VIDEO_SIZE_HVGA = new VideoSize(320,480); + public static final VideoSize VIDEO_SIZE_VGA = new VideoSize(640,480); + public static final VideoSize VIDEO_SIZE_720P = new VideoSize(1280,720); + public static final VideoSize VIDEO_SIZE_1020P = new VideoSize(1920,1080); public int width; public int height; @@ -36,6 +43,7 @@ public final class VideoSize { this.height = height; } + @Deprecated public static final VideoSize createStandard(int code, boolean inverted) { switch (code) { case QCIF: diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index fd1796102..2773189e8 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -150,6 +150,8 @@ public class LinphoneCoreImpl implements LinphoneCore { private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); private native void setIncomingTimeout(long nativePtr, int timeout); private native void setInCallTimeout(long nativePtr, int timeout); + private native void setPrimaryContact2(long nativePtr, String contact); + private native String getPrimaryContact(long nativePtr); private native void setPrimaryContact(long nativePtr, String displayName, String username); private native String getPrimaryContactUsername(long nativePtr); private native String getPrimaryContactDisplayName(long nativePtr); @@ -977,6 +979,14 @@ public class LinphoneCoreImpl implements LinphoneCore { setMicrophoneGain(nativePtr, gain); } + public synchronized void setPrimaryContact(String address) { + setPrimaryContact2(nativePtr, address); + } + + public synchronized String getPrimaryContact() { + return getPrimaryContact(nativePtr); + } + public synchronized void setPrimaryContact(String displayName, String username) { setPrimaryContact(nativePtr, displayName, username); }