Fix issue where state is not restored when adv operation fails 06/304306/1 accepted/tizen/7.0/unified/20240118.092849
authorWootak Jung <wootak.jung@samsung.com>
Fri, 5 Jan 2024 08:20:58 +0000 (17:20 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 15 Jan 2024 22:46:57 +0000 (07:46 +0900)
This patch reverts the iOS GM support patch below.

commit 0d9d2326e4bcc54a2a979eaad6ebec69fb9747dd
Author: Wootak Jung <wootak.jung@samsung.com>
Date:   Tue Dec 17 08:59:17 2019 +0900

    Fix iOS GM connection issue

Change-Id: I6ab48c90e5b4a57457c8ea04c570c1592ab5d234
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-service/services/gatt/bt-service-gatt.c

index 3daff77..55b40d7 100644 (file)
@@ -1695,10 +1695,8 @@ static void __bt_handle_gatt_server_connection_state(event_gatts_conn_t *event)
 {
        int result = BLUETOOTH_ERROR_NONE;
        struct gatt_client_info_t *client_info = NULL;
-       struct gatt_server_info_t *server_info = NULL;
        bluetooth_device_address_t dev_addr;
        GVariant *param = NULL;
-       int ret;
 
        char *address = g_malloc0(BT_ADDRESS_STRING_SIZE);
 
@@ -1741,18 +1739,24 @@ static void __bt_handle_gatt_server_connection_state(event_gatts_conn_t *event)
                gatt_client_info_list = g_slist_append(gatt_client_info_list, client_info);
                BT_INFO("Total num of connected Remote GATT Clients [%d]", g_slist_length(gatt_client_info_list));
 
-               /* Save server connection info */
-               server_info = g_new0(struct gatt_server_info_t, 1);
-               server_info->addr = g_strdup(address);
-               server_info->client_id = -1;
-               BT_INFO("Added GATT server addr[%s]", server_info->addr + 12);
-               server_info->connection_id = event->conn_id;
-               gatt_server_info_list = g_slist_append(gatt_server_info_list, server_info);
-               BT_INFO("Total num of connected Remote GATT Servers [%d]", g_slist_length(gatt_server_info_list));
-
-               ret = gattc_add_connection_info((bt_address_t *)&dev_addr, event->conn_id, event->server_inst);
-               if (ret != OAL_STATUS_SUCCESS) {
-                       BT_ERR("gattc register server instance failed");
+               /* Below is for iOS GM support, currently not needed */
+               if (TIZEN_PROFILE_WEARABLE) {
+                       struct gatt_server_info_t *server_info = NULL;
+                       int ret;
+
+                       /* Save server connection info */
+                       server_info = g_new0(struct gatt_server_info_t, 1);
+                       server_info->addr = g_strdup(address);
+                       server_info->client_id = -1;
+                       BT_INFO("Added GATT server addr[%s]", server_info->addr + 12);
+                       server_info->connection_id = event->conn_id;
+                       gatt_server_info_list = g_slist_append(gatt_server_info_list, server_info);
+                       BT_INFO("Total num of connected Remote GATT Servers [%d]", g_slist_length(gatt_server_info_list));
+
+                       ret = gattc_add_connection_info((bt_address_t *)&dev_addr, event->conn_id, event->server_inst);
+                       if (ret != OAL_STATUS_SUCCESS) {
+                               BT_ERR("gattc register server instance failed");
+                       }
                }
        }
 
@@ -1766,7 +1770,6 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
 {
        int result = BLUETOOTH_ERROR_NONE;
        struct gatt_client_info_t *client_info = NULL;
-       struct gatt_server_info_t *server_info = NULL;
        bluetooth_device_address_t dev_addr;
        GVariant *param = NULL;
        char address[BT_ADDRESS_STRING_SIZE];
@@ -1817,15 +1820,20 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
                                BLUETOOTH_EVENT_GATT_SERVER_DISCONNECTED, /* Local device is GATT server */
                                param);
 
-               /* Remove server info from list */
-               server_info = _bt_find_remote_gatt_server_info(address);
-               if (server_info) {
-                       gatt_server_info_list = g_slist_remove(gatt_server_info_list, server_info);
+               /* Below is for iOS GM support, currently not needed */
+               if (TIZEN_PROFILE_WEARABLE) {
+                       struct gatt_server_info_t *server_info = NULL;
 
-                       /* Remove all services from info list_gatt_info */
-                       __bt_cleanup_remote_services(server_info);
-               } else {
-                       BT_INFO("Can not find conn info, already removed!");
+                       /* Remove server info from list */
+                       server_info = _bt_find_remote_gatt_server_info(address);
+                       if (server_info) {
+                               gatt_server_info_list = g_slist_remove(gatt_server_info_list, server_info);
+
+                               /* Remove all services from info list_gatt_info */
+                               __bt_cleanup_remote_services(server_info);
+                       } else {
+                               BT_INFO("Can not find conn info, already removed!");
+                       }
                }
 
                /* Remove client info from List */