From 7f98e218f09997f0b3da1c0cc2221ed459a6203a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 5 Aug 2015 16:52:35 +0200 Subject: [PATCH] Finished RTT JNI/Java API --- coreapi/linphonecore_jni.cc | 24 +++++++++++++++++++ .../linphone/core/LinphoneChatMessage.java | 2 +- .../org/linphone/core/LinphoneCallImpl.java | 4 +++- .../linphone/core/LinphoneCallParamsImpl.java | 6 +++-- .../core/LinphoneChatMessageImpl.java | 6 +++-- .../linphone/core/LinphoneChatRoomImpl.java | 9 +++++-- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 509712753..b22cf34bf 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -6190,3 +6190,27 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoPreset const char *tmp = linphone_core_get_video_preset((LinphoneCore *)lc); return tmp ? env->NewStringUTF(tmp) : NULL; } + +extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getChatRoom(JNIEnv* env ,jobject thiz, jlong ptr) { + return (jlong) linphone_call_get_chat_room((LinphoneCall *) ptr); +} + +extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableRealTimeText(JNIEnv* env ,jobject thiz, jlong ptr, jboolean yesno) { + linphone_call_params_enable_realtime_text((LinphoneCallParams *)ptr, yesno); +} + +extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_realTimeTextEnabled(JNIEnv* env ,jobject thiz, jlong ptr) { + return linphone_call_params_realtime_text_enabled((LinphoneCallParams *)ptr); +} + +extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_putChar(JNIEnv* env ,jobject thiz, jlong ptr, jlong character) { + linphone_chat_message_put_char((LinphoneChatMessage *)ptr, character); +} + +extern "C" jobject Java_org_linphone_core_LinphoneChatRoomImpl_getCall(JNIEnv* env ,jobject thiz, jlong ptr) { + return getCall(env, linphone_chat_room_get_call((LinphoneChatRoom *)ptr)); +} + +extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getChar(JNIEnv* env ,jobject thiz, jlong ptr) { + return linphone_chat_room_get_char((LinphoneChatRoom *)ptr); +} \ No newline at end of file diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index c022be40c..5f74293d8 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -233,6 +233,6 @@ public interface LinphoneChatMessage { * @param[in] character T.140 char * @throw LinphoneCoreExeption . */ - void putChar(long charater) throws LinphoneCoreException; + void putChar(long character) throws LinphoneCoreException; } diff --git a/java/impl/org/linphone/core/LinphoneCallImpl.java b/java/impl/org/linphone/core/LinphoneCallImpl.java index af0875596..10b3575df 100644 --- a/java/impl/org/linphone/core/LinphoneCallImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallImpl.java @@ -254,9 +254,11 @@ class LinphoneCallImpl implements LinphoneCall { public LinphonePlayer getPlayer() { return new LinphonePlayerImpl(getPlayer(nativePtr)); } + + private native long getChatRoom(long nativePtr); @Override public LinphoneChatRoom getChatRoom() { - throw new RuntimeException("java binding not implemented yet"); + return new LinphoneChatRoomImpl(getChatRoom(nativePtr)); } } diff --git a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java index 0bdbc56c6..29e5d5c02 100644 --- a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java @@ -172,13 +172,15 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { return videoMulticastEnabled(nativePtr); } + private native void enableRealTimeText(long nativePtr, boolean yesno); @Override public void enableRealTimeText(boolean yesno) { - throw new RuntimeException("java binding not implemented yet"); + enableRealTimeText(nativePtr, yesno); } + private native boolean realTimeTextEnabled(long nativePtr); @Override public boolean realTimeTextEnabled() { - throw new RuntimeException("java binding not implemented yet"); + return realTimeTextEnabled(nativePtr); } } diff --git a/java/impl/org/linphone/core/LinphoneChatMessageImpl.java b/java/impl/org/linphone/core/LinphoneChatMessageImpl.java index a55a8bd40..54cd1ea64 100644 --- a/java/impl/org/linphone/core/LinphoneChatMessageImpl.java +++ b/java/impl/org/linphone/core/LinphoneChatMessageImpl.java @@ -154,8 +154,10 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage { public void setListener(LinphoneChatMessageListener listener) { setListener(nativePtr, listener); } + + private native void putChar(long nativePtr, long character); @Override - public void putChar(long charater) throws LinphoneCoreException { - throw new RuntimeException("java binding not implemented yet"); + public void putChar(long character) throws LinphoneCoreException { + putChar(nativePtr, character); } } diff --git a/java/impl/org/linphone/core/LinphoneChatRoomImpl.java b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java index 067c3eca3..b99426136 100644 --- a/java/impl/org/linphone/core/LinphoneChatRoomImpl.java +++ b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java @@ -20,6 +20,7 @@ package org.linphone.core; import org.linphone.core.LinphoneChatMessage.State; import org.linphone.core.LinphoneChatMessage.StateListener; +import org.linphone.core.LinphoneCall; @SuppressWarnings("deprecation") class LinphoneChatRoomImpl implements LinphoneChatRoom { @@ -174,12 +175,16 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { public void sendChatMessage(LinphoneChatMessage message) { sendChatMessage(nativePtr, message, ((LinphoneChatMessageImpl)message).getNativePtr()); } + + private native Object getCall(long nativePtr); @Override public LinphoneCall getCall() { - throw new RuntimeException("java binding not implemented yet"); + return (LinphoneCall) getCall(nativePtr); } + + private native long getChar(long nativePtr); @Override public long getChar() { - throw new RuntimeException("java binding not implemented yet"); + return getChar(nativePtr); } }