Unset gatt callback in network monitor 32/175032/1
authorVeeraj Khokale <veeraj.sk@samsung.com>
Tue, 3 Apr 2018 10:58:55 +0000 (16:28 +0530)
committerAmit KS <amit.s12@samsung.com>
Fri, 6 Apr 2018 05:21:21 +0000 (10:51 +0530)
Gatt connection state changed callback is set in the
network monitor (calenwmonitor.c) but is unset in the
gatt client (caleclient.c). Move this to network
monitor instead

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/278
(cherry picked from commit 961ff08710e7acd99277a335f7d9eeca2f68c16e)

Change-Id: I6e2cbc6c26ec23fc8cf308c44b6ae377b123fcb2
Signed-off-by: Veeraj Khokale <veeraj.sk@samsung.com>
Signed-off-by: Amit KS <amit.s12@samsung.com>
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c
resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor.c

index a829960..b0f374c 100644 (file)
@@ -811,8 +811,6 @@ void CALEGattUnSetCallbacks()
 {
     OIC_LOG(DEBUG, TAG, "IN");
 
-    bt_gatt_unset_connection_state_changed_cb();
-
     int numOfServersConnected = CAGetRegisteredServiceCount();
     LEServerInfo *leServerInfo = NULL;
 
index 5775877..9f2a527 100644 (file)
@@ -202,8 +202,14 @@ CAResult_t CAStartLEAdapter()
 
 CAResult_t CAStopLEAdapter()
 {
+    int ret = bt_gatt_unset_connection_state_changed_cb();
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG(DEBUG, TAG, "bt_gatt_unset_connection_state_changed_cb failed");
+        return CA_STATUS_FAILED;
+    }
 
-    int ret = bt_adapter_unset_state_changed_cb();
+    ret = bt_adapter_unset_state_changed_cb();
     if (BT_ERROR_NONE != ret)
     {
         OIC_LOG(DEBUG, TAG, "bt_adapter_unset_state_changed_cb failed");