diff -r 06b8e2af4411 -r 6fbed849b4f4 qtmobility/plugins/sensors/maemo6/maemo6orientationsensor.cpp --- 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 -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(&m_reading); - - if (!m_initDone) { - initSensor("orientationsensor"); + const QString sensorName = "orientationsensor"; + initSensor(sensorName, m_initDone); - if (m_sensorInterface) - QObject::connect(static_cast(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 "<setDataRate(142); - addOutputRange(0, 6, 1); - setDescription(QLatin1String("Measures orientation of the device screen as 6 pre-defined levels")); - - m_initDone = true; - } + setReading(&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()) {