sensorfw: sensors/rotationsensor/rotationsensor.h Source File

sensorfw

rotationsensor.h
Go to the documentation of this file.
1
27 #ifndef ROTATION_SENSOR_CHANNEL_H
28 #define ROTATION_SENSOR_CHANNEL_H
29
30 #include <QMutex>
31 #include "abstractsensor.h"
32 #include "abstractchain.h"
33 #include "rotationsensor_a.h"
34 #include "dataemitter.h"
35 #include "datatypes/orientationdata.h"
36
37 class Bin;
38 template <class TYPE> class BufferReader;
39 class FilterBase;
40
44 class RotationSensorChannel :
45 public AbstractSensorChannel,
46 public DataEmitter<TimedXyzData>
47 {
48 Q_OBJECT;
49 Q_PROPERTY(XYZ rotation READ rotation);
50 Q_PROPERTY(bool hasZ READ hasZ);
51
52 public:
57 static AbstractSensorChannel* factoryMethod(const QString& id)
58 {
59 RotationSensorChannel* sc = new RotationSensorChannel(id);
60 new RotationSensorChannelAdaptor(sc);
61
62 return sc;
63 }
64
65 XYZ rotation() const
66 {
67 return XYZ(prevRotation_);
68 }
69
70 bool hasZ() const
71 {
72 return compassReader_;
73 }
74
75 virtual unsigned int interval() const;
76 virtual bool setInterval(unsigned int value, int sessionId);
77
78 virtual void removeSession(int sessionId);
79
80 virtual bool downsamplingSupported() const;
81
82 public Q_SLOTS:
83 bool start();
84 bool stop();
85
86 signals:
91 void dataAvailable(const XYZ& data);
92
93 protected:
94 RotationSensorChannel(const QString& id);
95 virtual ~RotationSensorChannel();
96
97 private:
98 Bin* filterBin_;
99 Bin* marshallingBin_;
100 AbstractChain* accelerometerChain_;
101 AbstractChain* compassChain_;
102 BufferReader<TimedXyzData>* accelerometerReader_;
103 BufferReader<CompassData>* compassReader_;
104 FilterBase* rotationFilter_;
105 RingBuffer<TimedXyzData>* outputBuffer_;
106 TimedXyzData prevRotation_;
107 TimedXyzDownsampleBuffer downsampleBuffer_;
108 QMutex mutex_;
109
110 void emitData(const TimedXyzData& value);
111 };
112
113 #endif // ROTATION_SENSOR_CHANNEL_H
BufferReader
Definition: accelerometersensor.h:38
RotationSensorChannelAdaptor
Definition: rotationsensor_a.h:36
RotationSensorChannel
Sensor providing device rotation around axes.
Definition: rotationsensor.h:47
RotationSensorChannel::start
bool start()
RotationSensorChannel::hasZ
bool hasZ
Definition: rotationsensor.h:49
RotationSensorChannel::rotation
XYZ rotation() const
Definition: rotationsensor.h:65
RotationSensorChannel::downsamplingSupported
virtual bool downsamplingSupported() const
RotationSensorChannel::~RotationSensorChannel
virtual ~RotationSensorChannel()
RotationSensorChannel::hasZ
bool hasZ() const
Definition: rotationsensor.h:70
RotationSensorChannel::RotationSensorChannel
RotationSensorChannel(const QString &id)
RotationSensorChannel::stop
bool stop()
RotationSensorChannel::setInterval
virtual bool setInterval(unsigned int value, int sessionId)
RotationSensorChannel::interval
virtual unsigned int interval() const
RotationSensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for RotationSensorChannel.
Definition: rotationsensor.h:57
RotationSensorChannel::removeSession
virtual void removeSession(int sessionId)
RotationSensorChannel::rotation
XYZ rotation
Definition: rotationsensor.h:48
RotationSensorChannel::dataAvailable
void dataAvailable(const XYZ &data)
Sent when new measurement data has become available.
TimedXyzData
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
XYZ
QObject facade for XYZData.
Definition: xyz.h:37
orientationdata.h
Datatypes for different filters.
rotationsensor_a.h
D-Bus adaptor for RotationSensor.