blob: 001af4dd415bd45ce2ce6ada5c46a375889db6f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef GRUESENSORIMPL_H
#define GRUESENSORIMPL_H
#include <qsensorbackend.h>
#include "gruesensor.h"
#include <qambientlightsensor.h>
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE
class gruesensorimpl : public QSensorBackend
{
Q_OBJECT
public:
static char const * const id;
gruesensorimpl(QSensor *sensor);
void start() override;
void stop() override;
private Q_SLOTS:
void lightChanged();
void increaseChance();
private:
GrueSensorReading m_reading;
QAmbientLightSensor *lightSensor;
QTimer *darkTimer;
QElapsedTimer timer;
QAmbientLightReading::LightLevel lightLevel;
};
#endif
|