summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-01-04 10:12:55 +0100
committerAlex Blasche <alexander.blasche@qt.io>2018-01-25 12:51:20 +0000
commit6c1fe38977a3a22a195166818145a5649782c44d (patch)
tree44032b4e8135821c442369cfdeeac9bd0e83432b /src
parente55981842b702dced8ed0301ff9550e7d98e8a14 (diff)
Make tst_lowenergycontroller pass on DBUS Bluez backend
In addition the patch adds a few improvements making the tests somewhat more reliable. 1.) The 0x1800 BTLE Generic Access service is not exposed by BlueZ's API. That's a deliberate decision by the devs. The patch removes the service from the list of to-be-checked services. 2.) QTBUG-42519 is a limitation of the non-DBus BTLE implementation and cannot be fixed. The new DBus API does permit concurrent QLowEnergyController instances. However the instances share a platform wide singleton which means that if one instance is connected then the other instances connects as well. Other platforms separate the connectivity between instances. Therefore tst_concurrentDiscovery() has to offer three different behavior patterns 3.) Consecutive calls to writeDescriptor() in tst_readWriteDescriptor() cause a crash of bluetoothd (version 5.47 or below) and a premature disconnect from the BLE device in version BlueZ 5.48. To avoid the problem qWait calls were introduced to delay the time between individual calls. 4.) Improves the robustness of the tst_writeCharacteristicNoResponse() test which relied on notifications being enabled for two of its characteristics. So far the notifications for one characteristic were enabled but not for the other. For some magical reason this happened to be the case on all platforms but the new DBUS BTLE implementation. 5.) Swapped out some QVERIFY statements in favor of QCOMPARE. This provides better error visibility when a test fails. 6.) The patch adds a time limitation of BTLE discovery which reduces the time the entire test run takes. This is API that was recently added. Change-Id: Ib633a87614af9cbccdb0253ba47fd059a2013358 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/bluez/bluez5_helper_p.h5
-rw-r--r--src/bluetooth/qtbluetoothglobal_p.h6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/bluetooth/bluez/bluez5_helper_p.h b/src/bluetooth/bluez/bluez5_helper_p.h
index 1deecfc9..1747f249 100644
--- a/src/bluetooth/bluez/bluez5_helper_p.h
+++ b/src/bluetooth/bluez/bluez5_helper_p.h
@@ -54,6 +54,7 @@
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
#include <QtBluetooth/QBluetoothAddress>
+#include <QtBluetooth/private/qtbluetoothglobal_p.h>
typedef QMap<QString, QVariantMap> InterfaceList;
typedef QMap<QDBusObjectPath, InterfaceList> ManagedObjectList;
@@ -66,7 +67,9 @@ Q_DECLARE_METATYPE(ManagedObjectList)
QT_BEGIN_NAMESPACE
bool isBluez5();
-QVersionNumber bluetoothdVersion();
+
+// exported for unit test purposes
+Q_BLUETOOTH_PRIVATE_EXPORT QVersionNumber bluetoothdVersion();
QString sanitizeNameForDBus(const QString& text);
diff --git a/src/bluetooth/qtbluetoothglobal_p.h b/src/bluetooth/qtbluetoothglobal_p.h
index ffbfc4fe..59944593 100644
--- a/src/bluetooth/qtbluetoothglobal_p.h
+++ b/src/bluetooth/qtbluetoothglobal_p.h
@@ -56,4 +56,10 @@
#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/private/qtbluetooth-config_p.h>
+QT_BEGIN_NAMESPACE
+
+#define Q_BLUETOOTH_PRIVATE_EXPORT Q_BLUETOOTH_EXPORT
+
+QT_END_NAMESPACE
+
#endif // QTBLUETOOTHGLOBAL_P_H