1 | // Copyright (C) 2016 Canonical 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 QHUMIDITYSENSOR_H |
5 | #define QHUMIDITYSENSOR_H |
6 | |
7 | #include <QtSensors/qsensor.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QHumidityReadingPrivate; |
12 | |
13 | class Q_SENSORS_EXPORT QHumidityReading : public QSensorReading |
14 | { |
15 | Q_OBJECT |
16 | Q_PROPERTY(qreal relativeHumidity READ relativeHumidity) |
17 | Q_PROPERTY(qreal absoluteHumidity READ absoluteHumidity) |
18 | |
19 | DECLARE_READING(QHumidityReading) |
20 | public: |
21 | qreal relativeHumidity() const; |
22 | void setRelativeHumidity(qreal percent); |
23 | |
24 | qreal absoluteHumidity() const; |
25 | void setAbsoluteHumidity(qreal value); |
26 | }; |
27 | |
28 | class Q_SENSORS_EXPORT QHumidityFilter : public QSensorFilter |
29 | { |
30 | public: |
31 | virtual bool filter(QHumidityReading *reading) = 0; |
32 | private: |
33 | bool filter(QSensorReading *reading) override; |
34 | }; |
35 | |
36 | class QHumiditySensorPrivate; |
37 | |
38 | class Q_SENSORS_EXPORT QHumiditySensor : public QSensor |
39 | { |
40 | Q_OBJECT |
41 | public: |
42 | explicit QHumiditySensor(QObject *parent = nullptr); |
43 | ~QHumiditySensor(); |
44 | |
45 | QHumidityReading *reading() const; |
46 | static char const * const sensorType; |
47 | |
48 | private: |
49 | Q_DECLARE_PRIVATE(QHumiditySensor) |
50 | Q_DISABLE_COPY(QHumiditySensor) |
51 | }; |
52 | |
53 | QT_END_NAMESPACE |
54 | |
55 | #endif |
56 | |