-
Notifications
You must be signed in to change notification settings - Fork 475
Description
Summary
When a client writes to a control point characteristic using ATT_WriteRequest, NimBLE allows the application to start sending notifications/indications (data streaming) before the stack sends the corresponding ATT_WriteResponse for that write request.
This results in out-of-order ATT/GATT procedure behavior: the server processes the command and transmits follow-up data prior to acknowledging the write request.
Expected Behavior
For a Write Request:
Server should send ATT_WriteResponse first (acknowledge write request).
Only then should the application begin sending any related Notifications/Indications (e.g., historical data stream) triggered by that write.
Actual Behavior
Application callback for the write is invoked.
Inside the callback, application calls ble_gattc_notify_() / ble_gatts_indicate_() (or service helper does so).
These notifications/indications are transmitted before the stack sends ATT_WriteResponse.
The ATT_WriteResponse is only sent after the access callback returns.
Impact
Some clients may treat notifications/indications received before the write response as protocol/procedure violation or unexpected sequencing.
Can break interoperability for control point / procedure-style characteristics (e.g., RACP-like flows).
Evidence / Reference in NimBLE Example
A similar ordering exists in the Alert Notification Service example:
File: ble_svc_ans.c
Function: ble_svc_ans_access()
Case: Write Request to BLE_SVC_ANS_CHR_UUID16_ALERT_NOT_CTRL_PT
Behavior: ble_svc_ans_new_alert_notify() is called inside the access callback before the stack sends the ATT_WriteResponse, because the response is sent only after ble_svc_ans_access() exits.