Add LinphoneCore.setPrimaryContact() with address

This commit is contained in:
Margaux Clerc 2015-02-09 16:57:14 +01:00
parent 5a79ebff2e
commit cd00cc8355
4 changed files with 40 additions and 0 deletions

View file

@ -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;

View file

@ -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
*/

View file

@ -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:

View file

@ -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);
}