hello,ereryone!One nrf52832 as ble_central,and another nrf52832 as ble_peripheral. and the ble_peripheral (nrf52832 )set static passkey:
#define SEC_PARAM_BOND 1
#define SEC_PARAM_MITM 1
#define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_ONLY
#define SEC_PARAM_OOB 0
#define SEC_PARAM_MIN_KEY_SIZE 7
#define SEC_PARAM_MAX_KEY_SIZE 16
static ble_gap_sec_params_t sec_params;
static void static_passkey_pair_init(void)
{
uint32_t err_code;
sec_params.bond = SEC_PARAM_BOND;
sec_params.mitm = SEC_PARAM_MITM;
sec_params.io_caps = SEC_PARAM_IO_CAPABILITIES;
sec_params.oob = SEC_PARAM_OOB;
sec_params.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
sec_params.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
static uint8_t passkey[]="123456";
static ble_opt_t m_ble_opt;
m_ble_opt.gap_opt.passkey.p_passkey = &passkey[0];
err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY,&m_ble_opt);
APP_ERROR_CHECK(err_code);
}
How the ble_central (nrf52832 )need to set?