sensorfw: chains/orientationchain/orientationchain.h Source File

sensorfw

orientationchain.h
Go to the documentation of this file.
1
27#ifndef ORIENTATIONCHAIN_H
28#define ORIENTATIONCHAIN_H
29
30#include "abstractsensor.h"
31#include "abstractchain.h"
32#include "deviceadaptor.h"
33#include "bufferreader.h"
34#include "filter.h"
35#include "bin.h"
36#include "datatypes/orientationdata.h"
37#include "datatypes/posedata.h"
38#include "datatypes/unsigned.h"
39
40class Bin;
41template <class TYPE> class BufferReader;
42class FilterBase;
43
51 class OrientationChain : public AbstractChain
52{
53 Q_OBJECT;
54
55 Q_PROPERTY(TimedUnsigned orientation READ orientation);
56
57public:
62 static AbstractChain* factoryMethod(const QString& id)
63 {
64 OrientationChain* sc = new OrientationChain(id);
65 return sc;
66 }
67
72 TimedUnsigned orientation() const
73 {
74 QObject *filter = dynamic_cast<QObject*>(orientationInterpreterFilter_);
75 if (filter != NULL) {
76 PoseData pose = qvariant_cast< PoseData >(filter->property("orientation"));
77 return TimedUnsigned(pose.timestamp_, pose.orientation_);
78 }
79 return TimedUnsigned();
80 }
81
82public Q_SLOTS:
83 bool start();
84 bool stop();
85
86protected:
87 OrientationChain(const QString& id);
88 ~OrientationChain();
89
90private:
91 static double aconv_[3][3];
92 Bin* filterBin_;
93
94 AbstractChain* accelerometerChain_;
95 BufferReader<AccelerationData>* accelerometerReader_;
96 FilterBase* orientationInterpreterFilter_;
97 RingBuffer<PoseData>* topEdgeOutput_;
98 RingBuffer<PoseData>* faceOutput_;
99 RingBuffer<PoseData>* orientationOutput_;
100};
101
102#endif // ORIENTATIONCHAIN_H
BufferReader
Definition accelerometersensor.h:38
OrientationChain
Orientationchain providies device orientation information using the accelerometer information.
Definition orientationchain.h:52
OrientationChain::orientation
TimedUnsigned orientation() const
Property method returning current orientation.
Definition orientationchain.h:72
OrientationChain::OrientationChain
OrientationChain(const QString &id)
OrientationChain::stop
bool stop()
OrientationChain::start
bool start()
OrientationChain::~OrientationChain
~OrientationChain()
OrientationChain::factoryMethod
static AbstractChain * factoryMethod(const QString &id)
Factory method for OrientationChain.
Definition orientationchain.h:62
OrientationChain::orientation
TimedUnsigned orientation
Definition orientationchain.h:55
PoseData
Datatype for device pose interpretation.
Definition posedata.h:34
PoseData::orientation_
PoseData::Orientation orientation_
Device Orientation.
Definition posedata.h:84
TimedData::timestamp_
quint64 timestamp_
monotonic time (microsec)
Definition genericdata.h:46
TimedUnsigned
Datatype for unsigned integer value with timestamp.
Definition timedunsigned.h:34
orientationdata.h
Datatypes for different filters.
posedata.h
Datatype for device 'pose' (orientation)
unsigned.h
QObject based datatype for TimedUnsigned.