sensorfw: filters/orientationinterpreter/orientationinterpreter.h Source File

sensorfw

orientationinterpreter.h
Go to the documentation of this file.
1
29#ifndef ORIENTATIONINTERPRETER_H
30#define ORIENTATIONINTERPRETER_H
31
32#include <QObject>
33#include <QFile>
34#include "filter.h"
35#include <datatypes/orientationdata.h>
36#include <datatypes/posedata.h>
37
45 class OrientationInterpreter : public QObject, public FilterBase
46{
47 Q_OBJECT;
48
49 Q_PROPERTY(PoseData orientation READ orientation);
50
51private:
52 Sink<OrientationInterpreter, AccelerationData> accDataSink;
53 Source<PoseData> topEdgeSource;
54 Source<PoseData> faceSource;
55 Source<PoseData> orientationSource;
56
57 void accDataAvailable(unsigned, const AccelerationData*);
58
59 bool overFlowCheck();
60 void processTopEdge();
61 void processFace();
62 void processOrientation();
63
64 OrientationInterpreter();
65
66 PoseData topEdge;
67 PoseData face;
68 PoseData previousFace;
69 bool updatePreviousFace;
70
71 AccelerationData data;
72 QList<AccelerationData> dataBuffer;
73
74 int minLimit;
75 int maxLimit;
76 int angleThresholdPortrait;
77 int angleThresholdLandscape;
78 unsigned long discardTime;
79 int maxBufferSize;
80
81 PoseData orientationData;
82
83 QFile cpuBoostFile;
84
85 enum OrientationMode
86 {
87 Portrait = 0,
88 Landscape
89 };
90
91 PoseData rotateToLandscape(int);
92 PoseData rotateToPortrait(int);
93 int orientationCheck(const AccelerationData&, OrientationMode) const;
94 PoseData orientationRotation(const AccelerationData&, OrientationMode, PoseData (OrientationInterpreter::*)(int));
95
96 static const double RADIANS_TO_DEGREES;
97 static const int SAME_AXIS_LIMIT;
98
99 static const int OVERFLOW_MIN;
100 static const int OVERFLOW_MAX;
101
102 static const int THRESHOLD_LANDSCAPE;
103 static const int THRESHOLD_PORTRAIT;
104
105 static const int DISCARD_TIME;
106 static const int AVG_BUFFER_MAX_SIZE;
107
108 static const char* CPU_BOOST_PATH;
109
110public:
115 static FilterBase* factoryMethod()
116 {
117 return new OrientationInterpreter();
118 }
119
120 PoseData orientation() const { return orientationData; }
121};
122
123#endif
OrientationInterpreter
Filter for calculating device orientation.
Definition orientationinterpreter.h:46
OrientationInterpreter::orientation
PoseData orientation
Definition orientationinterpreter.h:49
OrientationInterpreter::factoryMethod
static FilterBase * factoryMethod()
Factory method.
Definition orientationinterpreter.h:115
OrientationInterpreter::orientation
PoseData orientation() const
Definition orientationinterpreter.h:120
PoseData
Datatype for device pose interpretation.
Definition posedata.h:34
TimedXyzData
Class for vector type measurement data (timestamp, x, y, z).
Definition genericdata.h:53
orientationdata.h
Datatypes for different filters.
posedata.h
Datatype for device 'pose' (orientation)