Commit dfa388b3 authored by jehan's avatar jehan
Browse files

migrate java binding to multical api

parent 091a2c90
......@@ -30,7 +30,6 @@ LOCAL_SRC_FILES = \
linphonecore.c \
misc.c \
enum.c \
enum.h \
presence.c \
proxy.c \
friend.c \
......@@ -46,7 +45,8 @@ LOCAL_SRC_FILES = \
sal_eXosip2_presence.c \
sal_eXosip2_sdp.c \
offeranswer.c \
callbacks.c
callbacks.c \
linphonecall.c
LOCAL_CFLAGS += \
-D_BYTE_ORDER=_LITTLE_ENDIAN \
......
......@@ -72,14 +72,13 @@ public:
userdata = auserdata?env->NewGlobalRef(auserdata):0;
memset(&vTable,0,sizeof(vTable));
vTable.show = showInterfaceCb;
vTable.inv_recv = inviteReceivedCb;
vTable.auth_info_requested = authInfoRequested;
vTable.display_status = displayStatusCb;
vTable.display_message = displayMessageCb;
vTable.display_warning = displayMessageCb;
vTable.global_state_changed = globalStateChange;
vTable.registration_state_changed = registrationState;
vTable.call_state_changed = callState;
vTable.registration_state_changed = registrationStateChange;
vTable.call_state_changed = callStateChange;
listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
/*displayStatus(LinphoneCore lc,String message);*/
......@@ -112,7 +111,12 @@ public:
env->DeleteGlobalRef(listener);
if (userdata) env->DeleteGlobalRef(userdata);
env->DeleteGlobalRef(listernerClass);
env->DeleteGlobalRef(generalStateClass);
env->DeleteGlobalRef(globalStateClass);
env->DeleteGlobalRef(registrationStateClass);
env->DeleteGlobalRef(callStateClass);
env->DeleteGlobalRef(proxyClass);
env->DeleteGlobalRef(callClass);
}
jobject core;
jobject listener;
......@@ -143,9 +147,6 @@ public:
static void showInterfaceCb(LinphoneCore *lc) {
}
static void inviteReceivedCb(LinphoneCore *lc, const char *from) {
}
static void byeReceivedCb(LinphoneCore *lc, const char *from) {
......@@ -177,10 +178,10 @@ public:
env->CallVoidMethod(lcData->listener
,lcData->globalStateId
,lcData->core
,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,gstate),
,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,(jint)gstate),
message ? env->NewStringUTF(message) : NULL);
}
static void registerStateChange(LinphoneCore *lc, LinphoneProxyConfig proxy,LinphoneRegistrationState state,const char* message) {
static void registrationStateChange(LinphoneCore *lc, LinphoneProxyConfig* proxy,LinphoneRegistrationState state,const char* message) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
......@@ -191,11 +192,11 @@ public:
env->CallVoidMethod(lcData->listener
,lcData->registrationStateId
,lcData->core
,env->NewObject(proxyClass,proxyCtrId,proxy)
,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,state),
,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,(jlong)proxy)
,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
message ? env->NewStringUTF(message) : NULL);
}
static void callStateChange(LinphoneCore *lc, LinphoneCall call,LinphoneCallState *state,const char* message) {
static void callStateChange(LinphoneCore *lc, LinphoneCall* call,LinphoneCallState state,const char* message) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
......@@ -206,8 +207,8 @@ public:
env->CallVoidMethod(lcData->listener
,lcData->callStateId
,lcData->core
,env->NewObject(callClass,callCtrId,call)
,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,state),
,env->NewObject(lcData->callClass,lcData->callCtrId,(jlong)call)
,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state),
message ? env->NewStringUTF(message) : NULL);
}
......@@ -300,11 +301,11 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_invite( JNIEnv* env
,jlong lc
,jstring juri) {
const char* uri = env->GetStringUTFChars(juri, NULL);
LinphoneCall lCall = linphone_core_invite((LinphoneCore*)lc,uri);
LinphoneCall* lCall = linphone_core_invite((LinphoneCore*)lc,uri);
env->ReleaseStringUTFChars(juri, uri);
return (jlong)lCall;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_inviteAddress( JNIEnv* env
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddress( JNIEnv* env
,jobject thiz
,jlong lc
,jlong to) {
......@@ -321,7 +322,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall( JNIEnv*
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress( JNIEnv* env
,jobject thiz
,jlong lc) {
return (jlong)linphone_core_get_remote_uri((LinphoneCore*)lc);
return (jlong)linphone_core_get_current_call_remote_address((LinphoneCore*)lc);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall( JNIEnv* env
,jobject thiz
......@@ -396,6 +397,19 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_sendDtmf( JNIEnv* env
,jchar dtmf) {
linphone_core_send_dtmf((LinphoneCore*)lc,dtmf);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_playDtmf( JNIEnv* env
,jobject thiz
,jlong lc
,jchar dtmf
,jint duration) {
linphone_core_play_dtmf((LinphoneCore*)lc,dtmf,duration);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf( JNIEnv* env
,jobject thiz
,jlong lc) {
linphone_core_stop_dtmf((LinphoneCore*)lc);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* env
,jobject thiz
,jlong lc) {
......@@ -436,6 +450,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoCancellationEn
return linphone_core_echo_cancellation_enabled((LinphoneCore*)lc);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv* env
,jobject thiz
,jlong lc
) {
return (jlong)linphone_core_get_current_call((LinphoneCore*)lc);
}
//ProxyConfig
......
......@@ -40,6 +40,7 @@ public interface LinphoneCall {
public final static State Refered = new State(11,"Refered");
public final static State Error = new State(12,"Error");
public final static State CallEnd = new State(13,"CallEnd");
public final static State PausedByRemote = new State(14,"PausedByRemote");
private State(int value,String stringValue) {
mValue = value;
values.addElement(this);
......
......@@ -135,10 +135,10 @@ public interface LinphoneCore {
* Returns The LinphoneCall the current call if one is in call
*
**/
public LinphoneCall getCurrentCall();
public LinphoneCall getCurrentCall();
/**
* get the remote address in case of in/out call
* get current call remote address in case of in/out call
* @return null if no call engaged yet
*/
public LinphoneAddress getRemoteAddress();
......@@ -220,6 +220,17 @@ public interface LinphoneCore {
* @param number
*/
public void sendDtmf(char number);
/**
* Initiate a dtmf signal to the speqker if not in call
* @param number
* @param duration in ms , -1 for unlimited
*/
public void playDtmf(char number,int duration);
/**
* stop current dtmf
*/
public void stopDtmf();
/**
*
*/
......
......@@ -25,9 +25,6 @@ public interface LinphoneCoreListener {
/**< Notifies the application that it should show up
* @return */
public void show(LinphoneCore lc);
/**< Notifies incoming calls
* @return */
public void inviteReceived(LinphoneCore lc,String from);
/**< Notify calls terminated by far end
* @return */
public void byeReceived(LinphoneCore lc,String from);
......
mediastreamer2 @ 955a7d6b
Subproject commit 46b69fe88700905a362eeb0a57e8218585b76565
Subproject commit 955a7d6b8aa205e8a97d751dd8d3920de1595455
oRTP @ 461dd13a
Subproject commit 6bc540160a8729f63f6074b958161bc696e78f93
Subproject commit 461dd13a0aad2a075a075bf618e68443475f7a24
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