Basic ble reading for STM32WB
Hi Guys,
I have problems reading. I have followed the STM32WB Workshop on stm32wb (using mx version 5.4.0). Now i'm trying to read but all examples seem to only use notifying and writing.
I have the following char created and added some default value.
aci_gatt_add_char(SvcHandle,
UUID_TYPE_128, &uuid16,
1,
CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RESP,
ATTR_PERMISSION_NONE,
GATT_NOTIFY_ATTRIBUTE_WRITE | GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP,
10,
0,
&(AlarmThresholdHandle));
uint8_t pData[1] = {59};
aci_gatt_update_char_value(SvcHandle,
AlarmThresholdHandle + 1,
0, /* charValOffset */
1, /* charValueLen */
pData);
Within server app handler it enters this case when im reading, and found the right handler. This is the part where i get lost, what to do next? I implemented the following but that does not work.
case EVT_BLUE_GATT_READ_PERMIT_REQ:
{
aci_gatt_read_permit_req_event_rp0* attributeToRead;
attributeToRead = (aci_gatt_read_permit_req_event_rp0*)blue_evt->data;
if(attributeToRead->Attribute_Handle == AlarmThresholdHandle + 1)
{
uint8_t pData[1] = {5};
retval = aci_gatt_update_char_value(SvcHandle,
AlarmThresholdHandle + 1,
0, /* charValOffset */
1, /* charValueLen */
pData);
}
returnValue = SVCCTL_EvtAckFlowEnable;
}Once i passed here i cant trigger any new events anymore.
I would like to see some examples of reading or get some feedback on which steps to preform to read successfully.
Thanks in advance,
