diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-10-11 17:31:54 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2018-10-15 12:48:51 +0000 |
commit | dfee9aa22f2dbaae3476770d0ab65f26494fe451 (patch) | |
tree | ee230824696665fa2d7057c20eaa31cdcf8e0213 /src/bluetooth/qbluetoothservicediscoveryagent_android.cpp | |
parent | b09f5e493d13276f74e52367cfe7db46cd581c63 (diff) |
Fix the BluetoothProfileDescriptorStructure
As per spec this is meant to be a list/sequence within a sequence and
the version was missing too. For simplicity version 1.0 is used.
Fixes: QTBUG-58529
Change-Id: I57090148aadf60ea1fbbb207ff0a4ae61e06caf2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_android.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_android.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp index ac2b1906..f8201c86 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp @@ -370,12 +370,18 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB << QVariant::fromValue(0); protocolDescriptorList.append(QVariant::fromValue(protocol)); - //set SPP service class uuid + QBluetoothServiceInfo::Sequence profileSequence; QBluetoothServiceInfo::Sequence classId; classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort)); + classId << QVariant::fromValue(quint16(0x100)); + profileSequence.append(QVariant::fromValue(classId)); serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, - classId); - classId.prepend(QVariant::fromValue(uuids.at(i))); + profileSequence); + + classId.clear(); + //set SPP service class uuid + classId << QVariant::fromValue(uuids.at(i)); + classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort)); serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); serviceInfo.setServiceName(QBluetoothServiceDiscoveryAgent::tr("Serial Port Profile")); @@ -387,10 +393,13 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB << QVariant::fromValue(0); protocolDescriptorList.append(QVariant::fromValue(protocol)); + QBluetoothServiceInfo::Sequence profileSequence; QBluetoothServiceInfo::Sequence classId; classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort)); + classId << QVariant::fromValue(quint16(0x100)); + profileSequence.append(QVariant::fromValue(classId)); serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, - classId); + profileSequence); //also we need to set the custom uuid to the SPP uuid //otherwise QBluetoothSocket::connectToService() would fail due to a missing service uuid |