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"
37 #include "datatypes/posedata.h"
38 #include "datatypes/unsigned.h"
39 
40 class Bin;
41 template <class TYPE> class BufferReader;
42 class FilterBase;
43 
51 class OrientationChain : public AbstractChain
52 {
53  Q_OBJECT;
54 
55  Q_PROPERTY(TimedUnsigned orientation READ orientation);
56 
57 public:
62  static AbstractChain* factoryMethod(const QString& id)
63  {
64  OrientationChain* sc = new OrientationChain(id);
65  return sc;
66  }
67 
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 
82 public Q_SLOTS:
83  bool start();
84  bool stop();
85 
86 protected:
87  OrientationChain(const QString& id);
89 
90 private:
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
Orientationchain providies device orientation information using the accelerometer information.
TimedUnsigned orientation() const
Property method returning current orientation.
OrientationChain(const QString &id)
static AbstractChain * factoryMethod(const QString &id)
Factory method for OrientationChain.
TimedUnsigned orientation
Datatype for device pose interpretation.
Definition: posedata.h:34
PoseData::Orientation orientation_
Device Orientation.
Definition: posedata.h:84
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
Datatype for unsigned integer value with timestamp.
Definition: timedunsigned.h:34
Datatypes for different filters.
Datatype for device 'pose' (orientation)
QObject based datatype for TimedUnsigned.