GATT-Client: Fix Primary list overwrite issue. 41/120841/1 accepted/tizen/common/20170327.142440 accepted/tizen/ivi/20170327.052058 accepted/tizen/mobile/20170327.052009 accepted/tizen/tv/20170327.052022 accepted/tizen/unified/20170327.052111 accepted/tizen/wearable/20170327.052042 submit/tizen/20170326.234938
authorh.sandeep <h.sandeep@samsung.com>
Fri, 24 Mar 2017 10:42:18 +0000 (16:12 +0530)
committerh.sandeep <h.sandeep@samsung.com>
Fri, 24 Mar 2017 10:46:38 +0000 (16:16 +0530)
This patch fixes the primary list getting overwrite while
registering the gatt services in client role of bluez code
when the gatt plugins are enabled.
This isuue was leading to CAPI layer failure to fetch the
primary service after connection.

Change-Id: Ib8bceab634c23520828d10010641647243a6aac5
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
src/device.c

index c87a0f6..430f165 100644 (file)
@@ -6411,8 +6411,14 @@ static void register_gatt_services(struct btd_device *device)
                update_gatt_uuids(req, device->primaries, services);
 #endif
 
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
+       /* do not delete existing primary list,
+        * just append the new primary uuids,
+        * the list will be modifed when service changed
+        * indication is received during connection */
        g_slist_free_full(device->primaries, g_free);
        device->primaries = NULL;
+#endif
 
        device_register_primaries(device, services, -1);
 
@@ -6435,10 +6441,19 @@ static void gatt_client_ready_cb(bool success, uint8_t att_ecode,
                return;
        }
 
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
+       /* Register the services after setting the client is ready
+        * and exporting all the services and characteristics paths.
+        */
        register_gatt_services(device);
+#endif
 
        btd_gatt_client_ready(device->client_dbus);
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       register_gatt_services(device);
+#endif
+
        /*
         * Update the GattServices property. Do this asynchronously since this
         * should happen after the "Characteristics" and "Descriptors"