BLE start_service() num_handles parameter
BLE start_service() num_handles parameter
Can someone explain to me the num_handle parameter of esp_ble_gatts_create_service()? If I put in 1, I am able to create a service, but unable to add characteristics. If I put in 3, I am able to create a single characteristic. It seems that each characteristic consumes two handles. I haven't tried anything else yet, but guess that other things also consume handles, and I would like to understand what I am doing, rather than learning from trial and error.
-
MicroController
- Posts: 2703
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: BLE start_service() num_handles parameter
Each BLE "attribute" gets its own handle. A service declaration is an attribute, so you need one handle for that.
A characteristic is made up of at least two attributes, one attribute for the required 'metadata' (UUID, permissions) and one attribute for the value of the characteristic; if a characteristic supports notifications/indications, another attribute, the "Client Characteristic Configuration Descriptor" (CCCD), is also needed.
It may be helpful to look at the service table example, where the whole service (GATT DB) is defined statically with all the attributes; each entry in that "database" (array) defines one attribute.
A characteristic is made up of at least two attributes, one attribute for the required 'metadata' (UUID, permissions) and one attribute for the value of the characteristic; if a characteristic supports notifications/indications, another attribute, the "Client Characteristic Configuration Descriptor" (CCCD), is also needed.
It may be helpful to look at the service table example, where the whole service (GATT DB) is defined statically with all the attributes; each entry in that "database" (array) defines one attribute.
Who is online
Users browsing this forum: Baidu [Spider], Qwantbot, Semrush [Bot] and 1 guest