Bluetooth profile info in linux - linux

As bluetooth device has a number of bluetooth profiles. when want to do communication is bluetooth device, first pair bluetooth device and then starts sending data using bluetooth.
In linux, hcitool is used to scan nearby bluetooth devices.
Questions:
1) How can i know which bluetooth profile is supported by selected nearby bluetooth device?Is there any particular command to know bluetooth profile supported by selected nearby bluetooth device in linux?
2) suppose, i come to know selected nearby bluetooth device support abcd and xyz bluetooth profiles. How can i select particular bluetooth profile in linux?, example abcd out of supported profiles.
2) How can i connect to that selected bluetooth device as SPP profile for transferring data as serial port in linux?
Regards,
Sukhdeep Singh

In linux, sdptool utility is provided with which you can search your own device supported profiles and other devices supported profiles(sdptool browse local/).
Since you know the peer device support abcd/xyz profile, you dont have to select any profile, you have to intiate a profile level connection request(pairing/authentication also needs to be taken care)
For SPP connection, rfcomm tool is provided by bluez

Related

Bluetooth dongle BLED112 on Debian 10 is not working

I just randomly found a Bluegiga BLED112 Bluetooth dongle and I tried to connect it to my Debian 10 laptop as a basic dongle for Bluetooth audio outs.
Unfortunately I wasn't able to solve all the issues I had, starting from the fact that the device is not fully listed once used lsusb and just a mere ID number - namely ID 2458:0001 - pops out and bluetooth or bluez helps weren't successful either.
This given, I tried to follow several of the guides you can find online, also by running available scripts, but again nothing worked.
So if it's possible, what should I do in order to run such a dongle for the basic use I mentioned above - i.e. just for connecting my stereo speakers to my computer?
Thanks
The BlueGiga BLED112 is not a regular Bluetooth USB dongle. It gives you a virtual com port that can be used to access an API that in turn acts as a BLE device.
It is ment to be used for development of IOT solutions.
Also it does not support Bluetooth Classic, it only supports Bluetooth Low Energy.

Detect mobile phone presence with Bluetooth usb dongle.

I am using BeagleBone Black and Bluetooth USB dongle V4.0. My dongle is detecting iBeacons with no problems but is there any way to detect mobile phones with bluetooth on. I am using NodeJs and Noble package.
So when I use hcitool lescan it's not finding mobile phone either but with hcitool there is option scan. When I call hcitool scan in terminal I get my mobile as result. Is there any NodeJs package that wraps this option. I have no need to connect to mobile device, I just need to discover it's presence, and see it's MAC address.
If you can see your device with "hcitool scan" and not with "hcitool lescan" it means your phone(or BT stack you use in phone) don't support BLE protocol. Not all BT devices are BLE capable.

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.

Android Bluetooth LE Chat example

I am trying to read serial data over Bluetooth LE but can't find any code examples for this type of bluetooth and api19. Does any one have an example?
There is no profile defined for serial data communication over Bluetooth Low Energy till now. For this one can use the Bluetooth classic only.
In any case, Android devices can not broadcast for advertising packets. They can only scan the advertising packets. Hence, these devices will be in Central mode only. But can act as either server or client.
For Bluetooth chat related app example one can refer Android SDK as,
sdk/samples/android-19/legacy/BluetoothChat
The above example is based on Bluetooth classic based on RFCOMM channel for serial communication.
Android 5.0 let mobile to be peripheral. So chat will be possible:
https://developer.android.com/about/versions/android-5.0.html
Bluetooth Classic got the SPP profile. This is not how Bluetooth Low Energy works.
In BLE you have 1 or more Services each with 1 or more Characteristics which are basically just bytes in a predefined format which by default can be max 23 bytes.
To send data from one device to another one must be the Master and the other must be Slave.
Android API19 does not support the Slave (Peripheral) role, it seems Google still doesn't understand the importance of Bluetooth Low Energy. It's so much more than just Pulse-readers.
You can send from an Android API19 phone to e.g. an iPhone which can be Slave/Peripheral.
You cannot send from an Android API19 phone to another API19 phone. For this you must use Bluetooth Classic SPP profile.

Get device handle of a Bluetooth Low Energy device

I have a Bluetooth Low Energy device to which I need send some values from the PC.I need to connect this device to the Windows 8 PC and should be communicate with it from my application (Visual C++, win 32 application). I already know the hardware ID and friendly name of the device.
Is there any API to establish connection to the device using this ID/ friendly name, and give a device handle so that I can use GATT APIs to send values to the device. http://msdn.microsoft.com/en-us/library/windows/hardware/hh450825(v=vs.85).aspx
http://code.msdn.microsoft.com/windowshardware/Bluetooth-Generic-4f4ea968
Bluetooth low energy is considered Network.Proximity just as NFC.

Resources