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 QMAGNETOMETER_H |
5 | #define QMAGNETOMETER_H |
6 | |
7 | #include <QtSensors/qsensor.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QMagnetometerReadingPrivate; |
12 | |
13 | class Q_SENSORS_EXPORT QMagnetometerReading : public QSensorReading |
14 | { |
15 | Q_OBJECT |
16 | Q_PROPERTY(qreal x READ x) |
17 | Q_PROPERTY(qreal y READ y) |
18 | Q_PROPERTY(qreal z READ z) |
19 | Q_PROPERTY(qreal calibrationLevel READ calibrationLevel) |
20 | DECLARE_READING(QMagnetometerReading) |
21 | public: |
22 | qreal x() const; |
23 | void setX(qreal x); |
24 | |
25 | qreal y() const; |
26 | void setY(qreal y); |
27 | |
28 | qreal z() const; |
29 | void setZ(qreal z); |
30 | |
31 | qreal calibrationLevel() const; |
32 | void setCalibrationLevel(qreal calibrationLevel); |
33 | }; |
34 | |
35 | class Q_SENSORS_EXPORT QMagnetometerFilter : public QSensorFilter |
36 | { |
37 | public: |
38 | virtual bool filter(QMagnetometerReading *reading) = 0; |
39 | private: |
40 | bool filter(QSensorReading *reading) override; |
41 | }; |
42 | |
43 | class QMagnetometerPrivate; |
44 | |
45 | class Q_SENSORS_EXPORT QMagnetometer : public QSensor |
46 | { |
47 | Q_OBJECT |
48 | Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged) |
49 | public: |
50 | explicit QMagnetometer(QObject *parent = nullptr); |
51 | virtual ~QMagnetometer(); |
52 | QMagnetometerReading *reading() const; |
53 | static char const * const sensorType; |
54 | |
55 | bool returnGeoValues() const; |
56 | void setReturnGeoValues(bool returnGeoValues); |
57 | |
58 | Q_SIGNALS: |
59 | void returnGeoValuesChanged(bool returnGeoValues); |
60 | |
61 | private: |
62 | Q_DECLARE_PRIVATE(QMagnetometer) |
63 | Q_DISABLE_COPY(QMagnetometer) |
64 | }; |
65 | |
66 | QT_END_NAMESPACE |
67 | |
68 | #endif |
69 | |
70 | |