esp_ble_gattc_get_characteristic(uint16_t conn_id,esp_gatt_srvc_id_t *srvc_id, esp_gatt_id_t *start_char_id);
esp_ble_gattc_get_descriptor(uint16_t conn_id,esp_gatt_srvc_id_t *srvc_id, esp_gatt_id_t *char_id,esp_gatt_id_t *start_descr_id);
I use these two APIs and want to get all included services,characteristics,descriptions. Sometimes esp32 has list all information, but sometimes it crashed.
Anyone has ever implement this function(list all connection info)? This is my first step to get connected device's info. Second step is writing characteristic and receiving notify. I also want to connect more than one ble devices.
My key code is followed:
Code: Select all
static void esp_gattc_cb(uint32_t event, void *param)
{
...
case ESP_GATTC_SEARCH_CMPL_EVT:
...
//call esp_ble_gattc_get_characteristic for each service
while( service_node )
{
esp_ble_gattc_get_characteristic( conn_id, service_node->srvc_id, NULL );
service_node = service_node->next;
}
break;
case ESP_GATTC_GET_CHAR_EVT:
...
esp_ble_gattc_get_descriptor( conn_id, srvc_id, char_id, NULL );
esp_ble_gattc_get_characteristic( conn_id, srvc_id, char_id );
break;
case ESP_GATTC_GET_DESCR_EVT:
...
esp_ble_gattc_get_descriptor( conn_id, srvc_id, char_id, descr_id );
break;
}