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

Parents
  • The GAP role is reported to the ble_evt_t structure when BLE events are received from the stack when in a connection with the peer (evt.gap_evt.params.connected.role).

    However, as you may know, it's not straight forward to implement complete handling for bonding and pairing. I'd recommend to use the peer manager for this event though it's currently in an experimental state.

    There are some linker bugs when using GCC with this module in SDK 11.0.0-2 alpha, but instructions on how to resolve them are given here.

Reply
  • The GAP role is reported to the ble_evt_t structure when BLE events are received from the stack when in a connection with the peer (evt.gap_evt.params.connected.role).

    However, as you may know, it's not straight forward to implement complete handling for bonding and pairing. I'd recommend to use the peer manager for this event though it's currently in an experimental state.

    There are some linker bugs when using GCC with this module in SDK 11.0.0-2 alpha, but instructions on how to resolve them are given here.

Children
No Data
Related