Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.0
-
None
-
Linux, BlueZ 5
Description
With BlueZ, it is possible (using bluetoothctl) to type the following sequence of commands to configure the Bluetooth device discovery:
$ bluetoothctl [bluetooth]# menu scan [bluetooth]# uuids AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE [bluetooth]# transport le [bluetooth]# rssi XYZ [bluetooth]# duplicate-data XYZ [bluetooth]# rssi XYZ ...
We can achieve the same thing using the BlueZ's D-Bus interface. In fact, Qt is already doing it, but ONLY for the transport setting (from qbluetoothdevicediscoveryagent_bluez.cpp, lines 262-272):
QVariantMap map; if (methods == (QBluetoothDeviceDiscoveryAgent::LowEnergyMethod|QBluetoothDeviceDiscoveryAgent::ClassicMethod)) map.insert(QStringLiteral("Transport"), QStringLiteral("auto")); else if (methods & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod) map.insert(QStringLiteral("Transport"), QStringLiteral("le")); else map.insert(QStringLiteral("Transport"), QStringLiteral("bredr")); // older BlueZ 5.x versions don't have this function // filterReply returns UnknownMethod which we ignore QDBusPendingReply<> filterReply = adapterBluez5->SetDiscoveryFilter(map);
We would like to set the vendor-specific 128 bit UUID to the discovery filter, so only devices with this UUID are discovered. Qt's Bluetooth discovery filter shall include this feature - without it, we can't use a large part of the Qt's Bluetooth stack, and have to implement our own D-Bus interface, because connecting to each device in range to read the "GenericAccess" and "DeviceInformation" services is very time consuming.