HI,all
when i want to notify with MITM,there is an issue with my project.
my central role device is IPHONE and the app is lightblue.
When i enabel notify ,the nrf52382 restart.
i know now the reason is the statement 'BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM'
following is my source code.
//in function '**main.c**'
#define IO_CAPS BLE_GAP_IO_CAPS_DISPLAY_ONLY
#define BOND 0
#define OOB 0
#define MITM 1
void resp_pair_request()
{
enter code here
ble_gap_sec_params_t sec_params;
uint32_t err_code;
memset(&sec_params,0,sizeof(ble_gap_sec_params_t));
sec_params.bond = BOND;
sec_params.io_caps = IO_CAPS;
sec_params.max_key_size = 16;
sec_params.min_key_size = 7;
sec_params.oob = BOND;
sec_params.mitm = MITM;
err_code=sd_ble_gap_sec_params_reply(m_conn_handle,BLE_GAP_SEC_STATUS_SUCCESS,&sec_params,NULL);
APP_ERROR_CHECK(err_code);
}
in function 'static void on_ble_evt(ble_evt_t * p_ble_evt)' in main.c
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
// Pairing not supported
printf("receive pair request\n");
resp_pair_request();
APP_ERROR_CHECK(err_code);
break;
case BLE_GAP_EVT_PASSKEY_DISPLAY:
printf("show passkey: ");
for ( int i = 0; i < 6; i++)
{
printf("%c",p_ble_evt->evt.gap_evt.params. \
passkey_display.passkey[i]);
}
break;
in source file 'ble_nus.c' , and in function 'static uint32_t rx_char_add(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) '
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&cccd_md.write_perm);