Remove the duplicated service from gatt_list_service 93/232493/1
authorinjun.yang <injun.yang@samsung.com>
Mon, 4 May 2020 11:35:57 +0000 (20:35 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 6 May 2020 02:18:32 +0000 (11:18 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] P200428-01509
[Request] Internal
[Occurrence Version] N/A

[Problem] bt-service access to the removed GATT service to get service information
[Cause & Measure] Whenever client app registered, duplicated service added to gatt_list_serice.
 Eventhough GATT service removed from server, all of the duplicated service is not removed from the list.
 So gatt_list_service should have a unique service for each device.
[Checking Method] n/a

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: If7898b33a572f4b446b04b5d788c6360c3e8fbab
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-oal/bluez_hal/src/bt-hal-gatt-client.c

index 641d324..bc8ba93 100644 (file)
@@ -691,6 +691,14 @@ static void _gattc_create_new_service(hal_gattc_server_info_t *conn_info, gboole
        hal_gattc_service_t* gatt_svc = NULL;
        int i;
        gchar *gp_char_path = NULL;
+       uint8_t uuid[BT_HAL_STACK_UUID_SIZE];
+
+       _bt_hal_convert_uuid_string_to_type(uuid, uuid_str);
+       gatt_svc = _gattc_find_service_from_uuid(conn_info, (bt_uuid_t *)uuid);
+       if (gatt_svc) {
+               DBG("Aleady added to gatt_list_services");
+               return;
+       }
 
        /* add the service */
        gatt_svc = _hal_gatt_client_add_service(conn_info, uuid_str, object_path, is_primary);