sensorfw
compassfilter.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2013 Jolla Ltd
4
5 This file is part of Sensord.
6
7 Sensord is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License
9 version 2.1 as published by the Free Software Foundation.
10
11 Sensord is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with Sensord. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef COMPASSFILTER_H
21#define COMPASSFILTER_H
22
23#include <QObject>
24#include "ringbuffer.h"
25#include "orientationdata.h"
26#include "filter.h"
27
28class CompassFilter : public QObject, public FilterBase
29{
30 Q_OBJECT
31
32public:
33
34 static FilterBase* factoryMethod() {
35 return new CompassFilter;
36 }
37
38protected:
39
41
42private:
43
44 Sink<CompassFilter, CalibratedMagneticFieldData> magDataSink;
45 Sink<CompassFilter, AccelerationData> accelSink;
46 Source<CompassData> magSource;
47
48 void magDataAvailable(unsigned, const CalibratedMagneticFieldData*);
49 void accelDataAvailable(unsigned, const AccelerationData*);
50
51 qreal magX;
52 qreal magY;
53 qreal magZ;
54 qreal oldMagX;
55 qreal oldMagY;
56 qreal oldMagZ;
57
58 int level;
59 qreal oldHeading;
60};
61
62#endif
Datatype for calibrated magnetometer measurements.
static FilterBase * factoryMethod()
Definition: compassfilter.h:34
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
Datatypes for different filters.