Read multiple characteristics from service

san27deep
Posts: 11
Joined: Mon Jun 12, 2017 9:34 am

Read multiple characteristics from service

Postby san27deep » Mon Jul 31, 2017 2:28 pm

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 ?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Read multiple characteristics from service

Postby kolban » Tue Aug 01, 2017 4:44 am

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
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: Google [Bot] and 90 guests