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__
+#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;
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 */
/* 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;
{
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;
client_info->addr = g_strdup(address);
BT_INFO("Added GATT client addr[%s]", client_info->addr);
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);
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) {
{
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];
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)
gatt_server_info_list = g_slist_remove(gatt_server_info_list, server_info);
else
BT_INFO("Can not find conn info, already removed!");
+#endif
/* Remove client info from List */
gatt_client_info_list = g_slist_remove(gatt_client_info_list, client_info);
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]",