How to detect MAC addresses or nearby Bluetooth devices


#1

Hello:

Is there any example code showing how to detect all nearby Bluetooth devices to a Bluz?

For example I want to be able to read the address of all mobile phones in the vicinity …

Do the Bluetooth devices have to have turned their discovery ON?

Thanks.


#2

Bluz works on Bluetooth LE, which has defined roles for different devices. The most relevant here are central and peripheral devices. Peripheral devices advertise their identity so that central devices can connect to them. One central can connect to many peripherals, but a peripheral can only be connected to one central.

Bluz DK is a peripheral, meaning it would advertise it’s identity and wait for a central to connect to it. A cellphone would be a good example of a central. The central wouldn’t broadcast it’s identity, so a peripheral would not be able to detect it unless the central tried to connect.

So for your example, detecting all smartphones around a bluz DK wouldn’t really be possible, as it would be a peripheral detecting a central.

If you want cellphones to detect bluz, that is much more aligned with the BLE protocol. You could look to our doc on beacons and how to enable that, but you would need an app on the smartphone side. Let me know if you have any further questions.