diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-08-27 12:19:11 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-09-03 12:54:38 +0200 |
commit | aaada70924dd53dbc9763581bc076ddb1aa8c9c9 (patch) | |
tree | 94e099e1e26b6a8738f15955e94f89b5e8cf6420 | |
parent | 5a694018992051a3c99339d5860eda4bbb703275 (diff) |
Set ATT as protocol descriptor for BTLE SDP records
At the same time we fix up some cases where the ProtocolDescriptorList
was not a list within a list.
Change-Id: If0ec6cf6374902a47a905edd08523906be9fd86b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 files changed, 46 insertions, 7 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp index d97c0e92..01993f25 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp @@ -337,8 +337,12 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB QBluetoothServiceInfo serviceInfo; serviceInfo.setDevice(remoteDevice); - QBluetoothServiceInfo::Sequence protocolDescriptorList; - protocolDescriptorList << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + QBluetoothServiceInfo::Sequence protocolDescriptorList; + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } if (customUuids.contains(i) && sppIndex > -1) { //we have a custom uuid of service class type SPP diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index fb956c9e..d82a73a8 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -448,7 +448,16 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa service.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); QBluetoothServiceInfo::Sequence protocolDescriptorList; - protocolDescriptorList << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Att)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } service.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); if (uuidFilter.isEmpty()) @@ -657,7 +666,16 @@ void QBluetoothServiceDiscoveryAgentPrivate::performMinimalServiceDiscovery(cons } QBluetoothServiceInfo::Sequence protocolDescriptorList; - protocolDescriptorList << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Att)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); //don't include the service if we already discovered it before diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp index 4ed62c25..7fe0fad7 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp @@ -278,8 +278,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd) QBluetoothServiceInfo serviceInfo; serviceInfo.setDevice(discoveredDevices.at(0)); - QBluetoothServiceInfo::Sequence protocolDescriptorList; - protocolDescriptorList << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + QBluetoothServiceInfo::Sequence protocolDescriptorList; + QBluetoothServiceInfo::Sequence l2cpProtocol; + l2cpProtocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + protocolDescriptorList.append(QVariant::fromValue(l2cpProtocol)); bool ok; QBluetoothUuid suuid(QByteArray(next_service).toUInt(&ok,16)); @@ -361,7 +363,16 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd) lowEnergyService.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); QBluetoothServiceInfo::Sequence protocolDescriptorList; - protocolDescriptorList << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } + { + QBluetoothServiceInfo::Sequence protocol; + protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Att)); + protocolDescriptorList.append(QVariant::fromValue(protocol)); + } service.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); qCDebug(QT_BT_QNX) << "Adding Low Energy service" << leUuid; diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp index 749dd65d..59ee2510 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp @@ -310,6 +310,12 @@ void QDeclarativeBluetoothService::setRegistered(bool registered) protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)) << QVariant::fromValue(quint16(d->m_server->serverPort())); } else if (d->m_protocol == RfcommProtocol) { + //rfcomm implies l2cp protocol + { + QBluetoothServiceInfo::Sequence l2cpProtocol; + l2cpProtocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); + protocolDescriptorList.append(QVariant::fromValue(l2cpProtocol)); + } protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm)) << QVariant::fromValue(quint8(d->m_server->serverPort())); } |