Page 1 of 1

Read multiple characteristics from service

Posted: Mon Jul 31, 2017 2:28 pm
by san27deep
I am writing gatt_client application, which will read multiple characteristics from service provided by external peripheral.

Well i went through API's, I am able to read the first characteristic of the service, but i am not able to read/write second and third characteristics of same service.

Please someone help me to do the same. Is there any separate API's to read 2nd onward characteristics ?

Re: Read multiple characteristics from service

Posted: Tue Aug 01, 2017 4:44 am
by kolban
When you wish to read the value of a characteristic, you can call the esp_ble_gattc_read_char() API. When called, this will send the request to the BLE server asynchronously.

When the response is ready, you receive an ESP_GATTC_READ_CHAR_EVT event which includes the response value. You can call esp_ble_gattc_read_char() any number of times with any number of characteristics owned by the remote service.

For me, I found all the plumbing of this level of BLE programming too much of an overhead and use some C++ classes that encapsulate the BLE story. For me, this simplifies much. See https://esp32.com/viewtopic.php?f=13&t=2330