/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // QT Mobility Sensor API headers #include #include #include // Internal Headers #include "proximitysensorsym.h" #include "ambientlightsensorsym.h" #include "magnetometersensorsym.h" #include "compasssym.h" #include "orientationsym.h" #include "accelerometersym.h" #include "rotationsensorsym.h" #include "tapsensorsym.h" #ifdef ENABLE_LIGHT_SENSOR #include "lightsensorsym.h" #endif // QT Utility headers #include class SensorPluginSym : public QObject, public QSensorPluginInterface, public QSensorBackendFactory { Q_OBJECT Q_INTERFACES(QtMobility::QSensorPluginInterface) public: void registerSensors() { qDebug() << "Loaded the symbian sensor plugins"; QSensorManager::registerBackend(QProximitySensor::type, CProximitySensorSym::id, this); QSensorManager::registerBackend(QAmbientLightSensor::type, CAmbientLightSensorSym::id, this); QSensorManager::registerBackend(QMagnetometer::type, CMagnetometerSensorSym::id, this); QSensorManager::registerBackend(QCompass::type, CCompassSym::id, this); QSensorManager::registerBackend(QOrientationSensor::type, COrientationSensorSym::id, this); QSensorManager::registerBackend(QAccelerometer::type, CAccelerometerSensorSym::id, this); QSensorManager::registerBackend(QRotationSensor::type, CRotationSensorSym::id, this); QSensorManager::registerBackend(QTapSensor::type, CTapSensorSym::id, this); #ifdef ENABLE_LIGHT_SENSOR QSensorManager::registerBackend(QLightSensor::type, CLightSensorSym::id, this); #endif } QSensorBackend *createBackend(QSensor *sensor) { if (sensor->identifier() == CProximitySensorSym::id) { CProximitySensorSym *self = NULL; TRAPD(err,self = CProximitySensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == CAmbientLightSensorSym::id) { CAmbientLightSensorSym *self = NULL; TRAPD(err,self = CAmbientLightSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == CMagnetometerSensorSym::id) { CMagnetometerSensorSym *self = NULL; TRAPD(err,self = CMagnetometerSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == CCompassSym::id) { CCompassSym *self = NULL; TRAPD(err,self = CCompassSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == COrientationSensorSym::id) { COrientationSensorSym *self = NULL; TRAPD(err,self = COrientationSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == CAccelerometerSensorSym::id) { CAccelerometerSensorSym *self = NULL; TRAPD(err,self = CAccelerometerSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == CRotationSensorSym::id) { CRotationSensorSym *self = NULL; TRAPD(err,self = CRotationSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } if (sensor->identifier() == CTapSensorSym::id) { CTapSensorSym *self = NULL; TRAPD(err,self = CTapSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } #ifdef ENABLE_LIGHT_SENSOR if (sensor->identifier() == CLightSensorSym::id) { CLightSensorSym *self = NULL; TRAPD(err,self = CLightSensorSym::NewL(sensor)); if(!err) { return self; } else { return 0; } } #endif return 0; } }; Q_EXPORT_PLUGIN2(qtsensors_sym, SensorPluginSym); #include "main.moc"