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
9QT_BEGIN_NAMESPACE
10
11class QOrientationReadingPrivate;
12
13class Q_SENSORS_EXPORT QOrientationReading : public QSensorReading
14{
15 Q_OBJECT
16 Q_PROPERTY(Orientation orientation READ orientation)
17 DECLARE_READING(QOrientationReading)
18public:
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
34class Q_SENSORS_EXPORT QOrientationFilter : public QSensorFilter
35{
36public:
37 virtual bool filter(QOrientationReading *reading) = 0;
38private:
39 bool filter(QSensorReading *reading) override;
40};
41
42class Q_SENSORS_EXPORT QOrientationSensor : public QSensor
43{
44 Q_OBJECT
45public:
46 explicit QOrientationSensor(QObject *parent = nullptr);
47 virtual ~QOrientationSensor();
48 QOrientationReading *reading() const;
49 static char const * const sensorType;
50
51private:
52 Q_DISABLE_COPY(QOrientationSensor)
53};
54
55QT_END_NAMESPACE
56
57#endif
58

source code of qtsensors/src/sensors/qorientationsensor.h