My Peripheral is using the ble_conn_params module. I'm seeing that if my Peripheral calls sd_ble_gap_disconnect() soon after making a connection, the module will sometimes throw NRF_ERROR_INVALID_STATE to ble_conn_params_init_t.error_handler. Is there a way to avoid this 100% of the time?
Inspecting the ble_conn_params.c code, it appears this is because the app_timer that is used to periodically send connection parameter update events is firing after sd_ble_gap_disconnect() is called, but before the SoftDevice has had a chance to complete the disconnection procedure.
I've considered using ble_conn_params_stop() after sd_ble_gap_disconnect(), but this would stop activity for all concurrent connections, instead of only the one connection that is to be terminated. Similarly, it looks like ble_conn_params_init() isn't designed to configure only one connection at a time. ble_conn_params_change_conn_params() also doesn't appear to provide a way to affect a currently running app_timer.
I'm using SDK 14.2, and the module in SDK 15.3 appears to be identical.