Hi Simon,

On Wed, May 24, 2017 at 10:38:06AM -0700, Simon Ratner wrote:
> Hi devs,
> 
> For a characteristic that is both WRITE and WRITE_NO_RSP, is there a way to
> distinguish which operation was received from within the gatt access
> callback? Nimble will automatically send the response if requested, but app
> may have different behaviour based on whether it expects the central device
> to receive the response.

I'm afraid not.  That information gets lost in the ATT server code.  To
propagate this information to the application, I think we would need to
do (something like) the following:

1. Define a new ATT op code: BLE_ATT_ACCESS_OP_WRITE_NO_RSP
2. Modify ble_att_svr_write() such that:
    a. it takes an op code parameter.
    b. it forwards the op code to the ATT access callback.
3. Add a boolean field to the ble_gatt_access_ctxt struct: no_rsp [*].

Step 3 is a bit hacky, but it maintains backwards compatibility.
Without the backwards compatibility concern, it would probably be better
to add a new GATT op for write-no-response.

So I think it is a fair amount of work.  I do remember making the
decision to collapse both write operations into a single opcode,
thinking the application would never care about this distinction.  It
sounds like I may have made the wrong choice!  Is the need to
distinguish among these two operations an actual or theoretical
requirement?

Chris

Reply via email to