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

Connecting with bonded peer

Hi,

For some time I'm developing application for both central and peripheral devices. The Idea is that both devices have a special mode in which they pair & bond and add each other to the whitelist and then disconnect, as the peripheral hoes to sleep. The central will be always alive and listening for whitelisted devices advertisements. When the peripheral is triggered (for example by user button press) it will start advertising to connect to the central and after connecting, it will send message. Now the whole setup works but have some bugs. There is one thing I'm not sure about though. When devices are bonded and central receives `PM_EVT_BONDED_PEER_CONNECTED` event, does it mean they are connected and the link is encrypted? Or should `pm_conn_secure` be called by central?

I'm not posting any code because I just want to know the idea

I'm using SDK 17.0.2 and nrf52833 on both central and peripheral

  • Hello,

    The PM_EVT_BONDED_PEER_CONNECTED just means that a device that the peer manager is familiar with has connected. The connection is not encrypted at this point. If you wait until you get the event:

    PM_EVT_CONN_SEC_SUCCEEDED. This means that the connection is encrypted and secure. 

    Actually, I am not 100% sure whether they will secure the connection automatically when they are already bonded. See if you get the PM_EVT_CONN_SEC_SUCCEEDED event (the one in pm_handler_pm_evt_log() in peer_manager_handler.c will print it in the log).

    If you don't see it, just add pm_conn_secure() in the BLE_GAP_EVT_CONNECTED event on one of the devices.

    Best regards,

    Edvin

  • Thanks! Just FYI, I checked it and you don't have to call pm_conn_secure. It will be done automatically after connecting with bonded peer

Related