summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-08-11 15:42:03 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-08-13 13:47:53 +0200
commitd5422ad7c9806e6a105ae9918fae650e38aad601 (patch)
tree4c4a4ea77846a33e312a0369416febc785ee27bf /src/bluetooth/qbluetoothdevicediscoveryagent_p.h
parent02a9784b2b502ade67710632c2872bda097770e3 (diff)
Improve consistency of device discovery.
Device discovery of BTLE devices fails once the second device discovery is performed in the current process. The first discovery always succeeds. BTLE devices are advertised right after the start of the device discovery session. However the discovery session never seems to stop once it is done for the first time. This can be seen by the fact that the Discovering property of the adapter constantly toggles between true and false. As a consequence the second device discovery won't find a BTLE device in 99% of all cases. The odds that the API user initiates the second discovery right between two continues adapter searches is rather slim. The fix is to extend the device discovery process beyond a toggle of a single device discovery cycle. We ignore the end signal of the first cycle and continue to the end of the second cycle. At the same time we rely on the perceived bug which restarts the second cycle automatically. Just for the case that the second cycle doesn't start automatically we utilize a timer to manually force an end of the device discovery. The problem is likely to be a bug in Bluez4. A negative side effect of this workaround is a longer device discovery process. Change-Id: I986c8d6498b2cc9ed51f4457267c53813132cf8e Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_p.h')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
index 168b6c0c..c4e804d3 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
@@ -102,6 +102,7 @@ public:
void _q_PropertiesChanged(const QString &interface,
const QVariantMap &changed_properties,
const QStringList &invalidated_properties);
+ void _q_extendedDeviceDiscoveryTimeout();
#endif
private:
@@ -136,6 +137,10 @@ private:
void deviceFoundBluez5(const QString& devicePath);
void startBluez5();
+
+ bool useExtendedDiscovery;
+ QTimer extendedDiscoveryTimer;
+
#elif defined(QT_QNX_BLUETOOTH)
private slots:
void finished();