I'm a bit confused regarding some nuances of the BlueNRG-2's BLE characteristic value write procedures' functions & events. Below is my understanding with a few questions.
Bluetooth Core Specification v5.2 | Vol 3, Part G; 4 GATT Feature Requirements 4.9 Characteristic Value Write
4.9.3 Write Characteristic Value
- Client calls aci_gatt_write_char_value
- Server event aci_gatt_write_permit_req_event
- aci_gatt_prepare_write_permit_req_event will not be generated based on Figure 4.15 correct?
- Server calls aci_gatt_write_resp
- If the server allows the write…
- Client event aci_att_exec_write_resp_event
- API documentation says aci_att_prepare_write_resp_event would occur from a call to aci_gatt_write_char_value; assuming this is inaccurate, otherwise ignore event…?
- Client event aci_gatt_proc_complete_event
- Server event aci_gatt_attribute_modified_event
- If the server rejects the write with an error code…
- Client event aci_gatt_error_resp_event
- aci_att_exec_write_resp_event & aci_att_prepare_write_resp_event are not generated correct?
- Client event aci_gatt_proc_complete_event
- If the server doesn’t respond in time…
- Client event aci_gatt_proc_timeout_event
- Server event aci_gatt_proc_timeout_event
4.9.4 Write Long Characteristic Values
- Client calls aci_gatt_write_long_char_value
Repeat below until all portions of the characteristic value is written or an error or timeout occurs
- Server event aci_gatt_prepare_write_permit_req_event
- Server calls aci_gatt_write_resp
- Is it correct to assume that under-the-hood of the aci_gatt_write_resp being called with Write_status set to 1 in response to aci_gatt_prepare_write_permit_req_event that ATT_PREPARE_WRITE_RSP is sent and the previously queued writes aren’t written at this time?
- Assuming the above is true because there is no other GATT write related function that the slave can call mentioned in the API documentation.
- Seeking clarification because the API documentation for aci_gatt_prepare_write_permit_req_event specifies the following which seems to contradict the above assumption:
- "…respond with the command aci_gatt_write_resp. Based on the response from the application, the attribute value will be modified by the stack."
- If the server allows the write…
- Client event aci_att_prepare_write_resp_event
- If the server rejects the write with an error code…
- Client event aci_gatt_error_resp_event
- Client event aci_gatt_proc_complete_event
- The characteristic value is left unchanged; i.e. the characteristic value is the same as it was prior to aci_gatt_write_long_char_value being called correct?
- If the server doesn’t respond in time…
- Client event aci_gatt_proc_timeout_event
- Server event aci_gatt_proc_timeout_event
Upon completion of preparing the writes and no previous errors or timeouts
- Server event aci_gatt_write_permit_req_event
- Server calls aci_gatt_write_resp
- In contrast to the above mentioned call to aci_gatt_write_resp, is it correct that when aci_gatt_write_resp is called with Write_status set to 1 in response to aci_gatt_write_permit_req_event, ATT_EXECUTE_WRITE_RSP is sent and the queued prepared writes are written?
- If the server allows the write…
- Client event aci_att_exec_write_resp_event
- Client event aci_gatt_proc_complete_event
- Server event aci_gatt_attribute_modified_event
- If the server rejects the write with an error code…
- Client event aci_gatt_error_resp_event
- Client event aci_gatt_proc_complete_event
- If the server doesn’t respond in time…
- Client event aci_gatt_proc_timeout_event
- Server event aci_gatt_proc_timeout_event
I also have multiple questions relating to reliable writes following the above being clarified.