1// qsensor.sip generated by MetaSIP
2//
3// This file is part of the QtSensors Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23%If (Qt_5_1_0 -)
24typedef quint64 qtimestamp;
25%End
26%If (Qt_5_1_0 -)
27typedef QList<QPair<int, int>> qrangelist;
28%End
29%If (Qt_5_1_0 -)
30
31struct qoutputrange
32{
33%TypeHeaderCode
34#include <qsensor.h>
35%End
36
37    qreal minimum;
38    qreal maximum;
39    qreal accuracy;
40};
41
42%End
43%If (Qt_5_1_0 -)
44typedef QList<qoutputrange> qoutputrangelist;
45%End
46%If (Qt_5_1_0 -)
47
48class QSensorReading : QObject /NoDefaultCtors/
49{
50%TypeHeaderCode
51#include <qsensor.h>
52%End
53
54public:
55    virtual ~QSensorReading();
56    quint64 timestamp() const;
57    void setTimestamp(quint64 timestamp);
58    int valueCount() const;
59    QVariant value(int index) const;
60};
61
62%End
63%If (Qt_5_1_0 -)
64
65class QSensorFilter
66{
67%TypeHeaderCode
68#include <qsensor.h>
69%End
70
71public:
72    virtual bool filter(QSensorReading *reading) = 0;
73
74protected:
75    QSensorFilter();
76    virtual ~QSensorFilter();
77};
78
79%End
80%If (Qt_5_1_0 -)
81
82class QSensor : QObject
83{
84%TypeHeaderCode
85#include <qsensor.h>
86%End
87
88%ConvertToSubClassCode
89    static struct class_graph {
90        const char *name;
91        sipTypeDef **type;
92        int yes, no;
93    } graph[] = {
94        {sipName_QSensor, &sipType_QSensor, 2, 1},
95        {sipName_QSensorReading, &sipType_QSensorReading, 21, -1},
96        {sipName_QAccelerometer, &sipType_QAccelerometer, -1, 3},
97        {sipName_QAltimeter, &sipType_QAltimeter, -1, 4},
98        {sipName_QAmbientLightSensor, &sipType_QAmbientLightSensor, -1, 5},
99        {sipName_QAmbientTemperatureSensor, &sipType_QAmbientTemperatureSensor, -1, 6},
100        {sipName_QCompass, &sipType_QCompass, -1, 7},
101    #if QT_VERSION >= 0x050400
102        {sipName_QDistanceSensor, &sipType_QDistanceSensor, -1, 8},
103    #else
104        {0, 0, -1, 8},
105    #endif
106        {sipName_QGyroscope, &sipType_QGyroscope, -1, 9},
107        {sipName_QHolsterSensor, &sipType_QHolsterSensor, -1, 10},
108    #if QT_VERSION >= 0x050900
109        {sipName_QHumiditySensor, &sipType_QHumiditySensor, -1, 11},
110    #else
111        {0, 0, -1, 11},
112    #endif
113        {sipName_QIRProximitySensor, &sipType_QIRProximitySensor, -1, 12},
114    #if QT_VERSION >= 0x050900
115        {sipName_QLidSensor, &sipType_QLidSensor, -1, 13},
116    #else
117        {0, 0, -1, 13},
118    #endif
119        {sipName_QLightSensor, &sipType_QLightSensor, -1, 14},
120        {sipName_QMagnetometer, &sipType_QMagnetometer, -1, 15},
121        {sipName_QOrientationSensor, &sipType_QOrientationSensor, -1, 16},
122        {sipName_QPressureSensor, &sipType_QPressureSensor, -1, 17},
123        {sipName_QProximitySensor, &sipType_QProximitySensor, -1, 18},
124        {sipName_QRotationSensor, &sipType_QRotationSensor, -1, 19},
125        {sipName_QTapSensor, &sipType_QTapSensor, -1, 20},
126        {sipName_QTiltSensor, &sipType_QTiltSensor, -1, -1},
127        {sipName_QAccelerometerReading, &sipType_QAccelerometerReading, -1, 22},
128        {sipName_QAltimeterReading, &sipType_QAltimeterReading, -1, 23},
129        {sipName_QAmbientLightReading, &sipType_QAmbientLightReading, -1, 24},
130        {sipName_QAmbientTemperatureReading, &sipType_QAmbientTemperatureReading, -1, 25},
131        {sipName_QCompassReading, &sipType_QCompassReading, -1, 26},
132    #if QT_VERSION >= 0x050400
133        {sipName_QDistanceReading, &sipType_QDistanceReading, -1, 27},
134    #else
135        {0, 0, -1, 27},
136    #endif
137        {sipName_QGyroscopeReading, &sipType_QGyroscopeReading, -1, 28},
138        {sipName_QHolsterReading, &sipType_QHolsterReading, -1, 29},
139    #if QT_VERSION >= 0x050900
140        {sipName_QHumidityReading, &sipType_QHumidityReading, -1, 30},
141    #else
142        {0, 0, -1, 30},
143    #endif
144        {sipName_QIRProximityReading, &sipType_QIRProximityReading, -1, 31},
145    #if QT_VERSION >= 0x050900
146        {sipName_QLidReading, &sipType_QLidReading, -1, 32},
147    #else
148        {0, 0, -1, 32},
149    #endif
150        {sipName_QLightReading, &sipType_QLightReading, -1, 33},
151        {sipName_QMagnetometerReading, &sipType_QMagnetometerReading, -1, 34},
152        {sipName_QOrientationReading, &sipType_QOrientationReading, -1, 35},
153        {sipName_QPressureReading, &sipType_QPressureReading, -1, 36},
154        {sipName_QProximityReading, &sipType_QProximityReading, -1, 37},
155        {sipName_QRotationReading, &sipType_QRotationReading, -1, 38},
156        {sipName_QTapReading, &sipType_QTapReading, -1, 39},
157        {sipName_QTiltReading, &sipType_QTiltReading, -1, -1},
158    };
159
160    int i = 0;
161
162    sipType = NULL;
163
164    do
165    {
166        struct class_graph *cg = &graph[i];
167
168        if (cg->name != NULL && sipCpp->inherits(cg->name))
169        {
170            sipType = *cg->type;
171            i = cg->yes;
172        }
173        else
174            i = cg->no;
175    }
176    while (i >= 0);
177%End
178
179public:
180    enum Feature
181    {
182        Buffering,
183        AlwaysOn,
184        GeoValues,
185        FieldOfView,
186        AccelerationMode,
187        SkipDuplicates,
188        AxesOrientation,
189%If (Qt_5_2_0 -)
190        PressureSensorTemperature,
191%End
192    };
193
194    enum AxesOrientationMode
195    {
196        FixedOrientation,
197        AutomaticOrientation,
198        UserOrientation,
199    };
200
201    QSensor(const QByteArray &type, QObject *parent /TransferThis/ = 0);
202    virtual ~QSensor();
203    QByteArray identifier() const;
204    void setIdentifier(const QByteArray &identifier);
205    QByteArray type() const;
206    bool connectToBackend();
207    bool isConnectedToBackend() const;
208    bool isBusy() const;
209    void setActive(bool active);
210    bool isActive() const;
211    bool isAlwaysOn() const;
212    void setAlwaysOn(bool alwaysOn);
213    bool skipDuplicates() const;
214    void setSkipDuplicates(bool skipDuplicates);
215    qrangelist availableDataRates() const;
216    int dataRate() const;
217    void setDataRate(int rate);
218    qoutputrangelist outputRanges() const;
219    int outputRange() const;
220    void setOutputRange(int index);
221    QString description() const;
222    int error() const;
223    void addFilter(QSensorFilter *filter);
224    void removeFilter(QSensorFilter *filter);
225    QList<QSensorFilter *> filters() const;
226    QSensorReading *reading() const;
227    static QList<QByteArray> sensorTypes();
228    static QList<QByteArray> sensorsForType(const QByteArray &type);
229    static QByteArray defaultSensorForType(const QByteArray &type);
230    bool isFeatureSupported(QSensor::Feature feature) const;
231    QSensor::AxesOrientationMode axesOrientationMode() const;
232    void setAxesOrientationMode(QSensor::AxesOrientationMode axesOrientationMode);
233    int currentOrientation() const;
234    void setCurrentOrientation(int currentOrientation);
235    int userOrientation() const;
236    void setUserOrientation(int userOrientation);
237    int maxBufferSize() const;
238    void setMaxBufferSize(int maxBufferSize);
239    int efficientBufferSize() const;
240    void setEfficientBufferSize(int efficientBufferSize);
241    int bufferSize() const;
242    void setBufferSize(int bufferSize);
243
244public slots:
245    bool start();
246    void stop();
247
248signals:
249    void busyChanged();
250    void activeChanged();
251    void readingChanged();
252    void sensorError(int error);
253    void availableSensorsChanged();
254    void alwaysOnChanged();
255    void dataRateChanged();
256    void skipDuplicatesChanged(bool skipDuplicates);
257    void axesOrientationModeChanged(QSensor::AxesOrientationMode axesOrientationMode /ScopesStripped=1/);
258    void currentOrientationChanged(int currentOrientation);
259    void userOrientationChanged(int userOrientation);
260    void maxBufferSizeChanged(int maxBufferSize);
261    void efficientBufferSizeChanged(int efficientBufferSize);
262    void bufferSizeChanged(int bufferSize);
263};
264
265%End
266