summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2019-05-10 11:17:21 +0200
committerOliver Wolff <oliver.wolff@qt.io>2019-05-27 07:00:21 +0000
commitb5ec1e15f360cd60386488588dd4796169082355 (patch)
treed4580142498101675b2813ef893db726d59c2e14
parent672ebe7690455c6ee13f96ad05d030183a7e57f8 (diff)
winrt: Make sure that ProtocolDescriptorList is always set for services
For some devices the attribute map does not have a protocol descriptor set which throws off Qt's logic. As Windows can only discover RFCOMM services, we can just add that protocol to the service ourselves if it is not found automatically. Task-number: QTBUG-62520 Change-Id: I6ce3948892699049b678b026840d346879b98269 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
index 3b99c1c4..f1476758 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
@@ -336,6 +336,17 @@ void QWinRTBluetoothServiceDiscoveryWorker::processServiceSearchResult(quint64 a
}
hr = iterator->MoveNext(&current);
}
+ // Windows is only able to discover Rfcomm services but the according protocolDescriptor is
+ // not always set in the raw attribute map. If we encounter a service like that we should
+ // fill the protocol descriptor ourselves.
+ if (info.protocolDescriptor(QBluetoothUuid::Rfcomm).isEmpty()) {
+ QBluetoothServiceInfo::Sequence protocolDescriptorList;
+ QBluetoothServiceInfo::Sequence protocol;
+ protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm))
+ << QVariant::fromValue(0);
+ protocolDescriptorList.append(QVariant::fromValue(protocol));
+ info.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList);
+ }
emit serviceFound(address, info);
}
emit scanFinished(address);