3 years, 3 months ago.
GattAttibute Descriptors preventing Characteristic Creation when using UUID 0x2901
Firstly the example code in GattAttribute.h does not refer to GattAttribute so isn't a great deal of help...
- @section EXAMPLE
- UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
- GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
Also not a GattCharacteristic constructor...
- - - - - - - - -
When attempting to create a service I'm finding that BLE_API doesn't properly create characteristics when using standard attribute UUIDs (the low 0x29xx range such as 0x2901).
If I use a value such as 0x29FF for the GattAttribute UUID then the descriptor is created and added and the value is visible when browsing the services (and all Characteristics are added to the Service).
If I use 0x2901 the descriptor is not visible when browsing the service and only the first Characteristic is actually added to the service - it's like it gets to the descriptor in the tree and ejects entirely without adding the value or continuing with subsequent Characteristics.
For example - I'm creating the descriptor with GattAttribute( BLE_UUID_DESCRIPTOR_CHAR_USER_DESC, (uint8_t *) "6", 1, 1 ); - this doesn't get included in the characteristic and blocks all subsequent characteristics on that service ( BLE_UUID_DESCRIPTOR_CHAR_USER_DESC is 0x2901)
GattAttribute( 0x29FF, (uint8_t *) "6", 1, 1 ); by contrast creates a descriptor in which the value 6 is visible when browsing the characteristic. It's just not as useful as x29FF has no SIG accepted function and isn't where I'd look for the Characteristic User Descriptor.
After a bit more digging through the spec I believe it's not possible to write 0x2901 in isolation - it can only be written if the auxillary writable bit of descriptor 0x2900 associated with the same characteristic is set to 1 (so 0x4000 or 0x0002 depending on bit order ) so that needs to be written first.
Do I need to have actually created the GattCharacteristic and have it added to the GattService before adding the descriptors on or is the constructor/parser smart enough to allow a 0x2901 attrib to be added when preceded by an appropriate 0x2900 in the descriptors array?
Question relating to:
To post an answer, please log in.