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
9QT_BEGIN_NAMESPACE
10
11class QAmbientLightReadingPrivate;
12
13class Q_SENSORS_EXPORT QAmbientLightReading : public QSensorReading
14{
15 Q_OBJECT
16 Q_PROPERTY(LightLevel lightLevel READ lightLevel)
17 DECLARE_READING(QAmbientLightReading)
18public:
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
33class Q_SENSORS_EXPORT QAmbientLightFilter : public QSensorFilter
34{
35public:
36 virtual bool filter(QAmbientLightReading *reading) = 0;
37private:
38 bool filter(QSensorReading *reading) override;
39};
40
41class Q_SENSORS_EXPORT QAmbientLightSensor : public QSensor
42{
43 Q_OBJECT
44public:
45 explicit QAmbientLightSensor(QObject *parent = nullptr);
46 virtual ~QAmbientLightSensor();
47 QAmbientLightReading *reading() const;
48 static char const * const sensorType;
49
50private:
51 Q_DISABLE_COPY(QAmbientLightSensor)
52};
53
54QT_END_NAMESPACE
55
56#endif
57

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