Go to the documentation of this file.00001
00027 #ifndef ORIENTATIONCHAIN_H
00028 #define ORIENTATIONCHAIN_H
00029
00030 #include "abstractsensor.h"
00031 #include "abstractchain.h"
00032 #include "deviceadaptor.h"
00033 #include "bufferreader.h"
00034 #include "filter.h"
00035 #include "bin.h"
00036 #include "datatypes/orientationdata.h"
00037 #include "datatypes/posedata.h"
00038 #include "datatypes/unsigned.h"
00039
00040 class Bin;
00041 template <class TYPE> class BufferReader;
00042 class FilterBase;
00043
00051 class OrientationChain : public AbstractChain
00052 {
00053 Q_OBJECT;
00054
00055 Q_PROPERTY(TimedUnsigned orientation READ orientation);
00056
00057 public:
00062 static AbstractChain* factoryMethod(const QString& id)
00063 {
00064 OrientationChain* sc = new OrientationChain(id);
00065 return sc;
00066 }
00067
00072 TimedUnsigned orientation() const
00073 {
00074 QObject *filter = dynamic_cast<QObject*>(orientationInterpreterFilter_);
00075 if (filter != NULL) {
00076 PoseData pose = qvariant_cast< PoseData >(filter->property("orientation"));
00077 return TimedUnsigned(pose.timestamp_, pose.orientation_);
00078 }
00079 return TimedUnsigned();
00080 }
00081
00082 public Q_SLOTS:
00083 bool start();
00084 bool stop();
00085
00086 protected:
00087 OrientationChain(const QString& id);
00088 ~OrientationChain();
00089
00090 private:
00091 static double aconv_[3][3];
00092 Bin* filterBin_;
00093
00094 AbstractChain* accelerometerChain_;
00095 BufferReader<AccelerationData>* accelerometerReader_;
00096 FilterBase* orientationInterpreterFilter_;
00097 RingBuffer<PoseData>* topEdgeOutput_;
00098 RingBuffer<PoseData>* faceOutput_;
00099 RingBuffer<PoseData>* orientationOutput_;
00100 };
00101
00102 #endif // ORIENTATIONCHAIN_H