diff --git a/src/jniutils.cc b/src/jniutils.cc index 634a20e..447c112 100644 --- a/src/jniutils.cc +++ b/src/jniutils.cc @@ -11,14 +11,6 @@ #include #endif -#if 0 // Enable if log needed -#include -#define LOG_TAG "PEPJNIUTILS" -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) -#else -#define LOGD(...) -#endif - namespace pEp { namespace JNIAdapter { jclass findClass(JNIEnv *env, const char *classname) @@ -316,15 +308,15 @@ namespace pEp { if (!ts) return (jobject) NULL; - LOGD("/* Seconds (0-60) */ FROM :%d", ts->tm_sec); - LOGD("/* Minutes (0-59) */ :%d", ts->tm_min); - LOGD("/* Hours (0-23) */ :%d", ts->tm_hour); - LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday); - LOGD("/* Month (0-11) */ :%d", ts->tm_mon); - LOGD("/* Year - 1900 */ :%d", ts->tm_year); + //LOGD("/* Seconds (0-60) */ FROM :%d", ts->tm_sec); + //LOGD("/* Minutes (0-59) */ :%d", ts->tm_min); + //LOGD("/* Hours (0-23) */ :%d", ts->tm_hour); + //LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday); + //LOGD("/* Month (0-11) */ :%d", ts->tm_mon); + //LOGD("/* Year - 1900 */ :%d", ts->tm_year); time64_t t = timegm64(ts)*1000; - LOGD( "TimeGM returns : %lld", t); + //LOGD( "TimeGM returns : %lld", t); jclass clazz = findClass(env, "java/util/Date"); jmethodID constructor = env->GetMethodID(clazz, "", "(J)V"); assert(constructor); @@ -343,7 +335,7 @@ namespace pEp { return NULL; jlong t = callLongMethod(env, date, "getTime"); - LOGD( "Set Time to : %lld", t); + //LOGD( "Set Time to : %lld", t); timestamp *ts = (timestamp*)calloc(1, sizeof(timestamp)); assert(ts); if (ts == NULL) @@ -353,12 +345,12 @@ namespace pEp { time64_t clock = t/1000; gmtime64_r(&clock, ts); - LOGD("/* Seconds (0-60) */ TO :%d", ts->tm_sec); - LOGD("/* Minutes (0-59) */ :%d", ts->tm_min); - LOGD("/* Hours (0-23) */ :%d", ts->tm_hour); - LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday); - LOGD("/* Month (0-11) */ :%d", ts->tm_mon); - LOGD("/* Year - 1900 */ :%d", ts->tm_year); + //LOGD("/* Seconds (0-60) */ TO :%d", ts->tm_sec); + //LOGD("/* Minutes (0-59) */ :%d", ts->tm_min); + //LOGD("/* Hours (0-23) */ :%d", ts->tm_hour); + //LOGD("/* Day of the month (1-31) */:%d", ts->tm_mday); + //LOGD("/* Month (0-11) */ :%d", ts->tm_mon); + //LOGD("/* Year - 1900 */ :%d", ts->tm_year); } return ts; diff --git a/src/jniutils.hh b/src/jniutils.hh index a523f65..dd038f5 100644 --- a/src/jniutils.hh +++ b/src/jniutils.hh @@ -8,6 +8,14 @@ #include #include +#if 1 // Enable if log needed +#include +#define LOG_TAG "PEPJNIUTILS" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) +#else +#define LOGD(...) +#endif + namespace pEp { namespace utility { using namespace std; diff --git a/src/org_pEp_jniadapter_AbstractEngine.cc b/src/org_pEp_jniadapter_AbstractEngine.cc index 8dd4a38..3f39456 100644 --- a/src/org_pEp_jniadapter_AbstractEngine.cc +++ b/src/org_pEp_jniadapter_AbstractEngine.cc @@ -221,6 +221,7 @@ extern "C" { // Called by sync thread only PEP_STATUS message_to_send(void *obj, message *msg) { + LOGD("Message To Send"); jobject msg_ = NULL; msg_ = sync_env->NewObject(messageClass, messageConstructorMethodID, (jlong) msg); @@ -266,7 +267,6 @@ extern "C" { { sync_thread_arg_t *a = (sync_thread_arg_t*)arg; PEP_SESSION session = (PEP_SESSION) a->session; - a->sync_jvm->AttachCurrentThread(&sync_env, NULL); jclass clazz = sync_env->GetObjectClass(sync_obj); @@ -274,7 +274,7 @@ extern "C" { showHandShakeMethodID = sync_env->GetMethodID( clazz, "showHandshakeCallFromC", - "(Lorg/pEp/jniadapter/_Identity;Lorg/pEp/jniadapter/_Identity;)I"); + "(Lorg/pEp/jniadapter/Identity;Lorg/pEp/jniadapter/Identity;)I"); assert(showHandShakeMethodID); messageToSendMethodID = sync_env->GetMethodID( @@ -285,11 +285,6 @@ extern "C" { sync_env->DeleteLocalRef(clazz); - messageClass = findClass(sync_env, "org/pEp/jniadapter/Message"); - assert(messageClass); - - messageConstructorMethodID = sync_env->GetMethodID(messageClass, "", "(J)V"); - assert(messageConstructorMethodID); PEP_STATUS status = do_sync_protocol(session, a->queue); @@ -316,6 +311,7 @@ extern "C" { jobject obj ) { + LOGD("Start Sync"); PEP_SESSION session = (PEP_SESSION) callLongMethod(env, obj, "getHandle"); pthread_t *thread = NULL; @@ -361,7 +357,10 @@ extern "C" { inject_sync_msg, retrieve_next_sync_msg); - + messageClass = findClass(env, "org/pEp/jniadapter/Message"); + assert(messageClass); + messageConstructorMethodID = env->GetMethodID(messageClass, "", "(J)V"); + assert(messageConstructorMethodID); pthread_create(thread, NULL, sync_thread_routine, (void *) a); }