| 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 QAMBIENTLIGHTSENSOR_H |
| 5 | #define QAMBIENTLIGHTSENSOR_H |
| 6 | |
| 7 | #include <QtSensors/qsensor.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | class QAmbientLightReadingPrivate; |
| 12 | |
| 13 | class Q_SENSORS_EXPORT QAmbientLightReading : public QSensorReading |
| 14 | { |
| 15 | Q_OBJECT |
| 16 | Q_PROPERTY(LightLevel lightLevel READ lightLevel) |
| 17 | DECLARE_READING(QAmbientLightReading) |
| 18 | public: |
| 19 | enum LightLevel { |
| 20 | Undefined = 0, |
| 21 | Dark, |
| 22 | Twilight, |
| 23 | Light, |
| 24 | Bright, |
| 25 | Sunny |
| 26 | }; |
| 27 | Q_ENUM(LightLevel) |
| 28 | |
| 29 | LightLevel lightLevel() const; |
| 30 | void setLightLevel(LightLevel lightLevel); |
| 31 | }; |
| 32 | |
| 33 | class Q_SENSORS_EXPORT QAmbientLightFilter : public QSensorFilter |
| 34 | { |
| 35 | public: |
| 36 | virtual bool filter(QAmbientLightReading *reading) = 0; |
| 37 | private: |
| 38 | bool filter(QSensorReading *reading) override; |
| 39 | }; |
| 40 | |
| 41 | class Q_SENSORS_EXPORT QAmbientLightSensor : public QSensor |
| 42 | { |
| 43 | Q_OBJECT |
| 44 | public: |
| 45 | explicit QAmbientLightSensor(QObject *parent = nullptr); |
| 46 | virtual ~QAmbientLightSensor(); |
| 47 | QAmbientLightReading *reading() const; |
| 48 | static char const * const sensorType; |
| 49 | |
| 50 | private: |
| 51 | Q_DISABLE_COPY(QAmbientLightSensor) |
| 52 | }; |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | #endif |
| 57 |
