]> sjero.net Git - linphone/commitdiff
Merge branch 'master' of git.savannah.nongnu.org:/srv/git/linphone
authorJehan Monnier <jehan.monnier@linphone.org>
Fri, 10 Sep 2010 13:14:56 +0000 (15:14 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Fri, 10 Sep 2010 13:14:56 +0000 (15:14 +0200)
Conflicts:
coreapi/linphonecore.h

1  2 
build/android/Android.mk
coreapi/linphonecore.h
coreapi/linphonecore_jni.cc
java/common/org/linphone/core/LinphoneCore.java

index 7432a77222fff84be3c4e3b0d60bd16e23b7f2c0,7432a77222fff84be3c4e3b0d60bd16e23b7f2c0..0997d9639d12cc5461a6ade75b82438cc66dd0b7
@@@ -37,7 -37,7 +37,6 @@@ LOCAL_SRC_FILES = 
        authentication.c \
        lpconfig.c \
        chat.c \
--      general_state.c \
        sipsetup.c \
        siplogin.c \
        address.c \
Simple merge
index 67da96a025d3e2e7fb6c5d029e2c4a9195be4f56,67da96a025d3e2e7fb6c5d029e2c4a9195be4f56..c6a7cd6f67d4f535981ed92fb831c9b2ab82b64d
@@@ -77,16 -77,16 +77,32 @@@ public
                vTable.display_status = displayStatusCb;
                vTable.display_message = displayMessageCb;
                vTable.display_warning = displayMessageCb;
--              vTable.general_state = generalStateChange;
++              vTable.global_state_changed = globalStateChange;
++              vTable.registration_state_changed = registrationState;
++              vTable.call_state_changed = callState;
  
                listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
                /*displayStatus(LinphoneCore lc,String message);*/
                displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
                /*void generalState(LinphoneCore lc,int state); */
--              generalStateId = env->GetMethodID(listernerClass,"generalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GeneralState;Ljava/lang/String;)V");
++              globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
++              globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState"));
++              globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;");
++              /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/
++              registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
++              registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState"));
++              registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;");
++              /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/
++              callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
++              callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
++              callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
++
++              proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
++              proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
++
++              callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
++              callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
  
--              generalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GeneralState"));
--              generalStateFromIntId = env->GetStaticMethodID(generalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GeneralState;");
        }
  
        ~LinphoneCoreData() {
        jobject userdata;
  
        jclass listernerClass;
--      jclass generalStateClass;
        jmethodID displayStatusId;
--      jmethodID generalStateId;
--      jmethodID generalStateFromIntId;
++
++      jclass globalStateClass;
++      jmethodID globalStateId;
++      jmethodID globalStateFromIntId;
++
++      jclass registrationStateClass;
++      jmethodID registrationStateId;
++      jmethodID registrationStateFromIntId;
++
++      jclass callStateClass;
++      jmethodID callStateId;
++      jmethodID callStateFromIntId;
++
++      jclass proxyClass;
++      jmethodID proxyCtrId;
++
++      jclass callClass;
++      jmethodID callCtrId;
++
        LinphoneCoreVTable vTable;
  
        static void showInterfaceCb(LinphoneCore *lc) {
        static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username) {
  
        }
--      static void generalStateChange(LinphoneCore *lc, LinphoneGeneralState *gstate) {
++      static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
++              JNIEnv *env = 0;
++              jint result = jvm->AttachCurrentThread(&env,NULL);
++              if (result != 0) {
++                      ms_error("cannot attach VM\n");
++                      return;
++              }
++              LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
++              env->CallVoidMethod(lcData->listener
++                                                      ,lcData->globalStateId
++                                                      ,lcData->core
++                                                      ,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,gstate),
++                                                      message ? env->NewStringUTF(message) : NULL);
++      }
++      static void registerStateChange(LinphoneCore *lc, LinphoneProxyConfig proxy,LinphoneRegistrationState state,const char* message) {
                JNIEnv *env = 0;
                jint result = jvm->AttachCurrentThread(&env,NULL);
                if (result != 0) {
                }
                LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
                env->CallVoidMethod(lcData->listener
--                                                      ,lcData->generalStateId
++                                                      ,lcData->registrationStateId
                                                        ,lcData->core
--                                                      ,env->CallStaticObjectMethod(lcData->generalStateClass,lcData->generalStateFromIntId,gstate->new_state),
--                                                      gstate->message ? env->NewStringUTF(gstate->message) : NULL);
++                                                      ,env->NewObject(proxyClass,proxyCtrId,proxy)
++                                                      ,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,state),
++                                                      message ? env->NewStringUTF(message) : NULL);
        }
++      static void callStateChange(LinphoneCore *lc, LinphoneCall call,LinphoneCallState *state,const char* message) {
++              JNIEnv *env = 0;
++              jint result = jvm->AttachCurrentThread(&env,NULL);
++              if (result != 0) {
++                      ms_error("cannot attach VM\n");
++                      return;
++              }
++              LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
++              env->CallVoidMethod(lcData->listener
++                                                      ,lcData->callStateId
++                                                      ,lcData->core
++                                                      ,env->NewObject(callClass,callCtrId,call)
++                                                      ,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,state),
++                                                      message ? env->NewStringUTF(message) : NULL);
++      }
++
  
  };
  extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*  env
@@@ -232,25 -232,25 +295,27 @@@ extern "C" void Java_org_linphone_core_
                ,jlong lc) {
        linphone_core_iterate((LinphoneCore*)lc);
  }
--extern "C" void Java_org_linphone_core_LinphoneCoreImpl_invite(       JNIEnv*  env
++extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_invite(      JNIEnv*  env
                ,jobject  thiz
                ,jlong lc
                ,jstring juri) {
        const char* uri = env->GetStringUTFChars(juri, NULL);
--      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
                ,jobject  thiz
                ,jlong lc
                ,jlong to) {
--      linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
++      return (jlong) linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
  }
  
  extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall(        JNIEnv*  env
                ,jobject  thiz
--              ,jlong lc) {
--      linphone_core_terminate_call((LinphoneCore*)lc,NULL);
++              ,jlong lc
++              ,jlong call) {
++      linphone_core_terminate_call((LinphoneCore*)lc,(LinphoneCall*)call);
  }
  
  extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress(    JNIEnv*  env
@@@ -272,9 -272,9 +337,10 @@@ extern "C" jboolean Java_org_linphone_c
  }
  extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall(   JNIEnv*  env
                ,jobject  thiz
--              ,jlong lc) {
++              ,jlong lc
++              ,jlong call) {
  
--      linphone_core_accept_call((LinphoneCore*)lc,NULL);
++      linphone_core_accept_call((LinphoneCore*)lc,(LinphoneCall*)call);
  }
  
  extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog(  JNIEnv*  env
@@@ -477,6 -477,6 +543,7 @@@ extern "C" void Java_org_linphone_core_
        env->ReleaseStringUTFChars(jprefix, prefix);
  }
  
++
  //Auth Info
  
  extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo(JNIEnv* env
@@@ -612,3 -612,3 +679,43 @@@ extern "C" jstring Java_org_linphone_co
        ms_free(value);
        return jvalue;
  }
++//LinphoneCall
++extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      linphone_call_ref((LinphoneCall*)ptr);
++}
++
++extern "C" void Java_org_linphone_core_LinphoneCallImpl_unref(JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      linphone_call_unref((LinphoneCall*)ptr);
++}
++
++extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog(  JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return (jlong)linphone_call_get_call_log((LinphoneCall*)ptr);
++}
++
++extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming(       JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return linphone_call_get_dir((LinphoneCall*)ptr)==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
++}
++
++extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress(    JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr);
++}
++
++extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState(     JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return (jint)linphone_call_get_state((LinphoneCall*)ptr);
++}
++
++
++
++