From: jihwan.seo Date: Mon, 28 Nov 2016 13:17:51 +0000 (+0900) Subject: Apply print log method in Android BLE adapter. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d5ef8d46de48ee48eb30a996d05a39066c263fa;p=contrib%2Fiotivity.git Apply print log method in Android BLE adapter. Change-Id: I5b0873a56e8c98094412b536309fa77f3643d126 Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/14853 Tested-by: jenkins-iotivity Reviewed-by: Jaehong Jo Reviewed-by: Dan Mihai Reviewed-by: Larry Sachs Reviewed-by: Rick Bell Reviewed-by: Ashok Babu Channa --- diff --git a/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c b/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c index 83a2b4e..be78e6d 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c @@ -4523,6 +4523,8 @@ Java_org_iotivity_ca_CaLeClientInterface_caLeGattCharacteristicWriteCallback( { jint length = (*env)->GetArrayLength(env, data); g_clientErrorCallback(address, data, length, CA_SEND_FAILED); + CALogSendStateInfo(CA_ADAPTER_GATT_BTLE, address, 0, length, + false, "writeChar failure"); } (*env)->ReleaseStringUTFChars(env, jni_address, address); @@ -4544,6 +4546,10 @@ Java_org_iotivity_ca_CaLeClientInterface_caLeGattCharacteristicWriteCallback( g_isSignalSetFlag = true; oc_cond_signal(g_threadWriteCharacteristicCond); oc_mutex_unlock(g_threadWriteCharacteristicMutex); + + CALogSendStateInfo(CA_ADAPTER_GATT_BTLE, address, 0, + (*env)->GetArrayLength(env, data), + true, "writeChar success"); } (*env)->ReleaseStringUTFChars(env, jni_address, address); diff --git a/resource/csdk/connectivity/src/bt_le_adapter/android/caleserver.c b/resource/csdk/connectivity/src/bt_le_adapter/android/caleserver.c index 4f0cafc..2a7cdb5 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/android/caleserver.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/android/caleserver.c @@ -2375,6 +2375,21 @@ Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerNotificationSentCallback( OIC_LOG_V(DEBUG, TAG, "Gatt Server Notification Sent Callback (status : %d)", status); + jstring jni_address = CALEGetAddressFromBTDevice(env, device); + if (!jni_address) + { + OIC_LOG(ERROR, TAG, "jni_address is null"); + return; + } + + const char* address = (*env)->GetStringUTFChars(env, jni_address, NULL); + if (!address) + { + OIC_LOG(ERROR, TAG, "address is not available"); + (*env)->DeleteLocalRef(env, jni_address); + return; + } + jint gatt_success = CALEGetConstantsValue(env, CLASSPATH_BT_GATT, "GATT_SUCCESS"); if (gatt_success != status) // error case { @@ -2395,8 +2410,14 @@ Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerNotificationSentCallback( g_isSignalSetFlag = true; oc_cond_signal(g_threadSendNotifyCond); oc_mutex_unlock(g_threadSendNotifyMutex); + + (*env)->ReleaseStringUTFChars(env, jni_address, address); + (*env)->DeleteLocalRef(env, jni_address); return; } + + CALogSendStateInfo(CA_ADAPTER_GATT_BTLE, address, 0, -1, + false, "notifyChar failure"); } else { @@ -2414,7 +2435,12 @@ Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerNotificationSentCallback( g_isSignalSetFlag = true; oc_cond_signal(g_threadSendNotifyCond); oc_mutex_unlock(g_threadSendNotifyMutex); + + CALogSendStateInfo(CA_ADAPTER_GATT_BTLE, address, 0, -1, + true, "notifyChar success"); } + (*env)->ReleaseStringUTFChars(env, jni_address, address); + (*env)->DeleteLocalRef(env, jni_address); }