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
serveracceptancethread_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 SERVERACCEPTANCETHREAD_H
5#define SERVERACCEPTANCETHREAD_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 <QtCore/QMutex>
19#include <QtCore/QJniObject>
20#include <QtBluetooth/QBluetoothServer>
21#include <QtBluetooth/QBluetoothUuid>
22#include "qbluetooth.h"
23#include "private/qglobal_p.h"
24
26
28{
30public:
31 explicit ServerAcceptanceThread(QObject *parent = nullptr);
33 void setServiceDetails(const QBluetoothUuid &uuid, const QString &serviceName,
34 QBluetooth::SecurityFlags securityFlags);
35
36
37 bool hasPendingConnections() const;
39 void setMaxPendingConnections(int maximumCount);
40
41 void javaThreadErrorOccurred(int errorCode);
42 void javaNewSocket(jobject socket);
43
44 void run();
45 void stop();
46 bool isRunning() const;
47
51
52private:
53 bool validSetup() const;
54 void shutdownPendingConnections();
55
56 QList<QJniObject> pendingSockets;
57 mutable QMutex m_mutex;
58 QString m_serviceName;
59 QBluetoothUuid m_uuid;
60 int maxPendingConnections;
61 QBluetooth::SecurityFlags secFlags;
62
63 QJniObject javaThread;
64
65};
66
67QT_END_NAMESPACE
68
69#endif // SERVERACCEPTANCETHREAD_H
QT_BEGIN_NAMESPACE void QtBroadcastReceiver_jniOnReceive(JNIEnv *, jobject, jlong, QtJniTypes::Context, QtJniTypes::Intent)
#define FIND_AND_CHECK_CLASS(CLASS_NAME)
friend void QtBluetoothLE_leScanResult(JNIEnv *, jobject, jlong, QtJniTypes::BluetoothDevice, jint, jbyteArray)
void javaThreadErrorOccurred(int errorCode)
void setServiceDetails(const QBluetoothUuid &uuid, const QString &serviceName, QBluetooth::SecurityFlags securityFlags)
void errorOccurred(QBluetoothServer::Error)
void javaNewSocket(jobject socket)
void javaThreadErrorOccurred(int errorCode)
void setMaxPendingConnections(int maximumCount)
#define LEHUB_SCOPED_METHOD(Method)
static const char classErrorMsg[]
static const char logTag[]
static void QtBluetoothInputStreamThread_errorOccurred(JNIEnv *, jobject, jlong qtObject, jint errorCode)
static void QtBluetoothInputStreamThread_readyData(JNIEnv *, jobject, jlong qtObject, jbyteArray buffer, jint bufferLength)
static void QtBluetoothSocketServer_newSocket(JNIEnv *, jobject, jlong qtObject, QtJniTypes::BluetoothSocket socket)
static void QtBluetoothSocketServer_errorOccurred(JNIEnv *, jobject, jlong qtObject, jint errorCode)
static bool registerNatives()
QString valueFromStaticFieldCache(const char *key, const char *className, const char *fieldName)