summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2018-10-10 15:41:45 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2018-10-11 07:44:07 +0000
commitc9ed3c49e3884ffad899d7ae28b2480691824228 (patch)
tree2258a7f62e229dc4293a9c3a12f2a115f92dea51 /src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
parentdb8c876c7478114a888947ce1f36e8a2a80e8ed2 (diff)
SDP records: handle ServiceID and ServiceClassIDList correctly (IOBluetooth)v5.12.0-beta2
We previously failed to correctly extract service ID and service class ID list. As a result, service discovery agent working with uuid filter and in MinimalDiscovery mode would fail to find anything, without filtering - would probably end up in services not having any valid service ID or ID list. Task-number: QTBUG-71052 Change-Id: I6b5a36399abfaf66297abe4a38efa7659cbb2aa0 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_osx.mm')
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_osx.mm15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
index 6a0247a6..bd9cc7f3 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
@@ -94,6 +94,8 @@ private:
bool isDuplicatedService(const QBluetoothServiceInfo &serviceInfo) const;
void serviceDiscoveryFinished();
+ bool serviceHasMathingUuid(const QBluetoothServiceInfo &serviceInfo) const;
+
QBluetoothServiceDiscoveryAgent *q_ptr;
QBluetoothServiceDiscoveryAgent::Error error;
@@ -369,7 +371,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::performMinimalServiceDiscovery(cons
if (!serviceInfo.isValid())
continue;
- if (!uuidFilter.isEmpty() && !uuidFilter.contains(serviceInfo.serviceUuid()))
+ if (!uuidFilter.isEmpty() && !serviceHasMathingUuid(serviceInfo))
continue;
if (!isDuplicatedService(serviceInfo)) {
@@ -424,6 +426,17 @@ void QBluetoothServiceDiscoveryAgentPrivate::serviceDiscoveryFinished()
startServiceDiscovery();
}
+bool QBluetoothServiceDiscoveryAgentPrivate::serviceHasMathingUuid(const QBluetoothServiceInfo &serviceInfo) const
+{
+ for (const auto &requestedUuid : uuidFilter) {
+ if (serviceInfo.serviceUuid() == requestedUuid)
+ return true;
+ if (serviceInfo.serviceClassUuids().contains(requestedUuid))
+ return true;
+ }
+ return false;
+}
+
QBluetoothServiceDiscoveryAgent::QBluetoothServiceDiscoveryAgent(QObject *parent)
: QObject(parent),
d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(this, QBluetoothAddress()))