summaryrefslogtreecommitdiff
path: root/examples/bluetooth/btchat/chatserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/btchat/chatserver.cpp')
-rw-r--r--examples/bluetooth/btchat/chatserver.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/bluetooth/btchat/chatserver.cpp b/examples/bluetooth/btchat/chatserver.cpp
index 2e6c314d..7a6ef80d 100644
--- a/examples/bluetooth/btchat/chatserver.cpp
+++ b/examples/bluetooth/btchat/chatserver.cpp
@@ -6,8 +6,10 @@
#include <QtBluetooth/qbluetoothserver.h>
#include <QtBluetooth/qbluetoothsocket.h>
+using namespace Qt::StringLiterals;
+
//! [Service UUID]
-static const QLatin1String serviceUuid("e8e10f95-1a70-4b27-9ccf-02010264e9c8");
+static constexpr auto serviceUuid = "e8e10f95-1a70-4b27-9ccf-02010264e9c8"_L1;
//! [Service UUID]
ChatServer::ChatServer(QObject *parent)
@@ -64,10 +66,10 @@ void ChatServer::startServer(const QBluetoothAddress& localAdapter)
//! [Service UUID set]
//! [Service Discoverability]
+ const auto groupUuid = QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::PublicBrowseGroup);
QBluetoothServiceInfo::Sequence publicBrowse;
- publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::ServiceClassUuid::PublicBrowseGroup));
- serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
- publicBrowse);
+ publicBrowse << QVariant::fromValue(groupUuid);
+ serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse);
//! [Service Discoverability]
//! [Protocol descriptor list]
@@ -122,7 +124,8 @@ void ChatServer::clientConnected()
return;
connect(socket, &QBluetoothSocket::readyRead, this, &ChatServer::readSocket);
- connect(socket, &QBluetoothSocket::disconnected, this, QOverload<>::of(&ChatServer::clientDisconnected));
+ connect(socket, &QBluetoothSocket::disconnected,
+ this, QOverload<>::of(&ChatServer::clientDisconnected));
clientSockets.append(socket);
clientNames[socket] = socket->peerName();
emit clientConnected(socket->peerName());