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 QMLPRESSURESENSOR_P_H
4#define QMLPRESSURESENSOR_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 QPressureSensor;
22
23class Q_SENSORSQUICK_PRIVATE_EXPORT QmlPressureSensor : public QmlSensor
24{
25 Q_OBJECT
26 QML_NAMED_ELEMENT(PressureSensor)
27 QML_ADDED_IN_VERSION(5,1)
28public:
29 explicit QmlPressureSensor(QObject *parent = 0);
30 ~QmlPressureSensor();
31
32 QSensor *sensor() const override;
33
34private:
35 QmlSensorReading *createReading() const override;
36
37 QPressureSensor *m_sensor;
38};
39
40class Q_SENSORSQUICK_PRIVATE_EXPORT QmlPressureReading : public QmlSensorReading
41{
42 Q_OBJECT
43 Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged BINDABLE bindablePressure)
44 Q_PROPERTY(qreal temperature READ temperature
45 NOTIFY temperatureChanged REVISION 1 BINDABLE bindableTemperature)
46 QML_NAMED_ELEMENT(PressureReading)
47 QML_UNCREATABLE("Cannot create PressureReading")
48 QML_ADDED_IN_VERSION(5,1)
49public:
50 explicit QmlPressureReading(QPressureSensor *sensor);
51 ~QmlPressureReading();
52
53 qreal pressure() const;
54 QBindable<qreal> bindablePressure() const;
55 qreal temperature() const;
56 QBindable<qreal> bindableTemperature() const;
57
58Q_SIGNALS:
59 void pressureChanged();
60 Q_REVISION(1) void temperatureChanged();
61
62private:
63 QSensorReading *reading() const override;
64 void readingUpdate() override;
65
66 QPressureSensor *m_sensor;
67 Q_OBJECT_BINDABLE_PROPERTY(QmlPressureReading, qreal,
68 m_pressure, &QmlPressureReading::pressureChanged)
69 Q_OBJECT_BINDABLE_PROPERTY(QmlPressureReading, qreal,
70 m_temperature, &QmlPressureReading::temperatureChanged)
71};
72
73QT_END_NAMESPACE
74#endif
75

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