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
lowenergynotificationhub_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 LOWENERGYNOTIFICATIONHUB_H
5#define LOWENERGYNOTIFICATIONHUB_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/QObject>
19#include <QtCore/QReadWriteLock>
20#include <QtCore/QJniObject>
21#include <QtBluetooth/QBluetoothAddress>
22#include <QtBluetooth/QLowEnergyController>
23#include <QtBluetooth/QLowEnergyService>
24#include <QtCore/private/qglobal_p.h>
25#include "android/jni_android_p.h"
26#include <jni.h>
27
28#include <QtBluetooth/QLowEnergyCharacteristic>
29
31
33{
35public:
37 QObject *parent = nullptr);
39
40 static void lowEnergy_connectionChange(JNIEnv*, jobject, jlong qtObject,
41 jint errorCode, jint newState);
44
47
52
58
65
70
76
82
88
93
99
103
107
109 bool success);
111
113 {
114 return jBluetoothLe;
115 }
116
117signals:
120 void mtuChanged(int mtu);
121 void remoteRssiRead(int rssi, bool success);
122 void servicesDiscovered(QLowEnergyController::Error errorCode, const QString &uuids);
123 void serviceDetailsDiscoveryFinished(const QString& serviceUuid,
124 int startHandle, int endHandle);
125 void characteristicRead(const QBluetoothUuid &serviceUuid,
126 int handle, const QBluetoothUuid &charUuid,
127 int properties, const QByteArray &data);
128 void descriptorRead(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid,
129 int handle, const QBluetoothUuid &descUuid, const QByteArray &data);
130 void characteristicWritten(int charHandle, const QByteArray &data,
131 QLowEnergyService::ServiceError errorCode);
132 void descriptorWritten(int descHandle, const QByteArray &data,
133 QLowEnergyService::ServiceError errorCode);
134 void serverDescriptorWritten(const QJniObject &descriptor, const QByteArray &newValue);
135 void characteristicChanged(int charHandle, const QByteArray &data);
136 void serverCharacteristicChanged(const QJniObject &characteristic, const QByteArray &newValue);
137 void serviceError(int attributeHandle, QLowEnergyService::ServiceError errorCode);
138 void advertisementError(int status);
139
140private:
141 static QReadWriteLock lock;
142
143 QJniObject jBluetoothLe;
144 long javaToCtoken;
145
146};
147
148QT_END_NAMESPACE
149
150#endif // LOWENERGYNOTIFICATIONHUB_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 serviceDetailsDiscoveryFinished(const QString &serviceUuid, int startHandle, int endHandle)
void characteristicRead(const QBluetoothUuid &serviceUuid, int handle, const QBluetoothUuid &charUuid, int properties, const QByteArray &data)
void servicesDiscovered(QLowEnergyController::Error errorCode, const QString &uuids)
void serverCharacteristicChanged(const QJniObject &characteristic, const QByteArray &newValue)
void serviceError(int attributeHandle, QLowEnergyService::ServiceError errorCode)
Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_connectionChange, leConnectionStateChange) static void lowEnergy_mtuChanged(JNIEnv *
static void lowEnergy_connectionChange(JNIEnv *, jobject, jlong qtObject, jint errorCode, jint newState)
void serverDescriptorWritten(const QJniObject &descriptor, const QByteArray &newValue)
void characteristicChanged(int charHandle, const QByteArray &data)
void mtuChanged(int mtu)
void descriptorRead(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid, int handle, const QBluetoothUuid &descUuid, const QByteArray &data)
void remoteRssiRead(int rssi, bool success)
void characteristicWritten(int charHandle, const QByteArray &data, QLowEnergyService::ServiceError errorCode)
void descriptorWritten(int descHandle, const QByteArray &data, QLowEnergyService::ServiceError errorCode)
void advertisementError(int status)
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)