sensorfw: chains/compasschain/compasschain.h Source File

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"
25#include "coordinatealignfilter.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
38 class 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();
60 void resetCalibration();
61
62 // declinationAngle()
63protected:
64 CompassChain(const QString& id);
65 ~CompassChain();
66
67private:
68 Bin* filterBin;
69
70 AbstractChain *accelerometerChain;
71 AbstractChain *magChain;
72
73 BufferReader<AccelerationData> *accelerometerReader;
74 BufferReader<CalibratedMagneticFieldData> *magReader;
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
BufferReader
Definition: accelerometersensor.h:38
CompassChain
Definition: compasschain.h:39
CompassChain::resetCalibration
void resetCalibration()
CompassChain::compassEnabled
bool compassEnabled
Definition: compasschain.h:42
CompassChain::start
bool start()
CompassChain::declinationValue
quint16 declinationValue
Definition: compasschain.h:43
CompassChain::CompassChain
CompassChain(const QString &id)
CompassChain::setCompassEnabled
void setCompassEnabled(bool enabled)
CompassChain::factoryMethod
static AbstractChain * factoryMethod(const QString &id)
Definition: compasschain.h:46
CompassChain::~CompassChain
~CompassChain()
CompassChain::declinationValue
quint16 declinationValue() const
CompassChain::compassEnabled
bool compassEnabled() const
CompassChain::stop
bool stop()
coordinatealignfilter.h
CoordinateAlignFilter.
orientationdata.h
Datatypes for different filters.
timedunsigned.h
Datatype for unsigned values.