Hello
I would like to modify the example "ble_thread_dyn_mtd_coap_cli_nfc" to use Just Works pairing instead of OOB with NFC.
To do this, I modified this in sdk_config.h:
#define NFC_BLE_PAIR_LIB_ENABLED 0
#define NFC_PAIRING_MODE 2
I added this in main.c:
/**@brief Function for handling Peer Manager events.
*
* @param[in] p_evt Peer Manager event.
*/
static void pm_evt_handler(pm_evt_t const * p_evt)
{
pm_handler_on_pm_evt(p_evt);
pm_handler_flash_clean(p_evt);
}
/**@brief Function for the Peer Manager initialization.
*
* @param[in] erase_bonds This flag informs if existing bonds should be erased.
*/
void peer_manager_init(bool erase_bonds)
{
ble_gap_sec_params_t sec_param;
ret_code_t err_code;
err_code = pm_init();
APP_ERROR_CHECK(err_code);
if (erase_bonds)
{
err_code = pm_peers_delete();
APP_ERROR_CHECK(err_code);
}
memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));
// Security parameters to be used for all security procedures.
sec_param.bond = false;//true;
sec_param.mitm = false;
sec_param.lesc = 1;
sec_param.keypress = 0;
sec_param.io_caps = BLE_GAP_IO_CAPS_NONE;
sec_param.oob = false;
sec_param.min_key_size = 7;
sec_param.max_key_size = 16;
sec_param.kdist_own.enc = 0;//1;
sec_param.kdist_own.id = 0;//1;
sec_param.kdist_peer.enc = 0;//1;
sec_param.kdist_peer.id = 0;//1;
err_code = pm_sec_params_set(&sec_param);
APP_ERROR_CHECK(err_code);
err_code = pm_register(pm_evt_handler);
APP_ERROR_CHECK(err_code);
}
And I added this in the while(true) of the main():
err_code = nrf_ble_lesc_request_handler();
APP_ERROR_CHECK(err_code);
I think I forgot something because I can connect but there is no pairing. Do you know why ?
I notice that sometimes it is indicated in the code that pairing is not supported: is this related to my problem?
Thank you