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

Pairing and limiting paired devices without manager

Hi,

Is it possible to make pairing without the peer/device/bond manager? I am using SDK 12.3 on NRF51 and/or NRF52 and would like to get it to pair with a certain device (android or iOS) and then not let any other device connect to it.

I have been looking into it a bit, but I am still quite lost. So, what I intend to do is retrieving the address from peer and storing it into flash using whitelist, if there is no device in the whitelist, and not allowing it to pair if there is a device in whitelist different from the one trying to connect. I would also like to have an option of clearing whitelist.

Looking through the tutorials and (un)answered questions on here I've found that solutions tend to go through peer manager, but I want to get around it if at all possible.

I think I should be using structures ble_gap_evt_connected_t and ble_gap_whitelist_t for that, but I still can't figure out how to retrieve the data from peer and store it into a variable so I can use it later. Any help will be appreciated!

  • Here is one example of using whitelist (go to section III Example code).

    If you want to handle pairing and bonding without using peer manager, I would suggest to start with ble_app_uart example. In this example we don't use peer manager, but we also don't handle pairing (Pairing not supported is sent when receive pairing request).

    Then you can have a look at this message sequence chart .

    If you want to bond, you need to store key_set in flash and re-use it when reconnect.

    In earlier SDK we also have an example that handles pairing and bonding but we don't store in flash, please have a look at ble_app_template in SDK v8.x APIs have changed quite a lot, but you still can get the rough idea how to handle bonding from that example.

Related