sensorfw: sensors/temperaturesensor/temperaturesensor.h Source File

sensorfw

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