+ jstring jni_remoteAddress = CALEGetAddressFromBTDevice(env, device);
+ if (!jni_remoteAddress)
+ {
+ OIC_LOG(ERROR, TAG, "jni_remoteAddress is null");
+ return;
+ }
+
+ const char* address = (*env)->GetStringUTFChars(env, jni_remoteAddress, NULL);
+ if (!address)
+ {
+ OIC_LOG(ERROR, TAG, "address is null");
+ CACheckJNIException(env);
+ return;
+ }
+
+ // STATE_DISCONNECTED
+ jint state_disconnected = CALEGetConstantsValue(env, CLASSPATH_BT_PROFILE,
+ "STATE_DISCONNECTED");
+
+ // STATE_CONNECTED
+ jint state_connected = CALEGetConstantsValue(env, CLASSPATH_BT_PROFILE,
+ "STATE_CONNECTED");
+
+ if (state_disconnected == newState)
+ {
+ OIC_LOG_V(DEBUG, TAG, "LE Disconnected state is %d, %s", newState, address);
+ g_bleConnectionStateChangedCallback(CA_ADAPTER_GATT_BTLE, address, false);
+ }
+ else if (state_connected == newState)
+ {
+ OIC_LOG_V(DEBUG, TAG, "LE Connected state is %d, %s", newState, address);
+ g_bleConnectionStateChangedCallback(CA_ADAPTER_GATT_BTLE, address, true);
+ }
+ else
+ {
+ OIC_LOG_V(DEBUG, TAG, "Unknown state : %d, %s", newState, address);
+ }
+
+ (*env)->ReleaseStringUTFChars(env, jni_remoteAddress, address);
+ }
+ }
+}
+
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattNWServicesDiscoveredCallback(JNIEnv *env,
+ jobject obj,
+ jobject gatt,
+ jint status)
+{
+ OIC_LOG_V(INFO, TAG, "caLeGattNWServicesDiscoveredCallback - status %d", status);
+ VERIFY_NON_NULL_VOID(env, TAG, "env");
+ VERIFY_NON_NULL_VOID(obj, TAG, "obj");
+ VERIFY_NON_NULL_VOID(gatt, TAG, "gatt");
+
+ if (GATT_SUCCESS == status)
+ {
+ jstring jni_address = CALEGetAddressFromGatt(env, gatt);
+ if (!jni_address)
+ {
+ OIC_LOG(ERROR, TAG, "jni_address is null");