qtmobility/plugins/sensors/maemo6/maemo6orientationsensor.cpp
changeset 11 06b8e2af4411
parent 8 71781823f776
child 14 6fbed849b4f4
--- a/qtmobility/plugins/sensors/maemo6/maemo6orientationsensor.cpp	Thu May 27 13:42:11 2010 +0300
+++ b/qtmobility/plugins/sensors/maemo6/maemo6orientationsensor.cpp	Fri Jun 11 14:26:25 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -41,7 +41,7 @@
 
 #include "maemo6orientationsensor.h"
 
-#include "sensord/filters/posedata.h"
+#include <posedata.h>
 
 const char *maemo6orientationsensor::id("maemo6.orientationsensor");
 bool maemo6orientationsensor::m_initDone = false;
@@ -55,7 +55,7 @@
         initSensor<OrientationSensorChannelInterface>("orientationsensor");
 
         if (m_sensorInterface)
-            QObject::connect(static_cast<OrientationSensorChannelInterface*>(m_sensorInterface), SIGNAL(orientationChanged(const int&)), this, SLOT(slotOrientationChanged(const int&)));
+            QObject::connect(static_cast<OrientationSensorChannelInterface*>(m_sensorInterface), SIGNAL(orientationChanged(const Unsigned&)), this, SLOT(slotOrientationChanged(const Unsigned&)));
         else
             qWarning() << "Unable to initialize orientation sensor.";
 
@@ -63,16 +63,16 @@
         addDataRate(142, 142); // 142Hz
         sensor->setDataRate(142);
         addOutputRange(0, 6, 1);
-        setDescription(QLatin1String("Orientation of the device screen"));
+        setDescription(QLatin1String("Measures orientation of the device screen as 6 pre-defined levels"));
 
         m_initDone = true;
     }
 }
 
-void maemo6orientationsensor::slotOrientationChanged(const int& data)
+void maemo6orientationsensor::slotOrientationChanged(const Unsigned& data)
 {
     QOrientationReading::Orientation o;
-    switch (data) {
+    switch (data.x()) {
         case PoseData::BottomDown: o = QOrientationReading::TopUp;     break;
         case PoseData::BottomUp:   o = QOrientationReading::TopDown;   break;
         case PoseData::LeftUp:     o = QOrientationReading::LeftUp;    break;
@@ -82,7 +82,6 @@
         default:                   o = QOrientationReading::Undefined;
     }
     m_reading.setOrientation(o);
-    //m_reading.setTimestamp(data.timestamp());
-    m_reading.setTimestamp(createTimestamp()); //TODO: use correct timestamp
+    m_reading.setTimestamp(data.UnsignedData().timestamp_);
     newReadingAvailable();
 }