Unset gatt callback in network monitor 27/175027/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:07:51 +0000 (10:37 +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: I386499c475a241bca840610df823f84d1a74ee0d
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 a82996040f6cf9c9b15a163ddf8bd67773dd119f..b0f374cba0b248c68fafde929580573c2ec99461 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 577587731864a8560bec0b0b2568d6ccf67c4970..9f2a527910528b0071196056ebbe72d0b3a7a144 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");