Skip to content

Commit cf26740

Browse files
committed
stashed
1 parent da9f2ca commit cf26740

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/connection.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,27 @@ void Connection::updateSignalSlot()
502502
void Connection::BTServer_initServiceInfo()
503503
{
504504
// call it once
505+
506+
// Reference:
507+
// https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host/service-discovery-protocol--sdp--specification.html
508+
// https://doc.qt.io/qt-5/qbluetoothserver.html#listen-1
509+
510+
const QBluetoothUuid serviceUuid(QLatin1String("4de17a00-52cb-11e6-bdf4-0800200c9a66"));
511+
512+
// Configure service attribute: BluetoothProfileDescriptorList(0x0009)
505513
QBluetoothServiceInfo::Sequence profileSequence;
506514
QBluetoothServiceInfo::Sequence classId;
507515
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
508-
classId << QVariant::fromValue(quint16(0x100));
516+
classId << QVariant::fromValue(quint16(0x100)); // profile version number: 1.0(initial version)
509517
profileSequence.append(QVariant::fromValue(classId));
510518
m_RfcommServiceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, profileSequence);
511519

512520
classId.clear();
513-
// Add user defined UUID there
521+
// "The UUIDs should be listed in order from the most specific class to the most general class unless otherwise specified by the profile specifications defining the service classes."
522+
// Android requires custom uuid to be set as service class
514523
// classId << QVariant::fromValue(QBluetoothUuid(serialServiceUuid));
515-
classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
524+
classId << QVariant::fromValue(serviceUuid);
525+
// classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
516526

517527
m_RfcommServiceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
518528

@@ -525,7 +535,7 @@ void Connection::BTServer_initServiceInfo()
525535
//! [Service UUID set]
526536
// use QBluetoothUuid::SerialPort there
527537
// m_RfcommServiceInfo.setServiceUuid(QBluetoothUuid(serialServiceUuid));
528-
m_RfcommServiceInfo.setServiceUuid(QBluetoothUuid::SerialPort);
538+
m_RfcommServiceInfo.setServiceUuid(serviceUuid);
529539
//! [Service UUID set]
530540

531541
//! [Service Discoverability]
@@ -534,6 +544,7 @@ void Connection::BTServer_initServiceInfo()
534544
m_RfcommServiceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
535545
publicBrowse);
536546
//! [Service Discoverability]
547+
m_Bt
537548
}
538549

539550
void Connection::BTServer_updateServicePort()

0 commit comments

Comments
 (0)