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 
28 class CompassFilter : public QObject, public FilterBase
29 {
30  Q_OBJECT
31 
32 public:
33 
34  static FilterBase* factoryMethod() {
35  return new CompassFilter;
36  }
37 
38 protected:
39 
41 
42 private:
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 
52 
53  qreal magX;
54  qreal magY;
55  qreal magZ;
56  qreal oldMagX;
57  qreal oldMagY;
58  qreal oldMagZ;
59 
60  int level;
61  qreal oldHeading;
62  QList <int> averagingBuffer;
63  QList <const CalibratedMagneticFieldData *> magAvgBuffer;
64  QList <const AccelerationData *> accelAvgBuffer;
65 // MagAvgBuffer magAvgBuffer;
66 };
67 
68 #endif
CalibratedMagneticFieldData
Datatype for calibrated magnetometer measurements.
Definition: orientationdata.h:59
TimedXyzData
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
CompassFilter
Definition: compassfilter.h:29
orientationdata.h
Datatypes for different filters.
CompassFilter::factoryMethod
static FilterBase * factoryMethod()
Definition: compassfilter.h:34
CompassFilter::CompassFilter
CompassFilter()