sensorfw: sensors/humiditysensor/humiditysensor.h Source File

sensorfw

humiditysensor.h
Go to the documentation of this file.
1
26 #ifndef HUMIDITY_SENSOR_CHANNEL_H
27 #define HUMIDITY_SENSOR_CHANNEL_H
28
29 #include <QObject>
30
31 #include "deviceadaptor.h"
32 #include "abstractsensor.h"
33 #include "humiditysensor_a.h"
34 #include "dataemitter.h"
35 #include "datatypes/timedunsigned.h"
36 #include "datatypes/unsigned.h"
37
38 class Bin;
39 template <class TYPE> class BufferReader;
40 class FilterBase;
41
48 class HumiditySensorChannel :
49 public AbstractSensorChannel,
50 public DataEmitter<TimedUnsigned>
51 {
52 Q_OBJECT
53 Q_PROPERTY(Unsigned relativeHumidity READ relativeHumidity NOTIFY relativeHumidityChanged)
54
55 public:
60 static AbstractSensorChannel* factoryMethod(const QString& id)
61 {
62 HumiditySensorChannel* sc = new HumiditySensorChannel(id);
63 new HumiditySensorChannelAdaptor(sc);
64
65 return sc;
66 }
67
72 Unsigned relativeHumidity() const { return previousRelativeValue_; }
73
74 public Q_SLOTS:
75 bool start();
76 bool stop();
77
78 signals:
83 void relativeHumidityChanged(const Unsigned& value);
84
85 protected:
86 HumiditySensorChannel(const QString& id);
87 virtual ~HumiditySensorChannel();
88
89 private:
90 TimedUnsigned previousRelativeValue_;
91 TimedUnsigned previousAbsoluteValue_;
92 Bin* filterBin_;
93 Bin* marshallingBin_;
94 DeviceAdaptor* humidityAdaptor_;
95 BufferReader<TimedUnsigned>* humidityReader_;
96 RingBuffer<TimedUnsigned>* outputBuffer_;
97
98 void emitData(const TimedUnsigned& value);
99 };
100
101 #endif // HUMIDITY_SENSOR_CHANNEL_H
BufferReader
Definition: accelerometersensor.h:38
HumiditySensorChannelAdaptor
Definition: humiditysensor_a.h:36
HumiditySensorChannel
Sensor for accessing the relative humidity sensor measurements.
Definition: humiditysensor.h:51
HumiditySensorChannel::relativeHumidity
Unsigned relativeHumidity
Definition: humiditysensor.h:53
HumiditySensorChannel::relativeHumidityChanged
void relativeHumidityChanged(const Unsigned &value)
Sent when a change in measured data is observed.
HumiditySensorChannel::HumiditySensorChannel
HumiditySensorChannel(const QString &id)
HumiditySensorChannel::~HumiditySensorChannel
virtual ~HumiditySensorChannel()
HumiditySensorChannel::stop
bool stop()
HumiditySensorChannel::relativeHumidity
Unsigned relativeHumidity() const
Property for accessing the measured value.
Definition: humiditysensor.h:72
HumiditySensorChannel::start
bool start()
HumiditySensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for HumiditySensorChannel.
Definition: humiditysensor.h:60
TimedUnsigned
Datatype for unsigned integer value with timestamp.
Definition: timedunsigned.h:34
Unsigned
QObject facae for TimedUnsigned.
Definition: unsigned.h:37
humiditysensor_a.h
D-Bus adaptor for HumiditySensor.
timedunsigned.h
Datatype for unsigned values.
unsigned.h
QObject based datatype for TimedUnsigned.