I am trying to emulate the case where a scanned peripheral goes offline before the connection was issued by the user by calling sd_ble_gap_connect() with a completely made up address (123456789abc).
The err_code returned by the function was NRF_SUCCESS. I understand that as the connection attempt was initiated successfully, which make sense.
However, all subsequent calls of sd_ble_gap_connect() always return an err_code of NRF_ERROR_INVALID_STATE. What does this mean? This suggests that the softdevice is not in a state where it could initiate a connection attempt.
I have a few questions raised from this situation:
- Exactly what state would the softdevice be in after a call of sd_ble_gap_connect()?
- Would the softdevice ever "recover"/get out of from that state if sd_ble_gap_connect() was called with a bad address?
- Is there a better way to handle bad BLE address then? If yes, what would it be?