1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtSensors module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include <QtQml/qqmlextensionplugin.h> |
41 | #include <QtQml/qqml.h> |
42 | #include <QtSensors/QSensorManager> |
43 | |
44 | #include <QtSensors/qaccelerometer.h> |
45 | #include <QtSensors/qaltimeter.h> |
46 | #include <QtSensors/qambientlightsensor.h> |
47 | #include <QtSensors/qambienttemperaturesensor.h> |
48 | #include <QtSensors/qcompass.h> |
49 | #include <QtSensors/qdistancesensor.h> |
50 | #include <QtSensors/qhumiditysensor.h> |
51 | #include <QtSensors/qmagnetometer.h> |
52 | #include <QtSensors/qorientationsensor.h> |
53 | #include <QtSensors/qproximitysensor.h> |
54 | #include <QtSensors/qrotationsensor.h> |
55 | #include <QtSensors/qtapsensor.h> |
56 | #include <QtSensors/qlightsensor.h> |
57 | #include <QtSensors/qgyroscope.h> |
58 | #include <QtSensors/qirproximitysensor.h> |
59 | #include <QtSensors/qtiltsensor.h> |
60 | #include <QtSensors/qlidsensor.h> |
61 | |
62 | #include "qmlsensorglobal.h" |
63 | #include "qmlsensor.h" |
64 | #include "qmlaccelerometer.h" |
65 | #include "qmlaltimeter.h" |
66 | #include "qmlambientlightsensor.h" |
67 | #include "qmlambienttemperaturesensor.h" |
68 | #include "qmlcompass.h" |
69 | #include "qmldistancesensor.h" |
70 | #include "qmlgyroscope.h" |
71 | #include "qmlholstersensor.h" |
72 | #include "qmlhumiditysensor.h" |
73 | #include "qmlirproximitysensor.h" |
74 | #include "qmllightsensor.h" |
75 | #include "qmlmagnetometer.h" |
76 | #include "qmlorientationsensor.h" |
77 | #include "qmlpressuresensor.h" |
78 | #include "qmlproximitysensor.h" |
79 | #include "qmlrotationsensor.h" |
80 | #include "qmltapsensor.h" |
81 | #include "qmltiltsensor.h" |
82 | #include "qmlsensorgesture.h" |
83 | #include "qmllidsensor.h" |
84 | |
85 | QT_BEGIN_NAMESPACE |
86 | |
87 | static QObject *global_object_50(QQmlEngine *, QJSEngine *) |
88 | { |
89 | return new QmlSensorGlobal; |
90 | } |
91 | |
92 | class QtSensorsDeclarativeModule : public QQmlExtensionPlugin |
93 | { |
94 | Q_OBJECT |
95 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "plugin.json" ) |
96 | public: |
97 | QtSensorsDeclarativeModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { } |
98 | void registerTypes(const char *uri) override |
99 | { |
100 | char const * const package = "QtSensors" ; |
101 | if (QLatin1String(uri) != QLatin1String(package)) return; |
102 | int major; |
103 | int minor; |
104 | |
105 | // Register the 5.0 interfaces |
106 | major = 5; |
107 | minor = 0; |
108 | qmlRegisterSingletonType <QmlSensorGlobal >(uri: package, versionMajor: major, versionMinor: minor, typeName: "QmlSensors" , callback: global_object_50); |
109 | qmlRegisterUncreatableType<QmlSensorRange >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Range" , reason: QLatin1String("Cannot create Range" )); |
110 | qmlRegisterUncreatableType<QmlSensorOutputRange >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OutputRange" , reason: QLatin1String("Cannot create OutputRange" )); |
111 | qmlRegisterUncreatableType<QmlSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Sensor" , reason: QLatin1String("Cannot create Sensor" )); |
112 | qmlRegisterUncreatableType<QmlSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "SensorReading" , reason: QLatin1String("Cannot create SensorReading" )); |
113 | qmlRegisterType <QmlAccelerometer >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Accelerometer" ); |
114 | qmlRegisterUncreatableType<QmlAccelerometerReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AccelerometerReading" , reason: QLatin1String("Cannot create AccelerometerReading" )); |
115 | qmlRegisterType <QmlAmbientLightSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientLightSensor" ); |
116 | qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientLightReading" , reason: QLatin1String("Cannot create AmbientLightReading" )); |
117 | qmlRegisterType <QmlCompass >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Compass" ); |
118 | qmlRegisterUncreatableType<QmlCompassReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "CompassReading" , reason: QLatin1String("Cannot create CompassReading" )); |
119 | qmlRegisterType <QmlGyroscope >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Gyroscope" ); |
120 | qmlRegisterUncreatableType<QmlGyroscopeReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "GyroscopeReading" , reason: QLatin1String("Cannot create GyroscopeReading" )); |
121 | qmlRegisterType <QmlIRProximitySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "IRProximitySensor" ); |
122 | qmlRegisterUncreatableType<QmlIRProximitySensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "IRProximityReading" , reason: QLatin1String("Cannot create IRProximityReading" )); |
123 | qmlRegisterType <QmlLightSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LightSensor" ); |
124 | qmlRegisterUncreatableType<QmlLightSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LightReading" , reason: QLatin1String("Cannot create LightReading" )); |
125 | qmlRegisterType <QmlMagnetometer >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Magnetometer" ); |
126 | qmlRegisterUncreatableType<QmlMagnetometerReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "MagnetometerReading" , reason: QLatin1String("Cannot create MagnetometerReading" )); |
127 | qmlRegisterType <QmlOrientationSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OrientationSensor" ); |
128 | qmlRegisterUncreatableType<QmlOrientationSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OrientationReading" , reason: QLatin1String("Cannot create OrientationReading" )); |
129 | qmlRegisterType <QmlProximitySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "ProximitySensor" ); |
130 | qmlRegisterUncreatableType<QmlProximitySensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "ProximityReading" , reason: QLatin1String("Cannot create ProximityReading" )); |
131 | qmlRegisterType <QmlRotationSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "RotationSensor" ); |
132 | qmlRegisterUncreatableType<QmlRotationSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "RotationReading" , reason: QLatin1String("Cannot create RotationReading" )); |
133 | qmlRegisterType <QmlTapSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TapSensor" ); |
134 | qmlRegisterUncreatableType<QmlTapSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TapReading" , reason: QLatin1String("Cannot create TapReading" )); |
135 | qmlRegisterType <QmlTiltSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TiltSensor" ); |
136 | qmlRegisterUncreatableType<QmlTiltSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TiltReading" , reason: QLatin1String("Cannot create TiltReading" )); |
137 | |
138 | qmlRegisterType <QmlSensorGesture >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "SensorGesture" ); |
139 | |
140 | // Register the 5.1 interfaces |
141 | minor = 1; |
142 | qmlRegisterSingletonType <QmlSensorGlobal >(uri: package, versionMajor: major, versionMinor: minor, typeName: "QmlSensors" , callback: global_object_50); |
143 | qmlRegisterUncreatableType<QmlSensorRange >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Range" , reason: QLatin1String("Cannot create Range" )); |
144 | qmlRegisterUncreatableType<QmlSensorOutputRange >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OutputRange" , reason: QLatin1String("Cannot create OutputRange" )); |
145 | qmlRegisterUncreatableType<QmlSensor,1 >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Sensor" , reason: QLatin1String("Cannot create Sensor" )); |
146 | qmlRegisterUncreatableType<QmlSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "SensorReading" , reason: QLatin1String("Cannot create SensorReading" )); |
147 | qmlRegisterType <QmlAccelerometer,1 >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Accelerometer" ); |
148 | qmlRegisterUncreatableType<QmlAccelerometerReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AccelerometerReading" , reason: QLatin1String("Cannot create AccelerometerReading" )); |
149 | qmlRegisterType <QmlAltimeter >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Altimeter" ); |
150 | qmlRegisterUncreatableType<QmlAltimeterReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AltimeterReading" , reason: QLatin1String("Cannot create AltimeterReading" )); |
151 | qmlRegisterType <QmlAmbientLightSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientLightSensor" ); |
152 | qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientLightReading" , reason: QLatin1String("Cannot create AmbientLightReading" )); |
153 | qmlRegisterType <QmlAmbientTemperatureSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientTemperatureSensor" ); |
154 | qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientTemperatureReading" , reason: QLatin1String("Cannot create AmbientTemperatureReading" )); |
155 | qmlRegisterType <QmlCompass >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Compass" ); |
156 | qmlRegisterUncreatableType<QmlCompassReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "CompassReading" , reason: QLatin1String("Cannot create CompassReading" )); |
157 | qmlRegisterType <QmlGyroscope >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Gyroscope" ); |
158 | qmlRegisterUncreatableType<QmlGyroscopeReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "GyroscopeReading" , reason: QLatin1String("Cannot create GyroscopeReading" )); |
159 | qmlRegisterType <QmlHolsterSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "HolsterSensor" ); |
160 | qmlRegisterUncreatableType<QmlHolsterReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "HolsterReading" , reason: QLatin1String("Cannot create HolsterReading" )); |
161 | qmlRegisterType <QmlIRProximitySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "IRProximitySensor" ); |
162 | qmlRegisterUncreatableType<QmlIRProximitySensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "IRProximityReading" , reason: QLatin1String("Cannot create IRProximityReading" )); |
163 | qmlRegisterType <QmlLightSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LightSensor" ); |
164 | qmlRegisterUncreatableType<QmlLightSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LightReading" , reason: QLatin1String("Cannot create LightReading" )); |
165 | qmlRegisterType <QmlMagnetometer >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Magnetometer" ); |
166 | qmlRegisterUncreatableType<QmlMagnetometerReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "MagnetometerReading" , reason: QLatin1String("Cannot create MagnetometerReading" )); |
167 | qmlRegisterType <QmlOrientationSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OrientationSensor" ); |
168 | qmlRegisterUncreatableType<QmlOrientationSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OrientationReading" , reason: QLatin1String("Cannot create OrientationReading" )); |
169 | qmlRegisterType <QmlPressureSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "PressureSensor" ); |
170 | qmlRegisterUncreatableType<QmlPressureReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "PressureReading" , reason: QLatin1String("Cannot create PressureReading" )); |
171 | qmlRegisterType <QmlProximitySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "ProximitySensor" ); |
172 | qmlRegisterUncreatableType<QmlProximitySensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "ProximityReading" , reason: QLatin1String("Cannot create ProximityReading" )); |
173 | qmlRegisterType <QmlRotationSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "RotationSensor" ); |
174 | qmlRegisterUncreatableType<QmlRotationSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "RotationReading" , reason: QLatin1String("Cannot create RotationReading" )); |
175 | qmlRegisterType <QmlTapSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TapSensor" ); |
176 | qmlRegisterUncreatableType<QmlTapSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TapReading" , reason: QLatin1String("Cannot create TapReading" )); |
177 | qmlRegisterType <QmlTiltSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TiltSensor" ); |
178 | qmlRegisterUncreatableType<QmlTiltSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TiltReading" , reason: QLatin1String("Cannot create TiltReading" )); |
179 | |
180 | qmlRegisterType <QmlSensorGesture >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "SensorGesture" ); |
181 | |
182 | // Register the 5.2 interfaces |
183 | minor = 2; |
184 | qmlRegisterSingletonType <QmlSensorGlobal >(uri: package, versionMajor: major, versionMinor: minor, typeName: "QmlSensors" , callback: global_object_50); |
185 | qmlRegisterUncreatableType<QmlSensorRange >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Range" , reason: QLatin1String("Cannot create Range" )); |
186 | qmlRegisterUncreatableType<QmlSensorOutputRange >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OutputRange" , reason: QLatin1String("Cannot create OutputRange" )); |
187 | qmlRegisterUncreatableType<QmlSensor,1 >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Sensor" , reason: QLatin1String("Cannot create Sensor" )); |
188 | qmlRegisterUncreatableType<QmlSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "SensorReading" , reason: QLatin1String("Cannot create SensorReading" )); |
189 | qmlRegisterType <QmlAccelerometer,1 >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Accelerometer" ); |
190 | qmlRegisterUncreatableType<QmlAccelerometerReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AccelerometerReading" , reason: QLatin1String("Cannot create AccelerometerReading" )); |
191 | qmlRegisterType <QmlAltimeter >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Altimeter" ); |
192 | qmlRegisterUncreatableType<QmlAltimeterReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AltimeterReading" , reason: QLatin1String("Cannot create AltimeterReading" )); |
193 | qmlRegisterType <QmlAmbientLightSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientLightSensor" ); |
194 | qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientLightReading" , reason: QLatin1String("Cannot create AmbientLightReading" )); |
195 | qmlRegisterType <QmlAmbientTemperatureSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientTemperatureSensor" ); |
196 | qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(uri: package, versionMajor: major, versionMinor: minor, qmlName: "AmbientTemperatureReading" , reason: QLatin1String("Cannot create AmbientTemperatureReading" )); |
197 | qmlRegisterType <QmlCompass >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Compass" ); |
198 | qmlRegisterUncreatableType<QmlCompassReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "CompassReading" , reason: QLatin1String("Cannot create CompassReading" )); |
199 | qmlRegisterType <QmlGyroscope >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Gyroscope" ); |
200 | qmlRegisterUncreatableType<QmlGyroscopeReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "GyroscopeReading" , reason: QLatin1String("Cannot create GyroscopeReading" )); |
201 | qmlRegisterType <QmlHolsterSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "HolsterSensor" ); |
202 | qmlRegisterUncreatableType<QmlHolsterReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "HolsterReading" , reason: QLatin1String("Cannot create HolsterReading" )); |
203 | qmlRegisterType <QmlIRProximitySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "IRProximitySensor" ); |
204 | qmlRegisterUncreatableType<QmlIRProximitySensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "IRProximityReading" , reason: QLatin1String("Cannot create IRProximityReading" )); |
205 | qmlRegisterType <QmlLightSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LightSensor" ); |
206 | qmlRegisterUncreatableType<QmlLightSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LightReading" , reason: QLatin1String("Cannot create LightReading" )); |
207 | qmlRegisterType <QmlMagnetometer >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "Magnetometer" ); |
208 | qmlRegisterUncreatableType<QmlMagnetometerReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "MagnetometerReading" , reason: QLatin1String("Cannot create MagnetometerReading" )); |
209 | qmlRegisterType <QmlOrientationSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OrientationSensor" ); |
210 | qmlRegisterUncreatableType<QmlOrientationSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "OrientationReading" , reason: QLatin1String("Cannot create OrientationReading" )); |
211 | qmlRegisterType <QmlPressureSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "PressureSensor" ); |
212 | qmlRegisterUncreatableType<QmlPressureReading,1 >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "PressureReading" , reason: QLatin1String("Cannot create PressureReading" )); |
213 | qmlRegisterType <QmlProximitySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "ProximitySensor" ); |
214 | qmlRegisterUncreatableType<QmlProximitySensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "ProximityReading" , reason: QLatin1String("Cannot create ProximityReading" )); |
215 | qmlRegisterType <QmlRotationSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "RotationSensor" ); |
216 | qmlRegisterUncreatableType<QmlRotationSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "RotationReading" , reason: QLatin1String("Cannot create RotationReading" )); |
217 | qmlRegisterType <QmlTapSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TapSensor" ); |
218 | qmlRegisterUncreatableType<QmlTapSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TapReading" , reason: QLatin1String("Cannot create TapReading" )); |
219 | qmlRegisterType <QmlTiltSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TiltSensor" ); |
220 | qmlRegisterUncreatableType<QmlTiltSensorReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "TiltReading" , reason: QLatin1String("Cannot create TiltReading" )); |
221 | |
222 | qmlRegisterType <QmlSensorGesture >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "SensorGesture" ); |
223 | |
224 | // Register the 5.4 interfaces |
225 | minor = 4; |
226 | qmlRegisterType <QmlDistanceSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "DistanceSensor" ); |
227 | qmlRegisterUncreatableType<QmlDistanceReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "DistanceReading" , reason: QLatin1String("Cannot create DistanceReading" )); |
228 | |
229 | // Register the new 5.9 interfaces |
230 | // Implicitly registers 5.3 - 5.8 too |
231 | minor = 9; |
232 | qmlRegisterType <QmlLidSensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LidSensor" ); |
233 | qmlRegisterUncreatableType<QmlLidReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "LidReading" , reason: QLatin1String("Cannot create LidReading" )); |
234 | qmlRegisterType <QmlHumiditySensor >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "HumiditySensor" ); |
235 | qmlRegisterUncreatableType<QmlHumidityReading >(uri: package, versionMajor: major, versionMinor: minor, qmlName: "HumidityReading" , reason: QLatin1String("Cannot create HumidityReading" )); |
236 | |
237 | // Register the latest Qt version as QML type version |
238 | qmlRegisterModule(uri: package, QT_VERSION_MAJOR, QT_VERSION_MINOR); |
239 | } |
240 | }; |
241 | |
242 | QT_END_NAMESPACE |
243 | |
244 | #include "sensors.moc" |
245 | |