sensorfw
compasschain.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 #ifndef COMPASSCHAIN_H
20 #define COMPASSCHAIN_H
21 
22 #include "abstractsensor.h"
23 #include "abstractchain.h"
24 #include "coordinatealignfilter.h"
25 #include "deviceadaptor.h"
26 #include "bufferreader.h"
27 #include "filter.h"
28 #include "bin.h"
29 
30 #include "orientationdata.h"
31 #include "timedunsigned.h"
32 
33 class Bin;
34 template <class TYPE> class BufferReader;
35 class FilterBase;
36 
37 class CompassChain : public AbstractChain
38 {
39  Q_OBJECT
40 
41  Q_PROPERTY(bool compassEnabled READ compassEnabled WRITE setCompassEnabled)
42  Q_PROPERTY(quint16 declinationValue READ declinationValue)
43 public:
44 
45  static AbstractChain *factoryMethod(const QString& id)
46  {
47  CompassChain *sc = new CompassChain(id);
48  return sc;
49  }
50 
51  bool compassEnabled() const;
52  void setCompassEnabled(bool enabled);
53 
54  quint16 declinationValue() const;
55 
56 public Q_SLOTS:
57  bool start();
58  bool stop();
60 
61  // declinationAngle()
62 protected:
63  CompassChain(const QString& id);
65 
66 private:
67  Bin* filterBin;
68 
69  AbstractChain *accelerometerChain;
70  AbstractChain *magChain;
71 
72  BufferReader<AccelerationData> *accelerometerReader;
74 
75  DeviceAdaptor *orientAdaptor;
76  BufferReader<CompassData> *orientationdataReader;
77 
78 
79  FilterBase *compassFilter;
80  FilterBase *orientationFilter;
81  FilterBase *declinationFilter;
82 
83  FilterBase *downsampleFilter;
84  FilterBase *avgaccFilter;
85 
86  RingBuffer<CompassData> *trueNorthBuffer;
87  RingBuffer<CompassData> *magneticNorthBuffer;
88 
89  bool hasOrientationAdaptor;
90 };
91 
92 #endif // COMPASSCHAIN_H
static AbstractChain * factoryMethod(const QString &id)
Definition: compasschain.h:45
void resetCalibration()
bool compassEnabled
Definition: compasschain.h:41
quint16 declinationValue
Definition: compasschain.h:42
CompassChain(const QString &id)
void setCompassEnabled(bool enabled)
quint16 declinationValue() const
bool compassEnabled() const
CoordinateAlignFilter.
Datatypes for different filters.
Datatype for unsigned values.