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