summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-08-15 12:37:58 +0200
committerAlex Blasche <alexander.blasche@qt.io>2018-08-15 11:57:47 +0000
commit72a48c7d108e1f3faaab0a03c6d2a6ead16d2bcc (patch)
tree8b911647ce3db2fc15e5daa8caaf32c9a839b2e4 /src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
parent01bce9f3329ba617c2bd53601f4a4abbe2cb5d44 (diff)
Android: Fix QBluetoothServiceDiscoveryAgent::uuidFilter() behavior
Task-number: QTBUG-69700 Change-Id: Ib8082156f81949926380e4e296d91c8dfc01b231 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_android.cpp')
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_android.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
index 51db091e..0d2aff2c 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
@@ -393,10 +393,6 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB
serviceInfo.setServiceUuid(uuids.at(i));
}
- //Check if the UUID is in the uuidFilter
- if (!uuidFilter.isEmpty() && !uuidFilter.contains(serviceInfo.serviceUuid()))
- continue;
-
serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList);
serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
@@ -411,6 +407,16 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB
serviceInfo.setServiceName(QBluetoothUuid::serviceClassToString(clsId));
}
+ //Check if the service is in the uuidFilter
+ if (!uuidFilter.isEmpty()) {
+ bool match = uuidFilter.contains(serviceInfo.serviceUuid());
+ for (const auto &uuid : qAsConst(uuidFilter))
+ match |= serviceInfo.serviceClassUuids().contains(uuid);
+
+ if (!match)
+ continue;
+ }
+
//don't include the service if we already discovered it before
if (!isDuplicatedService(serviceInfo)) {
discoveredServices << serviceInfo;