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

Peer Manager: Temporarily disable peer – "guest mode" with bonding

Imagine following use case:

  1. Alice has a peripheral bonded with Alice's phone (central)
  2. On the peripheral, Alice switches to a "guest mode" which disconnects from Alice's phone
  3. Any automatic connection from Alice's phone is now refused
  4. The peripheral advertises and is connectable to Bob's phone (central)
  5. Bob's phone can pair/bond and use the device (note: usage restriction would be handled in services)
  6. After the "guest mode" is switched off, the restrictions to automatically reconnect to Alice's phone are lifted
  7. The peripheral connects to Alice's phone

Alice's phone is the "owner" of the peripheral. Bob's phone's bonding keys can be deleted from the peripheral once the "guest mode" is switched off. The "guest mode" will also be switched off automatically after 1 hour of not being connected to Bob's phone.

Is this possible? How would you configure the Peer Manager?
I am trying to communicate this flow to one of our Chinese Bluetooth engineers and we're having a hard time understanding each other Smile

Go Nordic!

  • Hello,

    Sorry for the late reply.

    Let me go through your description:

    1. Ok
    2. Ok. This is possible by disabling the whitelist. Do you intend to have this switch on a button on the peripheral, or something that Alice does through BLE?
    3. Ok. You can't refuse connections, but you can disconnect immediately if you see that it is Alice's phone that connected. 
    4. Ok.
    5. Ok. You can't deny Bob to use certain services, except if Bob has a lower security level than Alice (e.g. Alice used OOB (out of band) during pairing, while Bob only use "just works" encryption. The alternative is to choose what to do with the data coming in on the different characteristics in the application layer depending on who's sending them.
    6. How do you intend to switch off guest mode? A button? BLE? Alice is not allowed to connect at this point in time? You can just remove the disconnect procedure from Alice at this point in time by enabling the whitelist (and deleting Bob from the whitelist if they were bonded).

    Regarding the "automatic connection". There isn't really anything that is automatically connecting. Phones tend to "auto connect" to certain devices, such as keyboards and a couple of other things. But when you are working on proprietary products, it is usually the mobile app working with the device that sends the connection request. 

     

    Alice's phone is the "owner" of the peripheral. Bob's phone's bonding keys can be deleted from the peripheral once the "guest mode" is switched off. The "guest mode" will also be switched off automatically after 1 hour of not being connected to Bob's phone.

     Yes. You can delete bonding data for certain devices using the peer manager. I suggest you play around a bit with the peer manager to get familiar. 

    The API that is used to delete a peer is pm_peer_delete(). You need to keep track of what peers that are added, or at least what peer to keep at all times (Alice's). You can use pm_peer_id_list(). There is also something called highest and lowest rank. Typically, a new peer will get a higher rank, so the first device that bonded will always have the lowest rank. You may also use this information to always keep Alice's bonding, but deleting Bob's, or Eve's, if she ever drops by Slight smile

    Please let me know if anything was unclear.

    Best regards,

    Edvin

Related