Handle BT_GATT_CLIENT_SERVICE_RESYNC event 99/265799/1
authordh79pyun <dh79.pyun@samsung.com>
Fri, 29 Oct 2021 00:49:53 +0000 (09:49 +0900)
committerdh79pyun <dh79.pyun@samsung.com>
Fri, 29 Oct 2021 00:49:53 +0000 (09:49 +0900)
Change-Id: I86582b12e6e89e9a3c6fe20ce3aedeabbb333036
Signed-off-by: dh79pyun <dh79.pyun@samsung.com>
src/bluetooth-common.c

index 1cadb78..136c2eb 100644 (file)
@@ -3044,11 +3044,13 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                _bt_convert_address_to_string(&device_addr,
                                &service_change->device_addr);
 
+#if 0
                /* Check if TDS Service removed */
                _bt_tds_check_service_changed(device_addr, service_change);
 
                /* Check if OTS Service removed */
                _bt_otp_check_service_changed(device_addr, service_change);
+#endif
 
                client = _bt_gatt_get_client(device_addr);
                if (device_addr != NULL)
@@ -3096,7 +3098,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                                                BT_GATT_CLIENT_SERVICE_ADDED,
                                                service_change->uuid,
                                                client->service_changed_user_data);
-               } else { /* BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_REMOVE */
+               } else if (service_change->change_type == BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_REMOVE) {
                        for (l = client->services; l; l = g_slist_next(l)) {
                                svc = l->data;
 #ifdef TIZEN_GATT_CLIENT
@@ -3129,6 +3131,16 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                                                BT_GATT_CLIENT_SERVICE_REMOVED,
                                                service_change->uuid,
                                                client->service_changed_user_data);
+               } else {
+                       BT_INFO("Service resync is required");
+
+                       client->services_discovered = false;
+
+                       if (client->connected && client->service_changed_cb)
+                               client->service_changed_cb(client,
+                                               BT_GATT_CLIENT_SERVICE_RESYNC,
+                                               service_change->uuid,
+                                               client->service_changed_user_data);
                }
                break;
        }