sensorfw: sensors/magnetometersensor/magnetometersensor.h Source File

sensorfw

magnetometersensor.h
Go to the documentation of this file.
1
28 #ifndef MAGNETOMETER_SENSOR_CHANNEL_H
29 #define MAGNETOMETER_SENSOR_CHANNEL_H
30
31 #include "abstractsensor.h"
32 #include "abstractchain.h"
33 #include "magnetometersensor_a.h"
34 #include "dataemitter.h"
35 #include "deviceadaptor.h"
36 #include "datatypes/orientationdata.h"
37
38 class Bin;
39 template <class TYPE> class BufferReader;
40 class FilterBase;
41
45 class MagnetometerSensorChannel :
46 public AbstractSensorChannel,
47 public DataEmitter<CalibratedMagneticFieldData>
48 {
49 Q_OBJECT;
50 Q_PROPERTY(MagneticField magneticField READ magneticField);
51
52 public:
57 static AbstractSensorChannel* factoryMethod(const QString& id)
58 {
59 MagnetometerSensorChannel* sc = new MagnetometerSensorChannel(id);
60 new MagnetometerSensorChannelAdaptor(sc);
61
62 return sc;
63 }
64
65 Q_INVOKABLE void resetCalibration();
66
67 MagneticField magneticField() const
68 {
69 return MagneticField(prevMeasurement_);
70 }
71
72 virtual void removeSession(int sessionId);
73
74 virtual bool downsamplingSupported() const;
75
76 public Q_SLOTS:
77 bool start();
78 bool stop();
79
80 signals:
85 void dataAvailable(const MagneticField& data);
86 void internalData(const MagneticField& data);
87
88 protected:
89 MagnetometerSensorChannel(const QString& id);
90 virtual ~MagnetometerSensorChannel();
91
92 virtual bool setDataRange(const DataRange& range, int sessionId);
93
94 private:
95 Bin* filterBin_;
96 Bin* marshallingBin_;
97 AbstractChain* magChain_;
98 FilterBase* scaleFilter_;
99 BufferReader<CalibratedMagneticFieldData>* magnetometerReader_;
100 RingBuffer<CalibratedMagneticFieldData>* outputBuffer_;
101 CalibratedMagneticFieldData prevMeasurement_;
102 int scaleCoefficient_;
103 MagneticFieldDownsampleBuffer downsampleBuffer_;
104
105 void emitData(const CalibratedMagneticFieldData& value);
106 };
107
108 #endif // MAGNETOMETER_SENSOR_CHANNEL_H
BufferReader
Definition: accelerometersensor.h:38
CalibratedMagneticFieldData
Datatype for calibrated magnetometer measurements.
Definition: orientationdata.h:59
DataRange
Datatype for storing sensor data range information.
Definition: datarange.h:46
MagneticField
QObject facade for CalibratedMagneticFieldData.
Definition: magneticfield.h:38
MagnetometerSensorChannelAdaptor
Definition: magnetometersensor_a.h:36
MagnetometerSensorChannel
Sensor providing magnetic field measurements.
Definition: magnetometersensor.h:48
MagnetometerSensorChannel::setDataRange
virtual bool setDataRange(const DataRange &range, int sessionId)
MagnetometerSensorChannel::dataAvailable
void dataAvailable(const MagneticField &data)
Sent when new measurement data has become available.
MagnetometerSensorChannel::MagnetometerSensorChannel
MagnetometerSensorChannel(const QString &id)
MagnetometerSensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for MagnetometerSensorChannel.
Definition: magnetometersensor.h:57
MagnetometerSensorChannel::start
bool start()
MagnetometerSensorChannel::~MagnetometerSensorChannel
virtual ~MagnetometerSensorChannel()
MagnetometerSensorChannel::magneticField
MagneticField magneticField() const
Definition: magnetometersensor.h:67
MagnetometerSensorChannel::internalData
void internalData(const MagneticField &data)
MagnetometerSensorChannel::removeSession
virtual void removeSession(int sessionId)
MagnetometerSensorChannel::magneticField
MagneticField magneticField
Definition: magnetometersensor.h:49
MagnetometerSensorChannel::stop
bool stop()
MagnetometerSensorChannel::downsamplingSupported
virtual bool downsamplingSupported() const
MagnetometerSensorChannel::resetCalibration
Q_INVOKABLE void resetCalibration()
magnetometersensor_a.h
D-Bus adaptor for MagnetometerSensor.
orientationdata.h
Datatypes for different filters.