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