Page 1 of 1

how to get all services supported by slaver?

Posted: Fri Dec 30, 2016 9:15 am
by xzwang
I have read the exmaple15, esp32 as the GATT Client. It can connect the indicated device now, but there is no code to get all services,charasteristics,descriptions. I have found the APIļ¼š
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)
	    //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;
	    esp_ble_gattc_get_descriptor( conn_id, srvc_id, char_id, NULL );
	    esp_ble_gattc_get_characteristic( conn_id, srvc_id, char_id );
	    esp_ble_gattc_get_descriptor( conn_id, srvc_id, char_id, descr_id );

Re: how to get all services supported by slaver?

Posted: Mon Feb 20, 2017 10:11 pm
by Narmor
Have you found a solution to your problem? I want to do the same thing, but I have just started working with the esp and bluetooth, so im not really progressing atm. It would be nice to see some snippets if you have solved the problem! Thanks!