Set L2CAP streaming mode in BlueZ - bluetooth

I need to create a simple L2CAP connection on BlueZ with the streaming mode enabled. Does anyone know how I can switch modes? At the moment, the connection has re-transmission enabled, and I need to cancel all re-transmissions.

Related

Can i intercept traffic of all nearby bluetooth devices with built into the laptop bluetooth dongle?

I know that bluetooth uses hoping, and because of this difficult to intercept traffic.
Сan i put my dong into monitoring mode?
If for example are 30 devices nearby, and i will always listen just one bluetooth channel, and my dongle works in monitor mode, should i get sometimes some data?
Can i use for these purposes Hcidump or tcpdump?
If I understand correctly, if bluetooth device does not have a password, i can directly interact with its services(with hcitool and tmux).?
I read that i can watch the battery level, device name, and other information.
PS: sorry for bad english.
It is possible to monitor traffic between Bluetooth devices but I am quite sure that your default laptop dongle is not capable of doing that.
Before establishing connection between two Bluetooth devices, they send connection request/response packets on primary advertising channels (37th, 38th, 39th channel). You need to capture these packets to learn hopping pattern, connection interval and etc. After receiving packets, you can monitor insecure Bluetooth connections. However it is hard to monitor 30 device simultaneously because you need to make time division between each connection.
Let's answer your questions.
It might be possible but you need to write driver level code.
It might be possible. As I mentioned, it is good approach to capture connection request/response packets before monitoring devices.
I have no idea about these tools.
To manipulate services, you need to know service handle and duplicate GATT client's mac address. I am not sure that, this method will work.

Qt Bluetooth Low Energy Multiple Connections

Qt: 5.10,
Linux Ubuntu 17.10,
Bluez 5.4x
and I´m using QBluetooth to connect with multiple Bluetooth Low Energy Devices. Everything works fine for one Connection. But when I connect to a second Device with QLowEnergyController::connectToDevice() I get the following error and the first Connection gets aborted:
qt.bluetooth.bluez: Cannot connect due to pending active LE Connections
qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 21 error: -1 "Software caused Connection abort"
After that the second connection gets established.
I`m using one instance of QLowEnergyController in Central Mode per Connection.
After a Research I think it should be possible to create multiple Connections to BLE Peripherals with the Bluez Bluetooth Protocol Stack. But I´m not sure if QBluetooth support this Feature...
Does anybody know something about multiple LE Connections with QBluetooth?
Is this the right way to establish a second Connection?
Does somebody know a good Workaround?
Thanks for your help!
The problem isn't BLE, but its Qt implementation. The documentation says that any attempt to connect simultaneously to two BLE devices using QLowEnergyController will fail. Check it there: http://doc.qt.io/qt-5/qlowenergycontroller.html ; Section "Detailed Description", paragraph 5:
"BlueZ based Linux cannot maintain two connected instances of QLowEnergyController to the same remote device. In such cases the second call to connectToDevice() may fail."
According to this, it should be possible to establish connexion to two different remote devices using two instances of the class, but it simply doesn't work. If you keep on reading the documentation, you'll find out that " This limitation may disappear at some stage in the future.".
I tried a workaround by disconnecting from the first device before connecting to the second device (both TI SensorTag), but since I had to re-discover the services and re-enable the sensors (see disconnectFromDevice() in the documentation) every time I would re-connect the program became way too slow.
If you want to connect to two devices using Qt, you have to use the Bluez API through the D-Bus with Qt's D-Bus classes.
Edit:
I managed to connect to multiple devices using D-Bus classes. The architecture of my program isn't much more complicated, only the syntax got a little more tricky. The only big issue was the BlueZ version: the D-Bus interface changed a lot between 5.3x (default Ubuntu 16.04) that doesn't support Low Energy (experimental...) and later versions. I think that's the reason why Qt's D-Bus Bluetooth hasn' been enabled yet. Since BLE isn't flagged as experimental since BlueZ 5.42, you should be fine using D-Bus with your current version. For the record, I'm perfectly fine using D-Bus with Raspbian's default 5.9 BlueZ.

Enabling Android A2DP SINK and RFCOMM simultaneous traffic (Lollipop)

Background:
I’m looking to enable A2DP audio streaming SINK support on my Nexus 4 & 5 devices (running Lollipop) . I also need concurrent SPP/RFCOMM bidirectional traffic for my application command and control. I’ll be sending serial traffic to a microcontroller via a Bluetooth module (such as the BlueGiga WT32i or ) which will be controlling various other hardware. As such, I believe AVRCP isn’t up to the task.
Question:
Has anyone enabled A2DP SINK support in Android (Target Lollipop or earlier) and either successfully got an concurrent SPP/RFCOMM channel working OR can offer options on how to achieve this?
For A2DP Sink support -
Yes. It is possible. I have done it in Android JB.
https://stackoverflow.com/a/28892944/987500 - Please read my reply.

Bluetooth protocol (RFCOMM, L2CAP and ACL)

From what I've read from Bluetooth Essentials for Programmers, this books mentions some points that I dont quite understand.
RFCOMM is a reliable stream-based protocol.
L2CAP is a packet-based protocol that can be configured with varying levels of reliability.
L2CAP actually serves as the transport protocol for RFCOMM, so every RFCOMM connection is actually encapsulated within an L2CAP connection.
This really confuses me since these two protocol are different types of protocols (one is stream based while the other is packet based). So based on its explanation, I have some questions in the following.
Since RFCOMM connection is encapsulated, then how serial port profile(SPP) can use RFCOMM connection? It should use L2CAP as well.
A2DP uses L2CAP connection. This means the same to me since L2CAP and RFCOMM are encapsulated within ACL connection, should this mean A2DP uses ACL connection? I know this is incorrect but how to explain this here.
Thanks for any explanation here.
The encapsulation could be at the "device" driver level so it would be invisible to you, its like you never "created" an Ethernet packet, but you still able to use TCP/IP natively, how come? same thing here, RFCOMM uses L2CAP, but doesn't mean you need to know L2CAP to use.
Usually encapsulation is used when you don't want to hassle with something else, in this case they didn't want to hassle with the signalling issue, RFCOMM is used for Serial interface, so they didn't want to handle the signalling issue of Serial interfaces

Make your computer discoverable

my .net app on the computer needs to make the computer discoverable, start a service and then wait to accept incoming connections. my app/computer is the slave and connecting device is the master. So I change my local radio mode to discoverable programmatically,start my service and wait... But when the device is supposed to connect to my app/computer, nothing happens.
Windows help and support has this :
Control Panel ->search for bluetooth -> click on change bluetooth settings ->
To make your computer discoverable to Bluetooth enabled devices,
select the check box for Allow Bluetooth devices to find this computer.
When a Bluetooth enabled computer is in discovery mode, it broadcasts a
wireless signal that allows it to be detected by other computers or devices.
This is sometimes called pairing mode. If you check this box, your computer
will still be able to detect Bluetooth enabled devices that are in discovery mode,
but they will not be able to detect your computer.
I am not quite sure what's the context. If I leave that box checked, then other devices will be able to detect me (because I am set to discoverable), but won't be able to connect????? So my service just keeps listening, won't be able to detect any incoming requests? Am I right?

Resources