BLE peripheral: scanning while connected

2019-07-15 03:23发布

问题:

Is it possible to make a peripheral scan for advertisments while connected to a central? It seems like it is either scanning for advertisments or have your peripheral connected but I need to do both. The peripheral should be able to report RSSI measurements from advertisements it picks up.

I'm using 'bleno' for the peripheral and 'noble' for the scanning on a linux box (bluez)

回答1:

The answer to this differs depending on the version of Bluetooth that your device is on.

For Bluetooth v4.0:

A peripheral cannot scan at all, whether in a connection or not. The peripheral can only send out adverts or accept incoming connections. For more information you can have a look at this document, page 18:-

http://chapters.comsoc.org/vancouver/BTLER3.pdf

For Bluetooth v4.1 onwards:

A device can be in central and peripheral role at the same time. By implication, this means that if a peripheral is connected to a central device, it can still scan for devices in it's "central mode". More information can be found in this link, page 5:-

http://www.ietf.org/proceedings/89/slides/slides-89-6lo-4.pdf

So in conclusion, if your device is BT v4.1 or newer, then this is dependant on the chip manufacturer, and if it is v4.0, then no, because the Bluetooth specification does not allow it.