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

Reconnecting in central mode

I am developing an application on nRF52 wich simultaneously acts as a central and peripheral and I am using the Peer Manager to manage bonding. The central needs to stay connected with a few already bonded peripherals which can occasionally get out or reach and disconnect. Therefore, if not all peripherals are connected, a scanning will be constantly running. The application parses all received advertising reports and first filter them out based on the Manufacturing specific data and then on the Flags. And here it comes the question - how do I filter out the advertising reports further and distinguish the ones coming from devices which have already got a valid bond with this particular central? Does the Peer Manager or the ID Manager provide this functionality or the application needs to keep track on that based on for instance peer addresses?

  • The values are:

    addr.addr_id_peer = 0
    addr.addr_type = 1
    addr -> conatins the expected address of the device
    

    The scan_params:

    m_scan_params.active = 0
    m_scan_params.use_white_list = 1
    m_scan_params.adv_dir_report = 0
    

    m_scan_params intervals and window have the expected value. The same goes to the m_connection_param.

  • Hi GT,

    Have you made sure you called sd_ble_gap_whitelist_set() prior to that call to connect ? ( I assume you called that for the scanning prior) , what do you have in that call ?

    Btw, if you aiming at connection to a specific address, then I don't really see the point of using whitelist here.

  • In the main() I have a call to whitelist_load() beofre start_scan(). In this function, there is a call to pm_whitelist_set(). The two functions whitelist_load() and peer_list_get() are copied from the ble_app_hrs_c example project. I do not call sd_ble_gap_whitelist_set() before calling sd_ble_gap_connect(). Should I do that considering the pm_whitelist_set()? The project that I am working on is an nRF52 with S132 V3 acting as a central which keeps a connection to up to 8 peripherals, and in parallel acts as a peripheral to a smartphone. Therefore, I thought that using a white list to handle all 9 connections would be "the smart" way to go.

  • Hi GT,

    You only use whitelist when doing sd_ble_gap_connect() if you don't plan to connect to a particular device but to connect to any of the device inside the whitelist. So who ever advertising first (or get the adv packet be received first) will be connected.

    In your case, maybe you don't need to use whitelist in this case ?

    If you want I can try to create an example with whitelist and sd_ble_gap_connect(). Pretty short on time now to create the example.

Related