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
9QT_BEGIN_NAMESPACE
10
11class QMagnetometerReadingPrivate;
12
13class 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)
21public:
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
35class Q_SENSORS_EXPORT QMagnetometerFilter : public QSensorFilter
36{
37public:
38 virtual bool filter(QMagnetometerReading *reading) = 0;
39private:
40 bool filter(QSensorReading *reading) override;
41};
42
43class QMagnetometerPrivate;
44
45class Q_SENSORS_EXPORT QMagnetometer : public QSensor
46{
47 Q_OBJECT
48 Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged)
49public:
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
58Q_SIGNALS:
59 void returnGeoValuesChanged(bool returnGeoValues);
60
61private:
62 Q_DECLARE_PRIVATE(QMagnetometer)
63 Q_DISABLE_COPY(QMagnetometer)
64};
65
66QT_END_NAMESPACE
67
68#endif
69
70

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