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
9QT_BEGIN_NAMESPACE
10
11class QLightReadingPrivate;
12
13class Q_SENSORS_EXPORT QLightReading : public QSensorReading
14{
15 Q_OBJECT
16 Q_PROPERTY(qreal lux READ lux)
17 DECLARE_READING(QLightReading)
18public:
19 qreal lux() const;
20 void setLux(qreal lux);
21};
22
23class Q_SENSORS_EXPORT QLightFilter : public QSensorFilter
24{
25public:
26 virtual bool filter(QLightReading *reading) = 0;
27private:
28 bool filter(QSensorReading *reading) override;
29};
30
31class QLightSensorPrivate;
32
33class Q_SENSORS_EXPORT QLightSensor : public QSensor
34{
35 Q_OBJECT
36 Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged)
37public:
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
46Q_SIGNALS:
47 void fieldOfViewChanged(qreal fieldOfView);
48
49private:
50 Q_DECLARE_PRIVATE(QLightSensor)
51 Q_DISABLE_COPY(QLightSensor)
52};
53
54QT_END_NAMESPACE
55
56#endif
57
58

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