Revert "Integrate list of client/server info to conn info list" 05/304305/1
authorWootak Jung <wootak.jung@samsung.com>
Mon, 6 Nov 2023 00:35:21 +0000 (09:35 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 15 Jan 2024 22:46:53 +0000 (07:46 +0900)
This reverts commit f693e2270a04917b1004cb8c7504d55aa94badfd.

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

index 7839911..180ce8d 100644 (file)
@@ -129,6 +129,9 @@ typedef struct {
        GSList *gatt_list_services;
 } hal_gattc_server_info_t;
 
+/* Linked List of connected GATT server */
+static GSList *hal_gattc_server_info_list = NULL;
+
 typedef struct {
        int client_if;
        bt_bdaddr_t bd_addr;    /*remote server address*/
@@ -137,33 +140,8 @@ typedef struct {
        gboolean is_gatt_connected;             /*status for GattConnected signal*/
 } hal_gattc_client_info_t;
 
-typedef struct {
-       bt_bdaddr_t bd_addr;        /* remote server address */
-       int conn_id;                /* connection id */
-       int inst_id;                /* server instance id */
-       gboolean is_gatt_connected; /* status for GattConnected signal */
-       int client_if;              /* client id */
-       GSList *gatt_list_services;
-} hal_gattc_conn_info_t;
-
-/* TODO:
- * Remove this feature after verified.
- * Remove hal_gattc_client/server_info_t and use hal_gattc_conn_info_t
- * Remove hal_gattc_client/server_info_list and use hal_gattc_conn_info_list
- */
-#define __INTEGRATE_HAL_GATT_INFO__
-#ifndef __INTEGRATE_HAL_GATT_INFO__
-/* Linked List of connected GATT server */
-static GSList *hal_gattc_server_info_list = NULL;
 /* Linked list of connected GATT client connection */
-static GSList *hal_gattc_client_info_list = NULL;
-#else
-static GSList *hal_gattc_conn_info_list = NULL;
-#define hal_gattc_server_info_t hal_gattc_conn_info_t
-#define hal_gattc_client_info_t hal_gattc_conn_info_t
-#define hal_gattc_server_info_list hal_gattc_conn_info_list
-#define hal_gattc_client_info_list hal_gattc_conn_info_list
-#endif
+static GSList * hal_gattc_client_info_list = NULL;
 
 static bt_pending_le_conn_info_s *pending_le_conn_info = NULL;
 static guint pending_le_conn_timer_id = 0;
@@ -365,12 +343,9 @@ bt_status_t btif_gattc_register_client(bt_uuid_t *uuid)
 
 bt_status_t btif_gattc_add_connection_info(const bt_bdaddr_t *bd_addr, int conn_id, int server_inst_id)
 {
-#ifndef __INTEGRATE_HAL_GATT_INFO__
        hal_gattc_client_info_t *client_info = NULL;
-#endif
        hal_gattc_server_info_t *server_info = NULL;
 
-#ifndef __INTEGRATE_HAL_GATT_INFO__
        /* Add client connection info in list */
        client_info = g_malloc0(sizeof(hal_gattc_client_info_t));
        client_info->client_if = -1;
@@ -379,7 +354,6 @@ bt_status_t btif_gattc_add_connection_info(const bt_bdaddr_t *bd_addr, int conn_
        client_info->inst_id = server_inst_id;
        hal_gattc_client_info_list = g_slist_append(hal_gattc_client_info_list, client_info);
        DBG("Added client connection info in list");
-#endif
 
        /* Add server connection info in list */
        server_info = __bt_find_gatt_conn_info(bd_addr);
@@ -389,9 +363,6 @@ bt_status_t btif_gattc_add_connection_info(const bt_bdaddr_t *bd_addr, int conn_
                server_info->conn_id = conn_id;
                server_info->inst_id = server_inst_id;
                server_info->is_gatt_connected = TRUE;
-#ifdef __INTEGRATE_HAL_GATT_INFO__
-               server_info->client_if = -1;
-#endif
                hal_gattc_server_info_list = g_slist_append(hal_gattc_server_info_list, server_info);
                DBG("Added server connection info in list");
        }
@@ -3789,18 +3760,13 @@ static void __le_connection_req_cb(GDBusProxy *proxy, GAsyncResult *res,
        gattc_data->conn_id = __hal_generate_conn_id() ;
        gattc_data->inst_id = __hal_generate_server_instance_id();
 
-#ifndef __INTEGRATE_HAL_GATT_INFO__
        hal_gattc_client_info_list = g_slist_append(hal_gattc_client_info_list, gattc_data);
-#endif
 
        /*add gatt server connection info*/
        gatt_conn_info = g_malloc0(sizeof(hal_gattc_server_info_t));
        memcpy(gatt_conn_info->bd_addr.address, gattc_data->bd_addr.address, BT_HAL_ADDRESS_LENGTH_MAX);
        gatt_conn_info->conn_id = gattc_data->conn_id;
        gatt_conn_info->inst_id = gattc_data->inst_id;
-#ifdef __INTEGRATE_HAL_GATT_INFO__
-       gatt_conn_info->client_if = gattc_data->client_if;
-#endif
        hal_gattc_server_info_list = g_slist_append(hal_gattc_server_info_list, gatt_conn_info);
 
        return;
@@ -3891,9 +3857,7 @@ int _bt_hal_handle_gattc_connected_event(char* address, gboolean gatt_connected)
        bt_bdaddr_t bd_addr;
        int event;
        hal_gattc_client_info_t *gattc_client = NULL;
-#ifndef __INTEGRATE_HAL_GATT_INFO__
        int inst_id = -1;
-#endif
 
        event = gatt_connected ? HAL_EV_GATT_CLIENT_CONNECTED :
                                HAL_EV_GATT_CLIENT_DISCONNECTED;
@@ -3923,13 +3887,11 @@ int _bt_hal_handle_gattc_connected_event(char* address, gboolean gatt_connected)
        }
 
        if (!gatt_connected) {
-#ifndef __INTEGRATE_HAL_GATT_INFO__
                inst_id = gattc_client->inst_id;
 
                /* remove the gatt client info from the client list also*/
                hal_gattc_client_info_list = g_slist_remove(hal_gattc_client_info_list, gattc_client);
                g_free(gattc_client);
-#endif
 
                //find the connected server info
                conn_info = __bt_find_gatt_conn_info(&bd_addr);
@@ -3938,12 +3900,10 @@ int _bt_hal_handle_gattc_connected_event(char* address, gboolean gatt_connected)
                        return -1;
                }
 
-#ifndef __INTEGRATE_HAL_GATT_INFO__
                if (inst_id != conn_info->inst_id) {
                        ERR("server instance is different");
                        return -1;
                }
-#endif
 
                //remove gatt conn info from the server list
                DBG("remove the server conn_info from list after gatt disconnection");