I want to bond with an peripheral, which has static passkey hardcoded in it. If I want to bond with it with MCP, I get an request for passkey, I can then bond and encrypt the connection with the peripheral, So far, so good. Then, I wanted to implement the same behavioural on my central, with S120 v2 and SDK 8.1.0. I wanted to use the function sd_ble_gap_authenticate
to get BLE_GAP_EVT_AUTH_KEY_REQUEST
response, so I could send the passkey to peripheral.
This is where I encountered a problem. My central connects to the peripheral and triggers bonding and encryption by calling sd_ble_gap_authenticate
. Funcion returns error NRF_ERROR_NOT_SUPPORTED
Why is that so? This error message isn't documented in SDK documentation as a valid error message.
I am calling the function with the following parameters:
ble_gap_sec_params_t security_params;
security_params.bond = 1;
security_params.mitm = 1;
security_params.io_caps = BLE_GAP_IO_CAPS_KEYBOARD_ONLY;
security_params.oob = 0;
security_params.min_key_size = 7;
security_params.max_key_size = 16;
security_params.kdist_periph.enc = 1;
security_params.kdist_periph.id = 1;
err_code = sd_ble_gap_authenticate(conn_handle, &security_params);
APP_ERROR_CHECK(err_code);
I can't seem to find any documentation on this topic, maybe I'm calling authenticating function too early or at the wrong place?