diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-06-07 13:46:00 +0200 |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-06-07 13:46:00 +0200 |
commit | d487c74a7f6a18a106314d3dc58013c6cfc2e1ca (patch) | |
tree | a061010dd8503d6263b72513a454aa5d2356ac5f /src/plugins | |
parent | 102bdf35b13f1b60df26052341ebc5a2833518c7 (diff) | |
parent | 5ae30e1ae8de41478476567148846a80cd508e7b (diff) | |
download | qtsensors-d487c74a7f6a18a106314d3dc58013c6cfc2e1ca.tar.gz |
Merge branch 'stable' into dev
Conflicts:
.qmake.conf
sync.profile
Change-Id: I0eaa022110b99fc5bc7cdf6304b5cda3ad3e8f8c
Diffstat (limited to 'src/plugins')
23 files changed, 45 insertions, 25 deletions
diff --git a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp b/src/plugins/sensorgestures/shake/qshakerecognizer.cpp index b70ad03..7c4133b 100644 --- a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp +++ b/src/plugins/sensorgestures/shake/qshakerecognizer.cpp @@ -158,6 +158,5 @@ bool QShakeSensorGestureRecognizer::checkForShake(AccelData prevSensorData, Acce return (deltaX > threshold || deltaY > threshold || deltaZ > threshold); - (deltaY > threshold && deltaZ > threshold); } diff --git a/src/plugins/sensors/sensorfw/sensorfw.pro b/src/plugins/sensors/sensorfw/sensorfw.pro index 8d67c81..f875f59 100644 --- a/src/plugins/sensors/sensorfw/sensorfw.pro +++ b/src/plugins/sensors/sensorfw/sensorfw.pro @@ -1,5 +1,5 @@ TARGET = qtsensors_sensorfw -QT = core sensors network +QT = core sensors network dbus PLUGIN_TYPE = sensors load(qt_plugin) @@ -8,7 +8,7 @@ include(sensorfw.pri) CONFIG += link_pkgconfig -PKGCONFIG += sensord +PKGCONFIG += sensord-qt5 CONFIGFILES.files = Sensors.conf CONFIGFILES.path = /etc/xdg/QtProject/ diff --git a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp index ddbaa9c..4c50faa 100644 --- a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp @@ -51,6 +51,7 @@ sensorfwaccelerometer::sensorfwaccelerometer(QSensor *sensor) setDescription(QLatin1String("x, y, and z axes accelerations in m/s^2")); setRanges(GRAVITY_EARTH_THOUSANDTH); setReading<QAccelerometerReading>(&m_reading); + sensor->setDataRate(50);//set a default rate } void sensorfwaccelerometer::slotDataAvailable(const XYZ& data) diff --git a/src/plugins/sensors/sensorfw/sensorfwals.cpp b/src/plugins/sensors/sensorfw/sensorfwals.cpp index 811da77..839c537 100644 --- a/src/plugins/sensors/sensorfw/sensorfwals.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwals.cpp @@ -54,6 +54,7 @@ Sensorfwals::Sensorfwals(QSensor *sensor) setDescription(QLatin1String("ambient light intensity given as 5 pre-defined levels")); addOutputRange(0, 5, 1); addDataRate(10,10); + sensor->setDataRate(10);//set a default rate } void Sensorfwals::start() diff --git a/src/plugins/sensors/sensorfw/sensorfwals.h b/src/plugins/sensors/sensorfw/sensorfwals.h index ba7c9af..63d6443 100644 --- a/src/plugins/sensors/sensorfw/sensorfwals.h +++ b/src/plugins/sensors/sensorfw/sensorfwals.h @@ -46,7 +46,6 @@ #include <qambientlightsensor.h> #include <alssensor_i.h> -#include <unsigned.h> diff --git a/src/plugins/sensors/sensorfw/sensorfwcompass.cpp b/src/plugins/sensors/sensorfw/sensorfwcompass.cpp index 00741a1..1fd8441 100644 --- a/src/plugins/sensors/sensorfw/sensorfwcompass.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwcompass.cpp @@ -50,6 +50,7 @@ SensorfwCompass::SensorfwCompass(QSensor *sensor) { initSensor<CompassSensorChannelInterface>(m_initDone); setReading<QCompassReading>(&m_reading); + sensor->setDataRate(50);//set a default rate } void SensorfwCompass::slotDataAvailable(const Compass& data) diff --git a/src/plugins/sensors/sensorfw/sensorfwcompass.h b/src/plugins/sensors/sensorfw/sensorfwcompass.h index e54c348..7cc5c43 100644 --- a/src/plugins/sensors/sensorfw/sensorfwcompass.h +++ b/src/plugins/sensors/sensorfw/sensorfwcompass.h @@ -45,7 +45,7 @@ #include <qcompass.h> #include <compasssensor_i.h> -#include <compass.h> +#include <datatypes/compass.h> diff --git a/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp b/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp index 238993a..e29b77e 100644 --- a/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp @@ -54,6 +54,7 @@ SensorfwGyroscope::SensorfwGyroscope(QSensor *sensor) setReading<QGyroscopeReading>(&m_reading); addDataRate(10, 10); addDataRate(50, 50); + sensor->setDataRate(50);//set a default rate } void SensorfwGyroscope::slotDataAvailable(const XYZ& data) diff --git a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp index 865d376..a2e2349 100644 --- a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp @@ -56,6 +56,7 @@ SensorfwIrProximitySensor::SensorfwIrProximitySensor(QSensor *sensor) addOutputRange(0, 100, 1); addDataRate(10,10); rangeMax = QFile::exists(RM680_PS)?255:1023; + sensor->setDataRate(10);//set a default rate } void SensorfwIrProximitySensor::slotDataAvailable(const Proximity& proximity) diff --git a/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp index b49e7b2..232d4e8 100644 --- a/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp @@ -49,6 +49,7 @@ SensorfwLightSensor::SensorfwLightSensor(QSensor *sensor) { initSensor<ALSSensorChannelInterface>(m_initDone); setReading<QLightReading>(&m_reading); + sensor->setDataRate(10);//set a default rate } void SensorfwLightSensor::slotDataAvailable(const Unsigned& data) diff --git a/src/plugins/sensors/sensorfw/sensorfwlightsensor.h b/src/plugins/sensors/sensorfw/sensorfwlightsensor.h index 83591fa..96df633 100644 --- a/src/plugins/sensors/sensorfw/sensorfwlightsensor.h +++ b/src/plugins/sensors/sensorfw/sensorfwlightsensor.h @@ -47,8 +47,6 @@ #include <qlightsensor.h> #include <alssensor_i.h> -#include <unsigned.h> - class SensorfwLightSensor : public SensorfwSensorBase diff --git a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp index 9778b95..e4afdd3 100644 --- a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "sensorfwmagnetometer.h" +#include <QSensor> + char const * const SensorfwMagnetometer::id("sensorfw.magnetometer"); bool SensorfwMagnetometer::m_initDone = false; @@ -53,11 +55,14 @@ SensorfwMagnetometer::SensorfwMagnetometer(QSensor *sensor) setDescription(QLatin1String("magnetic flux density in teslas (T)")); setRanges(NANO); setReading<QMagnetometerReading>(&m_reading); + sensor->setDataRate(50);//set a default rate } void SensorfwMagnetometer::start() { - m_isGeoMagnetometer = sensor()->returnGeoValues(); + QMagnetometer *const magnetometer = qobject_cast<QMagnetometer *>(sensor()); + if (magnetometer) + m_isGeoMagnetometer = magnetometer->returnGeoValues(); SensorfwSensorBase::start(); } @@ -67,13 +72,13 @@ void SensorfwMagnetometer::slotDataAvailable(const MagneticField& data) m_reading.setX( NANO * (m_isGeoMagnetometer?data.x():data.rx())); m_reading.setY( NANO * (m_isGeoMagnetometer?data.y():data.ry())); m_reading.setZ( NANO * (m_isGeoMagnetometer?data.z():data.rz())); - m_reading.setCalibrationLevel( m_isGeoMagnetometer?((float) data.level()) / 3.0 :1); + m_reading.setCalibrationLevel(m_isGeoMagnetometer?((float) data.level()) / 3.0 :1); m_reading.setTimestamp(data.timestamp()); newReadingAvailable(); } -void SensorfwMagnetometer::slotFrameAvailable(const QVector<MagneticField>& frame) +void SensorfwMagnetometer::slotFrameAvailable(const QVector<MagneticField>& frame) { for (int i=0, l=frame.size(); i<l; i++) { slotDataAvailable(frame.at(i)); @@ -83,8 +88,10 @@ void SensorfwMagnetometer::slotFrameAvailable(const QVector<MagneticField>& fr bool SensorfwMagnetometer::doConnect() { if (m_bufferSize==1) - return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(const MagneticField&)), this, SLOT(slotDataAvailable(const MagneticField&))); - return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(const QVector<MagneticField>& )),this, SLOT(slotFrameAvailable(const QVector<MagneticField>& ))); + return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(const MagneticField&)), + this, SLOT(slotDataAvailable(const MagneticField&))); + return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(const QVector<MagneticField>& )), + this, SLOT(slotFrameAvailable(const QVector<MagneticField>& ))); } QString SensorfwMagnetometer::sensorName() const diff --git a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h index dff70c0..22d81a8 100644 --- a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h +++ b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h @@ -46,7 +46,7 @@ #include <qmagnetometer.h> #include <magnetometersensor_i.h> -#include <magneticfield.h> +#include <datatypes/magneticfield.h> diff --git a/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp b/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp index 09dfb0e..6211a45 100644 --- a/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp +++ b/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp @@ -41,7 +41,7 @@ #include "sensorfworientationsensor.h" -#include <posedata.h> +#include <datatypes/posedata.h> char const * const SensorfwOrientationSensor::id("sensorfw.orientationsensor"); bool SensorfwOrientationSensor::m_initDone = false; @@ -51,6 +51,7 @@ SensorfwOrientationSensor::SensorfwOrientationSensor(QSensor *sensor) { initSensor<OrientationSensorChannelInterface>(m_initDone); setReading<QOrientationReading>(&m_reading); + sensor->setDataRate(10);//set a default rate } diff --git a/src/plugins/sensors/sensorfw/sensorfworientationsensor.h b/src/plugins/sensors/sensorfw/sensorfworientationsensor.h index 496939c..7c2ecdf 100644 --- a/src/plugins/sensors/sensorfw/sensorfworientationsensor.h +++ b/src/plugins/sensors/sensorfw/sensorfworientationsensor.h @@ -46,7 +46,6 @@ #include <qorientationsensor.h> #include <orientationsensor_i.h> -#include <unsigned.h> diff --git a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp index 4602a9a..1f4c2b5 100644 --- a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp @@ -50,6 +50,7 @@ SensorfwProximitySensor::SensorfwProximitySensor(QSensor *sensor) initSensor<ProximitySensorChannelInterface>(m_initDone); setReading<QProximityReading>(&m_reading); addDataRate(10,10); //TODO: fix this when we know better + sensor->setDataRate(10);//set a default rate } void SensorfwProximitySensor::start() diff --git a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h index 91800c2..404e66a 100644 --- a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h +++ b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h @@ -46,7 +46,6 @@ #include <qproximitysensor.h> #include <proximitysensor_i.h> -#include <unsigned.h> diff --git a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp index d577402..1971e92 100644 --- a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp @@ -49,7 +49,10 @@ SensorfwRotationSensor::SensorfwRotationSensor(QSensor *sensor) { initSensor<RotationSensorChannelInterface>(m_initDone); setReading<QRotationReading>(&m_reading); - sensor()->setHasZ(true); + QRotationSensor *const rotationSensor = qobject_cast<QRotationSensor *>(sensor); + if (rotationSensor) + rotationSensor->setHasZ(true); + sensor->setDataRate(20);//set a default rate } void SensorfwRotationSensor::slotDataAvailable(const XYZ& data) diff --git a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h index 5b5556d..d6b056b 100644 --- a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h +++ b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h @@ -47,7 +47,7 @@ #include <qrotationsensor.h> #include <rotationsensor_i.h> -#include <xyz.h> +#include <datatypes/xyz.h> diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp b/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp index 85968e2..b41d630 100644 --- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp @@ -73,7 +73,7 @@ void SensorfwSensorBase::start() if (m_sensorInterface) { // dataRate QByteArray type = sensor()->type(); - if (type != QTapSensor::type() && type != QProximitySensor::type()) { + if (type != QTapSensor::type && type != QProximitySensor::type) { int dataRate = sensor()->dataRate(); int interval = dataRate > 0 ? 1000 / dataRate : 0; // for testing maximum speed diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h index 78a6c14..1c2aa0e 100644 --- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h +++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h @@ -47,6 +47,11 @@ #include <sensormanagerinterface.h> #include <abstractsensor_i.h> +#include <QAmbientLightSensor> +#include <QIRProximitySensor> +#include <QTapSensor> +#include <QProximitySensor> + class SensorfwSensorBase : public QSensorBackend { public: @@ -137,11 +142,11 @@ protected: m_maxBufferSize = 1; sensor()->setMaxBufferSize(m_maxBufferSize); - sensor()->efficientBufferSize(m_efficientBufferSize); + sensor()->setEfficientBufferSize(m_efficientBufferSize); QByteArray type = sensor()->type(); - if (type == QAmbientLightSensor::type()) return; // SensorFW returns lux values, plugin enumerated values - if (type == QIRProximitySensor::type()) return; // SensorFW returns raw reflectance values, plugin % of max reflectance + if (type == QAmbientLightSensor::type) return; // SensorFW returns lux values, plugin enumerated values + if (type == QIRProximitySensor::type) return; // SensorFW returns raw reflectance values, plugin % of max reflectance if (name == "accelerometersensor") return; // SensorFW returns milliGs, plugin m/s^2 if (name == "magnetometersensor") return; // SensorFW returns nanoTeslas, plugin Teslas if (name == "gyroscopesensor") return; // SensorFW returns DSPs, plugin milliDSPs diff --git a/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp index c945ac1..d5539de 100644 --- a/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp +++ b/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp @@ -51,15 +51,18 @@ SensorfwTapSensor::SensorfwTapSensor(QSensor *sensor) setReading<QTapReading>(&m_reading); addOutputRange(QTapReading::Undefined, QTapReading::Z_Both, 1); addDataRate(10,10); //TODO: fix this when we know better + sensor->setDataRate(10);//set a default rate } void SensorfwTapSensor::start() { - bool b = sensor()->returnDoubleTapEvents(); + QTapSensor * const tapSensor = qobject_cast<QTapSensor *>(sensor()); + + bool b = tapSensor->returnDoubleTapEvents(); bool isDoubleTapSensor = m_isDoubleTapSensor; if (!b) { - sensor()->setReturnDoubleTapEvents(true); //by default doubles + tapSensor->setReturnDoubleTapEvents(true); //by default doubles m_isDoubleTapSensor = true; } else m_isDoubleTapSensor = b; diff --git a/src/plugins/sensors/sensorfw/sensorfwtapsensor.h b/src/plugins/sensors/sensorfw/sensorfwtapsensor.h index 6df3bcf..c577bde 100644 --- a/src/plugins/sensors/sensorfw/sensorfwtapsensor.h +++ b/src/plugins/sensors/sensorfw/sensorfwtapsensor.h @@ -45,7 +45,7 @@ #include <qtapsensor.h> #include <tapsensor_i.h> -#include <tap.h> +#include <datatypes/tap.h> |