STM32 WB55 Nucleo BLE: How to use indicate instead of notify.
I am trying to use the indication property instead of the notification property based on the heart rate example for the WB55. I have modified the gatt characteristic to advertise an indication. I have the android I am connecting to sending a CCCD to which it gets a successful response. I then try to send my indication.
To send an indication instead of a notification I believe I have to use: aci_gatt_update_char_value_ext function. I am unsure of the parameters required and there seems to be no up to date documentation for this function that includes all parameters. I know that my notification call works that looks like so:
result = aci_gatt_update_char_value(aTemplateContext.TemplateSvcHdle, //Service Handle
aTemplateContext.TemplateNotifyServerToClientCharHdle, //Char Handle
0, /* Value offset */
TEST_PAYLOAD_LENGTH, /* value length */
(uint8_t *) pPayload); //ValueBut my call to the extended function returns an INVALID_PARAMS error:
result = aci_gatt_update_char_value_ext(connectionHandle, //Conn_Handle_To_Notify
aTemplateContext.TemplateSvcHdle, //Service_Handle
aTemplateContext.TemplateNotifyServerToClientCharHdle, //Char_Handle
0x02, //Update_Type: Indication??
2, //Char_Length
0, //Value_Offset
TEST_PAYLOAD_LENGTH, //Value_Length
(uint8_t *) pPayload); //ValueI am particularly concerned about the params not included in the original call: Connection handle, Update type and Char length.
Connection handle I have passed from app_ble.c during the connection calls. This feels hacky but it should in theory work as long as the handle doesn’t change.
The update type doesn’t seem well documented but I found one source which suggested it be set to 0x02 to mean indication.
The char length I don’t understand at all. No documentation for this exists. This is separate from payload/value length and we shouldn’t have to report the length of the characteristic UUID in this send? If anyone knows what this is I’d be grateful, the only example I found online has this set as a magic number to 1.
Anyone who can either point me to up to date documentation or a working example would also be appreciated.