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