diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-01-10 21:37:16 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-01-10 21:37:16 +0100 |
commit | 18b57342a009b310c280feeaec3d7cf9f6b98dcb (patch) | |
tree | 6936fd2d1fcf5e40b8cd5a859c0d24abf944769c | |
parent | ff8c5cb8990dcd7ec676aff7104a9aee485ccbdd (diff) | |
parent | e957470ae0e61eea1afa96d76468dbdc87168421 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
.qmake.conf
Change-Id: I9e22e3963466ff8909f58cfb252dceac6ee2e7bd
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 18 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_android.cpp | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index e16caff6..6a93143b 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -291,7 +291,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_finishSdpScan(QBluetoothServiceD emit q->error(error); } else if (!xmlRecords.isEmpty() && discoveryState() != Inactive) { for (const QString &record : xmlRecords) { - const QBluetoothServiceInfo serviceInfo = parseServiceXml(record); + QBluetoothServiceInfo serviceInfo = parseServiceXml(record); //apply uuidFilter if (!uuidFilter.isEmpty()) { @@ -313,6 +313,22 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_finishSdpScan(QBluetoothServiceD if (!serviceInfo.isValid()) continue; + // Bluez sdpscanner declares custom uuids into the service class uuid list. + // Let's move a potential custom uuid from QBluetoothServiceInfo::serviceClassUuids() + // to QBluetoothServiceInfo::serviceUuid(). If there is more than one, just move the first uuid + const QList<QBluetoothUuid> serviceClassUuids = serviceInfo.serviceClassUuids(); + for (const QBluetoothUuid &id : serviceClassUuids) { + if (id.minimumSize() == 16) { + serviceInfo.setServiceUuid(id); + serviceInfo.setServiceName(QBluetoothServiceDiscoveryAgent::tr("Custom Service")); + QBluetoothServiceInfo::Sequence modSeq = + serviceInfo.attribute(QBluetoothServiceInfo::ServiceClassIds).value<QBluetoothServiceInfo::Sequence>(); + modSeq.removeOne(QVariant::fromValue(id)); + serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, modSeq); + break; + } + } + if (!isDuplicatedService(serviceInfo)) { discoveredServices.append(serviceInfo); qCDebug(QT_BT_BLUEZ) << "Discovered services" << discoveredDevices.at(0).address().toString() diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index a478819b..d7f17d17 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -196,7 +196,7 @@ static QBluetoothUuid reverseUuid(const QBluetoothUuid &serviceUuid) bool isBaseUuid = false; serviceUuid.toUInt32(&isBaseUuid); if (isBaseUuid) - return QBluetoothUuid(); + return serviceUuid; const quint128 original = serviceUuid.toUInt128(); quint128 reversed; |