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
jni_android_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 JNI_ANDROID_P_H
5
#define JNI_ANDROID_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 "
qbluetooth.h
"
19
#include <QtCore/QJniObject>
20
#include <QtCore/private/qglobal_p.h>
21
#include <QtCore/qcoreapplication_platform.h>
22
23
QT_BEGIN_NAMESPACE
24
25
// CLASS declaration implies also TYPE declaration
26
Q_DECLARE_JNI_CLASS
(QtBtBroadcastReceiver,
27
"org/qtproject/qt/android/bluetooth/QtBluetoothBroadcastReceiver"
);
28
Q_DECLARE_JNI_CLASS
(QtBtGattCharacteristic,
29
"org/qtproject/qt/android/bluetooth/QtBluetoothGattCharacteristic"
);
30
Q_DECLARE_JNI_CLASS
(QtBtGattDescriptor,
31
"org/qtproject/qt/android/bluetooth/QtBluetoothGattDescriptor"
);
32
Q_DECLARE_JNI_CLASS
(QtBtInputStreamThread,
33
"org/qtproject/qt/android/bluetooth/QtBluetoothInputStreamThread"
)
34
Q_DECLARE_JNI_CLASS
(QtBtSocketServer, "
org
/qtproject/qt/android/bluetooth/QtBluetoothSocketServer")
35
Q_DECLARE_JNI_CLASS
(QtBtLEServer, "
org
/qtproject/qt/android/bluetooth/QtBluetoothLEServer")
36
Q_DECLARE_JNI_CLASS
(QtBtLECentral, "
org
/qtproject/qt/android/bluetooth/QtBluetoothLE")
37
Q_DECLARE_JNI_CLASS
(BluetoothAdapter, "android/bluetooth/BluetoothAdapter")
38
Q_DECLARE_JNI_CLASS
(ParcelUuid, "android/os/ParcelUuid")
39
Q_DECLARE_JNI_CLASS
(AdvertiseDataBuilder, "android/bluetooth/
le
/AdvertiseData$Builder")
40
Q_DECLARE_JNI_CLASS
(AdvertiseSettingsBuilder, "android/bluetooth/
le
/AdvertiseSettings$Builder")
41
Q_DECLARE_JNI_CLASS
(BluetoothGattService, "android/bluetooth/BluetoothGattService")
42
Q_DECLARE_JNI_CLASS
(BluetoothGattDescriptor, "android/bluetooth/BluetoothGattDescriptor")
43
Q_DECLARE_JNI_CLASS
(BluetoothGattCharacteristic, "android/bluetooth/BluetoothGattCharacteristic")
44
Q_DECLARE_JNI_CLASS
(BluetoothDevice, "android/bluetooth/BluetoothDevice")
45
Q_DECLARE_JNI_CLASS
(IntentFilter, "android/content/IntentFilter")
46
Q_DECLARE_JNI_CLASS
(AndroidContext, "android/content/Context")
47
Q_DECLARE_JNI_CLASS
(UUID, "java/util/UUID")
48
49
Q_DECLARE_JNI_TYPE
(ParcelableArray, "[Landroid/os/Parcelable;")
50
Q_DECLARE_JNI_TYPE
(ParcelUuidArray, "[Landroid/os/ParcelUuid;")
51
Q_DECLARE_JNI_TYPE
(StringArray, "[Ljava/lang/String;")
52
53
Q_DECLARE_JNI_CLASS
(BluetoothManager, "android/bluetooth/BluetoothManager")
54
Q_DECLARE_JNI_CLASS
(AdvertiseData, "android/bluetooth/
le
/AdvertiseData")
55
Q_DECLARE_JNI_CLASS
(AdvertiseSettings, "android/bluetooth/
le
/AdvertiseSettings")
56
Q_DECLARE_JNI_CLASS
(InputStream, "java/io/InputStream")
57
Q_DECLARE_JNI_CLASS
(OutputStream, "java/io/OutputStream")
58
Q_DECLARE_JNI_CLASS
(BluetoothSocket, "android/bluetooth/BluetoothSocket")
59
Q_DECLARE_JNI_CLASS
(BroadcastReceiver, "android/content/BroadcastReceiver")
60
Q_DECLARE_JNI_CLASS
(BluetoothClass, "android/bluetooth/BluetoothClass")
61
Q_DECLARE_JNI_CLASS
(Parcelable, "android/os/Parcelable")
62
Q_DECLARE_JNI_CLASS
(Intent, "android/content/Intent")
63
Q_DECLARE_JNI_CLASS
(
Bundle
, "android/os/
Bundle
")
64
Q_DECLARE_JNI_CLASS
(List, "java/util/List")
65
66
// QLowEnergyHandle is a quint16, ensure it is interpreted as jint
67
template<>
68
constexpr auto QtJniTypes::Traits<
QLowEnergyHandle
>::signature()
69
{
70
return
QtJniTypes::Traits<jint>::signature();
71
}
72
73
enum
JavaNames
{
74
BluetoothAdapter = 0,
75
BluetoothDevice
,
76
ActionAclConnected
,
77
ActionAclDisconnected
,
78
ActionBondStateChanged
,
79
ActionDiscoveryStarted
,
80
ActionDiscoveryFinished
,
81
ActionFound
,
82
ActionScanModeChanged
,
83
ActionUuid
,
84
ExtraBondState
,
85
ExtraDevice
,
86
ExtraPairingKey
,
87
ExtraPairingVariant
,
88
ExtraRssi
,
89
ExtraScanMode
,
90
ExtraUuid
91
};
92
93
QString
valueFromStaticFieldCache
(
const
char
*
key
,
const
char
*
className
,
const
char
*fieldName);
94
95
96
template
<
typename
Klass, JavaNames Field>
97
QString
valueForStaticField
()
98
{
99
constexpr
auto
className
= QtJniTypes::Traits<Klass>::className();
100
constexpr
auto
fieldName = []() ->
auto
{
101
if
constexpr
(Field ==
JavaNames::ActionAclConnected
)
102
return
QtJniTypes::CTString(
"ACTION_ACL_CONNECTED"
);
103
else
if
constexpr
(Field ==
ActionAclDisconnected
)
104
return
QtJniTypes::CTString(
"ACTION_ACL_DISCONNECTED"
);
105
else
if
constexpr
(Field ==
ActionBondStateChanged
)
106
return
QtJniTypes::CTString(
"ACTION_BOND_STATE_CHANGED"
);
107
else
if
constexpr
(Field ==
ActionDiscoveryStarted
)
108
return
QtJniTypes::CTString(
"ACTION_DISCOVERY_STARTED"
);
109
else
if
constexpr
(Field ==
ActionDiscoveryFinished
)
110
return
QtJniTypes::CTString(
"ACTION_DISCOVERY_FINISHED"
);
111
else
if
constexpr
(Field ==
ActionFound
)
112
return
QtJniTypes::CTString(
"ACTION_FOUND"
);
113
else
if
constexpr
(Field ==
ActionScanModeChanged
)
114
return
QtJniTypes::CTString(
"ACTION_SCAN_MODE_CHANGED"
);
115
else
if
constexpr
(Field ==
ActionUuid
)
116
return
QtJniTypes::CTString(
"ACTION_UUID"
);
117
else
if
constexpr
(Field ==
ExtraBondState
)
118
return
QtJniTypes::CTString(
"EXTRA_BOND_STATE"
);
119
else
if
constexpr
(Field ==
ExtraDevice
)
120
return
QtJniTypes::CTString(
"EXTRA_DEVICE"
);
121
else
if
constexpr
(Field ==
ExtraPairingKey
)
122
return
QtJniTypes::CTString(
"EXTRA_PAIRING_KEY"
);
123
else
if
constexpr
(Field ==
ExtraPairingVariant
)
124
return
QtJniTypes::CTString(
"EXTRA_PAIRING_VARIANT"
);
125
else
if
constexpr
(Field ==
ExtraRssi
)
126
return
QtJniTypes::CTString(
"EXTRA_RSSI"
);
127
else
if
constexpr
(Field ==
ExtraScanMode
)
128
return
QtJniTypes::CTString(
"EXTRA_SCAN_MODE"
);
129
else
if
constexpr
(Field ==
ExtraUuid
)
130
return
QtJniTypes::CTString(
"EXTRA_UUID"
);
131
else
132
static_assert
(
QtPrivate::value_dependent_false<Field>
());
133
}();
134
135
return
valueFromStaticFieldCache
(
className
+ fieldName,
className
.data(), fieldName.data());
136
}
137
138
QT_END_NAMESPACE
139
140
#endif
// JNI_ANDROID_P_H
Q_DECLARE_JNI_TYPE
Q_DECLARE_JNI_TYPE(StringArray, "[Ljava/lang/String;")
QMap< Name, StatePointer >
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:129
valueForStaticField
QString valueForStaticField()
Definition
jni_android_p.h:97
JavaNames
JavaNames
Definition
jni_android_p.h:73
ExtraDevice
@ ExtraDevice
Definition
jni_android_p.h:85
ExtraUuid
@ ExtraUuid
Definition
jni_android_p.h:90
ExtraBondState
@ ExtraBondState
Definition
jni_android_p.h:84
ExtraRssi
@ ExtraRssi
Definition
jni_android_p.h:88
ActionScanModeChanged
@ ActionScanModeChanged
Definition
jni_android_p.h:82
ExtraPairingKey
@ ExtraPairingKey
Definition
jni_android_p.h:86
ActionFound
@ ActionFound
Definition
jni_android_p.h:81
ActionDiscoveryStarted
@ ActionDiscoveryStarted
Definition
jni_android_p.h:79
ActionAclDisconnected
@ ActionAclDisconnected
Definition
jni_android_p.h:77
ActionBondStateChanged
@ ActionBondStateChanged
Definition
jni_android_p.h:78
ActionUuid
@ ActionUuid
Definition
jni_android_p.h:83
ExtraPairingVariant
@ ExtraPairingVariant
Definition
jni_android_p.h:87
ExtraScanMode
@ ExtraScanMode
Definition
jni_android_p.h:89
BluetoothDevice
@ BluetoothDevice
Definition
jni_android_p.h:75
ActionAclConnected
@ ActionAclConnected
Definition
jni_android_p.h:76
ActionDiscoveryFinished
@ ActionDiscoveryFinished
Definition
jni_android_p.h:80
valueFromStaticFieldCache
QString valueFromStaticFieldCache(const char *key, const char *className, const char *fieldName)
Definition
jni_android.cpp:27
Q_DECLARE_JNI_CLASS
QT_BEGIN_NAMESPACE Q_DECLARE_JNI_CLASS(QtBtBroadcastReceiver, "org/qtproject/qt/android/bluetooth/QtBluetoothBroadcastReceiver")
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
org
qbluetooth.h
QLowEnergyHandle
quint16 QLowEnergyHandle
Definition
qbluetooth.h:42
key
GLuint64 key
Definition
qopengles2ext.h:2268
className
const char className[16]
[1]
Definition
qwizard.cpp:100
le
QPointer< QLineEdit > le
Definition
src_gui_kernel_qformlayout.cpp:44
QtPrivate::value_dependent_false
Definition
qttypetraits.h:60
qtconnectivity
src
bluetooth
android
jni_android_p.h
Generated by
1.10.0