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 QMLIRPROXIMITYSENSOR_P_H
5#define QMLIRPROXIMITYSENSOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qmlsensor_p.h"
19
20QT_BEGIN_NAMESPACE
21
22class QIRProximitySensor;
23
24class Q_SENSORSQUICK_PRIVATE_EXPORT QmlIRProximitySensor : public QmlSensor
25{
26 Q_OBJECT
27 QML_NAMED_ELEMENT(IRProximitySensor)
28 QML_ADDED_IN_VERSION(5,0)
29public:
30 explicit QmlIRProximitySensor(QObject *parent = 0);
31 ~QmlIRProximitySensor();
32
33 QSensor *sensor() const override;
34
35private:
36 QIRProximitySensor *m_sensor;
37 QmlSensorReading *createReading() const override;
38};
39
40class Q_SENSORSQUICK_PRIVATE_EXPORT QmlIRProximitySensorReading : public QmlSensorReading
41{
42 Q_OBJECT
43 Q_PROPERTY(qreal reflectance READ reflectance
44 NOTIFY reflectanceChanged BINDABLE bindableReflectance)
45 QML_NAMED_ELEMENT(IRProximityReading)
46 QML_UNCREATABLE("Cannot create IRProximityReading")
47 QML_ADDED_IN_VERSION(5,0)
48public:
49 explicit QmlIRProximitySensorReading(QIRProximitySensor *sensor);
50 ~QmlIRProximitySensorReading();
51
52 qreal reflectance() const;
53 QBindable<qreal> bindableReflectance() const;
54
55Q_SIGNALS:
56 void reflectanceChanged();
57
58private:
59 QSensorReading *reading() const override;
60 void readingUpdate() override;
61 QIRProximitySensor *m_sensor;
62 Q_OBJECT_BINDABLE_PROPERTY(QmlIRProximitySensorReading, qreal,
63 m_reflectance, &QmlIRProximitySensorReading::reflectanceChanged)
64};
65
66QT_END_NAMESPACE
67#endif
68

source code of qtsensors/src/sensorsquick/qmlirproximitysensor_p.h