[BLE central] Get the list of all nearby peripheral.

Hello, 

I'm working on a BLE central multilink application, where I want to get the list of all peripherals in range, In order to let the user select the needed periherals.

I can create a list based on "device_found" callback and delete sensors that we didn't detect since "x" seconds, but I was wondering if there is an easier way of doing so.

Best Regards.

Martin.

Parents Reply Children
  • Hi Simon, thanks for the response.

    What I want to do is having an "updated" list of nearby sensor. In that need I want to know if the sensor is still in range or not.

    The issue I'm facing is that I don't know when to delete the sensor from the list when I don't receive advertising packet anymore.

    Should I put a timeout for each device on advertising packet, should I try to connect periodically to all detected device to know if there are still in range ?

    Or maybe just keep all device scanned in the list.

    I'm trying to find the easiest way to do so.

    Do you know how the scanning it's done on regular phone ? 

    Best Regards.

    Martin. 

  • Hi

    I would recommend setting time of some seconds before deleting sensors from the list. I.E. if the central hasn't caught an advertisement of a device for the last 10, 30 or 50 seconds you can delete it from the list. Alternatively "grey them out" and keep them in the list if they haven't been heard from in a while.

    On the nRF Connect app for mobile the scanned devices will just be listed and not removed until you press scan again, where I believe they are removed if a full scanning period goes on without any advertisements from them.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for the help.

    What I've done is to delete the scanned device list one the scan is started again that way I don't have to implement a "refresh" button or a timeout mechanism.

    If I had more time I would have developed, the deletion of sensor on timeout.

    Best regards,

    Martin.

  • Let me know if you have any follow-ups or if we should close this case.

    Best regards,

    Simon

Related