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
qbluetoothserver_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QBLUETOOTHSERVER_P_H
5#define QBLUETOOTHSERVER_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 <QtGlobal>
19#include <QList>
20#include <QtBluetooth/QBluetoothSocket>
22#include "qbluetooth.h"
23
24#if QT_CONFIG(bluez)
26#endif
27
28#ifdef QT_ANDROID_BLUETOOTH
29#include <QtCore/QJniEnvironment>
30#include <QtCore/QJniObject>
31#include <QtBluetooth/QBluetoothUuid>
32
34#endif
35
36#ifdef QT_WINRT_BLUETOOTH
37#include <QtCore/QMutex>
38
39#include <wrl.h>
40// No forward declares because QBluetoothServerPrivate::listener does not work with them
41#include <windows.networking.sockets.h>
42#endif
43
44#ifdef QT_OSX_BLUETOOTH
45
46#include "darwin/btdelegates_p.h"
47#include "darwin/btraii_p.h"
48
49#include <QtCore/QMutex>
50
51#endif // QT_OSX_BLUETOOTH
52
54
55class QBluetoothAddress;
56class QBluetoothSocket;
57class QBluetoothServer;
58
60#ifdef QT_OSX_BLUETOOTH
62#endif
63{
64 Q_DECLARE_PUBLIC(QBluetoothServer)
65
66public:
69
70#if QT_CONFIG(bluez)
71 void _q_newConnection();
76#endif
77
78public:
79 QBluetoothSocket *socket = nullptr;
80
84
85protected:
86 QBluetoothServer *q_ptr;
87
88private:
89 QBluetoothServer::Error m_lastError = QBluetoothServer::NoError;
90#if QT_CONFIG(bluez)
92#elif defined(QT_ANDROID_BLUETOOTH)
96public:
97 bool isListening() const;
100#elif defined(QT_WINRT_BLUETOOTH)
102
106
110
111public:
112 bool isListening() const;
116#endif
117
118#ifdef QT_OSX_BLUETOOTH
119
120public:
121
122 friend class QBluetoothServer;
123 friend class QBluetoothServiceInfoPrivate;
124
125private:
127 void stopListener();
128 bool isListening() const;
129
130 // SocketListener (delegate):
132 void openNotifyL2CAP(void *channel) override;
133
134 // Either a "temporary" channelID/PSM assigned by QBluetoothServer::listen,
135 // or a real channelID/PSM returned by IOBluetooth after we've registered
136 // a service.
138
140
141 // These static functions below
142 // deal with differences between bluetooth sockets
143 // (bluez and QtBluetooth's API) and IOBluetooth, where it's not possible
144 // to have a real PSM/channelID _before_ a service is registered,
145 // the solution - "fake" ports.
146 // These functions require external locking - using channelMapMutex.
147 static QMutex &channelMapMutex();
148
149 static bool channelIsBusy(quint16 channelID);
150 static quint16 findFreeChannel();
151
152 static bool psmIsBusy(quint16 psm);
153 static quint16 findFreePSM();
154
158
161
162#endif // QT_OSX_BLUETOOTH
163};
164
165QT_END_NAMESPACE
166
167#endif
QBluetoothServiceInfo::Protocol serverType
QBluetooth::SecurityFlags securityFlags
QBluetoothSocket * socket
\inmodule QtBluetooth