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>
This commit is contained in:
parent
b09f5e493d
commit
dfee9aa22f
|
|
@ -85,13 +85,17 @@ void ChatServer::startServer(const QBluetoothAddress& localAdapter)
|
|||
|
||||
//serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceRecordHandle, (uint)0x00010010);
|
||||
|
||||
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);
|
||||
|
||||
classId.prepend(QVariant::fromValue(QBluetoothUuid(serviceUuid)));
|
||||
classId.clear();
|
||||
classId << QVariant::fromValue(QBluetoothUuid(serviceUuid));
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
||||
|
||||
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
|
||||
|
||||
|
|
|
|||
|
|
@ -217,13 +217,18 @@ QBluetoothServiceInfo QBluetoothServer::listen(const QBluetoothUuid &uuid, const
|
|||
serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
|
||||
browseSequence);
|
||||
|
||||
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);
|
||||
|
||||
classId.clear();
|
||||
//Android requires custom uuid to be set as service class
|
||||
classId.prepend(QVariant::fromValue(uuid));
|
||||
classId << QVariant::fromValue(uuid);
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
||||
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
|
||||
serviceInfo.setServiceUuid(uuid);
|
||||
|
||||
|
|
|
|||
|
|
@ -380,11 +380,16 @@ QBluetoothServiceInfo QBluetoothServer::listen(const QBluetoothUuid &uuid, const
|
|||
serviceInfo.setAttribute(QSInfo::BrowseGroupList,
|
||||
QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
|
||||
|
||||
QSInfo::Sequence profileSequence;
|
||||
QSInfo::Sequence classId;
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
||||
serviceInfo.setAttribute(QSInfo::BluetoothProfileDescriptorList, classId);
|
||||
classId << QVariant::fromValue(quint16(0x100));
|
||||
profileSequence.append(QVariant::fromValue(classId));
|
||||
serviceInfo.setAttribute(QSInfo::BluetoothProfileDescriptorList, profileSequence);
|
||||
|
||||
classId.prepend(QVariant::fromValue(uuid));
|
||||
classId.clear();
|
||||
classId << QVariant::fromValue(uuid);
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
||||
serviceInfo.setAttribute(QSInfo::ServiceClassIds, classId);
|
||||
serviceInfo.setServiceUuid(uuid);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -289,11 +289,13 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscoveryAdapters()
|
|||
serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
|
||||
QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
|
||||
|
||||
QBluetoothServiceInfo::Sequence profileSequence;
|
||||
QBluetoothServiceInfo::Sequence classId;
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
||||
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
|
||||
classId << QVariant::fromValue(quint16(0x100));
|
||||
profileSequence.append(QVariant::fromValue(classId));
|
||||
serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList,
|
||||
classId);
|
||||
profileSequence);
|
||||
|
||||
serviceInfo.setServiceUuid(uuid);
|
||||
|
||||
|
|
|
|||
|
|
@ -576,12 +576,17 @@ void BtLocalDevice::serverListenPort()
|
|||
if (!ret)
|
||||
return;
|
||||
|
||||
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);
|
||||
|
||||
classId.prepend(QVariant::fromValue(QBluetoothUuid(QString(TEST_SERVICE_UUID))));
|
||||
classId.clear();
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QString(TEST_SERVICE_UUID)));
|
||||
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
|
||||
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
|
||||
|
||||
// Service name, description and provider
|
||||
|
|
|
|||
Loading…
Reference in New Issue