137QBluetoothServer::QBluetoothServer(QBluetoothServiceInfo::Protocol serverType, QObject *parent)
138 : QObject(parent), d_ptr(
new QBluetoothServerPrivate(serverType,
this))
174QBluetoothServiceInfo QBluetoothServer::listen(
const QBluetoothUuid &uuid,
const QString &serviceName)
176 Q_D(
const QBluetoothServer);
178 return QBluetoothServiceInfo();
180 QBluetoothServiceInfo serviceInfo;
181 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceName, serviceName);
182 QBluetoothServiceInfo::Sequence browseSequence;
183 browseSequence << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::PublicBrowseGroup));
184 serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
187 QBluetoothServiceInfo::Sequence profileSequence;
188 QBluetoothServiceInfo::Sequence classId;
189 classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort));
190 classId << QVariant::fromValue(quint16(0x100));
191 profileSequence.append(QVariant::fromValue(classId));
192 serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList,
197 classId << QVariant::fromValue(uuid);
198 classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort));
199 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
200 serviceInfo.setServiceUuid(uuid);
202 QBluetoothServiceInfo::Sequence protocolDescriptorList;
203 QBluetoothServiceInfo::Sequence protocol;
204 protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ProtocolUuid::L2cap));
205 if (d->serverType == QBluetoothServiceInfo::L2capProtocol)
206 protocol << QVariant::fromValue(serverPort());
207 protocolDescriptorList.append(QVariant::fromValue(protocol));
210 if (d->serverType == QBluetoothServiceInfo::RfcommProtocol) {
212 protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ProtocolUuid::Rfcomm))
213 << QVariant::fromValue(quint8(serverPort()));
214 protocolDescriptorList.append(QVariant::fromValue(protocol));
218 serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList,
219 protocolDescriptorList);
220 bool result = serviceInfo.registerService();
224 return QBluetoothServiceInfo();