Commit e022b0d3 authored by Ghislain MARY's avatar Ghislain MARY

Add Android wrapper for RFC3994.

parent d468050c
......@@ -60,7 +60,8 @@ LOCAL_SRC_FILES := \
linphone_tunnel_config.c \
message_storage.c \
info.c \
event.c
event.c \
xml.c
ifndef LINPHONE_VERSION
LINPHONE_VERSION = "Devel"
......
......@@ -170,6 +170,7 @@ public:
vTable.call_encryption_changed = callEncryptionChange;
vTable.text_received = text_received;
vTable.message_received = message_received;
vTable.is_composing_received = is_composing_received;
vTable.dtmf_received = dtmf_received;
vTable.new_subscription_requested = new_subscription_requested;
vTable.notify_presence_received = notify_presence_received;
......@@ -225,6 +226,7 @@ public:
/*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/
textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneChatMessage;)V");
isComposingReceivedId = env->GetMethodID(listenerClass,"isComposingReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;)V");
dtmfReceivedId = env->GetMethodID(listenerClass,"dtmfReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;I)V");
infoReceivedId = env->GetMethodID(listenerClass,"infoReceived",
"(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneInfoMessage;)V");
......@@ -307,6 +309,7 @@ public:
jmethodID notifyPresenceReceivedId;
jmethodID textReceivedId;
jmethodID messageReceivedId;
jmethodID isComposingReceivedId;
jmethodID dtmfReceivedId;
jmethodID callStatsUpdatedId;
jmethodID transferStateId;
......@@ -550,6 +553,19 @@ public:
,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)
,env->NewObject(lcData->chatMessageClass,lcData->chatMessageCtrId,(jlong)msg));
}
static void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
ms_error("cannot attach VM");
return;
}
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
env->CallVoidMethod(lcData->listener
,lcData->isComposingReceivedId
,lcData->core
,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room));
}
static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
......@@ -2311,6 +2327,12 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_deleteHistory(JNIEnv
,jlong ptr) {
linphone_chat_room_delete_history((LinphoneChatRoom*)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneChatRoomImpl_compose(JNIEnv *env, jobject thiz, jlong ptr) {
linphone_chat_room_compose((LinphoneChatRoom *)ptr);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneChatRoomImpl_isRemoteComposing(JNIEnv *env, jobject thiz, jlong ptr) {
return (jboolean)linphone_chat_room_is_remote_composing((LinphoneChatRoom *)ptr);
}
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_deleteMessage(JNIEnv* env
,jobject thiz
,jlong room
......
......@@ -80,6 +80,17 @@ public interface LinphoneChatRoom {
* Deletes all the messages associated with the peer of this chat room
*/
void deleteHistory();
/**
* Notify the destination of the chat message being composed that the user is typing a new message.
*/
void compose();
/**
* Tells whether the remote is currently composing a message.
* @return true if the remote is currently composing a message, false otherwise.
*/
boolean isRemoteComposing();
/**
* Marks all the messages in this conversation as read
......
......@@ -91,6 +91,13 @@ public interface LinphoneCoreListener {
*/
void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message);
/**
* invoked when a composing notification is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in the conversation.
*/
void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr);
/**
* invoked when a new dtmf is received
* @param lc LinphoneCore
......
......@@ -31,6 +31,8 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
private native void destroy(long ptr);
private native int getUnreadMessagesCount(long ptr);
private native void deleteHistory(long ptr);
private native void compose(long ptr);
private native boolean isRemoteComposing(long ptr);
private native void markAsRead(long ptr);
private native void deleteMessage(long room, long message);
private native void updateUrl(long room, long message);
......@@ -87,6 +89,14 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
public void deleteHistory() {
deleteHistory(nativePtr);
}
public void compose() {
compose(nativePtr);
}
public boolean isRemoteComposing() {
return isRemoteComposing(nativePtr);
}
public void markAsRead() {
markAsRead(nativePtr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment