qtmobility/plugins/sensors/generic/main.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
--- a/qtmobility/plugins/sensors/generic/main.cpp	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/plugins/sensors/generic/main.cpp	Mon May 03 13:18:40 2010 +0300
@@ -40,6 +40,7 @@
 ****************************************************************************/
 
 #include "genericorientationsensor.h"
+#include "genericrotationsensor.h"
 #include <qsensorplugin.h>
 #include <qsensorbackend.h>
 #include <qsensormanager.h>
@@ -55,6 +56,7 @@
     {
         qDebug() << "loaded the Generic plugin";
         QSensorManager::registerBackend(QOrientationSensor::type, genericorientationsensor::id, this);
+        QSensorManager::registerBackend(QRotationSensor::type, genericrotationsensor::id, this);
     }
 
     QSensorBackend *createBackend(QSensor *sensor)
@@ -66,6 +68,13 @@
             qDebug() << "can't make" << sensor->identifier() << "because no" << QAccelerometer::type << "sensors exist";
         }
 
+        if (sensor->identifier() == genericrotationsensor::id) {
+            // Can't make this unless we have an accelerometer
+            if (!QSensor::defaultSensorForType(QAccelerometer::type).isEmpty())
+                return new genericrotationsensor(sensor);
+            qDebug() << "can't make" << sensor->identifier() << "because no" << QAccelerometer::type << "sensors exist";
+        }
+
         return 0;
     }
 };