cancel
Showing results for 
Search instead for 
Did you mean: 

Clarification of GATT Write Procedures

mdmottola
Associate II

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

  1. Client calls aci_gatt_write_char_value
  2. Server event aci_gatt_write_permit_req_event
    1. aci_gatt_prepare_write_permit_req_event will not be generated based on Figure 4.15 correct?
  3. Server calls aci_gatt_write_resp
  4. If the server allows the write…
    1. Client event aci_att_exec_write_resp_event
      1. 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…?
    2. Client event aci_gatt_proc_complete_event
    3. Server event aci_gatt_attribute_modified_event
  5. If the server rejects the write with an error code…
    1. Client event aci_gatt_error_resp_event
      1. aci_att_exec_write_resp_event & aci_att_prepare_write_resp_event are not generated correct?
    2. Client event aci_gatt_proc_complete_event
  6. If the server doesn’t respond in time…
    1. Client event aci_gatt_proc_timeout_event
    2. Server event aci_gatt_proc_timeout_event

4.9.4 Write Long Characteristic Values

  1. 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

  1. Server event aci_gatt_prepare_write_permit_req_event
  2. Server calls aci_gatt_write_resp
    1. 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?
    2. Assuming the above is true because there is no other GATT write related function that the slave can call mentioned in the API documentation.
    3. Seeking clarification because the API documentation for aci_gatt_prepare_write_permit_req_event specifies the following which seems to contradict the above assumption:
      1. "…respond with the command aci_gatt_write_resp. Based on the response from the application, the attribute value will be modified by the stack."
  3. If the server allows the write…
    1. Client event aci_att_prepare_write_resp_event
  4. If the server rejects the write with an error code…
    1. Client event aci_gatt_error_resp_event
    2. Client event aci_gatt_proc_complete_event
    3. 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?
  5. If the server doesn’t respond in time…
    1. Client event aci_gatt_proc_timeout_event
    2. Server event aci_gatt_proc_timeout_event

Upon completion of preparing the writes and no previous errors or timeouts

  1. Server event aci_gatt_write_permit_req_event
  2. Server calls aci_gatt_write_resp
    1. 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?
  3. If the server allows the write…
    1. Client event aci_att_exec_write_resp_event
    2. Client event aci_gatt_proc_complete_event
    3. Server event aci_gatt_attribute_modified_event
  4. If the server rejects the write with an error code…
    1. Client event aci_gatt_error_resp_event
    2. Client event aci_gatt_proc_complete_event
  5. If the server doesn’t respond in time…
    1. Client event aci_gatt_proc_timeout_event
    2. Server event aci_gatt_proc_timeout_event

I also have multiple questions relating to reliable writes following the above being clarified.

0 REPLIES 0