mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Add network reachable callback in JNI
This commit is contained in:
parent
b18702cf9e
commit
583b0ed767
7 changed files with 54 additions and 2 deletions
|
|
@ -361,4 +361,9 @@ public class TutorialBuddyStatus implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,4 +272,9 @@ public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessa
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,4 +278,9 @@ public class TutorialHelloWorld implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,4 +308,9 @@ public class TutorialRegistration implements LinphoneCoreListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,6 +318,8 @@ public:
|
|||
|
||||
notifyRecvId = env->GetMethodID(listenerClass,"notifyReceived", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneEvent;Ljava/lang/String;Lorg/linphone/core/LinphoneContent;)V");
|
||||
|
||||
networkReachableId = env->GetMethodID(listenerClass,"networkReachableChanged", "(Lorg/linphone/core/LinphoneCore;Z)V");
|
||||
|
||||
configuringStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RemoteProvisioningState"));
|
||||
configuringStateFromIntId = env->GetStaticMethodID(configuringStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RemoteProvisioningState;");
|
||||
configuringStateId = env->GetMethodID(listenerClass,"configuringStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$RemoteProvisioningState;Ljava/lang/String;)V");
|
||||
|
|
@ -445,6 +447,7 @@ public:
|
|||
jmethodID authenticationRequestedId;
|
||||
jmethodID publishStateId;
|
||||
jmethodID notifyRecvId;
|
||||
jmethodID networkReachableId;
|
||||
|
||||
jclass authMethodClass;
|
||||
jmethodID authMethodFromIntId;
|
||||
|
|
@ -874,6 +877,10 @@ public:
|
|||
vTable->notify_received = notifyReceived;
|
||||
}
|
||||
|
||||
if (ljb->networkReachableId) {
|
||||
vTable->network_reachable = networkReachableCb;
|
||||
}
|
||||
|
||||
if (ljb->configuringStateId) {
|
||||
vTable->configuring_status = configuringStatus;
|
||||
}
|
||||
|
|
@ -1397,6 +1404,21 @@ public:
|
|||
handle_possible_java_exception(env, lcData->listener);
|
||||
}
|
||||
|
||||
static void networkReachableCb(LinphoneCore *lc, bool_t enable){
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
env->CallVoidMethod(lcData->listener, ljb->networkReachableId, lcData->core, (jboolean)enable);
|
||||
handle_possible_java_exception(env, lcData->listener);
|
||||
}
|
||||
|
||||
static void configuringStatus(LinphoneCore *lc, LinphoneConfiguringState status, const char *message) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
|
|
@ -7877,8 +7899,6 @@ extern "C" jboolean Java_org_linphone_core_LinphoneConferenceParamsImpl_isVideoR
|
|||
return linphone_conference_params_video_requested((LinphoneConferenceParams *)paramsPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) {
|
||||
bctbx_list_t *participants, *it;
|
||||
jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl");
|
||||
|
|
|
|||
|
|
@ -269,5 +269,12 @@ public interface LinphoneCoreListener {
|
|||
* @param list LinphoneFriendList object
|
||||
*/
|
||||
void friendListRemoved(LinphoneCore lc, LinphoneFriendList list);
|
||||
|
||||
/**
|
||||
* Callback prototype for reporting network is reachable
|
||||
* @param lc LinphoneCore object
|
||||
* @param enable status of network
|
||||
*/
|
||||
void networkReachableChanged(LinphoneCore lc, boolean enable);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,4 +220,9 @@ public class LinphoneCoreListenerBase implements LinphoneCoreListener {
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue