8 years, 12 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
  • @code
  • UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
  • GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
  • @endcode

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.

Edit

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:

High level Bluetooth Low Energy API and radio abstraction layer

1 Answer

8 years, 12 months ago.

first things first, the comment header has been updated: https://github.com/mbedmicro/BLE_API/issues/37

Thank you!

posted by Jonathan Kestel 23 Apr 2015

The User Description descriptor is a special case; just like the CCCD. It cannot be added like other descriptors. I'll add an API to allow special handling of this descriptor. Thanks for bringing this up.

posted by Rohit Grover 24 Apr 2015

This is now being tracked under https://github.com/mbedmicro/BLE_API/issues/38

posted by Rohit Grover 24 Apr 2015

A fix is now available on Github. https://github.com/mbedmicro/nRF51822/issues/9 This will be pulled into mbed.org soon after the next release of mbed-sdk (expected next week).

posted by Rohit Grover 24 Apr 2015