From 164e4f5813d8beb30ce8e1555f49f84b785c0d51 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 9 Jun 2011 18:31:09 +1000 Subject: Add dummy, generic and simulator backend The Simulator backend is not working/tested at this stage as the simulator library is not available for Qt5 at this stage. In addtion the sensor_explorer test app was added for simple sensor testing. --- src/plugins/sensors/generic/generic.pri | 9 ++ src/plugins/sensors/generic/generic.pro | 24 ++++ src/plugins/sensors/generic/genericalssensor.cpp | 151 +++++++++++++++++++++ src/plugins/sensors/generic/genericalssensor.h | 67 +++++++++ .../sensors/generic/genericorientationsensor.cpp | 98 +++++++++++++ .../sensors/generic/genericorientationsensor.h | 67 +++++++++ .../sensors/generic/genericrotationsensor.cpp | 115 ++++++++++++++++ .../sensors/generic/genericrotationsensor.h | 69 ++++++++++ src/plugins/sensors/generic/main.cpp | 100 ++++++++++++++ 9 files changed, 700 insertions(+) create mode 100644 src/plugins/sensors/generic/generic.pri create mode 100644 src/plugins/sensors/generic/generic.pro create mode 100644 src/plugins/sensors/generic/genericalssensor.cpp create mode 100644 src/plugins/sensors/generic/genericalssensor.h create mode 100644 src/plugins/sensors/generic/genericorientationsensor.cpp create mode 100644 src/plugins/sensors/generic/genericorientationsensor.h create mode 100644 src/plugins/sensors/generic/genericrotationsensor.cpp create mode 100644 src/plugins/sensors/generic/genericrotationsensor.h create mode 100644 src/plugins/sensors/generic/main.cpp (limited to 'src/plugins/sensors/generic') diff --git a/src/plugins/sensors/generic/generic.pri b/src/plugins/sensors/generic/generic.pri new file mode 100644 index 00000000..69efdc06 --- /dev/null +++ b/src/plugins/sensors/generic/generic.pri @@ -0,0 +1,9 @@ +HEADERS += genericorientationsensor.h\ + genericrotationsensor.h\ + genericalssensor.h + +SOURCES += genericorientationsensor.cpp\ + main.cpp\ + genericrotationsensor.cpp\ + genericalssensor.cpp + diff --git a/src/plugins/sensors/generic/generic.pro b/src/plugins/sensors/generic/generic.pro new file mode 100644 index 00000000..3d9e9cc4 --- /dev/null +++ b/src/plugins/sensors/generic/generic.pro @@ -0,0 +1,24 @@ +load(qt_module) + +TARGET = qtsensors_generic +QT = core sensors + +load(qt_plugin) + +DESTDIR = $$QT.sensors.plugins/sensors + +include(generic.pri) + + +symbian { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002BFC3 + TARGET.CAPABILITY = ALL -TCB + + pluginDep.sources = $${TARGET}.dll + pluginDep.path = $${QT_PLUGINS_BASE_DIR}/$${PLUGIN_TYPE} + DEPLOYMENT += pluginDep +} + +target.path += $$[QT_INSTALL_PLUGINS]/sensors +INSTALLS += target diff --git a/src/plugins/sensors/generic/genericalssensor.cpp b/src/plugins/sensors/generic/genericalssensor.cpp new file mode 100644 index 00000000..48229966 --- /dev/null +++ b/src/plugins/sensors/generic/genericalssensor.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "genericalssensor.h" +#include + +char const * const genericalssensor::id("generic.als"); + +genericalssensor::genericalssensor(QSensor *sensor) + : QSensorBackend(sensor) +{ + lightSensor = new QLightSensor(this); + lightSensor->addFilter(this); + lightSensor->connectToBackend(); + + setReading(&m_reading); + setDataRates(lightSensor); +} + +void genericalssensor::start() +{ + lightSensor->setDataRate(sensor()->dataRate()); + lightSensor->start(); + if (!lightSensor->isActive()) + sensorStopped(); + if (lightSensor->isBusy()) + sensorBusy(); +} + +void genericalssensor::stop() +{ + lightSensor->stop(); +} + +struct lux_limit { + int min; + int max; +}; + +// Defines the min and max lux values that a given level has. +// These are used to add histeresis to the sensor. +// If the previous level is below a level, the lux must be at or above the minimum. +// If the previous level is above a level, the lux muyt be at or below the maximum. +static lux_limit limits[] = { + { 0, 0 }, // Undefined (not used) + { 0, 5 }, // Dark + { 10, 50 }, // Twilight + { 100, 200 }, // Light + { 500, 2000 }, // Bright + { 5000, 0 } // Sunny +}; + +#if 0 +// Used for debugging +static QString light_level(int level) +{ + switch (level) { + case 1: + return QLatin1String("Dark"); + case 2: + return QLatin1String("Twilight"); + case 3: + return QLatin1String("Light"); + case 4: + return QLatin1String("Bright"); + case 5: + return QLatin1String("Sunny"); + default: + return QLatin1String("Undefined"); + } +} +#endif + +bool genericalssensor::filter(QLightReading *reading) +{ + // It's unweildly dealing with these constants so make some + // local aliases that are shorter. This makes the code below + // much easier to read. + enum { + Undefined = QAmbientLightReading::Undefined, + Dark = QAmbientLightReading::Dark, + Twilight = QAmbientLightReading::Twilight, + Light = QAmbientLightReading::Light, + Bright = QAmbientLightReading::Bright, + Sunny = QAmbientLightReading::Sunny + }; + + int lightLevel = m_reading.lightLevel(); + qreal lux = reading->lux(); + + // Check for change direction to allow for histeresis + if (lightLevel < Sunny && lux >= limits[Sunny ].min) lightLevel = Sunny; + else if (lightLevel < Bright && lux >= limits[Bright ].min) lightLevel = Bright; + else if (lightLevel < Light && lux >= limits[Light ].min) lightLevel = Light; + else if (lightLevel < Twilight && lux >= limits[Twilight].min) lightLevel = Twilight; + else if (lightLevel < Dark && lux >= limits[Dark ].min) lightLevel = Dark; + else if (lightLevel > Dark && lux <= limits[Dark ].max) lightLevel = Dark; + else if (lightLevel > Twilight && lux <= limits[Twilight].max) lightLevel = Twilight; + else if (lightLevel > Light && lux <= limits[Light ].max) lightLevel = Light; + else if (lightLevel > Bright && lux <= limits[Bright ].max) lightLevel = Bright; + + //qDebug() << "lightLevel" << light_level(lightLevel) << "lux" << lux; + + if (static_cast(m_reading.lightLevel()) != lightLevel || m_reading.timestamp() == 0) { + m_reading.setTimestamp(reading->timestamp()); + m_reading.setLightLevel(static_cast(lightLevel)); + + newReadingAvailable(); + } + + return false; +} + diff --git a/src/plugins/sensors/generic/genericalssensor.h b/src/plugins/sensors/generic/genericalssensor.h new file mode 100644 index 00000000..fae005d8 --- /dev/null +++ b/src/plugins/sensors/generic/genericalssensor.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GENERICALSSENSOR_H +#define GENERICALSSENSOR_H + +#include +#include +#include + +class genericalssensor : public QSensorBackend, public QLightFilter +{ +public: + static char const * const id; + + genericalssensor(QSensor *sensor); + + void start(); + void stop(); + + bool filter(QLightReading *reading); + +private: + QAmbientLightReading m_reading; + QLightSensor *lightSensor; +}; + +#endif + diff --git a/src/plugins/sensors/generic/genericorientationsensor.cpp b/src/plugins/sensors/generic/genericorientationsensor.cpp new file mode 100644 index 00000000..3716047c --- /dev/null +++ b/src/plugins/sensors/generic/genericorientationsensor.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "genericorientationsensor.h" +#include + +char const * const genericorientationsensor::id("generic.orientation"); + +genericorientationsensor::genericorientationsensor(QSensor *sensor) + : QSensorBackend(sensor) +{ + accelerometer = new QAccelerometer(this); + accelerometer->addFilter(this); + accelerometer->connectToBackend(); + + setReading(&m_reading); + setDataRates(accelerometer); +} + +void genericorientationsensor::start() +{ + accelerometer->setDataRate(sensor()->dataRate()); + accelerometer->start(); + if (!accelerometer->isActive()) + sensorStopped(); + if (accelerometer->isBusy()) + sensorBusy(); +} + +void genericorientationsensor::stop() +{ + accelerometer->stop(); +} + +bool genericorientationsensor::filter(QAccelerometerReading *reading) +{ + QOrientationReading::Orientation o = m_reading.orientation(); + + if (reading->y() > 7.35) + o = QOrientationReading::TopUp; + else if (reading->y() < -7.35) + o = QOrientationReading::TopDown; + else if (reading->x() > 7.35) + o = QOrientationReading::RightUp; + else if (reading->x() < -7.35) + o = QOrientationReading::LeftUp; + else if (reading->z() > 7.35) + o = QOrientationReading::FaceUp; + else if (reading->z() < -7.35) + o = QOrientationReading::FaceDown; + + if (o != m_reading.orientation() || m_reading.timestamp() == 0) { + m_reading.setTimestamp(reading->timestamp()); + m_reading.setOrientation(o); + newReadingAvailable(); + } + + return false; +} + diff --git a/src/plugins/sensors/generic/genericorientationsensor.h b/src/plugins/sensors/generic/genericorientationsensor.h new file mode 100644 index 00000000..b66925de --- /dev/null +++ b/src/plugins/sensors/generic/genericorientationsensor.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GENERICORIENTATIONSENSOR_H +#define GENERICORIENTATIONSENSOR_H + +#include +#include +#include + +class genericorientationsensor : public QSensorBackend, public QAccelerometerFilter +{ +public: + static char const * const id; + + genericorientationsensor(QSensor *sensor); + + void start(); + void stop(); + + bool filter(QAccelerometerReading *reading); + +private: + QOrientationReading m_reading; + QAccelerometer *accelerometer; +}; + +#endif + diff --git a/src/plugins/sensors/generic/genericrotationsensor.cpp b/src/plugins/sensors/generic/genericrotationsensor.cpp new file mode 100644 index 00000000..4c735c10 --- /dev/null +++ b/src/plugins/sensors/generic/genericrotationsensor.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "genericrotationsensor.h" +#include +#include + +#define RADIANS_TO_DEGREES 57.2957795 + +char const * const genericrotationsensor::id("generic.rotation"); + +genericrotationsensor::genericrotationsensor(QSensor *sensor) + : QSensorBackend(sensor) +{ + accelerometer = new QAccelerometer(this); + accelerometer->addFilter(this); + accelerometer->connectToBackend(); + + setReading(&m_reading); + setDataRates(accelerometer); + + sensor->setProperty("hasZ", false); +} + +void genericrotationsensor::start() +{ + accelerometer->setDataRate(sensor()->dataRate()); + accelerometer->start(); + if (!accelerometer->isActive()) + sensorStopped(); + if (accelerometer->isBusy()) + sensorBusy(); +} + +void genericrotationsensor::stop() +{ + accelerometer->stop(); +} + +bool genericrotationsensor::filter(QSensorReading *reading) +{ + QAccelerometerReading *ar = qobject_cast(reading); + qreal pitch = 0; + qreal roll = 0; + + qreal x = ar->x(); + qreal y = ar->y(); + qreal z = ar->z(); + + // Note that the formula used come from this document: + // http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf + pitch = qAtan(y / sqrt(x*x + z*z)) * RADIANS_TO_DEGREES; + roll = qAtan(x / sqrt(y*y + z*z)) * RADIANS_TO_DEGREES; + // Roll is a left-handed rotation but we need right-handed rotation + roll = -roll; + + // We need to fix up roll to the (-180,180] range required. + // Check for negative theta values and apply an offset as required. + // Note that theta is defined as the angle of the Z axis relative + // to gravity (see referenced document). It's negative when the + // face of the device points downward. + qreal theta = qAtan(sqrt(x*x + y*y) / z) * RADIANS_TO_DEGREES; + if (theta < 0) { + if (roll > 0) + roll = 180 - roll; + else + roll = -180 - roll; + } + + m_reading.setTimestamp(ar->timestamp()); + m_reading.setX(pitch); + m_reading.setY(roll); + m_reading.setZ(0); + newReadingAvailable(); + return false; +} + diff --git a/src/plugins/sensors/generic/genericrotationsensor.h b/src/plugins/sensors/generic/genericrotationsensor.h new file mode 100644 index 00000000..bf2731df --- /dev/null +++ b/src/plugins/sensors/generic/genericrotationsensor.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GENERICROTATIONSENSOR_H +#define GENERICROTATIONSENSOR_H + +#include +#include +#include +#include + +class genericrotationsensor : public QSensorBackend, public QSensorFilter +{ +public: + static char const * const id; + + genericrotationsensor(QSensor *sensor); + + void start(); + void stop(); + + bool filter(QSensorReading *reading); + +private: + QRotationReading m_reading; + QAccelerometer *accelerometer; + QMagnetometer *magnetometer; +}; + +#endif + diff --git a/src/plugins/sensors/generic/main.cpp b/src/plugins/sensors/generic/main.cpp new file mode 100644 index 00000000..26bb0e80 --- /dev/null +++ b/src/plugins/sensors/generic/main.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "genericorientationsensor.h" +#include "genericrotationsensor.h" +#include "genericalssensor.h" +#include +#include +#include +#include +#include + +class genericSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorChangesInterface, public QSensorBackendFactory +{ + Q_OBJECT + Q_INTERFACES(QSensorPluginInterface QSensorChangesInterface) +public: + void registerSensors() + { + qDebug() << "loaded the Generic plugin"; + // Nothing to register here + } + + void sensorsChanged() + { + if (!QSensor::defaultSensorForType(QAccelerometer::type).isEmpty()) { + // There is an accelerometer available. Register the backends + if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id)) + QSensorManager::registerBackend(QOrientationSensor::type, genericorientationsensor::id, this); + if (!QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id)) + QSensorManager::registerBackend(QRotationSensor::type, genericrotationsensor::id, this); + if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) + QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this); + } else { + if (QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id)) + QSensorManager::unregisterBackend(QOrientationSensor::type, genericorientationsensor::id); + if (QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id)) + QSensorManager::unregisterBackend(QRotationSensor::type, genericrotationsensor::id); + if (QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) + QSensorManager::unregisterBackend(QAmbientLightSensor::type, genericalssensor::id); + } + } + + QSensorBackend *createBackend(QSensor *sensor) + { + if (sensor->identifier() == genericorientationsensor::id) + return new genericorientationsensor(sensor); + + if (sensor->identifier() == genericrotationsensor::id) + return new genericrotationsensor(sensor); + + if (sensor->identifier() == genericalssensor::id) + return new genericalssensor(sensor); + + return 0; + } +}; + +Q_EXPORT_PLUGIN2(qtsensors_generic, genericSensorPlugin) + +#include "main.moc" + -- cgit v1.2.3