This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF51822 Peripheral with Passkey

Hi, like many others, I'm confused with Peripheral Passkey Connection.

I'm playing with the ble_app_hrs, in order to be able to setup a Connection Passkey (for the moment I would like to have a static hard-coded passkey). The goal of my application is to connect to the nRF51822 Peripheral using a Smartphone/Tablet and to be prompted to input a Passkey.

On main.c I set up these sec parameters:


#define SEC_PARAM_TIMEOUT                    30    
#define SEC_PARAM_BOND                       1
#define SEC_PARAM_MITM                       0
#define SEC_PARAM_IO_CAPABILITIES            BLE_GAP_IO_CAPS_KEYBOARD_ONLY
#define SEC_PARAM_OOB                        0
#define SEC_PARAM_MIN_KEY_SIZE               7
#define SEC_PARAM_MAX_KEY_SIZE               16

Then in the function on_ble_evt(ble_evt_t * p_ble_evt) in the case BLE_GAP_EVT_CONNECTED I've added err_code = sd_ble_gap_authenticate(m_conn_handle, &m_sec_params); to let the Peripheral initiate the security establishment (is this correct?).

The call of this function generates the event: BLE_GAP_EVT_SEC_INFO_REQUEST which I think I should reply with sd_ble_gap_sec_info_reply, is it correct?

I can't understand how to fill the parameters for the sd_ble_gap_sec_info_reply

Are those sec parameters correct for this application purposes?

Thanks for any help/suggestions.

Regards, Samuele.

Related