Qt Bluetooth in Linux non-functional? (was: "Connect to Bluetooth device using RFCOMM")
I am trying to connect via Bluetooth to a custom device supporting RFCOMM. The system is Debian Testing running in a virtual machine (VMWare Workstation) and I thought about using the same code for Android in the upcoming Qt 5.3 (currently I am using Qt 5.2.1). The device is known to be working - there is a Windows program (written using InTheHand Bluetooth library) which is able to exchange data with it.
The device itself can be discovered using QBluetoothDeviceDiscoveryAgent and corresponding QBluetoothDeviceInfo object can be obtained. However, service discovery does not work. I have tried to use QBluetoothServiceDiscoveryAgent myself and have also run BTScanner example - there are no listed services. At the same time, when I run 'bluez-test-device discover <device ID>' command from terminal, it correctly lists all services. Sometimes BTScanner correctly finds Bluetooth services provided by my phone, but not always.
Since I have no QBluetoothServiceInfo object for the RFCOMM service of the device, but I know its UUID (from both Windows program and the output of bluez-test-device command), I have tried to create a socket in the following way:
@QBluetoothSocket* socket =
connect(socket, SIGNAL(connected()), this, SLOT(connected()));
The slots are the following:
qDebug() << "Connection established";
void BluetoothDiscoverer::error(QBluetoothSocket::SocketError e)
qDebug() << e;
As a result, the error slot is called, producing the following output: QBluetoothSocket::ServiceNotFoundError.
I can only conclude that QBluetoothServiceDiscoveryAgent and QBluetoothSocket in the Linux version of Qt do not work.
Since there were no replies to my original post and I have done some additional research, with somewhat surprising results, I have updated both its header and text.
Did you get bluetooth working?
Could you share sources with me, im trying to make simple bluetooth program to connect arduino and display data from it
Unfortunately, I made no further progress. My code, except for the attempt to create QBluetoothSocket (described in my first post), is based on the Bluetooth Scanner example available in Qt 5.2. But even the example program itself is not working properly (it cannot discover any services on my device), so I am out of ideas.
You should bring this on the interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)