summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@jollamobile.com>2013-06-02 06:44:02 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-06 09:38:03 +0200
commit07b86f3c2e8d400df0cdc70d0db3a6c1fb9bcca6 (patch)
tree1e7caac8fced8a3dbdbbdfde7729d68a970bdaf4 /src
parent4dca8393f1ea472cd9cc9b70bf2c6617c6e6355f (diff)
downloadqtsensors-07b86f3c2e8d400df0cdc70d0db3a6c1fb9bcca6.tar.gz
fix build in OBS, as well as fixes for API changes.
Change-Id: I27eabe7c8b79e03d814deb541db5e7f0b5449099 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sensors/sensorfw/sensorfw.pro2
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwals.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwals.h1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwcompass.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwcompass.h2
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlightsensor.h2
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp17
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwmagnetometer.h2
-rw-r--r--src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp3
-rw-r--r--src/plugins/sensors/sensorfw/sensorfworientationsensor.h1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwproximitysensor.h1
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp5
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwrotationsensor.h2
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp2
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwsensorbase.h11
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp7
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwtapsensor.h2
22 files changed, 44 insertions, 23 deletions
diff --git a/src/plugins/sensors/sensorfw/sensorfw.pro b/src/plugins/sensors/sensorfw/sensorfw.pro
index fb56058..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)
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>