ScreenRecord_20171204_133336.mp4
I am working in sdk14.1 nrf52832 ble_app_hids_keyboard_pca10040_s132.
IOS and WIN10 on working ,but android no working .
here is some of the important code :
define passkey and set it:
uint8_t passkey[] = "123456";
m_static_pin_option.gap_opt.passkey.p_passkey = passkey;
sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &m_static_pin_option);
parameter setting:
// Security parameters to be used for all security procedures.
sec_param.bond = 1;
sec_param.mitm = 1;
sec_param.lesc = 0;
sec_param.keypress = 0;
sec_param.io_caps = BLE_GAP_IO_CAPS_DISPLAY_ONLY;
sec_param.oob = 0;
sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
sec_param.kdist_own.enc = 1;
sec_param.kdist_own.id = 1;
sec_param.kdist_peer.enc = 1;
sec_param.kdist_peer.id = 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);
add m_sec_req_timer_id:
case BLE_GAP_EVT_PASSKEY_DISPLAY:
{
// Don't send delayed Security Request if security procedure is already in progress.
err_code = app_timer_stop(m_sec_req_timer_id);
APP_ERROR_CHECK(err_code);
} break;
case PM_EVT_BONDED_PEER_CONNECTED:
{
NRF_LOG_INFO("Connected to a previously bonded device.");
err_code = app_timer_start(m_sec_req_timer_id, SECURITY_REQUEST_DELAY, NULL);
APP_ERROR_CHECK(err_code);
} break;
case BLE_GAP_EVT_CONNECTED:
NRF_LOG_INFO("Connected");
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
// Start Security Request timer.
err_code = app_timer_start(m_sec_req_timer_id, SECURITY_REQUEST_DELAY, NULL);
APP_ERROR_CHECK(err_code);