summaryrefslogtreecommitdiffstats
path: root/src/imports/sensors
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/sensors')
-rw-r--r--src/imports/sensors/plugins.qmltypes181
-rw-r--r--src/imports/sensors/qmlaccelerometer.cpp21
-rw-r--r--src/imports/sensors/qmlaccelerometer.h17
-rw-r--r--src/imports/sensors/qmlaltimeter.cpp133
-rw-r--r--src/imports/sensors/qmlaltimeter.h86
-rw-r--r--src/imports/sensors/qmlambientlightsensor.h2
-rw-r--r--src/imports/sensors/qmlambienttemperaturesensor.cpp133
-rw-r--r--src/imports/sensors/qmlambienttemperaturesensor.h86
-rw-r--r--src/imports/sensors/qmlcompass.h2
-rw-r--r--src/imports/sensors/qmlgyroscope.h2
-rw-r--r--src/imports/sensors/qmlholstersensor.cpp133
-rw-r--r--src/imports/sensors/qmlholstersensor.h86
-rw-r--r--src/imports/sensors/qmlirproximitysensor.h2
-rw-r--r--src/imports/sensors/qmllightsensor.cpp10
-rw-r--r--src/imports/sensors/qmllightsensor.h6
-rw-r--r--src/imports/sensors/qmlmagnetometer.cpp7
-rw-r--r--src/imports/sensors/qmlmagnetometer.h5
-rw-r--r--src/imports/sensors/qmlorientationsensor.h2
-rw-r--r--src/imports/sensors/qmlpressuresensor.cpp133
-rw-r--r--src/imports/sensors/qmlpressuresensor.h86
-rw-r--r--src/imports/sensors/qmlproximitysensor.h2
-rw-r--r--src/imports/sensors/qmlrotationsensor.cpp3
-rw-r--r--src/imports/sensors/qmlrotationsensor.h6
-rw-r--r--src/imports/sensors/qmlsensor.cpp120
-rw-r--r--src/imports/sensors/qmlsensor.h45
-rw-r--r--src/imports/sensors/qmlsensorglobal.h2
-rw-r--r--src/imports/sensors/qmlsensorrange.h2
-rw-r--r--src/imports/sensors/qmltapsensor.cpp8
-rw-r--r--src/imports/sensors/qmltapsensor.h5
-rw-r--r--src/imports/sensors/qmltiltsensor.h2
-rw-r--r--src/imports/sensors/sensors.cpp49
-rw-r--r--src/imports/sensors/sensors.pro10
32 files changed, 1304 insertions, 83 deletions
diff --git a/src/imports/sensors/plugins.qmltypes b/src/imports/sensors/plugins.qmltypes
index 687a1f25..2deff792 100644
--- a/src/imports/sensors/plugins.qmltypes
+++ b/src/imports/sensors/plugins.qmltypes
@@ -3,90 +3,146 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtSensors 5.0 /home/thomas/src/qtbase/imports/'.
+// This file was auto-generated with the command 'qmlplugindump QtSensors 5.0 /home/thomas/src/qtbase/qml'.
Module {
Component {
name: "QmlAccelerometer"
prototype: "QmlSensor"
- exports: ["Accelerometer 5.0"]
+ exports: ["Accelerometer 5.0", "Accelerometer 5.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Enum {
+ name: "AccelerationMode"
+ values: {
+ "Combined": 0,
+ "Gravity": 1,
+ "User": 2
+ }
+ }
+ Property { name: "accelerationMode"; revision: 1; type: "AccelerationMode" }
+ Signal {
+ name: "accelerationModeChanged"
+ Parameter { name: "accelerationMode"; type: "AccelerationMode" }
+ }
}
Component {
name: "QmlAccelerometerReading"
prototype: "QmlSensorReading"
- exports: ["AccelerometerReading 5.0"]
+ exports: ["AccelerometerReading 5.0", "AccelerometerReading 5.1"]
Property { name: "x"; type: "double"; isReadonly: true }
Property { name: "y"; type: "double"; isReadonly: true }
Property { name: "z"; type: "double"; isReadonly: true }
}
Component {
+ name: "QmlAltimeter"
+ prototype: "QmlSensor"
+ exports: ["Altimeter 5.1"]
+ }
+ Component {
+ name: "QmlAltimeterReading"
+ prototype: "QmlSensorReading"
+ exports: ["AltimeterReading 5.1"]
+ Property { name: "altitude"; type: "double"; isReadonly: true }
+ }
+ Component {
name: "QmlAmbientLightSensor"
prototype: "QmlSensor"
- exports: ["AmbientLightSensor 5.0"]
+ exports: ["AmbientLightSensor 5.0", "AmbientLightSensor 5.1"]
}
Component {
name: "QmlAmbientLightSensorReading"
prototype: "QmlSensorReading"
- exports: ["AmbientLightReading 5.0"]
+ exports: ["AmbientLightReading 5.0", "AmbientLightReading 5.1"]
Property { name: "lightLevel"; type: "QAmbientLightReading::LightLevel"; isReadonly: true }
}
Component {
+ name: "QmlAmbientTemperatureReading"
+ prototype: "QmlSensorReading"
+ exports: ["AmbientTemperatureReading 5.1"]
+ Property { name: "temperature"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QmlAmbientTemperatureSensor"
+ prototype: "QmlSensor"
+ exports: ["AmbientTemperatureSensor 5.1"]
+ }
+ Component {
name: "QmlCompass"
prototype: "QmlSensor"
- exports: ["Compass 5.0"]
+ exports: ["Compass 5.0", "Compass 5.1"]
}
Component {
name: "QmlCompassReading"
prototype: "QmlSensorReading"
- exports: ["CompassReading 5.0"]
+ exports: ["CompassReading 5.0", "CompassReading 5.1"]
Property { name: "azimuth"; type: "double"; isReadonly: true }
Property { name: "calibrationLevel"; type: "double"; isReadonly: true }
}
Component {
name: "QmlGyroscope"
prototype: "QmlSensor"
- exports: ["Gyroscope 5.0"]
+ exports: ["Gyroscope 5.0", "Gyroscope 5.1"]
}
Component {
name: "QmlGyroscopeReading"
prototype: "QmlSensorReading"
- exports: ["GyroscopeReading 5.0"]
+ exports: ["GyroscopeReading 5.0", "GyroscopeReading 5.1"]
Property { name: "x"; type: "double"; isReadonly: true }
Property { name: "y"; type: "double"; isReadonly: true }
Property { name: "z"; type: "double"; isReadonly: true }
}
Component {
+ name: "QmlHolsterReading"
+ prototype: "QmlSensorReading"
+ exports: ["HolsterReading 5.1"]
+ Property { name: "holstered"; type: "bool"; isReadonly: true }
+ }
+ Component {
+ name: "QmlHolsterSensor"
+ prototype: "QmlSensor"
+ exports: ["HolsterSensor 5.1"]
+ }
+ Component {
name: "QmlIRProximitySensor"
prototype: "QmlSensor"
- exports: ["IRProximitySensor 5.0"]
+ exports: ["IRProximitySensor 5.0", "IRProximitySensor 5.1"]
}
Component {
name: "QmlIRProximitySensorReading"
prototype: "QmlSensorReading"
- exports: ["IRProximityReading 5.0"]
+ exports: ["IRProximityReading 5.0", "IRProximityReading 5.1"]
Property { name: "reflectance"; type: "double"; isReadonly: true }
}
Component {
name: "QmlLightSensor"
prototype: "QmlSensor"
- exports: ["LightSensor 5.0"]
+ exports: ["LightSensor 5.0", "LightSensor 5.1"]
Property { name: "fieldOfView"; type: "double"; isReadonly: true }
+ Signal {
+ name: "fieldOfViewChanged"
+ Parameter { name: "fieldOfView"; type: "double" }
+ }
}
Component {
name: "QmlLightSensorReading"
prototype: "QmlSensorReading"
- exports: ["LightReading 5.0"]
+ exports: ["LightReading 5.0", "LightReading 5.1"]
Property { name: "illuminance"; type: "double"; isReadonly: true }
}
Component {
name: "QmlMagnetometer"
prototype: "QmlSensor"
- exports: ["Magnetometer 5.0"]
+ exports: ["Magnetometer 5.0", "Magnetometer 5.1"]
+ Property { name: "returnGeoValues"; type: "bool" }
+ Signal {
+ name: "returnGeoValuesChanged"
+ Parameter { name: "returnGeoValues"; type: "bool" }
+ }
}
Component {
name: "QmlMagnetometerReading"
prototype: "QmlSensorReading"
- exports: ["MagnetometerReading 5.0"]
+ exports: ["MagnetometerReading 5.0", "MagnetometerReading 5.1"]
Property { name: "x"; type: "double"; isReadonly: true }
Property { name: "y"; type: "double"; isReadonly: true }
Property { name: "z"; type: "double"; isReadonly: true }
@@ -95,35 +151,50 @@ Module {
Component {
name: "QmlOrientationSensor"
prototype: "QmlSensor"
- exports: ["OrientationSensor 5.0"]
+ exports: ["OrientationSensor 5.0", "OrientationSensor 5.1"]
}
Component {
name: "QmlOrientationSensorReading"
prototype: "QmlSensorReading"
- exports: ["OrientationReading 5.0"]
+ exports: ["OrientationReading 5.0", "OrientationReading 5.1"]
Property { name: "orientation"; type: "QOrientationReading::Orientation"; isReadonly: true }
}
Component {
+ name: "QmlPressureReading"
+ prototype: "QmlSensorReading"
+ exports: ["PressureReading 5.1"]
+ Property { name: "pressure"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QmlPressureSensor"
+ prototype: "QmlSensor"
+ exports: ["PressureSensor 5.1"]
+ }
+ Component {
name: "QmlProximitySensor"
prototype: "QmlSensor"
- exports: ["ProximitySensor 5.0"]
+ exports: ["ProximitySensor 5.0", "ProximitySensor 5.1"]
}
Component {
name: "QmlProximitySensorReading"
prototype: "QmlSensorReading"
- exports: ["ProximityReading 5.0"]
+ exports: ["ProximityReading 5.0", "ProximityReading 5.1"]
Property { name: "near"; type: "bool"; isReadonly: true }
}
Component {
name: "QmlRotationSensor"
prototype: "QmlSensor"
- exports: ["RotationSensor 5.0"]
+ exports: ["RotationSensor 5.0", "RotationSensor 5.1"]
Property { name: "hasZ"; type: "bool"; isReadonly: true }
+ Signal {
+ name: "hasZChanged"
+ Parameter { name: "hasZ"; type: "bool" }
+ }
}
Component {
name: "QmlRotationSensorReading"
prototype: "QmlSensorReading"
- exports: ["RotationReading 5.0"]
+ exports: ["RotationReading 5.0", "RotationReading 5.1"]
Property { name: "x"; type: "double"; isReadonly: true }
Property { name: "y"; type: "double"; isReadonly: true }
Property { name: "z"; type: "double"; isReadonly: true }
@@ -131,7 +202,16 @@ Module {
Component {
name: "QmlSensor"
prototype: "QObject"
- exports: ["Sensor 5.0"]
+ exports: ["Sensor 5.0", "Sensor 5.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Enum {
+ name: "AxesOrientationMode"
+ values: {
+ "FixedOrientation": 0,
+ "AutomaticOrientation": 1,
+ "UserOrientation": 2
+ }
+ }
Property { name: "identifier"; type: "string" }
Property { name: "type"; type: "string"; isReadonly: true }
Property { name: "connectedToBackend"; type: "bool"; isReadonly: true }
@@ -145,13 +225,48 @@ Module {
Property { name: "description"; type: "string"; isReadonly: true }
Property { name: "error"; type: "int"; isReadonly: true }
Property { name: "alwaysOn"; type: "bool" }
+ Property { name: "skipDuplicates"; revision: 1; type: "bool" }
+ Property { name: "axesOrientationMode"; revision: 1; type: "AxesOrientationMode" }
+ Property { name: "currentOrientation"; revision: 1; type: "int"; isReadonly: true }
+ Property { name: "userOrientation"; revision: 1; type: "int" }
+ Property { name: "maxBufferSize"; revision: 1; type: "int"; isReadonly: true }
+ Property { name: "efficientBufferSize"; revision: 1; type: "int"; isReadonly: true }
+ Property { name: "bufferSize"; revision: 1; type: "int" }
+ Signal {
+ name: "skipDuplicatesChanged"
+ Parameter { name: "skipDuplicates"; type: "bool" }
+ }
+ Signal {
+ name: "axesOrientationModeChanged"
+ Parameter { name: "axesOrientationMode"; type: "AxesOrientationMode" }
+ }
+ Signal {
+ name: "currentOrientationChanged"
+ Parameter { name: "currentOrientation"; type: "int" }
+ }
+ Signal {
+ name: "userOrientationChanged"
+ Parameter { name: "userOrientation"; type: "int" }
+ }
+ Signal {
+ name: "maxBufferSizeChanged"
+ Parameter { name: "maxBufferSize"; type: "int" }
+ }
+ Signal {
+ name: "efficientBufferSizeChanged"
+ Parameter { name: "efficientBufferSize"; type: "int" }
+ }
+ Signal {
+ name: "bufferSizeChanged"
+ Parameter { name: "bufferSize"; type: "int" }
+ }
Method { name: "start"; type: "bool" }
Method { name: "stop" }
}
Component {
name: "QmlSensorGesture"
prototype: "QObject"
- exports: ["SensorGesture 5.0"]
+ exports: ["SensorGesture 5.0", "SensorGesture 5.1"]
Property { name: "availableGestures"; type: "QStringList"; isReadonly: true }
Property { name: "gestures"; type: "QStringList" }
Property { name: "validGestures"; type: "QStringList"; isReadonly: true }
@@ -165,7 +280,7 @@ Module {
Component {
name: "QmlSensorGlobal"
prototype: "QObject"
- exports: ["QmlSensors 5.0"]
+ exports: ["QmlSensors 5.0", "QmlSensors 5.1"]
Signal { name: "availableSensorsChanged" }
Method { name: "sensorTypes"; type: "QStringList" }
Method {
@@ -182,7 +297,7 @@ Module {
Component {
name: "QmlSensorOutputRange"
prototype: "QObject"
- exports: ["OutputRange 5.0"]
+ exports: ["OutputRange 5.0", "OutputRange 5.1"]
Property { name: "minimum"; type: "double"; isReadonly: true }
Property { name: "maximum"; type: "double"; isReadonly: true }
Property { name: "accuracy"; type: "double"; isReadonly: true }
@@ -190,26 +305,30 @@ Module {
Component {
name: "QmlSensorRange"
prototype: "QObject"
- exports: ["Range 5.0"]
+ exports: ["Range 5.0", "Range 5.1"]
Property { name: "minimum"; type: "int"; isReadonly: true }
Property { name: "maximum"; type: "int"; isReadonly: true }
}
Component {
name: "QmlSensorReading"
prototype: "QObject"
- exports: ["SensorReading 5.0"]
+ exports: ["SensorReading 5.0", "SensorReading 5.1"]
Property { name: "timestamp"; type: "qulonglong"; isReadonly: true }
}
Component {
name: "QmlTapSensor"
prototype: "QmlSensor"
- exports: ["TapSensor 5.0"]
+ exports: ["TapSensor 5.0", "TapSensor 5.1"]
Property { name: "returnDoubleTapEvents"; type: "bool" }
+ Signal {
+ name: "returnDoubleTapEventsChanged"
+ Parameter { name: "returnDoubleTapEvents"; type: "bool" }
+ }
}
Component {
name: "QmlTapSensorReading"
prototype: "QmlSensorReading"
- exports: ["TapReading 5.0"]
+ exports: ["TapReading 5.0", "TapReading 5.1"]
Property { name: "tapDirection"; type: "QTapReading::TapDirection"; isReadonly: true }
Property { name: "doubleTap"; type: "bool"; isReadonly: true }
Signal { name: "isDoubleTapChanged" }
@@ -217,13 +336,13 @@ Module {
Component {
name: "QmlTiltSensor"
prototype: "QmlSensor"
- exports: ["TiltSensor 5.0"]
+ exports: ["TiltSensor 5.0", "TiltSensor 5.1"]
Method { name: "calibrate" }
}
Component {
name: "QmlTiltSensorReading"
prototype: "QmlSensorReading"
- exports: ["TiltReading 5.0"]
+ exports: ["TiltReading 5.0", "TiltReading 5.1"]
Property { name: "yRotation"; type: "double"; isReadonly: true }
Property { name: "xRotation"; type: "double"; isReadonly: true }
}
diff --git a/src/imports/sensors/qmlaccelerometer.cpp b/src/imports/sensors/qmlaccelerometer.cpp
index 390f8beb..6fc82eab 100644
--- a/src/imports/sensors/qmlaccelerometer.cpp
+++ b/src/imports/sensors/qmlaccelerometer.cpp
@@ -65,12 +65,33 @@ QmlAccelerometer::QmlAccelerometer(QObject *parent)
: QmlSensor(parent)
, m_sensor(new QAccelerometer(this))
{
+ connect(m_sensor, SIGNAL(accelerationModeChanged(AccelerationMode)),
+ this, SIGNAL(accelerationModeChanged(AccelerationMode)));
}
QmlAccelerometer::~QmlAccelerometer()
{
}
+/*!
+ \qmlproperty AccelerationMode Accelerometer::accelerationMode
+ \since QtSensors 5.1
+
+ This property holds the current acceleration mode.
+
+ Please see QAccelerometer::accelerationMode for information about this property.
+*/
+
+QmlAccelerometer::AccelerationMode QmlAccelerometer::accelerationMode() const
+{
+ return static_cast<QmlAccelerometer::AccelerationMode>(m_sensor->accelerationMode());
+}
+
+void QmlAccelerometer::setAccelerationMode(QmlAccelerometer::AccelerationMode accelerationMode)
+{
+ m_sensor->setAccelerationMode(static_cast<QAccelerometer::AccelerationMode>(accelerationMode));
+}
+
QmlSensorReading *QmlAccelerometer::createReading() const
{
return new QmlAccelerometerReading(m_sensor);
diff --git a/src/imports/sensors/qmlaccelerometer.h b/src/imports/sensors/qmlaccelerometer.h
index 95785ed4..7a9a4cd0 100644
--- a/src/imports/sensors/qmlaccelerometer.h
+++ b/src/imports/sensors/qmlaccelerometer.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QAccelerometer;
@@ -52,10 +51,25 @@ class QAccelerometer;
class QmlAccelerometer : public QmlSensor
{
Q_OBJECT
+ Q_ENUMS(AccelerationMode)
+ Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode
+ NOTIFY accelerationModeChanged REVISION 1)
public:
explicit QmlAccelerometer(QObject *parent = 0);
~QmlAccelerometer();
+ // Keep this enum in sync with QAccelerometer::AccelerationMode
+ enum AccelerationMode {
+ Combined,
+ Gravity,
+ User
+ };
+
+ AccelerationMode accelerationMode() const;
+ void setAccelerationMode(AccelerationMode accelerationMode);
+
+signals:
+ void accelerationModeChanged(AccelerationMode accelerationMode);
private:
QSensor *sensor() const Q_DECL_OVERRIDE;
@@ -92,5 +106,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlaltimeter.cpp b/src/imports/sensors/qmlaltimeter.cpp
new file mode 100644
index 00000000..abe3f922
--- /dev/null
+++ b/src/imports/sensors/qmlaltimeter.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qmlaltimeter.h"
+#include <QAltimeter>
+
+/*!
+ \qmltype Altimeter
+ \instantiates QmlAltimeter
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits Sensor
+ \brief The Altimeter element reports on altitude.
+
+ The Altimeter element reports on altitude.
+
+ This element wraps the QAltimeter class. Please see the documentation for
+ QAltimeter for details.
+
+ \sa AltimeterReading
+*/
+
+QmlAltimeter::QmlAltimeter(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QAltimeter(this))
+{
+}
+
+QmlAltimeter::~QmlAltimeter()
+{
+}
+
+QmlSensorReading *QmlAltimeter::createReading() const
+{
+ return new QmlAltimeterReading(m_sensor);
+}
+
+QSensor *QmlAltimeter::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype AltimeterReading
+ \instantiates QmlAltimeterReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits SensorReading
+ \brief The AltimeterReading element holds the most recent Altimeter reading.
+
+ The AltimeterReading element holds the most recent Altimeter reading.
+
+ This element wraps the QAltimeterReading class. Please see the documentation for
+ QAltimeterReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlAltimeterReading::QmlAltimeterReading(QAltimeter *sensor)
+ : QmlSensorReading(sensor)
+ , m_sensor(sensor)
+ , m_altitude(0)
+{
+}
+
+QmlAltimeterReading::~QmlAltimeterReading()
+{
+}
+
+/*!
+ \qmlproperty qreal AltimeterReading::altitude
+ This property holds the altitude of the device.
+
+ Please see QAltimeterReading::altitude for information about this property.
+*/
+
+qreal QmlAltimeterReading::altitude() const
+{
+ return m_altitude;
+}
+
+QSensorReading *QmlAltimeterReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlAltimeterReading::readingUpdate()
+{
+ qreal altitude = m_sensor->reading()->altitude();
+ if (m_altitude != altitude) {
+ m_altitude = altitude;
+ Q_EMIT altitudeChanged();
+ }
+}
diff --git a/src/imports/sensors/qmlaltimeter.h b/src/imports/sensors/qmlaltimeter.h
new file mode 100644
index 00000000..4568baaa
--- /dev/null
+++ b/src/imports/sensors/qmlaltimeter.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QMLALTIMETER_H
+#define QMLALTIMETER_H
+
+#include "qmlsensor.h"
+
+QT_BEGIN_NAMESPACE
+
+class QAltimeter;
+
+class QmlAltimeter : public QmlSensor
+{
+ Q_OBJECT
+public:
+ explicit QmlAltimeter(QObject *parent = 0);
+ ~QmlAltimeter();
+
+private:
+ QSensor *sensor() const Q_DECL_OVERRIDE;
+ QmlSensorReading *createReading() const Q_DECL_OVERRIDE;
+
+ QAltimeter *m_sensor;
+};
+
+class QmlAltimeterReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal altitude READ altitude NOTIFY altitudeChanged)
+public:
+ explicit QmlAltimeterReading(QAltimeter *sensor);
+ ~QmlAltimeterReading();
+
+ qreal altitude() const;
+
+Q_SIGNALS:
+ void altitudeChanged();
+
+private:
+ QSensorReading *reading() const Q_DECL_OVERRIDE;
+ void readingUpdate() Q_DECL_OVERRIDE;
+
+ QAltimeter *m_sensor;
+ qreal m_altitude;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlambientlightsensor.h b/src/imports/sensors/qmlambientlightsensor.h
index eecb6b12..7715a39f 100644
--- a/src/imports/sensors/qmlambientlightsensor.h
+++ b/src/imports/sensors/qmlambientlightsensor.h
@@ -45,7 +45,6 @@
#include "qmlsensor.h"
#include <QAmbientLightSensor>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QAmbientLightSensor;
@@ -86,5 +85,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlambienttemperaturesensor.cpp b/src/imports/sensors/qmlambienttemperaturesensor.cpp
new file mode 100644
index 00000000..1190fca6
--- /dev/null
+++ b/src/imports/sensors/qmlambienttemperaturesensor.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qmlambienttemperaturesensor.h"
+#include <QAmbientTemperatureSensor>
+
+/*!
+ \qmltype AmbientTemperatureSensor
+ \instantiates QmlAmbientTemperatureSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits Sensor
+ \brief The AmbientTemperatureSensor element reports on the ambient temperature.
+
+ The AmbientTemperatureSensor element reports on the ambient temperature.
+
+ This element wraps the QAmbientTemperatureSensor class. Please see the documentation for
+ QAmbientTemperatureSensor for details.
+
+ \sa AmbientTemperatureReading
+*/
+
+QmlAmbientTemperatureSensor::QmlAmbientTemperatureSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QAmbientTemperatureSensor(this))
+{
+}
+
+QmlAmbientTemperatureSensor::~QmlAmbientTemperatureSensor()
+{
+}
+
+QmlSensorReading *QmlAmbientTemperatureSensor::createReading() const
+{
+ return new QmlAmbientTemperatureReading(m_sensor);
+}
+
+QSensor *QmlAmbientTemperatureSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype AmbientTemperatureReading
+ \instantiates QmlAmbientTemperatureReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits SensorReading
+ \brief The AmbientTemperatureReading element holds the most recent temperature reading.
+
+ The AmbientTemperatureReading element holds the most recent temperature reading.
+
+ This element wraps the QAmbientTemperatureReading class. Please see the documentation for
+ QAmbientTemperatureReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlAmbientTemperatureReading::QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor)
+ : QmlSensorReading(sensor)
+ , m_sensor(sensor)
+ , m_temperature(0)
+{
+}
+
+QmlAmbientTemperatureReading::~QmlAmbientTemperatureReading()
+{
+}
+
+/*!
+ \qmlproperty qreal AmbientTemperatureReading::temperature
+ This property holds the ambient temperature in degree Celsius.
+
+ Please see QAmbientTemperatureReading::temperature for information about this property.
+*/
+
+qreal QmlAmbientTemperatureReading::temperature() const
+{
+ return m_temperature;
+}
+
+QSensorReading *QmlAmbientTemperatureReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlAmbientTemperatureReading::readingUpdate()
+{
+ const qreal temperature = m_sensor->reading()->temperature();
+ if (m_temperature != temperature) {
+ m_temperature = temperature;
+ Q_EMIT temperatureChanged();
+ }
+}
diff --git a/src/imports/sensors/qmlambienttemperaturesensor.h b/src/imports/sensors/qmlambienttemperaturesensor.h
new file mode 100644
index 00000000..1c1d8dd6
--- /dev/null
+++ b/src/imports/sensors/qmlambienttemperaturesensor.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QMLAMBIENTTEMPERATURESENSOR_H
+#define QMLAMBIENTTEMPERATURESENSOR_H
+
+#include "qmlsensor.h"
+
+QT_BEGIN_NAMESPACE
+
+class QAmbientTemperatureSensor;
+
+class QmlAmbientTemperatureSensor : public QmlSensor
+{
+ Q_OBJECT
+public:
+ explicit QmlAmbientTemperatureSensor(QObject *parent = 0);
+ ~QmlAmbientTemperatureSensor();
+
+private:
+ QSensor *sensor() const Q_DECL_OVERRIDE;
+ QmlSensorReading *createReading() const Q_DECL_OVERRIDE;
+
+ QAmbientTemperatureSensor *m_sensor;
+};
+
+class QmlAmbientTemperatureReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal temperature READ temperature NOTIFY temperatureChanged)
+public:
+ explicit QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor);
+ ~QmlAmbientTemperatureReading();
+
+ qreal temperature() const;
+
+Q_SIGNALS:
+ void temperatureChanged();
+
+private:
+ QSensorReading *reading() const Q_DECL_OVERRIDE;
+ void readingUpdate() Q_DECL_OVERRIDE;
+
+ QAmbientTemperatureSensor *m_sensor;
+ qreal m_temperature;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlcompass.h b/src/imports/sensors/qmlcompass.h
index 30edbf0a..76294bf9 100644
--- a/src/imports/sensors/qmlcompass.h
+++ b/src/imports/sensors/qmlcompass.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QCompass;
@@ -88,5 +87,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlgyroscope.h b/src/imports/sensors/qmlgyroscope.h
index c5f6c902..f6fb6795 100644
--- a/src/imports/sensors/qmlgyroscope.h
+++ b/src/imports/sensors/qmlgyroscope.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QGyroscope;
@@ -92,5 +91,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlholstersensor.cpp b/src/imports/sensors/qmlholstersensor.cpp
new file mode 100644
index 00000000..a1eae05b
--- /dev/null
+++ b/src/imports/sensors/qmlholstersensor.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qmlholstersensor.h"
+#include <QHolsterSensor>
+
+/*!
+ \qmltype HolsterSensor
+ \instantiates QmlHolsterSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits Sensor
+ \brief The HolsterSensor element reports on whether a device is holstered.
+
+ The HolsterSensor element reports on whether a device is holstered.
+
+ This element wraps the QHolsterSensor class. Please see the documentation for
+ QHolsterSensor for details.
+
+ \sa HolsterReading
+*/
+
+QmlHolsterSensor::QmlHolsterSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QHolsterSensor(this))
+{
+}
+
+QmlHolsterSensor::~QmlHolsterSensor()
+{
+}
+
+QmlSensorReading *QmlHolsterSensor::createReading() const
+{
+ return new QmlHolsterReading(m_sensor);
+}
+
+QSensor *QmlHolsterSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype HolsterReading
+ \instantiates QmlHolsterReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits SensorReading
+ \brief The HolsterReading element holds the most recent HolsterSensor reading.
+
+ The HolsterReading element holds the most recent HolsterSensor reading.
+
+ This element wraps the QHolsterReading class. Please see the documentation for
+ QHolsterReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlHolsterReading::QmlHolsterReading(QHolsterSensor *sensor)
+ : QmlSensorReading(sensor)
+ , m_sensor(sensor)
+ , m_holstered(false)
+{
+}
+
+QmlHolsterReading::~QmlHolsterReading()
+{
+}
+
+/*!
+ \qmlproperty qreal HolsterReading::holstered
+ This property holds whether the device is holstered.
+
+ Please see QHolsterReading::holstered for information about this property.
+*/
+
+bool QmlHolsterReading::holstered() const
+{
+ return m_holstered;
+}
+
+QSensorReading *QmlHolsterReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlHolsterReading::readingUpdate()
+{
+ qreal holstered = m_sensor->reading()->holstered();
+ if (m_holstered != holstered) {
+ m_holstered = holstered;
+ Q_EMIT holsteredChanged();
+ }
+}
diff --git a/src/imports/sensors/qmlholstersensor.h b/src/imports/sensors/qmlholstersensor.h
new file mode 100644
index 00000000..262ba69d
--- /dev/null
+++ b/src/imports/sensors/qmlholstersensor.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QMLHOLSTERSENSOR_H
+#define QMLHOLSTERSENSOR_H
+
+#include "qmlsensor.h"
+
+QT_BEGIN_NAMESPACE
+
+class QHolsterSensor;
+
+class QmlHolsterSensor : public QmlSensor
+{
+ Q_OBJECT
+public:
+ explicit QmlHolsterSensor(QObject *parent = 0);
+ ~QmlHolsterSensor();
+
+private:
+ QSensor *sensor() const Q_DECL_OVERRIDE;
+ QmlSensorReading *createReading() const Q_DECL_OVERRIDE;
+
+ QHolsterSensor *m_sensor;
+};
+
+class QmlHolsterReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(bool holstered READ holstered NOTIFY holsteredChanged)
+public:
+ explicit QmlHolsterReading(QHolsterSensor *sensor);
+ ~QmlHolsterReading();
+
+ bool holstered() const;
+
+Q_SIGNALS:
+ void holsteredChanged();
+
+private:
+ QSensorReading *reading() const Q_DECL_OVERRIDE;
+ void readingUpdate() Q_DECL_OVERRIDE;
+
+ QHolsterSensor *m_sensor;
+ bool m_holstered;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlirproximitysensor.h b/src/imports/sensors/qmlirproximitysensor.h
index 2b2d4c49..ec39fe8b 100644
--- a/src/imports/sensors/qmlirproximitysensor.h
+++ b/src/imports/sensors/qmlirproximitysensor.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QIRProximitySensor;
@@ -83,5 +82,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmllightsensor.cpp b/src/imports/sensors/qmllightsensor.cpp
index 1c3fed2c..86126a2a 100644
--- a/src/imports/sensors/qmllightsensor.cpp
+++ b/src/imports/sensors/qmllightsensor.cpp
@@ -63,6 +63,8 @@ QmlLightSensor::QmlLightSensor(QObject *parent)
: QmlSensor(parent)
, m_sensor(new QLightSensor(this))
{
+ connect(m_sensor, SIGNAL(fieldOfViewChanged(qreal)),
+ this, SIGNAL(fieldOfViewChanged(qreal)));
}
QmlLightSensor::~QmlLightSensor()
@@ -88,13 +90,7 @@ QSensor *QmlLightSensor::sensor() const
qreal QmlLightSensor::fieldOfView() const
{
- return m_sensor->property("fieldOfView").value<qreal>();
-}
-
-void QmlLightSensor::_update()
-{
- if (fieldOfView() != qreal())
- Q_EMIT fieldOfViewChanged();
+ return m_sensor->fieldOfView();
}
/*!
diff --git a/src/imports/sensors/qmllightsensor.h b/src/imports/sensors/qmllightsensor.h
index 90fe0b7f..e42d7818 100644
--- a/src/imports/sensors/qmllightsensor.h
+++ b/src/imports/sensors/qmllightsensor.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QLightSensor;
@@ -59,13 +58,11 @@ public:
qreal fieldOfView() const;
-
Q_SIGNALS:
- void fieldOfViewChanged();
+ void fieldOfViewChanged(qreal fieldOfView);
private:
QSensor *sensor() const Q_DECL_OVERRIDE;
- void _update();
QLightSensor *m_sensor;
QmlSensorReading *createReading() const Q_DECL_OVERRIDE;
};
@@ -91,5 +88,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlmagnetometer.cpp b/src/imports/sensors/qmlmagnetometer.cpp
index 1f95b3f2..2c531f70 100644
--- a/src/imports/sensors/qmlmagnetometer.cpp
+++ b/src/imports/sensors/qmlmagnetometer.cpp
@@ -65,6 +65,8 @@ QmlMagnetometer::QmlMagnetometer(QObject *parent)
: QmlSensor(parent)
, m_sensor(new QMagnetometer(this))
{
+ connect(m_sensor, SIGNAL(returnGeoValuesChanged(bool)),
+ this, SIGNAL(returnGeoValuesChanged(bool)));
}
QmlMagnetometer::~QmlMagnetometer()
@@ -90,13 +92,12 @@ QSensor *QmlMagnetometer::sensor() const
bool QmlMagnetometer::returnGeoValues() const
{
- return m_sensor->property("returnGeoValues").toBool();
+ return m_sensor->returnGeoValues();
}
void QmlMagnetometer::setReturnGeoValues(bool geo)
{
- if (m_sensor->property("returnGeoValues").toBool() == geo) return;
- m_sensor->setProperty("returnGeoValues", geo);
+ m_sensor->setReturnGeoValues(geo);
}
/*!
diff --git a/src/imports/sensors/qmlmagnetometer.h b/src/imports/sensors/qmlmagnetometer.h
index d6c75c1e..6e5facda 100644
--- a/src/imports/sensors/qmlmagnetometer.h
+++ b/src/imports/sensors/qmlmagnetometer.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QMagnetometer;
@@ -52,6 +51,7 @@ class QMagnetometer;
class QmlMagnetometer : public QmlSensor
{
Q_OBJECT
+ Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged)
public:
explicit QmlMagnetometer(QObject *parent = 0);
~QmlMagnetometer();
@@ -59,6 +59,8 @@ public:
bool returnGeoValues() const;
void setReturnGeoValues(bool geo);
+Q_SIGNALS:
+ void returnGeoValuesChanged(bool returnGeoValues);
private:
QSensor *sensor() const Q_DECL_OVERRIDE;
@@ -99,5 +101,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlorientationsensor.h b/src/imports/sensors/qmlorientationsensor.h
index d14197e8..35e9d6fb 100644
--- a/src/imports/sensors/qmlorientationsensor.h
+++ b/src/imports/sensors/qmlorientationsensor.h
@@ -45,7 +45,6 @@
#include "qmlsensor.h"
#include <QOrientationSensor>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QOrientationSensor;
@@ -86,5 +85,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlpressuresensor.cpp b/src/imports/sensors/qmlpressuresensor.cpp
new file mode 100644
index 00000000..a21f7c0d
--- /dev/null
+++ b/src/imports/sensors/qmlpressuresensor.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qmlpressuresensor.h"
+#include <QPressureSensor>
+
+/*!
+ \qmltype PressureSensor
+ \instantiates QmlPressureSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits Sensor
+ \brief The PressureSensor element reports on atmospheric pressure values.
+
+ The PressureSensor element reports on atmospheric pressure values.
+
+ This element wraps the QPressureSensor class. Please see the documentation for
+ QPressureSensor for details.
+
+ \sa PressureReading
+*/
+
+QmlPressureSensor::QmlPressureSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QPressureSensor(this))
+{
+}
+
+QmlPressureSensor::~QmlPressureSensor()
+{
+}
+
+QmlSensorReading *QmlPressureSensor::createReading() const
+{
+ return new QmlPressureReading(m_sensor);
+}
+
+QSensor *QmlPressureSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype PressureReading
+ \instantiates QmlPressureReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors 5.0
+ \since QtSensors 5.1
+ \inherits SensorReading
+ \brief The PressureReading element holds the most recent PressureSensor reading.
+
+ The PressureReading element holds the most recent PressureSensor reading.
+
+ This element wraps the QPressureReading class. Please see the documentation for
+ QPressureReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlPressureReading::QmlPressureReading(QPressureSensor *sensor)
+ : QmlSensorReading(sensor)
+ , m_sensor(sensor)
+ , m_pressure(0)
+{
+}
+
+QmlPressureReading::~QmlPressureReading()
+{
+}
+
+/*!
+ \qmlproperty qreal PressureReading::pressure
+ This property holds the atmospheric pressure value in Pascals.
+
+ Please see QPressureReading::pressure for information about this property.
+*/
+
+qreal QmlPressureReading::pressure() const
+{
+ return m_pressure;
+}
+
+QSensorReading *QmlPressureReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlPressureReading::readingUpdate()
+{
+ qreal pressure = m_sensor->reading()->pressure();
+ if (m_pressure != pressure) {
+ m_pressure = pressure;
+ Q_EMIT pressureChanged();
+ }
+}
diff --git a/src/imports/sensors/qmlpressuresensor.h b/src/imports/sensors/qmlpressuresensor.h
new file mode 100644
index 00000000..627915a6
--- /dev/null
+++ b/src/imports/sensors/qmlpressuresensor.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QMLPRESSURESENSOR_H
+#define QMLPRESSURESENSOR_H
+
+#include "qmlsensor.h"
+
+QT_BEGIN_NAMESPACE
+
+class QPressureSensor;
+
+class QmlPressureSensor : public QmlSensor
+{
+ Q_OBJECT
+public:
+ explicit QmlPressureSensor(QObject *parent = 0);
+ ~QmlPressureSensor();
+
+private:
+ QSensor *sensor() const Q_DECL_OVERRIDE;
+ QmlSensorReading *createReading() const Q_DECL_OVERRIDE;
+
+ QPressureSensor *m_sensor;
+};
+
+class QmlPressureReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged)
+public:
+ explicit QmlPressureReading(QPressureSensor *sensor);
+ ~QmlPressureReading();
+
+ qreal pressure() const;
+
+Q_SIGNALS:
+ void pressureChanged();
+
+private:
+ QSensorReading *reading() const Q_DECL_OVERRIDE;
+ void readingUpdate() Q_DECL_OVERRIDE;
+
+ QPressureSensor *m_sensor;
+ qreal m_pressure;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlproximitysensor.h b/src/imports/sensors/qmlproximitysensor.h
index afbc3a01..17cb2f9a 100644
--- a/src/imports/sensors/qmlproximitysensor.h
+++ b/src/imports/sensors/qmlproximitysensor.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QProximitySensor;
@@ -84,5 +83,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlrotationsensor.cpp b/src/imports/sensors/qmlrotationsensor.cpp
index e58a3f8c..f1821641 100644
--- a/src/imports/sensors/qmlrotationsensor.cpp
+++ b/src/imports/sensors/qmlrotationsensor.cpp
@@ -65,6 +65,7 @@ QmlRotationSensor::QmlRotationSensor(QObject *parent)
: QmlSensor(parent)
, m_sensor(new QRotationSensor(this))
{
+ connect(m_sensor, SIGNAL(hasZChanged(bool)), this, SIGNAL(hasZChanged(bool)));
}
QmlRotationSensor::~QmlRotationSensor()
@@ -90,7 +91,7 @@ QSensor *QmlRotationSensor::sensor() const
bool QmlRotationSensor::hasZ() const
{
- return m_sensor->property("hasZ").toBool();
+ return m_sensor->hasZ();
}
void QmlRotationSensor::_update()
diff --git a/src/imports/sensors/qmlrotationsensor.h b/src/imports/sensors/qmlrotationsensor.h
index db3b62f6..4d7b543a 100644
--- a/src/imports/sensors/qmlrotationsensor.h
+++ b/src/imports/sensors/qmlrotationsensor.h
@@ -44,7 +44,6 @@
#include "qmlsensor.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QRotationSensor;
@@ -52,13 +51,15 @@ class QRotationSensor;
class QmlRotationSensor : public QmlSensor
{
Q_OBJECT
- Q_PROPERTY(bool hasZ READ hasZ)
+ Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged)
public:
explicit QmlRotationSensor(QObject *parent = 0);
~QmlRotationSensor();
bool hasZ() const;
+Q_SIGNALS:
+ void hasZChanged(bool hasZ);
private:
QSensor *sensor() const Q_DECL_OVERRIDE;
@@ -96,5 +97,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlsensor.cpp b/src/imports/sensors/qmlsensor.cpp
index ec1b0691..3d59a72d 100644
--- a/src/imports/sensors/qmlsensor.cpp
+++ b/src/imports/sensors/qmlsensor.cpp
@@ -171,6 +171,25 @@ void QmlSensor::setAlwaysOn(bool alwaysOn)
}
/*!
+ \qmlproperty bool Sensor::skipDuplicates
+ \since QtSensors 5.1
+
+ This property indicates whether duplicate reading values should be omitted.
+
+ Please see QSensor::skipDuplicates for information about this property.
+*/
+
+bool QmlSensor::skipDuplicates() const
+{
+ return sensor()->skipDuplicates();
+}
+
+void QmlSensor::setSkipDuplicates(bool skipDuplicates)
+{
+ sensor()->setSkipDuplicates(skipDuplicates);
+}
+
+/*!
\qmlproperty list<Range> Sensor::availableDataRates
This property holds the data rates that the sensor supports.
@@ -288,6 +307,99 @@ QmlSensorReading *QmlSensor::reading() const
}
/*!
+ \qmlproperty Sensor::AxesOrientationMode Sensor::axesOrientationMode
+ \since QtSensors 5.1
+ This property holds the mode that affects how the screen orientation changes reading values.
+
+ Please see QSensor::axesOrientationMode for information about this property.
+*/
+
+QmlSensor::AxesOrientationMode QmlSensor::axesOrientationMode() const
+{
+ return static_cast<QmlSensor::AxesOrientationMode>(sensor()->axesOrientationMode());
+}
+
+void QmlSensor::setAxesOrientationMode(QmlSensor::AxesOrientationMode axesOrientationMode)
+{
+ sensor()->setAxesOrientationMode(static_cast<QSensor::AxesOrientationMode>(axesOrientationMode));
+}
+
+/*!
+ \qmlproperty int Sensor::currentOrientation
+ \since QtSensors 5.1
+ This property holds the current orientation that is used for rotating the reading values.
+
+ Please see QSensor::currentOrientation for information about this property.
+*/
+
+int QmlSensor::currentOrientation() const
+{
+ return sensor()->currentOrientation();
+}
+
+/*!
+ \qmlproperty int Sensor::userOrientation
+ \since QtSensors 5.1
+ This property holds the angle used for rotating the reading values in the UserOrientation mode.
+
+ Please see QSensor::userOrientation for information about this property.
+*/
+
+int QmlSensor::userOrientation() const
+{
+ return sensor()->userOrientation();
+}
+
+void QmlSensor::setUserOrientation(int userOrientation)
+{
+ sensor()->setUserOrientation(userOrientation);
+}
+
+/*!
+ \qmlproperty int Sensor::maxBufferSize
+ \since QtSensors 5.1
+ This property holds the maximum buffer size.
+
+ Please see QSensor::maxBufferSize for information about this property.
+*/
+
+int QmlSensor::maxBufferSize() const
+{
+ return sensor()->maxBufferSize();
+}
+
+/*!
+ \qmlproperty int Sensor::efficientBufferSize
+ \since QtSensors 5.1
+ The property holds the most efficient buffer size.
+
+ Please see QSensor::efficientBufferSize for information about this property.
+*/
+
+int QmlSensor::efficientBufferSize() const
+{
+ return sensor()->efficientBufferSize();
+}
+
+/*!
+ \qmlproperty int Sensor::bufferSize
+ \since QtSensors 5.1
+ This property holds the size of the buffer.
+
+ Please see QSensor::bufferSize for information about this property.
+*/
+
+int QmlSensor::bufferSize() const
+{
+ return sensor()->bufferSize();
+}
+
+void QmlSensor::setBufferSize(int bufferSize)
+{
+ sensor()->setBufferSize(bufferSize);
+}
+
+/*!
\qmlmethod bool Sensor::start()
Start retrieving values from the sensor. Returns true if the sensor was started, false otherwise.
@@ -323,6 +435,14 @@ void QmlSensor::componentComplete()
connect(sensor(), SIGNAL(sensorError(int)), this, SIGNAL(errorChanged()));
connect(sensor(), SIGNAL(activeChanged()), this, SIGNAL(activeChanged()));
connect(sensor(), SIGNAL(alwaysOnChanged()), this, SIGNAL(alwaysOnChanged()));
+ connect(sensor(), SIGNAL(skipDuplicatesChanged(bool)), this, SIGNAL(skipDuplicatesChanged(bool)));
+ connect(sensor(), SIGNAL(axesOrientationModeChanged(AxesOrientationMode)),
+ this, SIGNAL(axesOrientationModeChanged(AxesOrientationMode)));
+ connect(sensor(), SIGNAL(userOrientationChanged(int)), this, SIGNAL(userOrientationChanged(int)));
+ connect(sensor(), SIGNAL(currentOrientationChanged(int)), this, SIGNAL(currentOrientationChanged(int)));
+ connect(sensor(), SIGNAL(bufferSizeChanged(int)), this, SIGNAL(bufferSizeChanged(int)));
+ connect(sensor(), SIGNAL(maxBufferSizeChanged(int)), this, SIGNAL(maxBufferSizeChanged(int)));
+ connect(sensor(), SIGNAL(efficientBufferSizeChanged(int)), this, SIGNAL(efficientBufferSizeChanged(int)));
// We need to set this on the sensor object now
sensor()->setIdentifier(m_identifier.toLocal8Bit());
diff --git a/src/imports/sensors/qmlsensor.h b/src/imports/sensors/qmlsensor.h
index a4ac852d..f72234ae 100644
--- a/src/imports/sensors/qmlsensor.h
+++ b/src/imports/sensors/qmlsensor.h
@@ -46,7 +46,6 @@
#include <QQmlListProperty>
#include "qmlsensorrange.h"
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QSensor;
@@ -57,6 +56,7 @@ class QmlSensorReading;
class QmlSensor : public QObject, public QQmlParserStatus
{
Q_OBJECT
+ Q_ENUMS(AxesOrientationMode)
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged)
Q_PROPERTY(QString type READ type NOTIFY typeChanged)
@@ -71,7 +71,22 @@ class QmlSensor : public QObject, public QQmlParserStatus
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
Q_PROPERTY(int error READ error NOTIFY errorChanged)
Q_PROPERTY(bool alwaysOn READ isAlwaysOn WRITE setAlwaysOn NOTIFY alwaysOnChanged)
+ Q_PROPERTY(bool skipDuplicates READ skipDuplicates WRITE setSkipDuplicates NOTIFY skipDuplicatesChanged REVISION 1)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged REVISION 1)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged REVISION 1)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged REVISION 1)
+ Q_PROPERTY(int maxBufferSize READ maxBufferSize NOTIFY maxBufferSizeChanged REVISION 1)
+ Q_PROPERTY(int efficientBufferSize READ efficientBufferSize NOTIFY efficientBufferSizeChanged REVISION 1)
+ Q_PROPERTY(int bufferSize READ bufferSize WRITE setBufferSize NOTIFY bufferSizeChanged REVISION 1)
+
public:
+ // Keep in sync with QSensor::AxesOrientationMode
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+
explicit QmlSensor(QObject *parent = 0);
~QmlSensor();
@@ -90,6 +105,9 @@ public:
bool isAlwaysOn() const;
void setAlwaysOn(bool alwaysOn);
+ bool skipDuplicates() const;
+ void setSkipDuplicates(bool skipDuplicates);
+
QQmlListProperty<QmlSensorRange> availableDataRates() const;
int dataRate() const;
void setDataRate(int rate);
@@ -103,6 +121,21 @@ public:
QmlSensorReading *reading() const;
+ AxesOrientationMode axesOrientationMode() const;
+ void setAxesOrientationMode(AxesOrientationMode axesOrientationMode);
+
+ int currentOrientation() const;
+
+ int userOrientation() const;
+ void setUserOrientation(int userOrientation);
+
+ int maxBufferSize() const;
+
+ int efficientBufferSize() const;
+
+ int bufferSize() const;
+ void setBufferSize(int bufferSize);
+
public Q_SLOTS:
bool start();
void stop();
@@ -120,6 +153,13 @@ Q_SIGNALS:
void descriptionChanged();
void errorChanged();
void alwaysOnChanged();
+ void skipDuplicatesChanged(bool skipDuplicates);
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+ void maxBufferSizeChanged(int maxBufferSize);
+ void efficientBufferSizeChanged(int efficientBufferSize);
+ void bufferSizeChanged(int bufferSize);
protected:
virtual QSensor *sensor() const = 0;
@@ -127,6 +167,8 @@ protected:
private Q_SLOTS:
void updateReading();
+
+protected Q_SLOTS:
void componentComplete();
private:
@@ -159,6 +201,5 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlsensorglobal.h b/src/imports/sensors/qmlsensorglobal.h
index fbbd30d7..cd28ffef 100644
--- a/src/imports/sensors/qmlsensorglobal.h
+++ b/src/imports/sensors/qmlsensorglobal.h
@@ -45,7 +45,6 @@
#include <QObject>
#include <QStringList>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QSensor;
@@ -69,6 +68,5 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmlsensorrange.h b/src/imports/sensors/qmlsensorrange.h
index 261825b5..f2fcb510 100644
--- a/src/imports/sensors/qmlsensorrange.h
+++ b/src/imports/sensors/qmlsensorrange.h
@@ -44,7 +44,6 @@
#include <QObject>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QmlSensorRange : public QObject
@@ -94,5 +93,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmltapsensor.cpp b/src/imports/sensors/qmltapsensor.cpp
index 65afcb59..8877b0b0 100644
--- a/src/imports/sensors/qmltapsensor.cpp
+++ b/src/imports/sensors/qmltapsensor.cpp
@@ -65,6 +65,8 @@ QmlTapSensor::QmlTapSensor(QObject *parent)
: QmlSensor(parent)
, m_sensor(new QTapSensor(this))
{
+ connect(m_sensor, SIGNAL(returnDoubleTapEventsChanged(bool)),
+ this, SIGNAL(returnDoubleTapEventsChanged(bool)));
}
QmlTapSensor::~QmlTapSensor()
@@ -90,14 +92,12 @@ QSensor *QmlTapSensor::sensor() const
bool QmlTapSensor::returnDoubleTapEvents() const
{
- return m_sensor->property("returnDoubleTapEvents").toBool();
+ return m_sensor->returnDoubleTapEvents();
}
void QmlTapSensor::setReturnDoubleTapEvents(bool ret)
{
- if (m_sensor->property("returnDoubleTapEvents").toBool() == ret) return;
- m_sensor->setProperty("returnDoubleTapEvents", ret);
- Q_EMIT returnDoubleTapEventsChanged();
+ m_sensor->setReturnDoubleTapEvents(ret);
}
/*!
diff --git a/src/imports/sensors/qmltapsensor.h b/src/imports/sensors/qmltapsensor.h
index f9ae94bd..b0c2fa5c 100644
--- a/src/imports/sensors/qmltapsensor.h
+++ b/src/imports/sensors/qmltapsensor.h
@@ -45,7 +45,6 @@
#include "qmlsensor.h"
#include <QTapSensor>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QTapSensor;
@@ -61,9 +60,8 @@ public:
bool returnDoubleTapEvents() const;
void setReturnDoubleTapEvents(bool ret);
-
Q_SIGNALS:
- void returnDoubleTapEventsChanged();
+ void returnDoubleTapEventsChanged(bool returnDoubleTapEvents);
private:
QSensor *sensor() const Q_DECL_OVERRIDE;
@@ -97,5 +95,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/qmltiltsensor.h b/src/imports/sensors/qmltiltsensor.h
index 9afed564..422c21dd 100644
--- a/src/imports/sensors/qmltiltsensor.h
+++ b/src/imports/sensors/qmltiltsensor.h
@@ -45,7 +45,6 @@
#include "qmlsensor.h"
#include <QtSensors/QTiltSensor>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QTiltSensor;
@@ -90,5 +89,4 @@ private:
};
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/imports/sensors/sensors.cpp b/src/imports/sensors/sensors.cpp
index 50ccdf93..77ad754a 100644
--- a/src/imports/sensors/sensors.cpp
+++ b/src/imports/sensors/sensors.cpp
@@ -44,7 +44,9 @@
#include <QtSensors/QSensorManager>
#include <QtSensors/qaccelerometer.h>
+#include <QtSensors/qaltimeter.h>
#include <QtSensors/qambientlightsensor.h>
+#include <QtSensors/qambienttemperaturesensor.h>
#include <QtSensors/qcompass.h>
#include <QtSensors/qmagnetometer.h>
#include <QtSensors/qorientationsensor.h>
@@ -59,13 +61,17 @@
#include "qmlsensorglobal.h"
#include "qmlsensor.h"
#include "qmlaccelerometer.h"
+#include "qmlaltimeter.h"
#include "qmlambientlightsensor.h"
+#include "qmlambienttemperaturesensor.h"
#include "qmlcompass.h"
#include "qmlgyroscope.h"
+#include "qmlholstersensor.h"
#include "qmlirproximitysensor.h"
#include "qmllightsensor.h"
#include "qmlmagnetometer.h"
#include "qmlorientationsensor.h"
+#include "qmlpressuresensor.h"
#include "qmlproximitysensor.h"
#include "qmlrotationsensor.h"
#include "qmltapsensor.h"
@@ -125,6 +131,49 @@ public:
qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading"));
qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture");
+
+ // Register the 5.1 interfaces
+ major = 5;
+ minor = 1;
+ qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50);
+ qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range"));
+ qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange"));
+ qmlRegisterUncreatableType<QmlSensor,1 >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor"));
+ qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading"));
+ qmlRegisterType <QmlAccelerometer,1 >(package, major, minor, "Accelerometer");
+ qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading"));
+ qmlRegisterType <QmlAltimeter >(package, major, minor, "Altimeter");
+ qmlRegisterUncreatableType<QmlAltimeterReading >(package, major, minor, "AltimeterReading", QLatin1String("Cannot create AltimeterReading"));
+ qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor");
+ qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading"));
+ qmlRegisterType <QmlAmbientTemperatureSensor >(package, major, minor, "AmbientTemperatureSensor");
+ qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(package, major, minor, "AmbientTemperatureReading", QLatin1String("Cannot create AmbientTemperatureReading"));
+ qmlRegisterType <QmlCompass >(package, major, minor, "Compass");
+ qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading"));
+ qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope");
+ qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading"));
+ qmlRegisterType <QmlHolsterSensor >(package, major, minor, "HolsterSensor");
+ qmlRegisterUncreatableType<QmlHolsterReading >(package, major, minor, "HolsterReading", QLatin1String("Cannot create HolsterReading"));
+ qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor");
+ qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading"));
+ qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor");
+ qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading"));
+ qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer");
+ qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading"));
+ qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor");
+ qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading"));
+ qmlRegisterType <QmlPressureSensor >(package, major, minor, "PressureSensor");
+ qmlRegisterUncreatableType<QmlPressureReading >(package, major, minor, "PressureReading", QLatin1String("Cannot create PressureReading"));
+ qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor");
+ qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading"));
+ qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor");
+ qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading"));
+ qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor");
+ qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading"));
+ qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor");
+ qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading"));
+
+ qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture");
}
};
diff --git a/src/imports/sensors/sensors.pro b/src/imports/sensors/sensors.pro
index 210ceac1..2236ce11 100644
--- a/src/imports/sensors/sensors.pro
+++ b/src/imports/sensors/sensors.pro
@@ -1,7 +1,7 @@
CXX_MODULE = sensors
TARGET = declarative_sensors
TARGETPATH = QtSensors
-IMPORT_VERSION = 5.0 # Doesn't matter, as long as it's a valid version?!
+IMPORT_VERSION = 5.1 # Doesn't matter, as long as it's a valid version?!
QT += qml sensors sensors-private
@@ -9,13 +9,17 @@ HEADERS += \
qmlsensor.h \
qmlsensorrange.h \
qmlaccelerometer.h \
+ qmlaltimeter.h \
qmlambientlightsensor.h \
+ qmlambienttemperaturesensor.h \
qmlcompass.h \
qmlgyroscope.h \
+ qmlholstersensor.h \
qmlirproximitysensor.h \
qmllightsensor.h \
qmlmagnetometer.h \
qmlorientationsensor.h \
+ qmlpressuresensor.h\
qmlproximitysensor.h \
qmltapsensor.h \
qmlrotationsensor.h \
@@ -27,13 +31,17 @@ SOURCES += sensors.cpp \
qmlsensor.cpp \
qmlsensorrange.cpp \
qmlaccelerometer.cpp \
+ qmlaltimeter.cpp \
qmlambientlightsensor.cpp \
+ qmlambienttemperaturesensor.cpp \
qmlcompass.cpp \
qmlgyroscope.cpp \
+ qmlholstersensor.cpp \
qmlirproximitysensor.cpp \
qmllightsensor.cpp \
qmlmagnetometer.cpp \
qmlorientationsensor.cpp \
+ qmlpressuresensor.cpp\
qmlproximitysensor.cpp \
qmltapsensor.cpp \
qmlrotationsensor.cpp \