To add connection manager for client for android BLE.
[platform/upstream/iotivity.git] / resource / csdk / connectivity / util / src / camanager / android / caleconnectionmanager.c
1 /* ****************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 #include <jni.h>
22 #include "logger.h"
23 #include "cautilinterface.h"
24 #include "camanagerleinterface.h"
25 #include "camanagerleutil.h"
26 #include "caleautoconnector.h"
27 #include "cacommon.h"
28 #include "cacommonutil.h"
29 #include "camanagerdevice.h"
30 #include "caleclient.h"
31 #include "caleutils.h"
32
33 #define TAG "OIC_CA_MANAGER_LE"
34
35 static CAAdapterStateChangedCB g_adapterStateCB = NULL;
36 static CAConnectionStateChangedCB g_connStateCB = NULL;
37
38 static const jint SUPPORT_ADNROID_API_LEVEL = 18;
39 static const jint AUTH_FAIL = 5;
40 static const jint LINK_LOSS = 8;
41 static const jint ACCEPT_TIMEOUT_EXCEPTION = 16;
42 static const jint REMOTE_DISCONNECT = 19;
43 static const jint LOCAL_DISCONNECT = 22;
44 static const jint CONNECTION_FAILED_TO_BE_EASTABLISHED = 62;
45 static const jint USER_REMOVED_BOND = 68;
46 static JavaVM *g_jvm = NULL;
47 static jobject g_context = NULL;
48 static jobject g_connectedDeviceSet = NULL;
49
50 void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB,
51                                     CAConnectionStateChangedCB connStateCB)
52 {
53     OIC_LOG(DEBUG, TAG, "CASetLENetworkMonitorCallbacks");
54
55     g_adapterStateCB = adapterStateCB;
56     g_connStateCB = connStateCB;
57 }
58
59 CAResult_t CASetLEClientAutoConnectionDeviceInfo(const char* address)
60 {
61     OIC_LOG(DEBUG, TAG, "CASetClientAutoConnectionDeviceInfo");
62     VERIFY_NON_NULL(address, TAG, "address");
63
64     bool isAttached = false;
65     JNIEnv* env;
66     jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
67     if (JNI_OK != res)
68     {
69         OIC_LOG(DEBUG, TAG, "AttachCurrentThread will be called for JNIEnv pointer");
70         res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
71
72         if (JNI_OK != res)
73         {
74             OIC_LOG(ERROR, TAG, "AttachCurrentThread has failed");
75             return CA_STATUS_FAILED;
76         }
77         isAttached = true;
78     }
79
80     OIC_LOG_V(DEBUG, TAG, "set [%s] for Auto Connection", address);
81     jstring jni_leAddress = (*env)->NewStringUTF(env, address);
82
83     if (!CAManagerCheckBTAddress(env, jni_leAddress))
84     {
85         OIC_LOG(ERROR, TAG, "this address is not BT address string format");
86         if (isAttached)
87         {
88             (*g_jvm)->DetachCurrentThread(g_jvm);
89         }
90         return CA_STATUS_FAILED;
91     }
92
93     // if there is target address in SharedPreference. it will be reseted.
94     if (CAManagerIsConnectedDeviceAddress(env, g_context,
95                                           jni_leAddress,
96                                           g_connectedDeviceSet))
97     {
98         if (!CAManagerRemoveConnectedDeviceAddress(env, g_context,
99                                                    jni_leAddress,
100                                                    g_connectedDeviceSet))
101         {
102             OIC_LOG(ERROR, TAG, "Preference - remove has failed");
103         }
104         else
105         {
106             OIC_LOG(INFO, TAG, "Preference - remove success");
107         }
108     }
109
110     // it will be added new target address.
111     if (!CAManagerAddConnectedDeviceAddress(env, g_context,
112                                             jni_leAddress, g_connectedDeviceSet))
113     {
114         OIC_LOG(ERROR, TAG, "Preference - putting has failed");
115     }
116     else
117     {
118         OIC_LOG(INFO, TAG, "Preference - putting success");
119     }
120
121     if (isAttached)
122     {
123         (*g_jvm)->DetachCurrentThread(g_jvm);
124     }
125
126     return CA_STATUS_OK;
127 }
128
129 CAResult_t CAUnsetLEClientAutoConnectionDeviceInfo(const char* address)
130 {
131     OIC_LOG(DEBUG, TAG, "CAUnsetClientAutoConnectionDeviceInfo");
132     VERIFY_NON_NULL(address, TAG, "address");
133
134     bool isAttached = false;
135     JNIEnv* env;
136     jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
137     if (JNI_OK != res)
138     {
139         OIC_LOG(DEBUG, TAG, "AttachCurrentThread will be called for JNIEnv pointer");
140         res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
141
142         if (JNI_OK != res)
143         {
144             OIC_LOG(ERROR, TAG, "AttachCurrentThread has failed");
145             return CA_STATUS_FAILED;
146         }
147         isAttached = true;
148     }
149
150     OIC_LOG_V(DEBUG, TAG, "unset [%s] for Auto Connection", address);
151     jstring jni_leAddress = (*env)->NewStringUTF(env, address);
152
153     if (!CAManagerCheckBTAddress(env, jni_leAddress))
154     {
155         OIC_LOG(ERROR, TAG, "this address is not BT address string format");
156         if (isAttached)
157         {
158             (*g_jvm)->DetachCurrentThread(g_jvm);
159         }
160         return CA_STATUS_FAILED;
161     }
162
163     // if there is target address in SharedPreference. it would be removed
164     if (CAManagerIsConnectedDeviceAddress(env, g_context,
165                                           jni_leAddress,
166                                           g_connectedDeviceSet))
167     {
168         if (!CAManagerRemoveConnectedDeviceAddress(env, g_context,
169                                                    jni_leAddress,
170                                                    g_connectedDeviceSet))
171         {
172             OIC_LOG(ERROR, TAG, "Preference - remove has failed");
173         }
174         else
175         {
176             OIC_LOG(INFO, TAG, "Preference - remove success");
177         }
178     }
179
180     // remove target device for auto connection
181     CAResult_t ret = CAManagerRemoveData(env, jni_leAddress);
182     if (CA_STATUS_OK != ret)
183     {
184         OIC_LOG(ERROR, TAG, "CAManagerRemoveData has failed");
185     }
186
187     if (isAttached)
188     {
189         (*g_jvm)->DetachCurrentThread(g_jvm);
190     }
191
192     return CA_STATUS_OK;
193 }
194
195 CAResult_t CAManagerLEClientInitialize(JNIEnv *env, JavaVM *jvm, jobject context)
196 {
197     OIC_LOG(DEBUG, TAG, "CAManagerClientInitialize");
198     VERIFY_NON_NULL(env, TAG, "env");
199     VERIFY_NON_NULL(jvm, TAG, "jvm");
200     VERIFY_NON_NULL(context, TAG, "context");
201
202     jint jni_int_sdk = CALEGetBuildVersion(env);
203     if (jni_int_sdk < SUPPORT_ADNROID_API_LEVEL)
204     {
205         OIC_LOG_V(ERROR, TAG, "it is not supported (%d)", jni_int_sdk);
206         return CA_STATUS_FAILED;
207     }
208
209     g_jvm = jvm;
210     g_context = (*env)->NewGlobalRef(env, context);;
211     CAManagerInitMutexVaraibles();
212     CAManagerInitLEAutoConnection();
213
214     CAManagerCreateACDataList(env);
215
216     // get last connected device list
217     jobject set = NULL;
218     set = CAManagerGetConnectedDeviceAddress(env, g_context);
219     if (!set)
220     {
221         // create new set<String> object
222         set = CAManagerCreateSetString(env);
223         if (set)
224         {
225             OIC_LOG(DEBUG, TAG, "created new SetString");
226         }
227         else
228         {
229             OIC_LOG(ERROR, TAG, "CAManagerCreateSetString has failed");
230             return CA_STATUS_FAILED;
231         }
232     }
233     else
234     {
235         OIC_LOG(DEBUG, TAG, "get previous Set<String> object");
236     }
237
238     g_connectedDeviceSet = (jobject)(*env)->NewGlobalRef(env, set);
239     if (!g_connectedDeviceSet)
240     {
241         OIC_LOG(ERROR, TAG, "g_connectedDeviceSet is null");
242         return CA_STATUS_FAILED;
243     }
244
245     return CA_STATUS_OK;
246 }
247
248 CAResult_t CAManagerLEClientTerminate(JNIEnv *env)
249 {
250     OIC_LOG(DEBUG, TAG, "CAManagerClientTerminate");
251     VERIFY_NON_NULL(env, TAG, "env");
252
253     // stop gatt connection
254     CAResult_t res = CALEClientDisconnectAll(env);
255     if (CA_STATUS_OK != res)
256     {
257         OIC_LOG(ERROR, TAG, "CALEClientDisconnectAll has failed");
258     }
259
260     res = CAManagerRemoveAllData(env);
261     if (CA_STATUS_OK != res)
262     {
263         OIC_LOG(ERROR, TAG, "CAManagerRemoveAllData has failed");
264     }
265
266     CAManagerTerminateLEAutoConnection();
267     CAManagerTerminateMutexVariables();
268
269     if (g_context)
270     {
271         (*env)->DeleteGlobalRef(env, g_context);
272     }
273
274     if (g_connectedDeviceSet)
275     {
276         (*env)->DeleteGlobalRef(env, g_connectedDeviceSet);
277     }
278
279     return res;
280 }
281
282 JNIEXPORT void JNICALL
283 Java_org_iotivity_ca_CaLeClientInterface_caManagerAdapterStateChangedCallback(
284         JNIEnv *env, jobject obj, jint state)
285 {
286     OIC_LOG(DEBUG, TAG, "caManagerAdapterStateChangedCallback");
287     VERIFY_NON_NULL_VOID(env, TAG, "env");
288     VERIFY_NON_NULL_VOID(obj, TAG, "obj");
289
290     jint state_on = CALEGetConstantsValue(env, CLASSPATH_BT_ADAPTER, "STATE_ON");
291     jint state_off = CALEGetConstantsValue(env, CLASSPATH_BT_ADAPTER, "STATE_OFF");
292     jint state_turning_off = CALEGetConstantsValue(env, CLASSPATH_BT_ADAPTER, "STATE_TURNING_OFF");
293
294     if (state_on == state)
295     {
296         OIC_LOG(DEBUG, TAG, "AdapterStateChangedCallback : state_on");
297         if (g_adapterStateCB)
298         {
299             g_adapterStateCB(CA_ADAPTER_GATT_BTLE, true);
300         }
301
302         // when BT state is on. recovery flag has to be reset.
303         CAManagerSetBTRecovery(false);
304
305         // find target device for autoconnect
306         size_t length = CAManagerGetACDataLength();
307         OIC_LOG_V(DEBUG, TAG, "target device : %d", length);
308         for (size_t idx = 0; idx < length; idx++)
309         {
310             jstring leAddress = CAManagerGetLEAddressFromACData(env, idx);
311             if (leAddress)
312             {
313                 CAResult_t res = CAManagerStartAutoConnection(env, leAddress);
314                 if (CA_STATUS_OK != res)
315                 {
316                     OIC_LOG(ERROR, TAG, "CAManagerStartAutoConnection has failed");
317                     return;
318                 }
319             }
320         }
321     }
322     else if (state_off == state)
323     {
324         OIC_LOG(DEBUG, TAG, "AdapterStateChangedCallback : state_off");
325         if (g_adapterStateCB)
326         {
327             g_adapterStateCB(CA_ADAPTER_GATT_BTLE, false);
328         }
329
330         // reset autoconnect flag for all target devices
331         size_t length = CAManagerGetACDataLength();
332         for (size_t idx = 0; idx < length; idx++)
333         {
334             jstring address = CAManagerGetLEAddressFromACData(env, idx);
335             if (address)
336             {
337                 CAManagerSetAutoConnectionFlag(env, address, false);
338             }
339         }
340
341         // check whether BT recovery is needed or not
342         if (CAManagerIsRecoveryFlagSet())
343         {
344             CAManagerProcessRecovery(env, STATE_OFF);
345         }
346     }
347     else if (state_turning_off == state)
348     {
349         OIC_LOG(DEBUG, TAG, "AdapterStateChangedCallback : state_turning_off");
350         return;
351     }
352     else
353     {
354         OIC_LOG(INFO, TAG, "AdapterStateChangedCallback state is not available");
355         return;
356     }
357 }
358
359 JNIEXPORT void JNICALL
360 Java_org_iotivity_ca_CaLeClientInterface_caManagerBondStateChangedCallback(
361         JNIEnv *env, jobject obj, jobject device)
362 {
363     OIC_LOG(DEBUG, TAG, "caManagerBondStateChangedCallback");
364     VERIFY_NON_NULL_VOID(env, TAG, "env");
365     VERIFY_NON_NULL_VOID(obj, TAG, "obj");
366     VERIFY_NON_NULL_VOID(device, TAG, "device");
367
368     // get ble address from Bluetooth Device object
369     jstring jni_leAddress = CALEClientGetLEAddressFromBTDevice(env, device);
370     if (!jni_leAddress)
371     {
372         OIC_LOG(INFO, TAG, "unbonded : it isn't same device type");
373         return;
374     }
375
376     char* leAddress = (char*)(*env)->GetStringUTFChars(env, jni_leAddress, NULL);
377     if (!leAddress)
378     {
379         OIC_LOG(ERROR, TAG, "leAddress is null");
380         return;
381     }
382
383     // if there is no data, CAData will be created.
384     OIC_LOG_V(DEBUG, TAG, "bond none device : %s", leAddress);
385
386     CAResult_t res = CAManagerRemoveData(env, jni_leAddress);
387     if (CA_STATUS_OK != res)
388     {
389         OIC_LOG(ERROR, TAG, "CAManagerRemoveData has failed");
390     }
391
392     (*env)->ReleaseStringUTFChars(env, jni_leAddress, leAddress);
393
394     if (!CAManagerRemoveConnectedDeviceAddress(env, g_context,
395                                                jni_leAddress,
396                                                g_connectedDeviceSet))
397     {
398         OIC_LOG(ERROR, TAG, "CAManagerRemoveConnectedDeviceAddress has failed");
399     }
400
401     OIC_LOG(INFO, TAG, "bonded state changed bone_none");
402 }
403
404 JNIEXPORT void JNICALL
405 Java_org_iotivity_ca_CaLeClientInterface_caManagerLeGattConnectionStateChangeCB(
406         JNIEnv *env, jobject obj, jobject gatt, jint status, jint newState)
407 {
408     OIC_LOG_V(DEBUG, TAG, "caManagerLeGattConnectionStateChangeCB-status(%d), newState(%d)",
409               status, newState);
410
411     VERIFY_NON_NULL_VOID(env, TAG, "env");
412     VERIFY_NON_NULL_VOID(obj, TAG, "obj");
413     VERIFY_NON_NULL_VOID(gatt, TAG, "gatt");
414
415     jint state_connected = CALEGetConstantsValue(env, CLASSPATH_BT_PROFILE, "STATE_CONNECTED");
416     jint state_disconnected = CALEGetConstantsValue(env, CLASSPATH_BT_PROFILE, "STATE_DISCONNECTED");
417     jint gatt_success = CALEGetConstantsValue(env, CLASSPATH_BT_GATT, "GATT_SUCCESS");
418
419     jstring jni_address = CAManagerGetAddressFromGatt(env, gatt);
420     if (!jni_address)
421     {
422         OIC_LOG(ERROR, TAG, "CAManagerGetAddressFromGatt is null");
423         return;
424     }
425
426     char* address = (char*)(*env)->GetStringUTFChars(env, jni_address, NULL);
427     if (!address)
428     {
429         OIC_LOG(ERROR, TAG, "address is null");
430         return;
431     }
432
433     OIC_LOG_V(INFO, TAG, "connection state : status(%d), addr:(%s), newState(%d)",
434               status, address, newState);
435
436     if (gatt_success == status && state_connected == newState) // le connected
437     {
438         OIC_LOG(DEBUG, TAG, "LE is connected");
439         CAResult_t res = CAManagerReadRemoteRssi(env, gatt);
440         if (CA_STATUS_OK != res)
441         {
442             OIC_LOG(ERROR, TAG, "CAManagerReadRemoteRssi has failed");
443             (*env)->ReleaseStringUTFChars(env, jni_address, address);
444             return;
445         }
446     }
447     else if (state_disconnected == newState)// le disconnected
448     {
449         if (LINK_LOSS == status || REMOTE_DISCONNECT == status)
450         {
451             OIC_LOG(DEBUG, TAG, "LE is disconnected");
452
453             if (g_connStateCB)
454             {
455                 OIC_LOG_V(DEBUG, TAG, "LE Disconnected state is %d, %s", newState, address);
456                 g_connStateCB(CA_ADAPTER_GATT_BTLE, address, false);
457                 OIC_LOG(DEBUG, TAG, "LE Disconnected state callback is called");
458             }
459
460             if (!CAManagerIsMatchedACData(env, jni_address))
461             {
462                 OIC_LOG_V(DEBUG, TAG, "this[%s] is not target address for Auto Connection",
463                           address);
464                 (*env)->ReleaseStringUTFChars(env, jni_address, address);
465                 return;
466             }
467
468             CAManagerSetAutoConnectionFlag(env, jni_address, false);
469
470             CAResult_t res = CAManagerStartAutoConnection(env, jni_address);
471             if (CA_STATUS_OK != res)
472             {
473                 (*env)->ReleaseStringUTFChars(env, jni_address, address);
474                 OIC_LOG(ERROR, TAG, "CAManagerStartAutoConnection has failed");
475                 return;
476             }
477         }
478         else if (ACCEPT_TIMEOUT_EXCEPTION == status)
479         {
480             CAManagerProcessRecovery(env, START_RECOVERY);
481         }
482     }
483     (*env)->ReleaseStringUTFChars(env, jni_address, address);
484     (*env)->DeleteLocalRef(env, jni_address);
485 }
486
487 /*
488  * Class:     org_iotivity_ca_jar_caleinterface
489  * Method:    caManagerLeServicesDiscoveredCallback
490  * Signature: (Landroid/bluetooth/BluetoothGatt;I)V
491  */
492 JNIEXPORT void JNICALL
493 Java_org_iotivity_ca_CaLeClientInterface_caManagerLeServicesDiscoveredCallback(JNIEnv *env,
494                                                                                jobject obj,
495                                                                                jobject gatt,
496                                                                                jint status)
497 {
498     OIC_LOG_V(DEBUG, TAG, "caManagerLeServicesDiscoveredCallback - status %d: ", status);
499     VERIFY_NON_NULL_VOID(env, TAG, "env");
500     VERIFY_NON_NULL_VOID(obj, TAG, "obj");
501     VERIFY_NON_NULL_VOID(gatt, TAG, "gatt");
502
503     if (GATT_SUCCESS == status)
504     {
505         jstring jni_address = CAManagerGetAddressFromGatt(env, gatt);
506         if (!jni_address)
507         {
508             OIC_LOG(ERROR, TAG, "CAManagerGetAddressFromGatt is null");
509             return;
510         }
511
512         char* address = (char*)(*env)->GetStringUTFChars(env, jni_address, NULL);
513         if (!address)
514         {
515             OIC_LOG(ERROR, TAG, "address is null");
516             return;
517         }
518         OIC_LOG_V(DEBUG, TAG, "ServicesDiscovered device : %s", address);
519
520         // target address for auto connection will be set in device list.
521         // check set connected address information by user
522         jclass jni_cls_set = (*env)->FindClass(env, "java/util/HashSet");
523         if (!jni_cls_set)
524         {
525             OIC_LOG(ERROR, TAG, "jni_cls_set is null");
526             return;
527         }
528
529         jmethodID jni_mid_iterator = (*env)->GetMethodID(env, jni_cls_set, "iterator", "()Ljava/util/Iterator;");
530         if (!jni_mid_iterator)
531         {
532             OIC_LOG(ERROR, TAG, "jni_mid_iterator is null");
533             return;
534         }
535
536         jobject jni_obj_iter = (*env)->CallObjectMethod(env, g_connectedDeviceSet, jni_mid_iterator);
537         if (!jni_obj_iter)
538         {
539             OIC_LOG(ERROR, TAG, "jni_obj_iter is null");
540             return;
541         }
542
543         // Get the Iterator method IDs
544         jclass jni_cls_iterator = (*env)->FindClass(env, "java/util/Iterator");
545         if (!jni_cls_iterator)
546         {
547             OIC_LOG(ERROR, TAG, "jni_cls_iterator is null");
548             return;
549         }
550
551         jmethodID jni_mid_hasNext = (*env)->GetMethodID(env, jni_cls_iterator, "hasNext", "()Z");
552         if (!jni_mid_hasNext)
553         {
554             OIC_LOG(ERROR, TAG, "jni_mid_hasNext is null");
555             return;
556         }
557
558         jmethodID jni_mid_next = (*env)->GetMethodID(env, jni_cls_iterator, "next", "()Ljava/lang/Object;");
559         if (!jni_mid_next)
560         {
561             OIC_LOG(ERROR, TAG, "jni_mid_next is null");
562             return;
563         }
564
565         // Iterate over the entry Set
566         while ((*env)->CallBooleanMethod(env, jni_obj_iter, jni_mid_hasNext))
567         {
568             jstring jni_str_entry = (jstring)(*env)->CallObjectMethod(env, jni_obj_iter, jni_mid_next);
569             const char* foundAddress = (*env)->GetStringUTFChars(env, jni_str_entry, NULL);
570             if (!foundAddress)
571             {
572                 OIC_LOG(ERROR, TAG, "addr is null");
573                 return;
574             }
575             OIC_LOG_V(INFO, TAG, "found last connected address [%s] from SharedPreferences",
576                       foundAddress);
577
578             if (!strcmp(foundAddress, address))
579             {
580                 // if BLE address is matched each other
581                 // this address will be added into auto connection list.
582                 OIC_LOG(INFO, TAG, "AC list - address will be added into ACData list");
583                 CAManagerAddACData(env, jni_address);
584                 CAManagerSetAutoConnectionFlag(env, jni_address, false);
585
586                 // next connection will be requested as JNI_TRUE flag
587                 // after first connection
588             }
589             else
590             {
591                 OIC_LOG(INFO, TAG, "AC list - device is not matched");
592             }
593
594             (*env)->ReleaseStringUTFChars(env, jni_str_entry, foundAddress);
595             (*env)->DeleteLocalRef(env, jni_str_entry);
596         }
597
598         if (g_connStateCB)
599         {
600             g_connStateCB(CA_ADAPTER_GATT_BTLE, address, true);
601             OIC_LOG(DEBUG, TAG, "LE Connected callback is called");
602         }
603         (*env)->ReleaseStringUTFChars(env, jni_address, address);
604         (*env)->DeleteLocalRef(env, jni_address);
605         (*env)->DeleteLocalRef(env, jni_cls_set);
606         (*env)->DeleteLocalRef(env, jni_obj_iter);
607         (*env)->DeleteLocalRef(env, jni_cls_iterator);
608
609         OIC_LOG(INFO, TAG, "ServicesDiscovery is successful");
610     }
611     else
612     {
613         OIC_LOG(ERROR, TAG, "ServicesDiscovery has failed");
614     }
615 }
616
617 /*
618  * Class:     org_iotivity_ca_jar_caleinterface
619  * Method:    caManagerLeRemoteRssiCallback
620  * Signature: (Landroid/bluetooth/BluetoothGatt;I)V
621  */
622 JNIEXPORT void JNICALL
623 Java_org_iotivity_ca_CaLeClientInterface_caManagerLeRemoteRssiCallback(JNIEnv *env,
624                                                                        jobject obj,
625                                                                        jobject gatt,
626                                                                        jint rssi,
627                                                                        jint status)
628 {
629     OIC_LOG_V(DEBUG, TAG, "caManagerLeRemoteRssiCallback - rssi : %d: ", rssi);
630     OIC_LOG_V(DEBUG, TAG, "caManagerLeRemoteRssiCallback - status : %d: ", status);
631     VERIFY_NON_NULL_VOID(env, TAG, "env");
632     VERIFY_NON_NULL_VOID(obj, TAG, "obj");
633     VERIFY_NON_NULL_VOID(gatt, TAG, "gatt");
634 }