iOS is using queued writes to send data to my nRF52832 application. For some reason, on the third queued write reply (in nrf_ble_qwr.c) sd_ble_gatts_rw_authorize_reply returns NRF_ERROR_INVALID_STATE.
I modified nrf_ble_qwr.c to log every time it calls sd_ble_gatts_rw_authorize_reply anywhere. I am sure that my code is not calling it, as I also log everywhere I call it too. The log output looks like this:
this occurs in the sd_ble_gatts_rw_authorize_reply call in on_prepare_write in nrf_ble_qwr.c. Unless sd_ble_gatts_rw_authorize_reply is being called by another nrf library, it is only being called from nrf_ble_qwr.c. I'm really struggling to understand why INVALID_STATE is being returned.