This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Pairing: sd_ble_gat_sec_params_reply for central and peripheral

Hi

I am trying to write an application that works in both central and peripheral role simultaneously. This means that my application needs to initiate and accept pairing seamlessly. I've had a look at the GAP central and GAP peripheral sequence charts, and as I understand it, in both cases the event BLE_GAP_EVT_SEC_PARAMS_REQUEST is generated at one point, and in both cases this should be met with an sd_ble_gat_sec_params_reply function. However, the parameters supplied in this function vary depending on whether we are central or peripheral:

In central role, the reply should be:-

sd_ble_gap_sec_params_reply(SUCCESS, central_params, NULL, NULL)

In peripheral role, the reply should be:-

sd_ble_gap_sec_params_reply(SUCCESS, periph_params: no_bond, no_mitm, no_iocaps, NULL)

My question is: From my application, I need to determine whether I am central or peripheral from the BLE_GAP_EVT_SEC_PARAMS_REQUEST (in order to respond to the event appropriately), is there a way to do that?

I am using SDK version 11.0.0-2 alpha, softdevice v2.0.0-7.alpha, and I am developing using gcc on an nRF52 EngB devkit.

Thanks

Related