Revert "Integrate gatt connection info" 05/300905/1
authorWootak Jung <wootak.jung@samsung.com>
Mon, 6 Nov 2023 00:34:45 +0000 (09:34 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 6 Nov 2023 00:34:45 +0000 (09:34 +0900)
This reverts commit 837896a29835d78365a7e1d852de09e1821635bc.

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

index 8df68da45d6bba6c5227e1c714afc8864edd522e..e01409d43e3cb1285c36defbc6fbd7cf48a310d2 100644 (file)
@@ -125,39 +125,8 @@ struct gatt_server_info_t {
        char *addr;                                      /* Remote GATT Server address */
 };
 
-struct gatt_client_info_t {
-       int connection_id;                               /* This value will uniquely identify a GATT client-server connection */
-       int instance_id;                                 /* This value unique identifies a GATT server instance */
-       char *addr;                                      /* Remote GATT client address */
-};
-
-/* TODO:
- * Remove this feature if code is verified
- * Remove gatt_client/server_info_t and use gatt_conn_info_t
- * Remove gatt_client/server_info_list and use gatt_conn_info_list
- */
-//#define __INTEGRATE_GATT_INFO__ // TODO: this feature can be used if easy setup scenario is fully supported and the name need to be changed to avoid confusion with existing GATT flags
-#ifndef __INTEGRATE_GATT_INFO__
 /* Linked List of connected Remote GATT Servers */
 static GSList *gatt_server_info_list = NULL;
-/* Linked List of connected Remote GATT clients */
-static GSList *gatt_client_info_list = NULL;
-#else
-/* GATT Connection Info List Structure */
-struct gatt_conn_info_t {
-       char *addr;        /* Remote GATT address */
-       int connection_id; /* This value will uniquely identify a GATT client-server connection */
-       int client_id;     /* This value unique identifies a GATT Client instance */
-       int instance_id;   /* This value unique identifies a GATT Server instance */
-};
-
-/* Linked List of connected Remote GATT info */
-static GSList *gatt_conn_info_list = NULL;
-#define gatt_server_info_t gatt_conn_info_t
-#define gatt_client_info_t gatt_conn_info_t
-#define gatt_server_info_list gatt_conn_info_list
-#define gatt_client_info_list gatt_conn_info_list
-#endif
 
 typedef struct {
        gboolean is_changed;
@@ -239,6 +208,13 @@ struct gatt_server_req_info {
        char *addr;                                      /* Remote GATT client address */
 };
 
+/* GATT Client Info List Structure */
+struct gatt_client_info_t {
+       int connection_id;                               /* This value will uniquely identify a GATT client-server connection */
+       int instance_id;                                 /* This value unique identifies a GATT server instance */
+       char *addr;                                      /* Remote GATT client address */
+};
+
 /* GATT Indicate confirm result  */
 struct gatt_indicate_cfm_result_info_t {
        int result;                                      /* Result of event */
@@ -305,6 +281,9 @@ static void __bt_update_mtu_gatt_device(char *address, int mtu);
 /* Linked List of GATT requests from Remote GATT Clients */
 static GSList *gatt_server_requests = NULL;
 
+/* Linked List of connected Remote GATT clients */
+static GSList *gatt_client_info_list = NULL;
+
 /* Number of clients to be notified to */
 static int num_indicate_clients;
 
@@ -1799,9 +1778,7 @@ 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;
-#ifndef __INTEGRATE_GATT_INFO__
        struct gatt_server_info_t *server_info = NULL;
-#endif
        bluetooth_device_address_t dev_addr;
        GVariant *param = NULL;
        int ret;
@@ -1843,14 +1820,10 @@ static void __bt_handle_gatt_server_connection_state(event_gatts_conn_t *event)
                client_info->addr = g_strdup(address);
                BT_INFO("Added GATT client addr[%s]", client_info->addr + 12);
                client_info->connection_id = event->conn_id;
-#ifdef __INTEGRATE_GATT_INFO__
-               client_info->client_id = -1;
-#endif
                client_info->instance_id = event->server_inst;
                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));
 
-#ifndef __INTEGRATE_GATT_INFO__
                /* Save server connection info */
                server_info = g_new0(struct gatt_server_info_t, 1);
                server_info->addr = g_strdup(address);
@@ -1859,7 +1832,6 @@ static void __bt_handle_gatt_server_connection_state(event_gatts_conn_t *event)
                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));
-#endif
 
                ret = gattc_add_connection_info((bt_address_t *)&dev_addr, event->conn_id, event->server_inst);
                if (ret != OAL_STATUS_SUCCESS) {
@@ -1877,9 +1849,7 @@ 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;
-#ifndef __INTEGRATE_GATT_INFO__
        struct gatt_server_info_t *server_info = NULL;
-#endif
        bluetooth_device_address_t dev_addr;
        GVariant *param = NULL;
        char address[BT_ADDRESS_STRING_SIZE];
@@ -1930,7 +1900,6 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
                                BLUETOOTH_EVENT_GATT_SERVER_DISCONNECTED, /* Local device is GATT server */
                                param);
 
-#ifndef __INTEGRATE_GATT_INFO__
                /* Remove server info from list */
                server_info = _bt_find_remote_gatt_server_info(address);
                if (server_info) {
@@ -1941,10 +1910,6 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
                } else {
                        BT_INFO("Can not find conn info, already removed!");
                }
-#else
-               /* Remove all services from info list_gatt_info */
-               __bt_cleanup_remote_services(client_info);
-#endif
 
                /* Remove client info from List */
                gatt_client_info_list = g_slist_remove(gatt_client_info_list, client_info);
@@ -3979,9 +3944,6 @@ static void __bt_handle_client_connected(event_gattc_conn_t *event_data)
                        conn_info = g_new0(struct gatt_server_info_t, 1);
                        conn_info->addr = g_strdup(address);
                        conn_info->client_id = event_data->client_if;
-#ifdef __INTEGRATE_GATT_INFO__
-                       conn_info->instance_id = -1;
-#endif
                        conn_info->connection_id = event_data->conn_id;
                        gatt_server_info_list = g_slist_append(gatt_server_info_list, conn_info);
                        BT_DBG("Total num of connected Remote GATT server devices [%d]",
@@ -4020,9 +3982,7 @@ static void __bt_handle_client_disconnected(event_gattc_conn_t *event_data)
 {
        int result = BLUETOOTH_ERROR_NONE;
        struct gatt_server_info_t *conn_info = NULL;
-#ifndef __INTEGRATE_GATT_INFO__
        struct gatt_client_info_t *client_info = NULL;
-#endif
        struct gatt_out_conn_info_t *out_conn_info = NULL;
        GVariant *param = NULL;
 
@@ -4078,7 +4038,6 @@ static void __bt_handle_client_disconnected(event_gattc_conn_t *event_data)
        } else
                BT_INFO("Can not find conn info, already removed!");
 
-#ifndef __INTEGRATE_GATT_INFO__
        /* Remove client info */
        client_info = _bt_find_remote_gatt_client_info(address);
        if (client_info) {
@@ -4087,7 +4046,6 @@ static void __bt_handle_client_disconnected(event_gattc_conn_t *event_data)
                g_free(client_info->addr);
                g_free(client_info);
        }
-#endif
 
        __bt_remove_mtu_gatt_device(address);
 
index fe014e97a0873435bf92705698194a4707ba5fe0..541c95fa3bd9fb7b67ab7129f10f713747dd7f65 100644 (file)
@@ -98,12 +98,7 @@ int _bt_gatt_server_set_service_persistence(const char *uuid);
 
 int _bt_gatt_server_unset_service_persistence(const char *uuid);
 
-//#define __INTEGRATE_GATT_INFO__ // TODO: this feature can be used if easy setup scenario is fully supported
-#ifndef __INTEGRATE_GATT_INFO__
 struct gatt_client_info_t *_bt_find_remote_gatt_client_info(char *address);
-#else
-struct gatt_conn_info_t *_bt_find_remote_gatt_client_info(char *address);
-#endif
 
 char * _bt_gatt_get_default_gatt_client_uuid(void);
 
@@ -173,12 +168,7 @@ int _bt_gatt_client_read_phy(bluetooth_device_address_t *address);
 int _bt_gatt_client_set_phy(bluetooth_device_address_t *device_address,
                int tx_phy, int rx_phy, int phy_options);
 
-
-#ifndef __INTEGRATE_GATT_INFO__
 struct gatt_server_info_t *_bt_find_remote_gatt_server_info(char *address);
-#else
-struct gatt_conn_info_t *_bt_find_remote_gatt_server_info(char *address);
-#endif
 
 #ifdef __cplusplus
 }