146QBluetoothServer::QBluetoothServer(QBluetoothServiceInfo::Protocol serverType, QObject *parent)
147 : QObject(parent), d_ptr(
new QBluetoothServerPrivate(serverType,
this))
183QBluetoothServiceInfo QBluetoothServer::listen(
const QBluetoothUuid &uuid,
const QString &serviceName)
185 Q_D(
const QBluetoothServer);
187 return QBluetoothServiceInfo();
189 QBluetoothServiceInfo serviceInfo;
190 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceName, serviceName);
191 QBluetoothServiceInfo::Sequence browseSequence;
192 browseSequence << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::PublicBrowseGroup));
193 serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
196 QBluetoothServiceInfo::Sequence profileSequence;
197 QBluetoothServiceInfo::Sequence classId;
198 classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort));
199 classId << QVariant::fromValue(quint16(0x100));
200 profileSequence.append(QVariant::fromValue(classId));
201 serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList,
206 classId << QVariant::fromValue(uuid);
207 classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::SerialPort));
208 serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
209 serviceInfo.setServiceUuid(uuid);
211 QBluetoothServiceInfo::Sequence protocolDescriptorList;
212 QBluetoothServiceInfo::Sequence protocol;
213 protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ProtocolUuid::L2cap));
214 if (d->serverType == QBluetoothServiceInfo::L2capProtocol)
215 protocol << QVariant::fromValue(serverPort());
216 protocolDescriptorList.append(QVariant::fromValue(protocol));
219 if (d->serverType == QBluetoothServiceInfo::RfcommProtocol) {
221 protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ProtocolUuid::Rfcomm))
222 << QVariant::fromValue(quint8(serverPort()));
223 protocolDescriptorList.append(QVariant::fromValue(protocol));
227 serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList,
228 protocolDescriptorList);
229 bool result = serviceInfo.registerService();
233 return QBluetoothServiceInfo();