diff options
author | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2012-03-02 14:13:39 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-03 09:22:38 +0200 |
commit | 4c61854d60fb5d2c68c6dcb1fb5bdf5c0dead3e2 (patch) | |
tree | b41d70a37b8a1ff76c32025d8562a94581a3bd22 /src/plugins/sensors/generic/generictiltsensor.h | |
parent | fb68fb8c052ae08fabed8f49256e79b0d0915fb0 (diff) |
Add TiltSensor to QtMobility.sensors 1.3
This has been adapted from the TiltSensor type in QtSensors 5.0
import but the code there has been split into multiple pieces.
There's a C++ class, a generic backend
and a QML interface.
Change-Id: Ic09465a5f76250a02a13938abe4789958137376f
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/sensors/generic/generictiltsensor.h')
-rw-r--r-- | src/plugins/sensors/generic/generictiltsensor.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/plugins/sensors/generic/generictiltsensor.h b/src/plugins/sensors/generic/generictiltsensor.h new file mode 100644 index 00000000..0633662c --- /dev/null +++ b/src/plugins/sensors/generic/generictiltsensor.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $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$ +** +****************************************************************************/ + +#ifndef GENERICTILTSENSOR_H +#define GENERICTILTSENSOR_H + +#include <qsensorbackend.h> +#include <qtiltsensor.h> +#include <qaccelerometer.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +class GenericTiltSensor : public QSensorBackend, public QAccelerometerFilter +{ +public: + + static char const * const id; + + GenericTiltSensor(QSensor *sensor); + + void start(); + void stop(); + + void calibrate(); + + bool filter(QAccelerometerReading *reading); + +private: + QTiltReading m_reading; + QAccelerometer *accelerometer; + qreal radAccuracy; + qreal pitch; + qreal roll; + qreal calibratedPitch; + qreal calibratedRoll; + qreal xRotation; + qreal yRotation; +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif + |