Add logcollection methods in linphoneFactory

This commit is contained in:
Margaux Clerc 2015-02-10 18:12:07 +01:00
parent f06f93a76c
commit e797f7063f
4 changed files with 42 additions and 24 deletions

View file

@ -161,6 +161,21 @@ extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIE
linphone_core_disable_logs();
}
}
extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_enableLogCollection(JNIEnv* env
,jobject thiz
,jboolean enable) {
linphone_core_enable_log_collection(enable ? LinphoneLogCollectionEnabledWithoutPreviousLogHandler : LinphoneLogCollectionDisabled);
}
extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setLogCollectionPath(JNIEnv* env
,jobject thiz
,jstring jpath) {
const char* path = env->GetStringUTFChars(jpath, NULL);
linphone_core_set_log_collection_path(path);
env->ReleaseStringUTFChars(jpath, path);
}
// LinphoneCore
/*
@ -1073,6 +1088,10 @@ public:
,lcData->core
,(jlong)offset
,(jlong)total);
if (env->ExceptionCheck()) {
ms_error("Listener %p raised an exception",lcData->listener);
env->ExceptionClear();
}
}
static void logCollectionUploadStateChange(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info) {
JNIEnv *env = 0;
@ -1089,6 +1108,10 @@ public:
,lcData->core
,env->CallStaticObjectMethod(lcData->logCollectionUploadStateClass,lcData->logCollectionUploadStateFromIntId,(jint)state),
msg);
if (env->ExceptionCheck()) {
ms_error("Listener %p raised an exception",lcData->listener);
env->ExceptionClear();
}
if (msg) {
env->DeleteLocalRef(msg);
}
@ -1175,22 +1198,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeListener(JNIEnv* e
//env->DeleteGlobalRef(listener);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_uploadLogCollection(JNIEnv* env, jobject thiz, jlong lc) {
LinphoneCore *core = (LinphoneCore*)lc;
linphone_core_upload_log_collection(core);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableLogCollection(JNIEnv* env, jclass cls, jboolean enable) {
linphone_core_enable_log_collection(enable ? LinphoneLogCollectionEnabledWithoutPreviousLogHandler : LinphoneLogCollectionDisabled);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setLogCollectionPath(JNIEnv* env, jclass cls, jstring jpath) {
const char* path = env->GetStringUTFChars(jpath, NULL);
linphone_core_set_log_collection_path(path);
env->ReleaseStringUTFChars(jpath, path);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_migrateToMultiTransport(JNIEnv* env
,jobject thiz
,jlong lc) {

View file

@ -109,7 +109,18 @@ abstract public class LinphoneCoreFactory {
* @param enable true to enable debug mode, false to disable it
* @param tag Tag which prefixes each log message.
*/
abstract public void setDebugMode(boolean enable, String tag);
abstract public void setDebugMode(boolean enable, String tag);
/**
* Enable the linphone core log collection to upload logs on a server.
*/
abstract public void enableLogCollection(boolean enable);
/**
* Set the path where the log files will be written for log collection.
* @param path The path where the log files will be written.
*/
abstract public void setLogCollectionPath(String path);
abstract public void setLogHandler(LinphoneLogHandler handler);

View file

@ -127,6 +127,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
public LinphoneFriend createLinphoneFriend() {
return createLinphoneFriend(null);
}
@Override
public native void enableLogCollection(boolean enable);
@Override
public native void setLogCollectionPath(String path);
public static boolean isArmv7()
{

View file

@ -36,7 +36,7 @@ import android.net.wifi.WifiManager;
import android.net.wifi.WifiManager.MulticastLock;
import android.net.wifi.WifiManager.WifiLock;
public class LinphoneCoreImpl implements LinphoneCore {
class LinphoneCoreImpl implements LinphoneCore {
private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object
protected long nativePtr = 0;
@ -1353,17 +1353,6 @@ public class LinphoneCoreImpl implements LinphoneCore {
uploadLogCollection(nativePtr);
}
/**
* Enable the linphone core log collection to upload logs on a server.
*/
public native static void enableLogCollection(boolean enable);
/**
* Set the path where the log files will be written for log collection.
* @param path The path where the log files will be written.
*/
public native static void setLogCollectionPath(String path);
private native void setPreferredFramerate(long nativePtr, float fps);
@Override
public void setPreferredFramerate(float fps) {