diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2019-01-02 13:24:56 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2019-01-04 07:42:05 +0000 |
commit | fb03b1e921e641a106722f8f3d59861ce7e6789e (patch) | |
tree | f85d1bc4c1e8646789d2a054a835dd6f270c48bd /src | |
parent | 193e53e544ebbb5ee60d4ad798648df345679e5a (diff) |
Add missing dbus registrations and change documentation
Qt DBus registration for Bluez specific types was done by isBluez5().
However Qt 5.12 introduced bluetoothdVersion() which is a bit more
precise. It became necessary because runtime decisions based on exact
minor release versions of Bluez became necessary. Therefore some code
paths (depending on the user's use case) never called isBluez5() anymore.
Subsequently the dbus registrations were missed out on.
In the future isBLuez5() should be replaced by bluetoothdVersion().
QBluetoothSocket changed its underlying implementation when addressing
QTBUG-68550. It uses dbus sockets to establish rfcomm socket connections
to remote devices. The QBluetoothSocket::connectToService() overload that
expects a port number is no longer possible as Bluez DBus API does not
support connection establishment based on port numbers.
Fixes: QTBUG-72742
Change-Id: If6adb391b0524cabc3a702d761e0cbd263508396
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/bluez/bluez5_helper.cpp | 7 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket.cpp | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp index bacdfe3c..7ce67690 100644 --- a/src/bluetooth/bluez/bluez5_helper.cpp +++ b/src/bluetooth/bluez/bluez5_helper.cpp @@ -195,6 +195,13 @@ bool mandatoryHciIoctlsAvailable() QVersionNumber bluetoothdVersion() { if (bluezDaemonVersion()->isNull()) { + // Register DBus specific meta types (copied from isBluez5()) + // Not all code paths run through isBluez5() but still need the + // registration. + qDBusRegisterMetaType<InterfaceList>(); + qDBusRegisterMetaType<ManagedObjectList>(); + qDBusRegisterMetaType<ManufacturerDataList>(); + qCDebug(QT_BT_BLUEZ) << "Detecting bluetoothd version"; //Order of matching // 1. Pick whatever the user decides via BLUETOOTH_FORCE_DBUS_LE_VERSION diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp index 16461bd3..eecb1401 100644 --- a/src/bluetooth/qbluetoothsocket.cpp +++ b/src/bluetooth/qbluetoothsocket.cpp @@ -427,8 +427,8 @@ void QBluetoothSocket::connectToService(const QBluetoothAddress &address, const At any point, the socket can emit error() to signal that an error occurred. - On Android, a connection to a service can not be established using a port. Calling this function - will emit a \l {QBluetoothSocket::ServiceNotFoundError}{ServiceNotFoundError}. + On Android and BlueZ (version 5.46 or above), a connection to a service can not be established using a port. + Calling this function will emit a \l {QBluetoothSocket::ServiceNotFoundError}{ServiceNotFoundError}. Note that most platforms require a pairing prior to connecting to the remote device. Otherwise the connection process may fail. |