sensorfw: sensors/orientationsensor/orientationsensor.h Source File

sensorfw

orientationsensor.h
Go to the documentation of this file.
1
26#ifndef ORIENTATION_SENSOR_CHANNEL_H
27#define ORIENTATION_SENSOR_CHANNEL_H
28
29#include "abstractsensor.h"
30#include "abstractchain.h"
31#include "orientationsensor_a.h"
32#include "dataemitter.h"
33#include "datatypes/orientationdata.h"
34#include "datatypes/posedata.h"
35#include "datatypes/unsigned.h"
36
37class Bin;
38template <class TYPE> class BufferReader;
39class FilterBase;
40
48 class OrientationSensorChannel :
49 public AbstractSensorChannel,
50 public DataEmitter<PoseData>
51{
52 Q_OBJECT;
53 Q_PROPERTY(Unsigned orientation READ orientation);
54
55public:
56
61 static AbstractSensorChannel* factoryMethod(const QString& id)
62 {
63 OrientationSensorChannel* sc = new OrientationSensorChannel(id);
64 new OrientationSensorChannelAdaptor(sc);
65
66 return sc;
67 }
68
73 Unsigned orientation() const
74 {
75 TimedUnsigned o = orientationChain_->property("orientation").value<TimedUnsigned>();
76 return Unsigned(o);
77 }
78
79public Q_SLOTS:
80 bool start();
81 bool stop();
82
83signals:
88 void orientationChanged(const int& orientation);
89
90protected:
91 OrientationSensorChannel(const QString& id);
92 virtual ~OrientationSensorChannel();
93
94private:
95 PoseData prevOrientation;
96 Bin* filterBin_;
97 Bin* marshallingBin_;
98
99 AbstractChain* orientationChain_;
100
101 BufferReader<PoseData>* orientationReader_;
102
103 RingBuffer<PoseData>* outputBuffer_;
104
109 void emitData(const PoseData& value);
110};
111
112#endif // ORIENTATION_SENSOR_CHANNEL_H
BufferReader
Definition accelerometersensor.h:38
OrientationSensorChannelAdaptor
Definition orientationsensor_a.h:37
OrientationSensorChannel
Sensor for accessing device orientation.
Definition orientationsensor.h:51
OrientationSensorChannel::OrientationSensorChannel
OrientationSensorChannel(const QString &id)
OrientationSensorChannel::~OrientationSensorChannel
virtual ~OrientationSensorChannel()
OrientationSensorChannel::orientation
Unsigned orientation
Definition orientationsensor.h:53
OrientationSensorChannel::stop
bool stop()
OrientationSensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for OrientationSensorChannel.
Definition orientationsensor.h:61
OrientationSensorChannel::orientationChanged
void orientationChanged(const int &orientation)
Sent whenever orientation interpretation has changed.
OrientationSensorChannel::start
bool start()
OrientationSensorChannel::orientation
Unsigned orientation() const
Property method returning current orientation.
Definition orientationsensor.h:73
PoseData
Datatype for device pose interpretation.
Definition posedata.h:34
TimedUnsigned
Datatype for unsigned integer value with timestamp.
Definition timedunsigned.h:34
Unsigned
QObject facae for TimedUnsigned.
Definition unsigned.h:37
orientationdata.h
Datatypes for different filters.
orientationsensor_a.h
D-Bus Adaptor for OrientationSensor.
posedata.h
Datatype for device 'pose' (orientation)
unsigned.h
QObject based datatype for TimedUnsigned.