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

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