Is there a way to active scan all BLE devices nearby?

Hello!

From related materials I went through, seems the AdvA in active_scanning payload should be filled with the targeted device's public/random address.

So according what mentioned above, if I have tens of BLE devices nearby, I have to active scan them one in each time, with each one's address.

Is there an lazier way, so that I can active scan all these BLE devices? That is, just send out a universal scan request, all BLE devices received it will respond back.

If not, is there a similar way around?

Thanks and cheers,

Daniel Duan

  • Hello,

    I suggest you check out one of Zephyr's samples found in:

    NCS v2.4.0\zephyr\samples\bluetooth\central

    (It is also present in older NCS versions, not only v2.4.0)

    What this sample does is that it starts scanning. Whenever it picks up an advertising packet, it triggers the device_found() callback. It then checks whether it is connectable, and checks if the RSSI is above -70 (meaning it is a fairly strong signal. This is not required for connection, but it is done in this sample).

    Then it connects to the device that sent out this advertisement. Then, in the connected event callback, it disconnects and resumes scanning.

    So while this is not a particularly useful application in itself, it is a good demo how to set up scanning and look at advertisement packets. Perhaps this is something that you can use.

    Best regards,

    Edvin

  • Hi Edvin,

    Thank you so much for your reply! Really appreciate it.

    Finally I chose to follow the standard active_scanning method after reading the Core Specification, it works well.

    Cheers,

    DanielDuan

Related