Is just the BD_ADDR of responding devices shared with the master during inquiry? - bluetooth

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.

Related

Uniquely identifying bluetooth devices

I am new to bluetooth development and recently started reading about it.
I am trying to develop ble devices scanner and I need to provide an option to mark specific devices as trusted or untrusted.
I am able to get list of discoverable ble devices using hcitool lescan. But bluetooth addresses returned here can be random addresses. I need to uniquely identify trusted neighbouring ble devices to mark them as trusted even after changing random address. Static/public bluetooth address seems to be the only option to uniquely identify ble devices.
AFAIK static bluetooth address and IRK are shared during pairing. So after pairing with trusted BLE devices, I can get static bluetooth address and IRK which can be used for uniquely identifying trusted bluetooth devices. Also post pairing device can be uniquely identified when resolvable random address is used by paired ble device.
gatttool can be used to connect to scanned BLE devices. But how can I get the static/public address after I connect to BLE device (assuming gatttool connect will perform pairing).
I am not able to find any out of the box tool like hcitool which can be used to pair to get static bluetooth address and uniquely identify when trusted ble device is scanned with resolvable random address.
Is there any tool which can be used to uniquely identify trusted bluetooth device?

Is it possible to scan a bluetooth device to find it's capabilities

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.

Bluetooth low energy: detect what system is running on central

is there a way for a peripheral to determine to what central it is connected to?
Suppose i have a peripheral device that can connect to a PC, a Smartphone, or a smart TV, etc. The peripheral is an arduino based system, therefore has got some intelligence and i want it to behave in different ways according to what the central it is connected to is. What would be the best way to understand what the central is?
Thanks
There is no way to determine the connected central device type, the way you asked. One way to do is program your arduino to act differently as per the BD_ADDR addresses of the central device. But in this case, you need to know the addresses of all your central devices, and it works only with known set of devices. Also some central devices may not use public BD_ADDR addresses. For example Apple devices use random addresses. In this case you don't know the real BD_ADDR address, until your device pairs with central device. You can't rely on their names because Bluetooth device names can be changed.

BLE peripheral: scanning while connected

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.

Linux writing raw bytes on USB

I've got usb cable plugged to my computer, which D+ and D- pins are connected to multimeter. I want to send some raw bytes to get some voltage.. is it possible at all?
I'm 99% sure that usb port I've plugged cable in is something like /dev/bus/usb/002
I know that there was possibility to do the same with LPT or RS232 ports.
RS232 and LPT are not bus ! USB devices need to be addressed in order to become reachable.
Maybe unloading and reloading usb driver that drive your usb host... or trying to make a reset on usb hub host...
For doing this kind of operation on usb port, you have to break usb kernel driver and whipe all addressing operation to address directly the chipset...
At all, due to USB concept, I'm not sure you may successfully hold some power state on outlet.
For playing with that kind of physical IO, two solution:
Install a low-cost RS-232 <-> USB adapter
or better
Buy an Arduino micro-controller for prototyping and development.
I'm nearly 100% sure that you can't send anything down your USB lead unless you actually have a device at the other end. If you still want to play with this, get a cheap memory stick, break the casing off it [not too roughly], and measure whilst doing a large file-transfer to the memory stick, or some such.
But I'm not sure your multimeter will show much, as they tend to be a bit slow, compared to USB rates.
USB uses pull-up / pull-down resistors on the data lines to detect whether or not a port is connected (1.5k pull-up to 3.3v on the device side, 15k pull-down on the host side IIRC). The exact connection depends on the device speed.
So if you connect an appropriate resistor, the host should attempt to start signalling. Because of the data-rate, you might not be able to see that on a multimeter; an oscilloscope would be more appropriate.
If you want to by-pass the normal USB protocol and just blindly send data, I think you'll need to get your hands dirty and write code to bypass the usual device drivers and access the USB hardware directly. Even then I'm not sure what's possible - the USB hardware is a lot smarter than good ol' LPT and RS232 ports, which might get in the way of doing this sort of low level stuff.

Resources