I am developing with nrf52832 (s132 v7.0.1, SDK v17.0.0) as a peripheral device.
I would like to have it re-paired when there is no pairing information for either peripheral or central.
I found out that this can be done by allowing re-pairing when PM_EVT_CONN_SEC_CONFIG_REQ occurs, so I added that process, but the pairing does not succeed and the device is disconnected.
pm_conn_sec_config_t conn_sec_config;
case PM_EVT_CONN_SEC_CONFIG_REQ:
NRF_LOG_INFO("PM_EVT_CONN_SEC_CONFIG_REQ");
conn_sec_config.allow_repairing = true;
pm_conn_sec_config_reply(conn_handle, &conn_sec_config);
break;
The disconnection is done after PM_EVT_CONN_SEC_FAILED.
No special processing is done in PM_EVT_CONN_SEC_FAILED.
case PM_EVT_CONN_SEC_FAILED:
if (p_evt.params.conn_sec_failed.error == BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP) {
NRF_LOG_INFO("No Bonding Infomation for Central.");
return;
}
else if (p_evt.params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING) {
NRF_LOG_INFO("No Bonding Infomation for Peripheral.");
return;
}
break;
How can we achieve re-pairing?