summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-06-15 14:47:33 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-06-16 07:53:02 +0000
commit1ed8390e17831afc5624bc7519b667eb8eea05a7 (patch)
tree3a741561e2fcacbbe5452727b2c894a45f61fe2e
parentcba4c454543ab83797b44946b132323687a198dc (diff)
Android: Don't miss services if the last device discovery failed
Android collects the SDP information for all devices and puts them into an sdp cache. Only when the discovery finishes the sdp cache is evaluated and the serviceDiscovered() signal is sent. The evaluation is triggerd by _q_fetchUuidsTimeout(). If it is not possible to retrieve uuids or an address for the last discovered device, the old code never triggered _q_fetchUuidsTimeout(). As a consequence QBluetoothServiceDiscoveryAgent appeared to never find any service. This patch ensures that if the last SDP discovery failed we still trigger the final UUID evaluation and subsequent serviceDiscovered() signal emissions. Change-Id: I8454dc3f7cf3688110e6c86af324d797351b5b33 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_android.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
index ba5bcb0a..51db091e 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
@@ -244,6 +244,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_processFetchedUuids(
//could not find any service for the current address/device -> go to next one
if (address.isNull() || uuids.isEmpty()) {
+ if (discoveredDevices.count() == 1) {
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+ QTimer::singleShot(4000, q, SLOT(_q_fetchUuidsTimeout()));
+ }
_q_serviceDiscoveryFinished();
return;
}