From e9b6722f57ac734dcb1f71d61456075bdd8fd7a3 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 23 Mar 2010 17:17:08 +0100 Subject: [PATCH] add setDebugMode method to jni --- coreapi/linphonecore_jni.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 556c0e54d..04373c159 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -42,8 +42,7 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved) { - #ifdef ANDROID - linphone_core_enable_logs_with_cb(linphone_android_log_handler); +#ifdef ANDROID ms_andsnd_register_card(ajvm); #endif /*ANDROID*/ jvm=ajvm; @@ -51,7 +50,16 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved) } - +//LinphoneFactory +extern "C" void Java_org_linphone_core_LinphoneCoreFactory_setDebugMode(JNIEnv* env + ,jobject thiz + ,jboolean isDebug) { + if (isDebug) { + linphone_core_enable_logs_with_cb(linphone_android_log_handler); + } else { + linphone_core_disable_logs(); + } +} // LinphoneCore class LinphoneCoreData { @@ -194,11 +202,11 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig( extern "C" int Java_org_linphone_core_LinphoneCoreImpl_addProxyConfig( JNIEnv* env ,jobject thiz + ,jobject jproxyCfg ,jlong lc ,jlong pc) { LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)pc; - linphone_proxy_config_set_user_data(proxy - ,env->NewGlobalRef((jobject)linphone_proxy_config_get_user_data(proxy))); + linphone_proxy_config_set_user_data(proxy, env->NewGlobalRef(jproxyCfg)); return linphone_core_add_proxy_config((LinphoneCore*)lc,(LinphoneProxyConfig*)pc); } @@ -327,7 +335,6 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv* e extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv* env,jobject thiz) { LinphoneProxyConfig* proxy = linphone_proxy_config_new(); - linphone_proxy_config_set_user_data(proxy,thiz); return (jlong) proxy; }