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

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