1 | // Copyright (C) 2016 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 QORIENTATIONSENSOR_H |
5 | #define QORIENTATIONSENSOR_H |
6 | |
7 | #include <QtSensors/qsensor.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QOrientationReadingPrivate; |
12 | |
13 | class Q_SENSORS_EXPORT QOrientationReading : public QSensorReading |
14 | { |
15 | Q_OBJECT |
16 | Q_PROPERTY(Orientation orientation READ orientation) |
17 | DECLARE_READING(QOrientationReading) |
18 | public: |
19 | enum Orientation { |
20 | Undefined = 0, |
21 | TopUp, |
22 | TopDown, |
23 | LeftUp, |
24 | RightUp, |
25 | FaceUp, |
26 | FaceDown |
27 | }; |
28 | Q_ENUM(Orientation) |
29 | |
30 | Orientation orientation() const; |
31 | void setOrientation(Orientation orientation); |
32 | }; |
33 | |
34 | class Q_SENSORS_EXPORT QOrientationFilter : public QSensorFilter |
35 | { |
36 | public: |
37 | virtual bool filter(QOrientationReading *reading) = 0; |
38 | private: |
39 | bool filter(QSensorReading *reading) override; |
40 | }; |
41 | |
42 | class Q_SENSORS_EXPORT QOrientationSensor : public QSensor |
43 | { |
44 | Q_OBJECT |
45 | public: |
46 | explicit QOrientationSensor(QObject *parent = nullptr); |
47 | virtual ~QOrientationSensor(); |
48 | QOrientationReading *reading() const; |
49 | static char const * const sensorType; |
50 | |
51 | private: |
52 | Q_DISABLE_COPY(QOrientationSensor) |
53 | }; |
54 | |
55 | QT_END_NAMESPACE |
56 | |
57 | #endif |
58 | |