summaryrefslogtreecommitdiffstats
path: root/src/sensors
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-05-23 13:18:07 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-05-23 13:18:07 +0200
commite8237a3d19e90c31af6d5a6c5e3a2f7815740226 (patch)
tree24696c0400318684bc00cf36d41a445051b67b96 /src/sensors
parentf57241666fd4b7074cbe33567827293e2a0a9ad5 (diff)
parent3d75c54b8d0d055eff2a41cef7733b6204f8241c (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/sensors')
-rw-r--r--src/sensors/doc/qtsensors.qdocconf2
-rw-r--r--src/sensors/doc/snippets/sensors/creating.cpp16
-rwxr-xr-xsrc/sensors/make_sensor.pl15
-rw-r--r--src/sensors/qaccelerometer.cpp10
-rw-r--r--src/sensors/qaccelerometer.h4
-rw-r--r--src/sensors/qaltimeter.cpp10
-rw-r--r--src/sensors/qaltimeter.h5
-rw-r--r--src/sensors/qambientlightsensor.cpp10
-rw-r--r--src/sensors/qambientlightsensor.h4
-rw-r--r--src/sensors/qambienttemperaturesensor.cpp10
-rw-r--r--src/sensors/qambienttemperaturesensor.h5
-rw-r--r--src/sensors/qcompass.cpp10
-rw-r--r--src/sensors/qcompass.h4
-rw-r--r--src/sensors/qgyroscope.cpp10
-rw-r--r--src/sensors/qgyroscope.h4
-rw-r--r--src/sensors/qholstersensor.cpp10
-rw-r--r--src/sensors/qholstersensor.h5
-rw-r--r--src/sensors/qirproximitysensor.cpp9
-rw-r--r--src/sensors/qirproximitysensor.h4
-rw-r--r--src/sensors/qlightsensor.cpp10
-rw-r--r--src/sensors/qlightsensor.h4
-rw-r--r--src/sensors/qmagnetometer.cpp10
-rw-r--r--src/sensors/qmagnetometer.h4
-rw-r--r--src/sensors/qorientationsensor.cpp10
-rw-r--r--src/sensors/qorientationsensor.h4
-rw-r--r--src/sensors/qpressuresensor.cpp10
-rw-r--r--src/sensors/qpressuresensor.h5
-rw-r--r--src/sensors/qproximitysensor.cpp10
-rw-r--r--src/sensors/qproximitysensor.h4
-rw-r--r--src/sensors/qrotationsensor.cpp10
-rw-r--r--src/sensors/qrotationsensor.h4
-rw-r--r--src/sensors/qsensor.cpp17
-rw-r--r--src/sensors/qsensorbackend.cpp80
-rw-r--r--src/sensors/qsensorbackend.h8
-rw-r--r--src/sensors/qsensorbackend_p.h76
-rw-r--r--src/sensors/qsensormanager.cpp4
-rw-r--r--src/sensors/qsensormanager.h2
-rw-r--r--src/sensors/qsensorplugin.cpp9
-rw-r--r--src/sensors/qsensorplugin.h4
-rw-r--r--src/sensors/qtapsensor.cpp10
-rw-r--r--src/sensors/qtapsensor.h4
-rw-r--r--src/sensors/qtiltsensor.cpp9
-rw-r--r--src/sensors/qtiltsensor.h4
-rw-r--r--src/sensors/sensors.pro5
44 files changed, 383 insertions, 81 deletions
diff --git a/src/sensors/doc/qtsensors.qdocconf b/src/sensors/doc/qtsensors.qdocconf
index 2ede8cf4..b84d3fa3 100644
--- a/src/sensors/doc/qtsensors.qdocconf
+++ b/src/sensors/doc/qtsensors.qdocconf
@@ -46,6 +46,8 @@ sourcedirs += .. \
exampledirs += ../../../examples/sensors \
snippets/
+# Specify the install path under QT_INSTALL_EXAMPLES
+examplesinstallpath = sensors
imagedirs += images
diff --git a/src/sensors/doc/snippets/sensors/creating.cpp b/src/sensors/doc/snippets/sensors/creating.cpp
index 01e3e369..7988f7e7 100644
--- a/src/sensors/doc/snippets/sensors/creating.cpp
+++ b/src/sensors/doc/snippets/sensors/creating.cpp
@@ -40,6 +40,7 @@
#include <QObject>
#include <qaccelerometer.h>
+#include <qmagnetometer.h>
#include <qorientationsensor.h>
class MyObject : public QObject
@@ -59,5 +60,20 @@ QOrientationSensor orient_sensor;
Q_UNUSED(sensor)
Q_UNUSED(orient_sensor);
+
+{
+//! [2]
+QMagnetometer *magnetometer = new QMagnetometer(this);
+//! [2]
+Q_UNUSED(magnetometer);
+}
+
+{
+//! [3]
+QSensor *magnetometer = new QSensor(QMagnetometer::type, this);
+//! [3]
+Q_UNUSED(magnetometer);
+}
+
}
diff --git a/src/sensors/make_sensor.pl b/src/sensors/make_sensor.pl
index 27322517..00afa724 100755
--- a/src/sensors/make_sensor.pl
+++ b/src/sensors/make_sensor.pl
@@ -315,8 +315,7 @@ class Q_SENSORS_EXPORT '.$filter.' : public QSensorFilter
public:
virtual bool filter('.$reading.' *reading) = 0;
private:
- bool filter(QSensorReading *reading) Q_DECL_OVERRIDE
- { return filter(static_cast<'.$reading.'*>(reading)); }
+ bool filter(QSensorReading *reading) Q_DECL_OVERRIDE;
};
class Q_SENSORS_EXPORT '.$sensor.' : public QSensor
@@ -325,7 +324,7 @@ class Q_SENSORS_EXPORT '.$sensor.' : public QSensor
public:
explicit '.$sensor.'(QObject *parent = 0);
~'.$sensor.'();
- '.$reading.' *reading() const { return static_cast<'.$reading.'*>(QSensor::reading()); }
+ '.$reading.' *reading() const;
static char const * const type;
private:
@@ -408,6 +407,11 @@ void '.$reading.'::setMyprop(qreal myprop)
\sa QSensorFilter::filter()
*/
+bool '.$filter.'::filter(QSensorReading *reading)
+{
+ return filter(static_cast<'.$reading.'*>(reading));
+}
+
char const * const '.$sensor.'::type("'.$sensor.'");
/*!
@@ -450,6 +454,11 @@ char const * const '.$sensor.'::type("'.$sensor.'");
\sa QSensor::reading()
*/
+'.$reading.' *'.$sensor.'::reading() const
+{
+ return static_cast<'.$reading.'*>(QSensor::reading());
+}
+
#include "moc_'.$source.'"
QT_END_NAMESPACE
';
diff --git a/src/sensors/qaccelerometer.cpp b/src/sensors/qaccelerometer.cpp
index 9b9bd346..dd822735 100644
--- a/src/sensors/qaccelerometer.cpp
+++ b/src/sensors/qaccelerometer.cpp
@@ -150,6 +150,11 @@ void QAccelerometerReading::setZ(qreal z)
\sa QSensorFilter::filter()
*/
+bool QAccelerometerFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QAccelerometerReading*>(reading));
+}
+
char const * const QAccelerometer::type("QAccelerometer");
/*!
@@ -257,6 +262,11 @@ void QAccelerometer::setAccelerationMode(QAccelerometer::AccelerationMode accele
\sa QSensor::reading()
*/
+QAccelerometerReading *QAccelerometer::reading() const
+{
+ return static_cast<QAccelerometerReading*>(QSensor::reading());
+}
+
/*!
\fn QAccelerometer::accelerationModeChanged(AccelerationMode accelerationMode)
diff --git a/src/sensors/qaccelerometer.h b/src/sensors/qaccelerometer.h
index 4478235c..b9be0523 100644
--- a/src/sensors/qaccelerometer.h
+++ b/src/sensors/qaccelerometer.h
@@ -71,7 +71,7 @@ class Q_SENSORS_EXPORT QAccelerometerFilter : public QSensorFilter
public:
virtual bool filter(QAccelerometerReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QAccelerometerReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class QAccelerometerPrivate;
@@ -96,7 +96,7 @@ public:
AccelerationMode accelerationMode() const;
void setAccelerationMode(AccelerationMode accelerationMode);
- QAccelerometerReading *reading() const { return static_cast<QAccelerometerReading*>(QSensor::reading()); }
+ QAccelerometerReading *reading() const;
static char const * const type;
Q_SIGNALS:
diff --git a/src/sensors/qaltimeter.cpp b/src/sensors/qaltimeter.cpp
index 6a7caa7b..44c5767b 100644
--- a/src/sensors/qaltimeter.cpp
+++ b/src/sensors/qaltimeter.cpp
@@ -102,6 +102,11 @@ void QAltimeterReading::setAltitude(qreal altitude)
\sa QSensorFilter::filter()
*/
+bool QAltimeterFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QAltimeterReading*>(reading));
+}
+
char const * const QAltimeter::type("QAltimeter");
/*!
@@ -144,5 +149,10 @@ QAltimeter::~QAltimeter()
\sa QSensor::reading()
*/
+QAltimeterReading *QAltimeter::reading() const
+{
+ return static_cast<QAltimeterReading*>(QSensor::reading());
+}
+
#include "moc_qaltimeter.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qaltimeter.h b/src/sensors/qaltimeter.h
index 6b7d2232..7077e381 100644
--- a/src/sensors/qaltimeter.h
+++ b/src/sensors/qaltimeter.h
@@ -62,8 +62,7 @@ class Q_SENSORS_EXPORT QAltimeterFilter : public QSensorFilter
public:
virtual bool filter(QAltimeterReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) Q_DECL_OVERRIDE
- { return filter(static_cast<QAltimeterReading*>(reading)); }
+ bool filter(QSensorReading *reading) Q_DECL_OVERRIDE;
};
class Q_SENSORS_EXPORT QAltimeter : public QSensor
@@ -72,7 +71,7 @@ class Q_SENSORS_EXPORT QAltimeter : public QSensor
public:
explicit QAltimeter(QObject *parent = 0);
~QAltimeter();
- QAltimeterReading *reading() const { return static_cast<QAltimeterReading*>(QSensor::reading()); }
+ QAltimeterReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qambientlightsensor.cpp b/src/sensors/qambientlightsensor.cpp
index 2c434b47..6992459a 100644
--- a/src/sensors/qambientlightsensor.cpp
+++ b/src/sensors/qambientlightsensor.cpp
@@ -126,6 +126,11 @@ void QAmbientLightReading::setLightLevel(QAmbientLightReading::LightLevel lightL
\sa QSensorFilter::filter()
*/
+bool QAmbientLightFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QAmbientLightReading*>(reading));
+}
+
char const * const QAmbientLightSensor::type("QAmbientLightSensor");
/*!
@@ -167,6 +172,11 @@ QAmbientLightSensor::~QAmbientLightSensor()
\sa QSensor::reading()
*/
+QAmbientLightReading *QAmbientLightSensor::reading() const
+{
+ return static_cast<QAmbientLightReading*>(QSensor::reading());
+}
+
#include "moc_qambientlightsensor.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qambientlightsensor.h b/src/sensors/qambientlightsensor.h
index 3dae639c..8f9ee501 100644
--- a/src/sensors/qambientlightsensor.h
+++ b/src/sensors/qambientlightsensor.h
@@ -73,7 +73,7 @@ class Q_SENSORS_EXPORT QAmbientLightFilter : public QSensorFilter
public:
virtual bool filter(QAmbientLightReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QAmbientLightReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QAmbientLightSensor : public QSensor
@@ -82,7 +82,7 @@ class Q_SENSORS_EXPORT QAmbientLightSensor : public QSensor
public:
explicit QAmbientLightSensor(QObject *parent = 0);
virtual ~QAmbientLightSensor();
- QAmbientLightReading *reading() const { return static_cast<QAmbientLightReading*>(QSensor::reading()); }
+ QAmbientLightReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qambienttemperaturesensor.cpp b/src/sensors/qambienttemperaturesensor.cpp
index 9ecde6df..7dd34dd2 100644
--- a/src/sensors/qambienttemperaturesensor.cpp
+++ b/src/sensors/qambienttemperaturesensor.cpp
@@ -98,6 +98,11 @@ void QAmbientTemperatureReading::setTemperature(qreal temperature)
\sa QSensorFilter::filter()
*/
+bool QAmbientTemperatureFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QAmbientTemperatureReading*>(reading));
+}
+
char const * const QAmbientTemperatureSensor::type("QAmbientTemperatureSensor");
/*!
@@ -140,5 +145,10 @@ QAmbientTemperatureSensor::~QAmbientTemperatureSensor()
\sa QSensor::reading()
*/
+QAmbientTemperatureReading *QAmbientTemperatureSensor::reading() const
+{
+ return static_cast<QAmbientTemperatureReading*>(QSensor::reading());
+}
+
#include "moc_qambienttemperaturesensor.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qambienttemperaturesensor.h b/src/sensors/qambienttemperaturesensor.h
index 134e5a92..c91392d0 100644
--- a/src/sensors/qambienttemperaturesensor.h
+++ b/src/sensors/qambienttemperaturesensor.h
@@ -62,8 +62,7 @@ class Q_SENSORS_EXPORT QAmbientTemperatureFilter : public QSensorFilter
public:
virtual bool filter(QAmbientTemperatureReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) Q_DECL_OVERRIDE
- { return filter(static_cast<QAmbientTemperatureReading*>(reading)); }
+ bool filter(QSensorReading *reading) Q_DECL_OVERRIDE;
};
class Q_SENSORS_EXPORT QAmbientTemperatureSensor : public QSensor
@@ -72,7 +71,7 @@ class Q_SENSORS_EXPORT QAmbientTemperatureSensor : public QSensor
public:
explicit QAmbientTemperatureSensor(QObject *parent = 0);
~QAmbientTemperatureSensor();
- QAmbientTemperatureReading *reading() const { return static_cast<QAmbientTemperatureReading*>(QSensor::reading()); }
+ QAmbientTemperatureReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qcompass.cpp b/src/sensors/qcompass.cpp
index e0592ef3..8bfca073 100644
--- a/src/sensors/qcompass.cpp
+++ b/src/sensors/qcompass.cpp
@@ -136,6 +136,11 @@ void QCompassReading::setCalibrationLevel(qreal calibrationLevel)
\sa QSensorFilter::filter()
*/
+bool QCompassFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QCompassReading*>(reading));
+}
+
char const * const QCompass::type("QCompass");
/*!
@@ -177,6 +182,11 @@ QCompass::~QCompass()
\sa QSensor::reading()
*/
+QCompassReading *QCompass::reading() const
+{
+ return static_cast<QCompassReading*>(QSensor::reading());
+}
+
#include "moc_qcompass.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qcompass.h b/src/sensors/qcompass.h
index 8b858ff7..75b68692 100644
--- a/src/sensors/qcompass.h
+++ b/src/sensors/qcompass.h
@@ -67,7 +67,7 @@ class Q_SENSORS_EXPORT QCompassFilter : public QSensorFilter
public:
virtual bool filter(QCompassReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QCompassReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QCompass : public QSensor
@@ -76,7 +76,7 @@ class Q_SENSORS_EXPORT QCompass : public QSensor
public:
explicit QCompass(QObject *parent = 0);
virtual ~QCompass();
- QCompassReading *reading() const { return static_cast<QCompassReading*>(QSensor::reading()); }
+ QCompassReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qgyroscope.cpp b/src/sensors/qgyroscope.cpp
index a2dfff8a..ca370ba3 100644
--- a/src/sensors/qgyroscope.cpp
+++ b/src/sensors/qgyroscope.cpp
@@ -148,6 +148,11 @@ void QGyroscopeReading::setZ(qreal z)
\sa QSensorFilter::filter()
*/
+bool QGyroscopeFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QGyroscopeReading*>(reading));
+}
+
char const * const QGyroscope::type("QGyroscope");
/*!
@@ -189,6 +194,11 @@ QGyroscope::~QGyroscope()
\sa QSensor::reading()
*/
+QGyroscopeReading *QGyroscope::reading() const
+{
+ return static_cast<QGyroscopeReading*>(QSensor::reading());
+}
+
#include "moc_qgyroscope.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qgyroscope.h b/src/sensors/qgyroscope.h
index 32c01da8..31ed23bc 100644
--- a/src/sensors/qgyroscope.h
+++ b/src/sensors/qgyroscope.h
@@ -71,7 +71,7 @@ class Q_SENSORS_EXPORT QGyroscopeFilter : public QSensorFilter
public:
virtual bool filter(QGyroscopeReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QGyroscopeReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QGyroscope : public QSensor
@@ -80,7 +80,7 @@ class Q_SENSORS_EXPORT QGyroscope : public QSensor
public:
explicit QGyroscope(QObject *parent = 0);
virtual ~QGyroscope();
- QGyroscopeReading *reading() const { return static_cast<QGyroscopeReading*>(QSensor::reading()); }
+ QGyroscopeReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qholstersensor.cpp b/src/sensors/qholstersensor.cpp
index 761910f2..648afa35 100644
--- a/src/sensors/qholstersensor.cpp
+++ b/src/sensors/qholstersensor.cpp
@@ -102,6 +102,11 @@ void QHolsterReading::setHolstered(bool holstered)
\sa QSensorFilter::filter()
*/
+bool QHolsterFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QHolsterReading*>(reading));
+}
+
char const * const QHolsterSensor::type("QHolsterSensor");
/*!
@@ -144,5 +149,10 @@ QHolsterSensor::~QHolsterSensor()
\sa QSensor::reading()
*/
+QHolsterReading *QHolsterSensor::reading() const
+{
+ return static_cast<QHolsterReading*>(QSensor::reading());
+}
+
#include "moc_qholstersensor.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qholstersensor.h b/src/sensors/qholstersensor.h
index f44b381e..85faa17b 100644
--- a/src/sensors/qholstersensor.h
+++ b/src/sensors/qholstersensor.h
@@ -62,8 +62,7 @@ class Q_SENSORS_EXPORT QHolsterFilter : public QSensorFilter
public:
virtual bool filter(QHolsterReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) Q_DECL_OVERRIDE
- { return filter(static_cast<QHolsterReading*>(reading)); }
+ bool filter(QSensorReading *reading) Q_DECL_OVERRIDE;
};
class Q_SENSORS_EXPORT QHolsterSensor : public QSensor
@@ -72,7 +71,7 @@ class Q_SENSORS_EXPORT QHolsterSensor : public QSensor
public:
explicit QHolsterSensor(QObject *parent = 0);
~QHolsterSensor();
- QHolsterReading *reading() const { return static_cast<QHolsterReading*>(QSensor::reading()); }
+ QHolsterReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qirproximitysensor.cpp b/src/sensors/qirproximitysensor.cpp
index 6197bb96..81ef9095 100644
--- a/src/sensors/qirproximitysensor.cpp
+++ b/src/sensors/qirproximitysensor.cpp
@@ -114,6 +114,11 @@ void QIRProximityReading::setReflectance(qreal reflectance)
\sa QSensorFilter::filter()
*/
+bool QIRProximityFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QIRProximityReading*>(reading));
+}
+
char const * const QIRProximitySensor::type("QIRProximitySensor");
/*!
@@ -155,5 +160,9 @@ QIRProximitySensor::~QIRProximitySensor()
\sa QSensor::reading()
*/
+QIRProximityReading *QIRProximitySensor::reading() const
+{
+ return static_cast<QIRProximityReading*>(QSensor::reading());
+}
#include "moc_qirproximitysensor.cpp"
diff --git a/src/sensors/qirproximitysensor.h b/src/sensors/qirproximitysensor.h
index 29eb49cd..c4ecba4e 100644
--- a/src/sensors/qirproximitysensor.h
+++ b/src/sensors/qirproximitysensor.h
@@ -63,7 +63,7 @@ class Q_SENSORS_EXPORT QIRProximityFilter : public QSensorFilter
public:
virtual bool filter(QIRProximityReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QIRProximityReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QIRProximitySensor : public QSensor
@@ -72,7 +72,7 @@ class Q_SENSORS_EXPORT QIRProximitySensor : public QSensor
public:
explicit QIRProximitySensor(QObject *parent = 0);
virtual ~QIRProximitySensor();
- QIRProximityReading *reading() const { return static_cast<QIRProximityReading*>(QSensor::reading()); }
+ QIRProximityReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qlightsensor.cpp b/src/sensors/qlightsensor.cpp
index 1e80ef09..7e10f0ff 100644
--- a/src/sensors/qlightsensor.cpp
+++ b/src/sensors/qlightsensor.cpp
@@ -100,6 +100,11 @@ void QLightReading::setLux(qreal lux)
\sa QSensorFilter::filter()
*/
+bool QLightFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QLightReading*>(reading));
+}
+
char const * const QLightSensor::type("QLightSensor");
/*!
@@ -141,6 +146,11 @@ QLightSensor::~QLightSensor()
\sa QSensor::reading()
*/
+QLightReading *QLightSensor::reading() const
+{
+ return static_cast<QLightReading*>(QSensor::reading());
+}
+
/*!
\property QLightSensor::fieldOfView
\brief a value indicating the field of view.
diff --git a/src/sensors/qlightsensor.h b/src/sensors/qlightsensor.h
index 1da84498..26240b46 100644
--- a/src/sensors/qlightsensor.h
+++ b/src/sensors/qlightsensor.h
@@ -63,7 +63,7 @@ class Q_SENSORS_EXPORT QLightFilter : public QSensorFilter
public:
virtual bool filter(QLightReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QLightReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class QLightSensorPrivate;
@@ -75,7 +75,7 @@ class Q_SENSORS_EXPORT QLightSensor : public QSensor
public:
explicit QLightSensor(QObject *parent = 0);
virtual ~QLightSensor();
- QLightReading *reading() const { return static_cast<QLightReading*>(QSensor::reading()); }
+ QLightReading *reading() const;
static char const * const type;
qreal fieldOfView() const;
diff --git a/src/sensors/qmagnetometer.cpp b/src/sensors/qmagnetometer.cpp
index 7c5c9657..e7cc61c0 100644
--- a/src/sensors/qmagnetometer.cpp
+++ b/src/sensors/qmagnetometer.cpp
@@ -188,6 +188,11 @@ void QMagnetometerReading::setCalibrationLevel(qreal calibrationLevel)
\sa QSensorFilter::filter()
*/
+bool QMagnetometerFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QMagnetometerReading*>(reading));
+}
+
char const * const QMagnetometer::type("QMagnetometer");
/*!
@@ -229,6 +234,11 @@ QMagnetometer::~QMagnetometer()
\sa QSensor::reading()
*/
+QMagnetometerReading *QMagnetometer::reading() const
+{
+ return static_cast<QMagnetometerReading*>(QSensor::reading());
+}
+
/*!
\property QMagnetometer::returnGeoValues
\brief a value indicating if geomagnetic values should be returned.
diff --git a/src/sensors/qmagnetometer.h b/src/sensors/qmagnetometer.h
index 93b6157f..9d754fc7 100644
--- a/src/sensors/qmagnetometer.h
+++ b/src/sensors/qmagnetometer.h
@@ -75,7 +75,7 @@ class Q_SENSORS_EXPORT QMagnetometerFilter : public QSensorFilter
public:
virtual bool filter(QMagnetometerReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QMagnetometerReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class QMagnetometerPrivate;
@@ -87,7 +87,7 @@ class Q_SENSORS_EXPORT QMagnetometer : public QSensor
public:
explicit QMagnetometer(QObject *parent = 0);
virtual ~QMagnetometer();
- QMagnetometerReading *reading() const { return static_cast<QMagnetometerReading*>(QSensor::reading()); }
+ QMagnetometerReading *reading() const;
static char const * const type;
bool returnGeoValues() const;
diff --git a/src/sensors/qorientationsensor.cpp b/src/sensors/qorientationsensor.cpp
index 0ca545e6..5f5015d6 100644
--- a/src/sensors/qorientationsensor.cpp
+++ b/src/sensors/qorientationsensor.cpp
@@ -149,6 +149,11 @@ void QOrientationReading::setOrientation(QOrientationReading::Orientation orient
\sa QSensorFilter::filter()
*/
+bool QOrientationFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QOrientationReading*>(reading));
+}
+
char const * const QOrientationSensor::type("QOrientationSensor");
/*!
@@ -190,6 +195,11 @@ QOrientationSensor::~QOrientationSensor()
\sa QSensor::reading()
*/
+QOrientationReading *QOrientationSensor::reading() const
+{
+ return static_cast<QOrientationReading*>(QSensor::reading());
+}
+
#include "moc_qorientationsensor.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qorientationsensor.h b/src/sensors/qorientationsensor.h
index 082598fb..a6fccb87 100644
--- a/src/sensors/qorientationsensor.h
+++ b/src/sensors/qorientationsensor.h
@@ -74,7 +74,7 @@ class Q_SENSORS_EXPORT QOrientationFilter : public QSensorFilter
public:
virtual bool filter(QOrientationReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QOrientationReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QOrientationSensor : public QSensor
@@ -83,7 +83,7 @@ class Q_SENSORS_EXPORT QOrientationSensor : public QSensor
public:
explicit QOrientationSensor(QObject *parent = 0);
virtual ~QOrientationSensor();
- QOrientationReading *reading() const { return static_cast<QOrientationReading*>(QSensor::reading()); }
+ QOrientationReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qpressuresensor.cpp b/src/sensors/qpressuresensor.cpp
index ca3a861f..1aea843a 100644
--- a/src/sensors/qpressuresensor.cpp
+++ b/src/sensors/qpressuresensor.cpp
@@ -128,6 +128,11 @@ void QPressureReading::setTemperature(qreal temperature)
\sa QSensorFilter::filter()
*/
+bool QPressureFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QPressureReading*>(reading));
+}
+
char const * const QPressureSensor::type("QPressureSensor");
/*!
@@ -170,5 +175,10 @@ QPressureSensor::~QPressureSensor()
\sa QSensor::reading()
*/
+QPressureReading *QPressureSensor::reading() const
+{
+ return static_cast<QPressureReading*>(QSensor::reading());
+}
+
#include "moc_qpressuresensor.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qpressuresensor.h b/src/sensors/qpressuresensor.h
index 4df22899..8a14d410 100644
--- a/src/sensors/qpressuresensor.h
+++ b/src/sensors/qpressuresensor.h
@@ -66,8 +66,7 @@ class Q_SENSORS_EXPORT QPressureFilter : public QSensorFilter
public:
virtual bool filter(QPressureReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) Q_DECL_OVERRIDE
- { return filter(static_cast<QPressureReading*>(reading)); }
+ bool filter(QSensorReading *reading) Q_DECL_OVERRIDE;
};
class Q_SENSORS_EXPORT QPressureSensor : public QSensor
@@ -76,7 +75,7 @@ class Q_SENSORS_EXPORT QPressureSensor : public QSensor
public:
explicit QPressureSensor(QObject *parent = 0);
~QPressureSensor();
- QPressureReading *reading() const { return static_cast<QPressureReading*>(QSensor::reading()); }
+ QPressureReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qproximitysensor.cpp b/src/sensors/qproximitysensor.cpp
index 599d2906..102976d1 100644
--- a/src/sensors/qproximitysensor.cpp
+++ b/src/sensors/qproximitysensor.cpp
@@ -105,6 +105,11 @@ void QProximityReading::setClose(bool close)
\sa QSensorFilter::filter()
*/
+bool QProximityFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QProximityReading*>(reading));
+}
+
char const * const QProximitySensor::type("QProximitySensor");
/*!
@@ -146,6 +151,11 @@ QProximitySensor::~QProximitySensor()
\sa QSensor::reading()
*/
+QProximityReading *QProximitySensor::reading() const
+{
+ return static_cast<QProximityReading*>(QSensor::reading());
+}
+
#include "moc_qproximitysensor.cpp"
QT_END_NAMESPACE
diff --git a/src/sensors/qproximitysensor.h b/src/sensors/qproximitysensor.h
index cc8eb78b..162334f7 100644
--- a/src/sensors/qproximitysensor.h
+++ b/src/sensors/qproximitysensor.h
@@ -63,7 +63,7 @@ class Q_SENSORS_EXPORT QProximityFilter : public QSensorFilter
public:
virtual bool filter(QProximityReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QProximityReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QProximitySensor : public QSensor
@@ -72,7 +72,7 @@ class Q_SENSORS_EXPORT QProximitySensor : public QSensor
public:
explicit QProximitySensor(QObject *parent = 0);
virtual ~QProximitySensor();
- QProximityReading *reading() const { return static_cast<QProximityReading*>(QSensor::reading()); }
+ QProximityReading *reading() const;
static char const * const type;
private:
diff --git a/src/sensors/qrotationsensor.cpp b/src/sensors/qrotationsensor.cpp
index 06ee4064..135b6576 100644
--- a/src/sensors/qrotationsensor.cpp
+++ b/src/sensors/qrotationsensor.cpp
@@ -179,6 +179,11 @@ void QRotationReading::setFromEuler(qreal x, qreal y, qreal z)
\sa QSensorFilter::filter()
*/
+bool QRotationFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QRotationReading*>(reading));
+}
+
char const * const QRotationSensor::type("QRotationSensor");
/*!
@@ -220,6 +225,11 @@ QRotationSensor::~QRotationSensor()
\sa QSensor::reading()
*/
+QRotationReading *QRotationSensor::reading() const
+{
+ return static_cast<QRotationReading*>(QSensor::reading());
+}
+
/*!
\property QRotationSensor::hasZ
\brief a value indicating if the z angle is available.
diff --git a/src/sensors/qrotationsensor.h b/src/sensors/qrotationsensor.h
index 68a0d1d3..e7d0e2e9 100644
--- a/src/sensors/qrotationsensor.h
+++ b/src/sensors/qrotationsensor.h
@@ -68,7 +68,7 @@ class Q_SENSORS_EXPORT QRotationFilter : public QSensorFilter
public:
virtual bool filter(QRotationReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QRotationReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class QRotationSensorPrivate;
@@ -80,7 +80,7 @@ class Q_SENSORS_EXPORT QRotationSensor : public QSensor
public:
explicit QRotationSensor(QObject *parent = 0);
virtual ~QRotationSensor();
- QRotationReading *reading() const { return static_cast<QRotationReading*>(QSensor::reading()); }
+ QRotationReading *reading() const;
static char const * const type;
bool hasZ() const;
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp
index fad1de2d..7f05189f 100644
--- a/src/sensors/qsensor.cpp
+++ b/src/sensors/qsensor.cpp
@@ -262,6 +262,23 @@ void QSensorPrivate::init(const QByteArray &sensorType)
/*!
Construct the \a type sensor as a child of \a parent.
+
+ Do not use this constructor if a derived class exists for the specific sensor type.
+
+ The wrong way is to use the base class constructor:
+ \snippet sensors/creating.cpp 3
+ The right way is to create an instance of the derived class:
+ \snippet sensors/creating.cpp 2
+
+ The derived classes have
+ additional properties and data members which are needed for certain features such as
+ geo value support in QMagnetometer or acceleration mode support in QAccelerometer.
+ These features will only work properly when creating a sensor instance from a QSensor
+ subclass.
+
+ Only use this constructor if there is no derived sensor class available. Note that all
+ built-in sensors have a derived class, so using this constructor should only be necessary
+ when implementing custom sensors, like in the \l {Qt Sensors - Grue Sensor Example}{Grue sensor example}.
*/
QSensor::QSensor(const QByteArray &type, QObject *parent)
: QObject(*new QSensorPrivate, parent)
diff --git a/src/sensors/qsensorbackend.cpp b/src/sensors/qsensorbackend.cpp
index 304674ee..363ad873 100644
--- a/src/sensors/qsensorbackend.cpp
+++ b/src/sensors/qsensorbackend.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qsensorbackend.h"
+#include "qsensorbackend_p.h"
#include "qsensor_p.h"
#include <QDebug>
@@ -59,8 +60,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
*/
-QSensorBackend::QSensorBackend(QSensor *sensor)
- : m_sensor(sensor)
+QSensorBackend::QSensorBackend(QSensor *sensor, QObject *parent)
+ : QObject(*new QSensorBackendPrivate(sensor), parent)
{
}
@@ -91,21 +92,22 @@ bool QSensorBackend::isFeatureSupported(QSensor::Feature feature) const
*/
void QSensorBackend::newReadingAvailable()
{
- QSensorPrivate *d = m_sensor->d_func();
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
// Copy the values from the device reading to the filter reading
- d->filter_reading->copyValuesFrom(d->device_reading);
+ sensorPrivate->filter_reading->copyValuesFrom(sensorPrivate->device_reading);
- for (QFilterList::const_iterator it = d->filters.constBegin(); it != d->filters.constEnd(); ++it) {
+ for (QFilterList::const_iterator it = sensorPrivate->filters.constBegin(); it != sensorPrivate->filters.constEnd(); ++it) {
QSensorFilter *filter = (*it);
- if (!filter->filter(d->filter_reading))
+ if (!filter->filter(sensorPrivate->filter_reading))
return;
}
// Copy the values from the filter reading to the cached reading
- d->cache_reading->copyValuesFrom(d->filter_reading);
+ sensorPrivate->cache_reading->copyValuesFrom(sensorPrivate->filter_reading);
- Q_EMIT m_sensor->readingChanged();
+ Q_EMIT d->m_sensor->readingChanged();
}
/*!
@@ -131,15 +133,19 @@ void QSensorBackend::newReadingAvailable()
*/
QSensorReading *QSensorBackend::reading() const
{
- QSensorPrivate *d = m_sensor->d_func();
- return d->device_reading;
+ Q_D(const QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ return sensorPrivate->device_reading;
}
/*!
- \fn QSensorBackend::sensor() const
-
Returns the sensor front end associated with this backend.
*/
+QSensor *QSensorBackend::sensor() const
+{
+ Q_D(const QSensorBackend);
+ return d->m_sensor;
+}
/*!
\fn QSensorBackend::setReading(T *reading)
@@ -210,10 +216,11 @@ QSensorReading *QSensorBackend::reading() const
*/
void QSensorBackend::setReadings(QSensorReading *device, QSensorReading *filter, QSensorReading *cache)
{
- QSensorPrivate *d = m_sensor->d_func();
- d->device_reading = device;
- d->filter_reading = filter;
- d->cache_reading = cache;
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->device_reading = device;
+ sensorPrivate->filter_reading = filter;
+ sensorPrivate->cache_reading = cache;
}
/*!
@@ -226,8 +233,9 @@ void QSensorBackend::setReadings(QSensorReading *device, QSensorReading *filter,
*/
void QSensorBackend::addDataRate(qreal min, qreal max)
{
- QSensorPrivate *d = m_sensor->d_func();
- d->availableDataRates << qrange(min, max);
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->availableDataRates << qrange(min, max);
}
/*!
@@ -245,6 +253,7 @@ void QSensorBackend::addDataRate(qreal min, qreal max)
*/
void QSensorBackend::setDataRates(const QSensor *otherSensor)
{
+ Q_D(QSensorBackend);
if (!otherSensor) {
qWarning() << "ERROR: Cannot call QSensorBackend::setDataRates with 0";
return;
@@ -253,12 +262,12 @@ void QSensorBackend::setDataRates(const QSensor *otherSensor)
qWarning() << "ERROR: Cannot call QSensorBackend::setDataRates with an invalid sensor";
return;
}
- if (m_sensor->isConnectedToBackend()) {
+ if (d->m_sensor->isConnectedToBackend()) {
qWarning() << "ERROR: Cannot call QSensorBackend::setDataRates outside of the constructor";
return;
}
- QSensorPrivate *d = m_sensor->d_func();
- d->availableDataRates = otherSensor->availableDataRates();
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->availableDataRates = otherSensor->availableDataRates();
}
/*!
@@ -271,11 +280,12 @@ void QSensorBackend::setDataRates(const QSensor *otherSensor)
*/
void QSensorBackend::addOutputRange(qreal min, qreal max, qreal accuracy)
{
- QSensorPrivate *d = m_sensor->d_func();
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
qoutputrange details = {min, max, accuracy};
- d->outputRanges << details;
+ sensorPrivate->outputRanges << details;
}
/*!
@@ -286,8 +296,9 @@ void QSensorBackend::addOutputRange(qreal min, qreal max, qreal accuracy)
*/
void QSensorBackend::setDescription(const QString &description)
{
- QSensorPrivate *d = m_sensor->d_func();
- d->description = description;
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->description = description;
}
/*!
@@ -302,8 +313,9 @@ void QSensorBackend::setDescription(const QString &description)
*/
void QSensorBackend::sensorStopped()
{
- QSensorPrivate *d = m_sensor->d_func();
- d->active = false;
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->active = false;
}
/*!
@@ -318,9 +330,10 @@ void QSensorBackend::sensorStopped()
*/
void QSensorBackend::sensorBusy()
{
- QSensorPrivate *d = m_sensor->d_func();
- d->active = false;
- d->busy = true;
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->active = false;
+ sensorPrivate->busy = true;
}
/*!
@@ -332,9 +345,10 @@ void QSensorBackend::sensorBusy()
*/
void QSensorBackend::sensorError(int error)
{
- QSensorPrivate *d = m_sensor->d_func();
- d->error = error;
- Q_EMIT m_sensor->sensorError(error);
+ Q_D(QSensorBackend);
+ QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
+ sensorPrivate->error = error;
+ Q_EMIT d->m_sensor->sensorError(error);
}
#include "moc_qsensorbackend.cpp"
diff --git a/src/sensors/qsensorbackend.h b/src/sensors/qsensorbackend.h
index 4c6ce8b5..03a0c413 100644
--- a/src/sensors/qsensorbackend.h
+++ b/src/sensors/qsensorbackend.h
@@ -47,11 +47,13 @@
QT_BEGIN_NAMESPACE
+class QSensorBackendPrivate;
+
class Q_SENSORS_EXPORT QSensorBackend : public QObject
{
Q_OBJECT
public:
- QSensorBackend(QSensor *sensor);
+ explicit QSensorBackend(QSensor *sensor, QObject *parent = 0);
virtual ~QSensorBackend();
virtual void start() = 0;
@@ -75,7 +77,7 @@ public:
}
QSensorReading *reading() const;
- QSensor *sensor() const { return m_sensor; }
+ QSensor *sensor() const;
// used by the backend to inform us of events
void newReadingAvailable();
@@ -86,7 +88,7 @@ public:
private:
void setReadings(QSensorReading *device, QSensorReading *filter, QSensorReading *cache);
- QSensor *m_sensor;
+ Q_DECLARE_PRIVATE(QSensorBackend)
Q_DISABLE_COPY(QSensorBackend)
};
diff --git a/src/sensors/qsensorbackend_p.h b/src/sensors/qsensorbackend_p.h
new file mode 100644
index 00000000..5b989401
--- /dev/null
+++ b/src/sensors/qsensorbackend_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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 QSENSORBACKEND_P_H
+#define QSENSORBACKEND_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.
+//
+
+#include "qsensorbackend.h"
+
+#include "private/qobject_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSensorBackendPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QSensorBackend)
+public:
+ explicit QSensorBackendPrivate(QSensor *sensor)
+ : m_sensor(sensor)
+ {
+ }
+
+ QSensor *m_sensor;
+};
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp
index dbaf1ebb..29bd4b5f 100644
--- a/src/sensors/qsensormanager.cpp
+++ b/src/sensors/qsensormanager.cpp
@@ -496,9 +496,11 @@ void QSensor::registerInstance()
*/
/*!
- \fn QSensorBackendFactory::~QSensorBackendFactory()
\internal
*/
+QSensorBackendFactory::~QSensorBackendFactory()
+{
+}
/*!
\fn QSensorBackendFactory::createBackend(QSensor *sensor)
diff --git a/src/sensors/qsensormanager.h b/src/sensors/qsensormanager.h
index 8fa87d1f..a1611cf4 100644
--- a/src/sensors/qsensormanager.h
+++ b/src/sensors/qsensormanager.h
@@ -70,7 +70,7 @@ class Q_SENSORS_EXPORT QSensorBackendFactory
public:
virtual QSensorBackend *createBackend(QSensor *sensor) = 0;
protected:
- ~QSensorBackendFactory() {}
+ virtual ~QSensorBackendFactory();
};
QT_END_NAMESPACE
diff --git a/src/sensors/qsensorplugin.cpp b/src/sensors/qsensorplugin.cpp
index 29498b9f..ae184eb9 100644
--- a/src/sensors/qsensorplugin.cpp
+++ b/src/sensors/qsensorplugin.cpp
@@ -54,9 +54,11 @@
*/
/*!
- \fn QSensorPluginInterface::~QSensorPluginInterface()
\internal
*/
+QSensorPluginInterface::~QSensorPluginInterface()
+{
+}
/*!
\fn QSensorPluginInterface::registerSensors()
@@ -82,9 +84,12 @@
*/
/*!
- \fn QSensorChangesInterface::~QSensorChangesInterface()
\internal
*/
+QSensorChangesInterface::~QSensorChangesInterface()
+{
+}
+
/*!
\fn QSensorChangesInterface::sensorsChanged()
diff --git a/src/sensors/qsensorplugin.h b/src/sensors/qsensorplugin.h
index 336bce6b..e81d4d56 100644
--- a/src/sensors/qsensorplugin.h
+++ b/src/sensors/qsensorplugin.h
@@ -53,7 +53,7 @@ class Q_SENSORS_EXPORT QSensorPluginInterface
public:
virtual void registerSensors() = 0;
protected:
- ~QSensorPluginInterface() {}
+ virtual ~QSensorPluginInterface();
};
class Q_SENSORS_EXPORT QSensorChangesInterface
@@ -61,7 +61,7 @@ class Q_SENSORS_EXPORT QSensorChangesInterface
public:
virtual void sensorsChanged() = 0;
protected:
- ~QSensorChangesInterface() {}
+ virtual ~QSensorChangesInterface();
};
Q_DECLARE_INTERFACE(QSensorPluginInterface, "com.qt-project.Qt.QSensorPluginInterface/1.0")
diff --git a/src/sensors/qtapsensor.cpp b/src/sensors/qtapsensor.cpp
index 23ec492f..626268d4 100644
--- a/src/sensors/qtapsensor.cpp
+++ b/src/sensors/qtapsensor.cpp
@@ -189,6 +189,11 @@ void QTapReading::setDoubleTap(bool doubleTap)
\sa QSensorFilter::filter()
*/
+bool QTapFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QTapReading*>(reading));
+}
+
char const * const QTapSensor::type("QTapSensor");
/*!
@@ -230,6 +235,11 @@ QTapSensor::~QTapSensor()
\sa QSensor::reading()
*/
+QTapReading *QTapSensor::reading() const
+{
+ return static_cast<QTapReading*>(QSensor::reading());
+}
+
/*!
\property QTapSensor::returnDoubleTapEvents
\brief a value indicating if double tap events should be reported.
diff --git a/src/sensors/qtapsensor.h b/src/sensors/qtapsensor.h
index b8704114..688781eb 100644
--- a/src/sensors/qtapsensor.h
+++ b/src/sensors/qtapsensor.h
@@ -84,7 +84,7 @@ class Q_SENSORS_EXPORT QTapFilter : public QSensorFilter
public:
virtual bool filter(QTapReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QTapReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class QTapSensorPrivate;
@@ -97,7 +97,7 @@ class Q_SENSORS_EXPORT QTapSensor : public QSensor
public:
explicit QTapSensor(QObject *parent = 0);
virtual ~QTapSensor();
- QTapReading *reading() const { return static_cast<QTapReading*>(QSensor::reading()); }
+ QTapReading *reading() const;
static char const * const type;
bool returnDoubleTapEvents() const;
diff --git a/src/sensors/qtiltsensor.cpp b/src/sensors/qtiltsensor.cpp
index b78746bc..220b8f93 100644
--- a/src/sensors/qtiltsensor.cpp
+++ b/src/sensors/qtiltsensor.cpp
@@ -118,6 +118,11 @@ void QTiltReading::setXRotation(qreal x)
\sa QSensorFilter::filter()
*/
+bool QTiltFilter::filter(QSensorReading *reading)
+{
+ return filter(static_cast<QTiltReading*>(reading));
+}
+
char const * const QTiltSensor::type("QTiltSensor");
/*!
@@ -162,6 +167,10 @@ QTiltSensor::~QTiltSensor()
\sa QSensor::reading()
*/
+QTiltReading *QTiltSensor::reading() const
+{
+ return static_cast<QTiltReading*>(QSensor::reading());
+}
/*!
Calibrates the tilt sensor. Uses the current tilt angles as 0.
diff --git a/src/sensors/qtiltsensor.h b/src/sensors/qtiltsensor.h
index 246a103e..4d7e4c76 100644
--- a/src/sensors/qtiltsensor.h
+++ b/src/sensors/qtiltsensor.h
@@ -69,7 +69,7 @@ class Q_SENSORS_EXPORT QTiltFilter : public QSensorFilter
public:
virtual bool filter(QTiltReading *reading) = 0;
private:
- bool filter(QSensorReading *reading) { return filter(static_cast<QTiltReading*>(reading)); }
+ bool filter(QSensorReading *reading);
};
class Q_SENSORS_EXPORT QTiltSensor : public QSensor
@@ -78,7 +78,7 @@ class Q_SENSORS_EXPORT QTiltSensor : public QSensor
public:
explicit QTiltSensor(QObject *parent = 0);
~QTiltSensor();
- QTiltReading *reading() const { return static_cast<QTiltReading*>(QSensor::reading()); }
+ QTiltReading *reading() const;
static char const * const type;
Q_INVOKABLE void calibrate();
diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro
index fe10a5e7..e7ad05f5 100644
--- a/src/sensors/sensors.pro
+++ b/src/sensors/sensors.pro
@@ -12,10 +12,15 @@ simulator {
QMAKE_DOCS = $$PWD/doc/qtsensors.qdocconf
+ANDROID_BUNDLED_JAR_DEPENDENCIES = \
+ jar/QtSensors-bundled.jar:org.qtproject.qt5.android.sensors.QtSensors
ANDROID_JAR_DEPENDENCIES = \
jar/QtSensors.jar:org.qtproject.qt5.android.sensors.QtSensors
ANDROID_LIB_DEPENDENCIES = \
plugins/sensors/libqtsensors_android.so
+MODULE_PLUGIN_TYPES = \
+ sensors \
+ sensorgestures
load(qt_module)