Hi,
From the documentation for the sd_ble_gap_sec_info_reply() function, "This function is only used to reply to a BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in NRF_ERROR_INVALID_STATE."
Yet I get this when using the bond manager with SD 6.0 and SDK 5.2.
The bonded central has been saved successfully and when attempting to reconnect to the saved bonded central, I get the error in the function below
static void on_sec_info_request(ble_evt_t * p_ble_evt) { uint32_t err_code;
err_code = central_find_in_db(p_ble_evt->evt.gap_evt.params.sec_info_request.div);
if (err_code == NRF_SUCCESS)
{
// Bond information has been found and loaded for security procedures. Reflect this in the
// status variable
m_bond_loaded = true;
// Central found in the list of bonded central. Use the encryption info for this central.
err_code = sd_ble_gap_sec_info_reply(m_conn_handle,
&m_central.bond.auth_status.periph_keys.enc_info,
NULL);
if (err_code != NRF_SUCCESS)
{
m_bondmngr_config.error_handler(err_code);
}
// Do not set the sys_attr yet, should be set only when sec_update is successful.
}
else if (err_code == NRF_ERROR_NOT_FOUND)
{
m_central.bond.central_id_info = p_ble_evt->evt.gap_evt.params.sec_info_request;
// New central.
err_code = sd_ble_gap_sec_info_reply(m_conn_handle, NULL, NULL);
if (err_code != NRF_SUCCESS)
{
m_bondmngr_config.error_handler(err_code); <<--- err_code here is NRF_ERROR_INVALID_STATE or 8
}