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 QTILTSENSOR_H
5#define QTILTSENSOR_H
6
7#include <QtSensors/qsensor.h>
8
9QT_BEGIN_NAMESPACE
10
11class QTiltReadingPrivate;
12
13class Q_SENSORS_EXPORT QTiltReading : public QSensorReading
14{
15 Q_OBJECT
16 Q_PROPERTY(qreal yRotation READ yRotation)
17 Q_PROPERTY(qreal xRotation READ xRotation)
18 DECLARE_READING(QTiltReading)
19
20public:
21 qreal yRotation() const;
22 void setYRotation(qreal y);
23
24 qreal xRotation() const;
25 void setXRotation(qreal x);
26
27};
28
29class Q_SENSORS_EXPORT QTiltFilter : public QSensorFilter
30{
31public:
32 virtual bool filter(QTiltReading *reading) = 0;
33private:
34 bool filter(QSensorReading *reading) override;
35};
36
37class Q_SENSORS_EXPORT QTiltSensor : public QSensor
38{
39 Q_OBJECT
40public:
41 explicit QTiltSensor(QObject *parent = nullptr);
42 ~QTiltSensor();
43 QTiltReading *reading() const;
44 static char const * const sensorType;
45
46 Q_INVOKABLE void calibrate();
47
48private:
49 Q_DISABLE_COPY(QTiltSensor)
50};
51
52QT_END_NAMESPACE
53#endif
54

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