diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 0bc48f880..38e7fa8a2 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -4315,6 +4315,21 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv return (jint)linphone_core_get_conference_size((LinphoneCore *) pCore); } +extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_createConference(JNIEnv *env, jobject thiz, jlong corePtr, jobject jparams) { + jclass params_class = env->FindClass("org/linphone/core/LinphoneConferenceParamsImpl"); + jclass conference_class = env->FindClass("org/linphone/core/LinphoneConferenceImpl"); + jfieldID params_native_ptr_attr = env->GetFieldID(params_class, "nativePtr", "J"); + jmethodID conference_constructor = env->GetMethodID(conference_class, "", "(J)V"); + LinphoneConferenceParams *params = NULL; + LinphoneConference *conference; + jobject jconference; + + if(jparams) params = (LinphoneConferenceParams *)env->GetLongField(params_class, params_native_ptr_attr); + conference = linphone_core_create_conference_with_params((LinphoneCore *)corePtr, params); + if(conference) return env->NewObject(conference_class, conference_constructor, (jlong)conference); + else return NULL; +} + extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getConference(JNIEnv *env, jobject thiz, jlong pCore) { jclass conference_class = env->FindClass("org/linphone/core/LinphoneConferenceImpl"); jmethodID conference_constructor = env->GetMethodID(conference_class, "", "(J)V"); @@ -6746,6 +6761,32 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNortpTimeout(J +extern "C" jlong Java_org_linphone_core_LinphoneConferenceParamsImpl_createInstance(JNIEnv *env, jobject thiz, jobject jcore) { + jclass core_class = env->FindClass("org/linphone/core/LinphoneCoreImpl"); + jfieldID native_ptr_attr = env->GetFieldID(core_class, "nativePtr", "J"); + LinphoneCore *core = NULL; + if(jcore) core = (LinphoneCore *)env->GetLongField(jcore, native_ptr_attr); + return (jlong)linphone_conference_params_new(core); +} + +extern "C" jlong Java_org_linphone_core_LinphoneConferenceParamsImpl_copyInstance(JNIEnv *env, jobject thiz, jlong paramsPtr) { + return (jlong)linphone_conference_params_clone((LinphoneConferenceParams *)paramsPtr); +} + +extern "C" void Java_org_linphone_core_LinphoneConferenceParamsImpl_destroyInstance(JNIEnv *env, jobject thiz, jlong paramsPtr) { + linphone_conference_params_free((LinphoneConferenceParams *)paramsPtr); +} + +extern "C" void Java_org_linphone_core_LinphoneConferenceParamsImpl_enableVideo(JNIEnv *env, jobject thiz, jlong paramsPtr, jboolean enable) { + linphone_conference_params_enable_video((LinphoneConferenceParams *)paramsPtr, enable); +} + +extern "C" jboolean Java_org_linphone_core_LinphoneConferenceParamsImpl_isVideoEnabled(JNIEnv *env, jobject thiz, jlong paramsPtr) { + return linphone_conference_params_video_requested((LinphoneConferenceParams *)paramsPtr); +} + + + extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) { MSList *participants, *it; jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl"); diff --git a/java/common/org/linphone/core/LinphoneConferenceParams.java b/java/common/org/linphone/core/LinphoneConferenceParams.java new file mode 100644 index 000000000..ee67ddd9b --- /dev/null +++ b/java/common/org/linphone/core/LinphoneConferenceParams.java @@ -0,0 +1,25 @@ +/* +LinphoneConferenceParams.java +Copyright (C) 2015 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +package org.linphone.core; + +public interface LinphoneConferenceParams { + public void enableVideo(boolean enable); + public boolean isVideoRequested(); +} diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index ef5112622..4c5c8bc0f 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -1348,6 +1348,19 @@ public interface LinphoneCore { void setZrtpSecretsCache(String file); void enableEchoLimiter(boolean val); + /** + * Create a conference + * @param params Parameters of the conference. Can be null + * @return The new conference or null if the creation has failed + */ + LinphoneConference createConference(LinphoneConferenceParams params); + /** + * Return the value of the C pointer on the conference instance. + * + * That function can be used to test whether a conference is running. + * @return A positive value if a conference is running, 0 if not. + **/ + LinphoneConference getConference(); /** * Indicates whether the local user is part of the conference. **/ @@ -1368,7 +1381,6 @@ public interface LinphoneCore { * When the local participant is out of the conference, the remote participants can continue to talk normally. **/ void leaveConference(); - /** * Merge a call into a conference. * @@ -1417,13 +1429,6 @@ public interface LinphoneCore { * @returns the number of participants to the conference **/ int getConferenceSize(); - /** - * Return the value of the C pointer on the conference instance. - * - * That function can be used to test whether a conference is running. - * @return A positive value if a conference is running, 0 if not. - **/ - LinphoneConference getConference(); /** * Request recording of the conference into a supplied file path. diff --git a/java/impl/org/linphone/core/LinphoneConferenceParamsImpl.java b/java/impl/org/linphone/core/LinphoneConferenceParamsImpl.java new file mode 100644 index 000000000..7210dfa8f --- /dev/null +++ b/java/impl/org/linphone/core/LinphoneConferenceParamsImpl.java @@ -0,0 +1,51 @@ +/* +LinphoneConferenceParamsImpl.java +Copyright (C) 2015 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +package org.linphone.core; + +public class LinphoneConferenceParamsImpl implements LinphoneConferenceParams { + private long nativePtr = 0; + + private native long createInstance(LinphoneCoreImpl core); + public LinphoneConferenceParamsImpl(LinphoneCore core) { + this.nativePtr = createInstance((LinphoneCoreImpl)core); + } + + private native long copyInstance(long paramsPtr); + public LinphoneConferenceParamsImpl(LinphoneConferenceParamsImpl params) { + nativePtr = copyInstance(params.nativePtr); + } + + private native void destroyInstance(long nativePtr); + public void finalize() { + destroyInstance(this.nativePtr); + } + + private native void enableVideo(long paramsPtr, boolean enable); + @Override + public void enableVideo(boolean enable) { + enableVideo(this.nativePtr, enable); + } + + private native boolean isVideoRequested(long paramsPtr); + @Override + public boolean isVideoRequested() { + return isVideoRequested(this.nativePtr); + } +} \ No newline at end of file diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 1147305b2..ab09f7e06 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -322,7 +322,7 @@ class LinphoneCoreImpl implements LinphoneCore { setNetworkStateReachable(nativePtr,isReachable); } public synchronized void setPlaybackGain(float gain) { - setPlaybackGain(nativePtr,gain); + setPlaybackGain(nativePtr, gain); } public synchronized float getPlaybackGain() { @@ -382,7 +382,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean payloadTypeIsVbr(PayloadType pt) { isValid(); - return payloadTypeIsVbr(nativePtr, ((PayloadTypeImpl)pt).nativePtr); + return payloadTypeIsVbr(nativePtr, ((PayloadTypeImpl) pt).nativePtr); } public synchronized void enableEchoCancellation(boolean enable) { @@ -449,7 +449,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException { - addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr); + addFriend(nativePtr, ((LinphoneFriendImpl) lf).nativePtr); } @@ -484,7 +484,7 @@ class LinphoneCoreImpl implements LinphoneCore { return new LinphoneChatRoomImpl(getOrCreateChatRoom(nativePtr,to)); } public synchronized LinphoneChatRoom getChatRoom(LinphoneAddress to) { - return new LinphoneChatRoomImpl(getChatRoom(nativePtr,((LinphoneAddressImpl)to).nativePtr)); + return new LinphoneChatRoomImpl(getChatRoom(nativePtr, ((LinphoneAddressImpl) to).nativePtr)); } public synchronized void setPreviewWindow(Object w) { setPreviewWindowId(nativePtr,w); @@ -497,7 +497,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) { - enableVideo(nativePtr,vcap_enabled, display_enabled); + enableVideo(nativePtr, vcap_enabled, display_enabled); } public synchronized boolean isVideoEnabled() { return isVideoEnabled(nativePtr); @@ -515,7 +515,7 @@ class LinphoneCoreImpl implements LinphoneCore { setFirewallPolicy(nativePtr,pol.value()); } public synchronized void setStunServer(String stunServer) { - setStunServer(nativePtr,stunServer); + setStunServer(nativePtr, stunServer); } public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException { @@ -655,7 +655,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void enableIpv6(boolean enable) { - enableIpv6(nativePtr,enable); + enableIpv6(nativePtr, enable); } public synchronized boolean isIpv6Enabled() { return isIpv6Enabled(nativePtr); @@ -678,14 +678,14 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void setUploadPtime(int ptime) { - setUploadPtime(nativePtr,ptime); + setUploadPtime(nativePtr, ptime); } public synchronized void setZrtpSecretsCache(String file) { - setZrtpSecretsCache(nativePtr,file); + setZrtpSecretsCache(nativePtr, file); } public synchronized void enableEchoLimiter(boolean val) { - enableEchoLimiter(nativePtr,val); + enableEchoLimiter(nativePtr, val); } public synchronized void setVideoDevice(int id) { Log.i("Setting camera id :", id); @@ -721,6 +721,10 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized int getConferenceSize() { return getConferenceSize(nativePtr); } + private native LinphoneConference createConference(long corePtr, LinphoneConferenceParams params); + public synchronized LinphoneConference createConference(LinphoneConferenceParams params) { + return createConference(this.nativePtr, params); + } private native LinphoneConference getConference(long nativePtr); public synchronized LinphoneConference getConference() { return getConference(nativePtr);