1// Copyright (C) 2016 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QMLAMBIENTTEMPERATURESENSOR_P_H
4#define QMLAMBIENTTEMPERATURESENSOR_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include "qmlsensor_p.h"
18
19QT_BEGIN_NAMESPACE
20
21class QAmbientTemperatureSensor;
22
23class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAmbientTemperatureSensor : public QmlSensor
24{
25 Q_OBJECT
26 QML_NAMED_ELEMENT(AmbientTemperatureSensor)
27 QML_ADDED_IN_VERSION(5,1)
28public:
29 explicit QmlAmbientTemperatureSensor(QObject *parent = 0);
30 ~QmlAmbientTemperatureSensor();
31
32 QSensor *sensor() const override;
33
34private:
35 QmlSensorReading *createReading() const override;
36
37 QAmbientTemperatureSensor *m_sensor;
38};
39
40class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAmbientTemperatureReading : public QmlSensorReading
41{
42 Q_OBJECT
43 Q_PROPERTY(qreal temperature READ temperature
44 NOTIFY temperatureChanged BINDABLE bindableTemperature)
45 QML_NAMED_ELEMENT(AmbientTemperatureReading)
46 QML_UNCREATABLE("Cannot create AmbientTemperatureReading")
47 QML_ADDED_IN_VERSION(5,1)
48public:
49 explicit QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor);
50 ~QmlAmbientTemperatureReading();
51
52 qreal temperature() const;
53 QBindable<qreal> bindableTemperature() const;
54
55Q_SIGNALS:
56 void temperatureChanged();
57
58private:
59 QSensorReading *reading() const override;
60 void readingUpdate() override;
61
62 QAmbientTemperatureSensor *m_sensor;
63 Q_OBJECT_BINDABLE_PROPERTY(QmlAmbientTemperatureReading, qreal,
64 m_temperature, &QmlAmbientTemperatureReading::temperatureChanged)
65};
66
67QT_END_NAMESPACE
68#endif
69

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