bt_bdaddr_t bd_addr; /*remote server address*/
int conn_id;
int inst_id;
+ gboolean is_gatt_connected;
} hal_gattc_client_info_t;
/* Linked list of connected GATT client connection */
hal_gattc_client_info_t *gattc_client = NULL;
int inst_id = -1;
-
- DBG("+ connected device address [%s]", address);
-
event = gatt_connected ? HAL_EV_GATT_CLIENT_CONNECTED :
HAL_EV_GATT_CLIENT_DISCONNECTED;
return;
}
+ gattc_client->is_gatt_connected = gatt_connected;
+
//send event
memset(&ev, 0, sizeof(ev));
ev.conn_id = gattc_client->conn_id;
hal_gattc_server_info_list = g_slist_remove(hal_gattc_server_info_list, conn_info);
__hal_clean_gattc_server_info(conn_info);
}
-
- DBG("-");
}
static void _bt_hal_send_search_service_result_event(int conn_id, int is_primary,
struct hal_ev_gatt_client_service_changed ev = {0, };
char address[BT_HAL_ADDRESS_STRING_SIZE];
hal_gattc_server_info_t *server_info = NULL;
+ hal_gattc_client_info_t *gattc_client = NULL;
hal_gattc_service_t *service = NULL;
GSList *list = NULL;
char *uuid_str = NULL;
return;
}
+ gattc_client = __bt_find_gatt_client_info((bt_bdaddr_t *)ev.bdaddr);
+ if (gattc_client == NULL) {
+ ERR("gattc_client is NULL");
+ return;
+ }
+
+ if (gattc_client->is_gatt_connected == FALSE) {
+ DBG("GattConnected signal is not received yet. Just skip");
+ return;
+ }
+
if (is_added) {
/* Get service UUID from path */
__bt_hal_gattc_get_uuid_from_path(path, &uuid_str);