cancel
Showing results for 
Search instead for 
Did you mean: 

How to use aci_gatt_add_char_desc() for STM32WB BLE?

YGail.2
Associate III

My biggest issue currently is on my external app which is connecting to the WB that it cannot get the descriptor.

As I debug using BLE using LightBlue there is no descriptor in my characteristic.

0693W00000aH1FKQA0.jpg As I notice recently by reading again the manual there is a command aci_gatt_add_char_desc() which in my opinion add the missing descriptor. By generating the default project with cubeMX, this function is never called. As there are no comments in the code, neither any documentation about this routine, this makes it hard to implement correctly. This would really helpful if the documentation could be extended (@Remy ISSALYS​ ). Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Remy ISSALYS
ST Employee

Hello,

The command aci_gatt_add_char_desc is used when you have to create several instances of the same characteristic.

In your case, I think you search the Client Characteristic Configuration Descriptor (CCCD) to enable or disable the notification. The CCCD is create when you add your characteristic through aci_gatt_add_char command.

The command returns the handle of the declaration attribute. The attribute that holds the Characteristic Value is always allocated at the next handle (Char_Handle + 1).

The Characteristic Value is immediately followed, in order, by:

  • The Server Characteristic Configuration descriptor if CHAR_PROP_BROADCAST is selected;
  • The Client Characteristic Configuration descriptor if CHAR_PROP_NOTIFY or CHAR_PROP_INDICATE properties is selected;
  • The Characteristic Extended Properties descriptor if CHAR_PROP_EXT is selected.

For instance, if CHAR_PROP_NOTIFY is selected but not CHAR_PROP_BROADCAST nor CHAR_PROP_EXT, then the Client Characteristic Configuration Descriptor attribute handle is Char_Handle + 2.

Best Regards,

View solution in original post

1 REPLY 1
Remy ISSALYS
ST Employee

Hello,

The command aci_gatt_add_char_desc is used when you have to create several instances of the same characteristic.

In your case, I think you search the Client Characteristic Configuration Descriptor (CCCD) to enable or disable the notification. The CCCD is create when you add your characteristic through aci_gatt_add_char command.

The command returns the handle of the declaration attribute. The attribute that holds the Characteristic Value is always allocated at the next handle (Char_Handle + 1).

The Characteristic Value is immediately followed, in order, by:

  • The Server Characteristic Configuration descriptor if CHAR_PROP_BROADCAST is selected;
  • The Client Characteristic Configuration descriptor if CHAR_PROP_NOTIFY or CHAR_PROP_INDICATE properties is selected;
  • The Characteristic Extended Properties descriptor if CHAR_PROP_EXT is selected.

For instance, if CHAR_PROP_NOTIFY is selected but not CHAR_PROP_BROADCAST nor CHAR_PROP_EXT, then the Client Characteristic Configuration Descriptor attribute handle is Char_Handle + 2.

Best Regards,