diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2012-06-29 13:18:47 +0200 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2012-11-28 18:29:54 +0100 |
commit | b64e52acb421dceae303124f63059c658090bd5d (patch) | |
tree | 078f30d387f1e44ee5e2ceb3d73db71bd8d554c4 | |
parent | 56bf25db496cbf2bb8fec3114cc24007688cc3c7 (diff) |
Add QPressureSensor and QHolsterSensor
Change-Id: I650e31887d8e8651058e6d30417e8c64a4ed8645
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r-- | config.tests/bbsensor_holster/bbsensor_holster.pro | 5 | ||||
-rw-r--r-- | config.tests/bbsensor_holster/main.cpp | 57 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | configure.bat | 1 | ||||
-rw-r--r-- | plugins/declarative/sensors/sensors.cpp | 101 | ||||
-rw-r--r-- | src/sensors/qholstersensor.cpp | 145 | ||||
-rw-r--r-- | src/sensors/qholstersensor.h | 84 | ||||
-rw-r--r-- | src/sensors/qholstersensor_p.h | 70 | ||||
-rw-r--r-- | src/sensors/qpressuresensor.cpp | 148 | ||||
-rw-r--r-- | src/sensors/qpressuresensor.h | 81 | ||||
-rw-r--r-- | src/sensors/qpressuresensor_p.h | 70 | ||||
-rw-r--r-- | src/sensors/sensors.pro | 2 |
12 files changed, 764 insertions, 1 deletions
diff --git a/config.tests/bbsensor_holster/bbsensor_holster.pro b/config.tests/bbsensor_holster/bbsensor_holster.pro new file mode 100644 index 0000000000..362ae67bd9 --- /dev/null +++ b/config.tests/bbsensor_holster/bbsensor_holster.pro @@ -0,0 +1,5 @@ +TEMPLATE = app +DEPENDPATH += . +INCLUDEPATH += . + +SOURCES += main.cpp diff --git a/config.tests/bbsensor_holster/main.cpp b/config.tests/bbsensor_holster/main.cpp new file mode 100644 index 0000000000..67972b43de --- /dev/null +++ b/config.tests/bbsensor_holster/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 <QtCore/qglobal.h> + +#ifdef Q_OS_BLACKBERRY +#include <sensor/sensor.h> +#endif + +int main(int argc, char** argv) +{ + Q_UNUSED(argc); + Q_UNUSED(argv); + sensor_event_t event; + const int type = SENSOR_TYPE_HOLSTER; + const bool holstered = event.holster_s.holstered; + Q_UNUSED(type); + Q_UNUSED(holstered); + return 0; +} @@ -619,6 +619,7 @@ if [ -z "$PLATFORM_CONFIG" ]; then compileTest "udev" udev compileTest "Maemo Heartbeat" iphb compileTest "BlackBerry NDK sensor header" bbsensor_header + compileTest "BlackBerry NDK holster sensor" bbsensor_holster if [ "$NFC_SYMBIAN" = auto ]; then compileTest "Symbian NFC" nfc_symbian diff --git a/configure.bat b/configure.bat index 3402e79f7b..819e55f4c3 100644 --- a/configure.bat +++ b/configure.bat @@ -743,6 +743,7 @@ if "%MODULE_SENSORS_REQUESTED%" == "yes" ( call :compileTest Symbian_Sensor_Framework sensors_symbian
call :compileTest Sensor_Framework_Light sensors_symbian_light
call :compileTest BlackBerry_NDK_sensor_header bbsensor_header
+ call :compileTest BlackBerry_NDK_holster_sensor bbsensor_holster
)
if "%MODULE_SERVICEFRAMEWORK_REQUESTED%" == "yes" (
diff --git a/plugins/declarative/sensors/sensors.cpp b/plugins/declarative/sensors/sensors.cpp index 0a0180d925..500e680eeb 100644 --- a/plugins/declarative/sensors/sensors.cpp +++ b/plugins/declarative/sensors/sensors.cpp @@ -55,6 +55,9 @@ #include <qgyroscope.h> #include "qmlsensorgesture.h" +#include <qpressuresensor.h> +#include <qholstersensor.h> + QT_BEGIN_NAMESPACE QTM_USE_NAMESPACE @@ -143,7 +146,10 @@ public: qmlRegisterUncreatableType<QGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading")); qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture"); - + qmlRegisterType <QHolsterSensor >(package, major, minor, "HolsterSensor"); + qmlRegisterUncreatableType<QHolsterReading >(package, major, minor, "HolsterReading", QLatin1String("Cannot create HolsterReading")); + qmlRegisterType <QPressureSensor >(package, major, minor, "PressureSensor"); + qmlRegisterUncreatableType<QPressureReading >(package, major, minor, "PressureReading", QLatin1String("Cannot create PressureReading")); } }; @@ -869,3 +875,96 @@ Q_EXPORT_PLUGIN2(qsensorsdeclarativemodule, QT_PREPEND_NAMESPACE(QSensorsDeclara \qmlproperty qreal IRProximityReading::reflectance Please see QIRProximityReading::reflectance for information about this property. */ + +/*! + \qmlclass PressureSensor QPressureSensor + \ingroup qml-sensors_type + \since Mobility 1.3 + \inherits Sensor + \brief The PressureSensor type reports on atmospheric pressure values. + + This type wraps the QPressureSensor class. Please see the documentation of + QPressureSensor for details. + + \sa {QML Limitations} +*/ + +/*! + \qmlproperty PressureReading PressureSensor::reading + Holds the most recent pressure reading. + Please see QSensor::reading for information about this property. +*/ + +/*! + \qmlsignal PressureSensor::onReadingChanged() + Called when the reading object changes. + Please see QSensor::readingChanged() for information about this signal. +*/ + +/*! + \qmlclass PressureReading QPressureReading + \ingroup qml-sensors_reading + \since Mobility 1.3 + \inherits SensorReading + \brief The PressureReading type holds the most recent pressure reading. + + The PressureReading type holds the most recent pressure reading. + + This type wraps the QPressureReading class. Please see the documentation of + QPressureReading for details. + + This type cannot be directly created. +*/ + +/*! + \qmlproperty qreal PressureReading::pressure + Please see QPressureReading::pressure for information about this property. +*/ + +/*! + \qmlclass HolsterSensor QHolsterSensor + \ingroup qml-sensors_type + \since Mobility 1.3 + \inherits Sensor + \brief The HolsterSensor type detects if a device is holstered or not. + + The HolsterSensor type detects if a device is holstered or not. + + This type wraps the QHolsterSensor class. + + \sa {QML Limitations} + \sa QHolsterSensor +*/ + +/*! + \qmlproperty HolsterReading HolsterSensor::reading + Holds the most recent holster reading. + \sa QSensor::reading +*/ + +/*! + \qmlsignal HolsterSensor::onReadingChanged() + Called when the reading object changes. + \sa QSensor::readingChanged() +*/ + +/*! + \qmlclass HolsterReading QHolsterReading + \ingroup qml-sensors_reading + \since Mobility 1.3 + \inherits SensorReading + \brief The HolsterReading type holds the most recent HolsterSensor reading. + + The HolsterReading type holds the most recent HolsterSensor reading. + + This type wraps the QHolsterReading class. + + This type cannot be directly created. + + \sa QHolsterReading +*/ + +/*! + \qmlproperty bool HolsterReading::holstered + \sa QHolsterReading::holstered +*/ diff --git a/src/sensors/qholstersensor.cpp b/src/sensors/qholstersensor.cpp new file mode 100644 index 0000000000..7c1a2197fb --- /dev/null +++ b/src/sensors/qholstersensor.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 <qholstersensor.h> +#include "qholstersensor_p.h" + +QTM_BEGIN_NAMESPACE + +IMPLEMENT_READING(QHolsterReading) + +/*! + \class QHolsterReading + \ingroup sensors_reading + \inmodule QtSensors + + \brief The QHolsterReading class holds readings from the holster sensor. + + \section2 QHolsterReading Units + The holster sensor can detect if a device is holstered or not. A holster is a pocket, + similar to a gun holster, specifically made for the device. If the device is inside of this + pocket, it is holstered. The holster supports the device in detecting whether the device is + holstered or not. +*/ + +/*! + \property QHolsterReading::holstered + \brief A value indicating whether the device is holstered. + + \sa {QHolsterReading Units} +*/ + +bool QHolsterReading::holstered() const +{ + return d->holstered; +} + +/*! + Sets the holstered value to \a holstered. +*/ +void QHolsterReading::setHolstered(bool holstered) +{ + d->holstered = holstered; +} + +// ===================================================================== + +/*! + \class QHolsterFilter + \ingroup sensors_filter + \inmodule QtSensors + + \brief The QHolsterFilter class is a convenience wrapper around QSensorFilter. + + The only difference is that the filter() method features a pointer to QHolsterReading + instead of QSensorReading. +*/ + +/*! + \fn QHolsterFilter::filter(QHolsterReading *reading) + + Called when \a reading changes. Returns false to prevent the reading from propagating. + + \sa QSensorFilter::filter() +*/ + +char const * const QHolsterSensor::type("QHolsterSensor"); + +/*! + \class QHolsterSensor + \ingroup sensors_type + \inmodule QtSensors + + \brief The QHolsterSensor class is a convenience wrapper around QSensor. + + The only behavioural difference is that this class sets the type properly. + + This class also features a reading() function that returns a QHolsterReading instead of a QSensorReading. + + For details about how the sensor works, see \l QHolsterReading. + + \sa QHolsterReading +*/ + +/*! + Construct the sensor as a child of \a parent. +*/ +QHolsterSensor::QHolsterSensor(QObject *parent) + : QSensor(QHolsterSensor::type, parent) +{ +} + +/*! + Destroy the sensor. Stops the sensor if it has not already been stopped. +*/ +QHolsterSensor::~QHolsterSensor() +{ +} + +/*! + \fn QHolsterSensor::reading() const + + Returns the reading class for this sensor. + + \sa QSensor::reading() +*/ + +#include "moc_qholstersensor.cpp" +QTM_END_NAMESPACE diff --git a/src/sensors/qholstersensor.h b/src/sensors/qholstersensor.h new file mode 100644 index 0000000000..ea9acb6cea --- /dev/null +++ b/src/sensors/qholstersensor.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 QHOLSTERSENSOR_H +#define QHOLSTERSENSOR_H + +#include <qsensor.h> + +QTM_BEGIN_NAMESPACE + +class QHolsterReadingPrivate; + +class Q_SENSORS_EXPORT QHolsterReading : public QSensorReading +{ + Q_OBJECT + Q_PROPERTY(bool holstered READ holstered) + DECLARE_READING(QHolsterReading) +public: + bool holstered() const; + void setHolstered(bool holstered); +}; + +class Q_SENSORS_EXPORT QHolsterFilter : public QSensorFilter +{ +public: + virtual bool filter(QHolsterReading *reading) = 0; +private: + bool filter(QSensorReading *reading) + { return filter(static_cast<QHolsterReading*>(reading)); } +}; + +class Q_SENSORS_EXPORT QHolsterSensor : public QSensor +{ + Q_OBJECT +public: + explicit QHolsterSensor(QObject *parent = 0); + ~QHolsterSensor(); + QHolsterReading *reading() const { return static_cast<QHolsterReading*>(QSensor::reading()); } + static char const * const type; + +private: + Q_DISABLE_COPY(QHolsterSensor) +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/sensors/qholstersensor_p.h b/src/sensors/qholstersensor_p.h new file mode 100644 index 0000000000..c8a4cc4088 --- /dev/null +++ b/src/sensors/qholstersensor_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 QHOLSTERSENSOR_P_H +#define QHOLSTERSENSOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QTM_BEGIN_NAMESPACE + +class QHolsterReadingPrivate +{ +public: + QHolsterReadingPrivate() + : holstered(false) + { + } + + bool holstered; +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/sensors/qpressuresensor.cpp b/src/sensors/qpressuresensor.cpp new file mode 100644 index 0000000000..6eb889fc36 --- /dev/null +++ b/src/sensors/qpressuresensor.cpp @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 <qpressuresensor.h> +#include "qpressuresensor_p.h" + +QTM_BEGIN_NAMESPACE + +IMPLEMENT_READING(QPressureReading) + +/*! + \class QPressureReading + \ingroup sensors_reading + \inmodule QtSensors + + \brief The QPressureReading class holds readings from the pressure sensor. + + \section2 QPressureReading Units + + The pressure sensor returns atmospheric pressure values in Pascals. +*/ + +/*! + \property QPressureReading::pressure + \brief The measured atmospheric pressure. + + Returned as Pascals. + \sa {QPressureReading Units} +*/ + +qreal QPressureReading::pressure() const +{ + return d->pressure; +} + +/*! + Sets the pressure to \a pressure. +*/ +void QPressureReading::setPressure(qreal pressure) +{ + d->pressure = pressure; +} + +// ===================================================================== + +/*! + \class QPressureFilter + \ingroup sensors_filter + \inmodule QtSensors + + \brief The QPressureFilter class is a convenience wrapper around QSensorFilter. + + The only difference is that the filter() method features a pointer to QPressureReading + instead of QSensorReading. +*/ + +/*! + \fn QPressureFilter::filter(QPressureReading *reading) + + Called when \a reading changes. Returns false to prevent the reading from propagating. + + \sa QSensorFilter::filter() +*/ + +char const * const QPressureSensor::type("QPressureSensor"); + +/*! + \class QPressureSensor + \ingroup sensors_type + \inmodule QtSensors + + \brief The QPressureSensor class is a convenience wrapper around QSensor. + + The only behavioural difference is that this class sets the type properly. + + This class also features a reading() function that returns a QPressureReading instead of a QSensorReading. + + For details about how the sensor works, see \l QPressureReading. + + \sa QPressureReading +*/ + +/*! + \fn QPressureSensor::QPressureSensor(QObject *parent) + + Construct the sensor as a child of \a parent. +*/ +QPressureSensor::QPressureSensor(QObject *parent) + : QSensor(QPressureSensor::type, parent) +{ +} + +/*! + \fn QPressureSensor::~QPressureSensor() + + Destroy the sensor. Stops the sensor if it has not already been stopped. +*/ +QPressureSensor::~QPressureSensor() +{ +} + +/*! + \fn QPressureSensor::reading() const + + Returns the reading class for this sensor. + + \sa QSensor::reading() +*/ + +#include "moc_qpressuresensor.cpp" +QTM_END_NAMESPACE diff --git a/src/sensors/qpressuresensor.h b/src/sensors/qpressuresensor.h new file mode 100644 index 0000000000..8c917f9370 --- /dev/null +++ b/src/sensors/qpressuresensor.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 QPRESSURESENSOR_H +#define QPRESSURESENSOR_H + +#include <qsensor.h> + +QTM_BEGIN_NAMESPACE + +class QPressureReadingPrivate; + +class Q_SENSORS_EXPORT QPressureReading : public QSensorReading +{ + Q_OBJECT + Q_PROPERTY(qreal pressure READ pressure) + DECLARE_READING(QPressureReading) +public: + qreal pressure() const; + void setPressure(qreal pressure); +}; + +class Q_SENSORS_EXPORT QPressureFilter : public QSensorFilter +{ +public: + virtual bool filter(QPressureReading *reading) = 0; +private: + bool filter(QSensorReading *reading) + { return filter(static_cast<QPressureReading*>(reading)); } +}; + +class Q_SENSORS_EXPORT QPressureSensor : public QSensor +{ + Q_OBJECT +public: + explicit QPressureSensor(QObject *parent = 0); + virtual ~QPressureSensor(); + QPressureReading *reading() const { return static_cast<QPressureReading*>(QSensor::reading()); } + static char const * const type; +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/sensors/qpressuresensor_p.h b/src/sensors/qpressuresensor_p.h new file mode 100644 index 0000000000..790e0d53dd --- /dev/null +++ b/src/sensors/qpressuresensor_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $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 QPRESSURESENSOR_P_H +#define QPRESSURESENSOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QTM_BEGIN_NAMESPACE + +class QPressureReadingPrivate +{ +public: + QPressureReadingPrivate() + : pressure(0) + { + } + + qreal pressure; +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro index 3c16db72bf..f9f587991b 100644 --- a/src/sensors/sensors.pro +++ b/src/sensors/sensors.pro @@ -52,9 +52,11 @@ SENSORS=\ qaccelerometer\ qambientlightsensor\ qcompass\ + qholstersensor\ qlightsensor\ qmagnetometer\ qorientationsensor\ + qpressuresensor\ qproximitysensor\ qrotationsensor\ qtapsensor\ |