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

Secure and unprotected connections simultaneously.

Is it possible on the central device to create secure and unprotected connections simultaneously with different peripheral devices? How should the peer manager be configured in this case?

  • I have not done this myself, and couldn't find any other cases where people have done (after a quick search). However, I think this should be possible. In the central (or the peripheral), you simply call pm_conn_secure(), and provide the connection handle for the link you want to establish an encryption on. You also have to implement the steps explained in Peer Manager - Usage.

    If you aren't able to make this work, please tell me, and I'll try to put together a simple project that demonstrates it.

    Best regards,

    Simon

  • Hi Simon! Thanks for the answer. This is a hypothetical case. In a real device, we will have 2 types of peripheral devices: 1) devices without a display and keyboard, and 2) smartphones. For the first type, I assume to use bonding (LESC with numerical comparison). For smartphones - use bonding : passkey entry, user inputs on peripheral. Also, smartphones may not support LESC. I have a question about the peer manager settings: do I need to make a new pm_sec_params_set () call for different connection types after receiving the BLE_GAP_EVT_CONNECTED event?

  • I took a look at the Peer Manager library, and is seems like you simply call pm_sec_params_set(right before calling pm_conn_secure() (which is called when all the services are discovered). 

    • pm_sec_params_set() will call sm_sec_params_set(), and assign the security parameters to  mp_sec_params in security_manager.c
    • The function pm_conn_secure() calls sm_link_secure()-->link_secure(), where the last function uses new_context_get() to get the security parameters mp_sec_params

    I have not tested this myself, and don't have time at the moment, due to reduces staffing in the summer holidays. I might be able to do it later on.

    I would recommend you to start with the BLE Multi-link Example, modify it and add bonding, and check out if this works.

    Best regards,

    Simon

Related