--- a/qtmobility/plugins/sensors/maemo6/maemo6orientationsensor.cpp Fri Jun 11 14:26:25 2010 +0300
+++ b/qtmobility/plugins/sensors/maemo6/maemo6orientationsensor.cpp Wed Jun 23 19:08:38 2010 +0300
@@ -43,33 +43,32 @@
#include <posedata.h>
-const char *maemo6orientationsensor::id("maemo6.orientationsensor");
+char const * const maemo6orientationsensor::id("maemo6.orientationsensor");
bool maemo6orientationsensor::m_initDone = false;
maemo6orientationsensor::maemo6orientationsensor(QSensor *sensor)
: maemo6sensorbase(sensor)
{
- setReading<QOrientationReading>(&m_reading);
-
- if (!m_initDone) {
- initSensor<OrientationSensorChannelInterface>("orientationsensor");
+ const QString sensorName = "orientationsensor";
+ initSensor<OrientationSensorChannelInterface>(sensorName, m_initDone);
- if (m_sensorInterface)
- QObject::connect(static_cast<OrientationSensorChannelInterface*>(m_sensorInterface), SIGNAL(orientationChanged(const Unsigned&)), this, SLOT(slotOrientationChanged(const Unsigned&)));
- else
- qWarning() << "Unable to initialize orientation sensor.";
+ if (m_sensorInterface){
+ if (!(QObject::connect(m_sensorInterface, SIGNAL(orientationChanged(const Unsigned&)),
+ this, SLOT(slotDataAvailable(const Unsigned&)))))
+ qWarning() << "Unable to connect "<< sensorName;
+ }
+ else
+ qWarning() << "Unable to initialize "<<sensorName;
- // metadata
- addDataRate(142, 142); // 142Hz
- sensor->setDataRate(142);
- addOutputRange(0, 6, 1);
- setDescription(QLatin1String("Measures orientation of the device screen as 6 pre-defined levels"));
-
- m_initDone = true;
- }
+ setReading<QOrientationReading>(&m_reading);
+ // metadata
+ addDataRate(130, 130);
+ addDataRate(1, 130); // TODO: this is for testing only
+ addOutputRange(0, 6, 1);
+ setDescription(QLatin1String("Measures orientation of the device screen as 6 pre-defined positions"));
}
-void maemo6orientationsensor::slotOrientationChanged(const Unsigned& data)
+void maemo6orientationsensor::slotDataAvailable(const Unsigned& data)
{
QOrientationReading::Orientation o;
switch (data.x()) {