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

1-1 permanent connection between central and peripheral

Hello,
I am trying to implement 1-1 connection between a central and a peripheral, with these (classic) requirements :
- when starting central, scan for any peripheral with a given name
- connect to it => peripheral does not advertise anymore
- when central is powered down, peripheral must not advertise
- when central is powered up with a peer stored, it should connect to it

For now, I'm not concerned by security issues, I'm looking for the minimal implementation to make it work.

I have some questions :
A) From what I gather from the documentation, I guess the correct way to implement this is with the peer manager + whitelist with a maximum link of 1. Is this correct ? Is there a simpler/other API ?
B) Is the reconnect automatic at start with the peer manager ? If not, what is the function for that ? scan with whitelist ?
C) Is this possible with the "No pairing/bonding" mode of peer manager ? If not, is "Pairing, no bonding" the way to go ?
D) Is there a standard way for the central to indicate to the peripheral to reset peer or should I create a custom service for that ?

Thanks !

  • Hi,

    - when central is powered down, peripheral must not advertise
    - when central is powered up with a peer stored, it should connect to it

    I doubt that How the peripheral knows the central is power off and on to advertise or not.  

    A) From what I gather from the documentation, I guess the correct way to implement this is with the peer manager + whitelist with a maximum link of 1. Is this correct ? Is there a simpler/other API ?

    That is correct. You can take a look HID Mouse Application for whitelist, and Heart Rate Application for Peer Manager and LESC pair. You might be interested in this similar case

    B) Is the reconnect automatic at start with the peer manager ? If not, what is the function for that ? scan with whitelist ?

    No, you could scan and connect with the whitelist. See this post

    C) Is this possible with the "No pairing/bonding" mode of peer manager ? If not, is "Pairing, no bonding" the way to go ?

     Yes, see Security parameters for Pairing, no bonding.

    D) Is there a standard way for the central to indicate to the peripheral to reset peer or should I create a custom service for that ?

      You could send strings to the peripheral and handle it to execute NVIC_SystemReset();

    -Amanda H.

  • I doubt that How the peripheral knows the central is power off and on to advertise or not.
    The peripheral can know the central disconnected.   
    If the peripheral doesn't advertise, isn't it possible for the central to connect using the peer address.

     > You could send strings to the peripheral and handle it to execute NVIC_SystemReset();
    I didn't meant a perihperal reset, I meant a peer reset (to allow the peripheral to be "free" and be scannable/connectable by another central)

  • Hi, 

    QuentinFarizon said:
    If the peripheral doesn't advertise, isn't it possible for the central to connect using the peer address.

    A peripheral device broadcasts info about itself using advertising. The central device will scan for advertisements, and analyze the advertisements found in the scan result.

    QuentinFarizon said:
    I didn't meant a perihperal reset, I meant a peer reset (to allow the peripheral to be "free" and be scannable/connectable by another central)

    You can take a look at this Bond Management Application which you could write a command to to the Bond Management Service Control Point Characteristic (0x2AA4) to delete the current bond. 

     -Amanda H.

  • Is it then possible for the peripheral to forbid connections from other centrals ?

     How do you suggest to implement the fact that the peripheral is "reserved" for a given previously connected central? 

  • You would need to use bonding and whitelisting so that the devices will reject connection from devices outside of the whitelist. 

    This feature is supported by the softdevice and implemented in the peer manager libary: https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_pm_functionality.html?cp=7_1_3_2_7_1_2#lib_pm_functionality_whitelist 

    You can refer to our example ble_app_hids_mouse (or keyboard). In the example, after bonding we will do directed advertising and after that will do whitelisting advertising,  after the whitelist advertising timeout, it will advertise in normal mode. 
    To be able to make sure there will be no other device to connect to your device, you can disable the timeout to normal mode. Only advertise in whitelisting mode. 

Related