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)
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.
Related
Is the Bluetooth address exchanged between two Bluetooth devices if no connection is made yet?
As when a device is in discovery mode, and you see for example a tv, headphones, or a different computer show up, is the Bluetooth address of that device being shared with the device making the inquiry, or are the others also getting the Bluetooth address of the inquiring device?
Alternatively, is the Bluetooth address only shared upon selection of the device for connection?
Thanks!
Edit: spelling
Advertising devices broadcast one-way. They do not know what devices have discovered them. Scanning for advertisements is passive. It does not require sending any packets, so neither the advertising device, nor other scanners in the area, will be aware of the scanning device.
Note that Bluetooth addresses are quite complex and varied, so how they are shared is not trivial. Devices have many kinds of addresses and change what they publicize frequently. But to the question of when an address (rather than the address) is shared, that is during connection.
I am looking for a way to scan a device I own and discover "what it can do".
In other words, I'd like to know if a device is able to describe the way you have to communicate with it in order to build some application around it.
In my case it is a simple Christmas light that I'd like to play with but this could be used in different situations.
For classic bluetooth (BR/EDR):
When scanning for bluetooth devices (Inquiry), the bluetooth device will send an inquiry response (if it wants to be discovered) and maybe also an extended inquiry response (EIR). This EIR may already contain a list of services, the devices supports. This is a very fast way to get a picture of a remote device.
Moreover, the service discovery protocol (SDP) gives more information on a device. This takes some more steps. In SDP two devices can exchange their capabilites in kind of ping pong process.
For BLE:
After connecting a BLE device usually a service discovery takes place. The BLE peripheral (e.g. headset or a light) reports its capabilities to the central (e.g. smart phone). Some of these services have predefines functionalities. Additionally, it is free to the manufacturer to add custom services.
We have multiple devices (same kind) advertising at the same time. But in iOS, all the advertising packets are treated as one device.
Understand the reason: iOS filtered out the BLE address for privacy reasons.
Without BLE address the advertising packets from the difference devices are exactly the same.
My question is: is it possible to use iOS core bluetooth to tell there are multiple devices are advertising?
Thanks
I couldn't find a clear explanation what is Bluetooth le multi advertising.
For example, in Specification of the Bluetooth System, I see only
description of BLE advertising but not multi advertising.
What the difference between BLE advertising and multi advertising?
Thanks
LE Multi advertising refers to a specific offload (non bluetooth specification) feature that has been implemented in the Android releases by Google, starting from the L release.
What multi advertising means is, that your Android phone or a device with Android stack, can enable multiple advertisement trains at the same time. For instance, one specific app can set certain advertisement data (example supported services etc.), advertisement parameters and enable advertisement, and so can N number of other apps, on the same device.
At the hardware level (or physical layer), these advertisement trains are interleaved between the three advertisement channels (37, 38, 39) and thus your phone behaves as multiple peripheral devices at the same time. All these advertisement trains also have a separate Random private address, so they are seen distinctly by the remote scanner.
Bluetooth Smart has two ways of communicating. The first one is using advertisements, where a BLE peripheral device broadcasts packets to every device around it. The receiving device can then act on this information or connect to receive more information. The second way to communicate is to receive packets using a connection, where both the peripheral and central send packets. We will focus on advertisement for several reasons:
You can’t create a connection between two devices without using advertisements. Defining the data and format of advertisement packets is usually the first thing you work on when developing a BLE device.
A large number of BLE products sleep most of the time, waking up only to advertise and connect when needed. This means advertisements have a big impact on power consumption.
Users want responsive products, and the advertising interval is critical in quick connections.
Advertising is by design unidirectional. A Central device can’t send any data to the Peripheral device without a connection. But a single peripheral can advertise to multiple masters in the area.
ref:http://www.argenox.com/bluetooth-low-energy-ble-v4-0-development/library/a-ble-advertising-primer/
Can we know the bdaddress and rssi of all nearby ble devices without continuous lescanning? As the continuous lescan will consume more power and also we would not be able to properly make connection to a device while active scanning is going on in background.
The lescan background process also gets killed when we are disconnected from the connected state with any ble device
Also with how many peripherals can a central device be connected to simultanoeusly with bluez-4.101 stack?
Yes you are right you cannot make connection while you are scanning for Low Energy devices and number of devices that can be connected to the central device is entirely dependent on the Software Stack you are using for BLE.
Like in CC2540 you can connect 3 devices at a time.
For RSSI and bluetooth address you refer function le_advertising_report according to bluez-4.101 stack.