| 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 QLIGHTSENSOR_H |
| 5 | #define QLIGHTSENSOR_H |
| 6 | |
| 7 | #include <QtSensors/qsensor.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | class QLightReadingPrivate; |
| 12 | |
| 13 | class Q_SENSORS_EXPORT QLightReading : public QSensorReading |
| 14 | { |
| 15 | Q_OBJECT |
| 16 | Q_PROPERTY(qreal lux READ lux) |
| 17 | DECLARE_READING(QLightReading) |
| 18 | public: |
| 19 | qreal lux() const; |
| 20 | void setLux(qreal lux); |
| 21 | }; |
| 22 | |
| 23 | class Q_SENSORS_EXPORT QLightFilter : public QSensorFilter |
| 24 | { |
| 25 | public: |
| 26 | virtual bool filter(QLightReading *reading) = 0; |
| 27 | private: |
| 28 | bool filter(QSensorReading *reading) override; |
| 29 | }; |
| 30 | |
| 31 | class QLightSensorPrivate; |
| 32 | |
| 33 | class Q_SENSORS_EXPORT QLightSensor : public QSensor |
| 34 | { |
| 35 | Q_OBJECT |
| 36 | Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged) |
| 37 | public: |
| 38 | explicit QLightSensor(QObject *parent = nullptr); |
| 39 | virtual ~QLightSensor(); |
| 40 | QLightReading *reading() const; |
| 41 | static char const * const sensorType; |
| 42 | |
| 43 | qreal fieldOfView() const; |
| 44 | void setFieldOfView(qreal fieldOfView); |
| 45 | |
| 46 | Q_SIGNALS: |
| 47 | void fieldOfViewChanged(qreal fieldOfView); |
| 48 | |
| 49 | private: |
| 50 | Q_DECLARE_PRIVATE(QLightSensor) |
| 51 | Q_DISABLE_COPY(QLightSensor) |
| 52 | }; |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | #endif |
| 57 | |
| 58 | |