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*/
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;
+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 bt_pending_le_conn_info_s *pending_le_conn_info = NULL;
static guint pending_le_conn_timer_id = 0;
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;
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);
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");
}
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;
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;
}
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);
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");