This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can call to sd_ble_gatts_rw_authorize_reply() be deferred?

Working with SDK 15 on an nRF52832:

I have a peripheral applicatin where I'm computing the value of a BLE read on the fly.

Currently I do that by:

  • Setting up a BLE observer
  • When it sees a BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event
  • If the operation is read and the attribute is the one in question
  • It computes the new value and
  • Calls sd_ble_gatts_rw_authorize_reply() to update the value and authorize the read.

But now I want to use data on an external flash to compute the value.  Because I'm on a nRF52832 rather than a nRF52840 I don't have the SPIM to memory-map the external flash for read.  So I need to kick off some SPI operations to read the data.  Those will take a while.  So doing them before returning from the event observer is not practical.

Question:

  • Does the sd_ble_gatts_rw_authorize_reply() have to be called before the observers have all handled the authorize request BLE event?
  • Or can I have:
    • my event handler kick off a background process (string of SPI driver calls and callbacks) and return, then
    • the background process do the SPI reads, compute the value, and call sd_ble_gatts_rw_authorize_reply() once this is complete?

If the latter doesn't work, how SHOULD I do such an operation?

Parents Reply Children
No Data
Related