sensorfw
avgaccfilter.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 ROTATIONFILTER_H
21 #define ROTATIONFILTER_H
22 
23 #include <QObject>
24 
25 #include "orientationdata.h"
26 #include "filter.h"
27 
28 class AvgAccFilter : public QObject, public Filter<TimedXyzData, AvgAccFilter, TimedXyzData>
29 {
30  Q_OBJECT
31 
32 public:
33  static FilterBase* factoryMethod()
34  {
35  return new AvgAccFilter();
36  }
37 
38  void reset();
39  void setFactor(qreal);
40  qreal factor();
41 
42 private:
43 
44  AvgAccFilter();
45 
46  void interpret(unsigned, const TimedXyzData*);
47 
48  typedef QList<TimedXyzData> XyzAvgAccBuffer;
49 
50  TimedXyzData avgAccdata;
51  XyzAvgAccBuffer avgBuffer;
52  unsigned int avgBufferSize;
53  qreal filterFactor;
54 
55  qreal averageX;
56  qreal averageY;
57  qreal averageZ;
58 
59  QList<TimedXyzData> avgAccelBuffer;
60 
61 };
62 
63 #endif // ROTATIONFILTER_H
static FilterBase * factoryMethod()
Definition: avgaccfilter.h:33
qreal factor()
void setFactor(qreal)
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
Datatypes for different filters.