Details
-
Bug
-
Resolution: Cannot Reproduce
-
Not Evaluated
-
5.3.0 Beta1
-
None
Description
This task originated from the Qt Interest mailing list. The mail was sent by Alexander Zakharov [alexander.v.zakharov@gmail.com]:
I am trying to connect via Bluetooth to a custom device using RFCOMM.
The system is Debian Testing running in a virtual machine (VMWare
Workstation), Qt version is 5.2.1, BlueZ version is 4.101. I hoped to
write my code under Linux and later use it for Android in the upcoming
Qt 5.3, but I cannot get it working. The device is known to function
properly: there is a Windows program (in C#, written using InTheHand
Bluetooth library) and a Mac OS X program (written using the native
API), both of which are able to connect to the device and exchange
data with it. Mac OS X is also running in a virtual machine on the
same host, so there seems to be no issues with Bluetooth support in
VMs.The device itself can be discovered using
QBluetoothDeviceDiscoveryAgent and corresponding QBluetoothDeviceInfo
object can be obtained. However, service discovery in Qt does not work
for the device. 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.Since I have no QBluetoothServiceInfo object for the RFCOMM service of
the device, but I know its UUID (it is used in both Windows and Mac OS
X programs and is also printed in the output of bluez-test-device
command), I have tried to create a socket in the following way:QBluetoothSocket* socket = new
QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
connect(socket, SIGNAL(connected()), this, SLOT(connected()));
connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this,
SLOT(error(QBluetoothSocket::SocketError)));
socket->connectToService(device.address(),
QBluetoothUuid(QString("00001101-0000-1000-8000-00805f9b34fb")));As a result, the error slot is called, with
QBluetoothSocket::ServiceNotFoundError.The documentation about Bluetooth in Qt is very scant and I may be
using QtBluetooth incorrectly, but the case when BTScanner is not
working while 'bluez-test-device' command does is worrisome. Do you
have any suggestions?