Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohosbluetoothserver_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOHOSBLUETOOTHSERVER_P_H
5#define QOHOSBLUETOOTHSERVER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtBluetooth/private/qohosbluetoothcommon_p.h>
19
20#include <QtCore/qobject.h>
21#include <QtCore/qstring.h>
22#include <QtCore/qtconfigmacros.h>
23
24#include <cstdint>
25#include <memory>
26#include <optional>
27
28QT_BEGIN_NAMESPACE
29
30namespace QtOhosBluetooth {
31
34{
36public:
38
39 bool listen(const QString &serviceName, const QString &uuid, bool secure);
40 bool accept();
41 void close();
42 bool isServiceRegistered() const;
44 std::optional<std::uint64_t> tryGetRegisteredServiceId() const;
45
49 void errorOccurred(QOhosBluetoothErrorCode errorCode);
50
51private:
52 void onClientAccepted(std::shared_ptr<int> clientSocketHandle);
53 void onAcceptFailed(QOhosBluetoothErrorCode errorCode);
54 void acceptNextConnection();
55 void scheduleAcceptNextConnection();
56 void reportError(QOhosBluetoothErrorCode errorCode);
57 void reportAcceptingStopped();
58
59 std::shared_ptr<int> m_serverSocketHandle;
60 std::optional<QString> m_registeredServiceName;
61 std::optional<std::uint64_t> m_optRegisteredServiceId;
62 std::uint64_t m_registeredServicesCounter = 0;
63};
64
65}
66
67QT_END_NAMESPACE
68
69#endif // QOHOSBLUETOOTHSERVER_P_H
std::optional< std::uint64_t > tryGetRegisteredServiceId() const
std::optional< QString > tryGetRegisteredServiceName() const
void errorOccurred(QOhosBluetoothErrorCode errorCode)
bool listen(const QString &serviceName, const QString &uuid, bool secure)
Combined button and popup list for selecting options.