Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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>
26#include <jni.h>
27
28#include <QtBluetooth/QLowEnergyCharacteristic>
29
31
33{
35public:
36 explicit LowEnergyNotificationHub(const QBluetoothAddress &remote, bool isPeripheral,
37 QObject *parent = nullptr);
39
40 static void lowEnergy_connectionChange(JNIEnv*, jobject, jlong qtObject,
41 jint errorCode, jint newState);
43 leConnectionStateChange)
44
45 static void lowEnergy_mtuChanged(JNIEnv*, jobject, jlong qtObject, jint mtu);
46 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_mtuChanged, leMtuChanged)
47
48 static void lowEnergy_servicesDiscovered(JNIEnv*, jobject, jlong qtObject,
49 jint errorCode, jstring uuidList);
51 leServicesDiscovered)
52
53 static void lowEnergy_serviceDetailsDiscovered(JNIEnv *, jobject,
54 jlong qtObject, jstring uuid,
56 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_serviceDetailsDiscovered,
57 leServiceDetailDiscoveryFinished)
58
59 static void lowEnergy_characteristicRead(JNIEnv*env, jobject, jlong qtObject,
60 jstring serviceUuid,
61 jint handle, jstring charUuid,
62 jint properties, jbyteArray data);
64 leCharacteristicRead)
65
66 static void lowEnergy_descriptorRead(JNIEnv *env, jobject, jlong qtObject,
67 jstring sUuid, jstring cUuid,
68 jint handle, jstring dUuid, jbyteArray data);
69 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_descriptorRead, leDescriptorRead)
70
71 static void lowEnergy_characteristicWritten(JNIEnv *, jobject, jlong qtObject,
72 jint charHandle, jbyteArray data,
73 jint errorCode);
75 leCharacteristicWritten)
76
77 static void lowEnergy_descriptorWritten(JNIEnv *, jobject, jlong qtObject,
78 jint descHandle, jbyteArray data,
79 jint errorCode);
81 leDescriptorWritten)
82
83 static void lowEnergy_serverDescriptorWritten(JNIEnv *, jobject, jlong qtObject,
84 QtJniTypes::BluetoothGattDescriptor descriptor,
85 jbyteArray newValue);
86 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_serverDescriptorWritten,
87 leServerDescriptorWritten)
88
89 static void lowEnergy_characteristicChanged(JNIEnv *, jobject, jlong qtObject,
90 jint charHandle, jbyteArray data);
91 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_characteristicChanged,
92 leCharacteristicChanged)
93
94 static void lowEnergy_serverCharacteristicChanged(JNIEnv *, jobject, jlong qtObject,
95 QtJniTypes::BluetoothGattCharacteristic characteristic,
96 jbyteArray newValue);
97 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_serverCharacteristicChanged,
98 leServerCharacteristicChanged)
99
100 static void lowEnergy_serviceError(JNIEnv *, jobject, jlong qtObject,
102 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_serviceError, leServiceError)
103
104 static void lowEnergy_advertisementError(JNIEnv *, jobject, jlong qtObject, jint status);
106 leServerAdvertisementError)
107
108 static void lowEnergy_remoteRssiRead(JNIEnv *, jobject, jlong qtObject, int rssi,
109 bool success);
110 Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(lowEnergy_remoteRssiRead, leRemoteRssiRead);
111
113 {
114 return jBluetoothLe;
115 }
116
117signals:
120 void mtuChanged(int mtu);
121 void remoteRssiRead(int rssi, bool success);
124 int startHandle, int endHandle);
126 int handle, const QBluetoothUuid &charUuid,
127 int properties, const QByteArray &data);
129 int handle, const QBluetoothUuid &descUuid, const QByteArray &data);
138 void advertisementError(int status);
139
140private:
141 static QReadWriteLock lock;
142
143 QJniObject jBluetoothLe;
144 long javaToCtoken;
145
146};
147
149
150#endif // LOWENERGYNOTIFICATIONHUB_H
151
void serviceDetailsDiscoveryFinished(const QString &serviceUuid, int startHandle, int endHandle)
static void lowEnergy_advertisementError(JNIEnv *, jobject, jlong qtObject, jint status)
jlong QtJniTypes::BluetoothGattDescriptor descriptor
jlong QtJniTypes::BluetoothGattCharacteristic characteristic
void characteristicRead(const QBluetoothUuid &serviceUuid, int handle, const QBluetoothUuid &charUuid, int properties, const QByteArray &data)
jlong jstring jstring jint jstring dUuid
void servicesDiscovered(QLowEnergyController::Error errorCode, const QString &uuids)
jlong jstring jint jstring jint properties
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)
static void lowEnergy_characteristicWritten(JNIEnv *, jobject, jlong qtObject, jint charHandle, jbyteArray data, jint errorCode)
jlong jstring jint jstring charUuid
void serverDescriptorWritten(const QJniObject &descriptor, const QByteArray &newValue)
void characteristicChanged(int charHandle, const QByteArray &data)
jlong QtJniTypes::BluetoothGattDescriptor jbyteArray newValue
void mtuChanged(int mtu)
jlong jstring jint jint endHandle
void descriptorRead(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid, int handle, const QBluetoothUuid &descUuid, const QByteArray &data)
void remoteRssiRead(int rssi, bool success)
LowEnergyNotificationHub(const QBluetoothAddress &remote, bool isPeripheral, QObject *parent=nullptr)
void characteristicWritten(int charHandle, const QByteArray &data, QLowEnergyService::ServiceError errorCode)
static void lowEnergy_servicesDiscovered(JNIEnv *, jobject, jlong qtObject, jint errorCode, jstring uuidList)
void descriptorWritten(int descHandle, const QByteArray &data, QLowEnergyService::ServiceError errorCode)
jlong jint jbyteArray jint errorCode
void connectionUpdated(QLowEnergyController::ControllerState newState, QLowEnergyController::Error errorCode)
void advertisementError(int status)
\inmodule QtBluetooth
\inmodule QtBluetooth
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
ControllerState
Indicates the state of the controller object.
Error
Indicates all possible error conditions found during the controller's existence.
ServiceError
This enum describes all possible error conditions during the service's existence.
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_OBJECT
#define signals