sensorfw: sensors/proximitysensor/proximitysensor.h Source File

sensorfw

proximitysensor.h
Go to the documentation of this file.
1
28 #ifndef PROXIMITY_SENSOR_CHANNEL_H
29 #define PROXIMITY_SENSOR_CHANNEL_H
30
31 #include "abstractsensor.h"
32 #include "proximitysensor_a.h"
33 #include "dataemitter.h"
34 #include "deviceadaptor.h"
35 #include "datatypes/timedunsigned.h"
36 #include "datatypes/unsigned.h"
37
38 class Bin;
39 template <class TYPE> class BufferReader;
40
46 class ProximitySensorChannel :
47 public AbstractSensorChannel,
48 public DataEmitter<ProximityData>
49 {
50 Q_OBJECT;
51 Q_PROPERTY(Unsigned proximity READ proximity);
52 Q_PROPERTY(Proximity proximityReflectance READ proximityReflectance);
53
54 public:
59 static AbstractSensorChannel* factoryMethod(const QString& id)
60 {
61 ProximitySensorChannel* sc = new ProximitySensorChannel(id);
62 new ProximitySensorChannelAdaptor(sc);
63 return sc;
64 }
65
70 Unsigned proximity() const { return previousValue_; }
71
72 Proximity proximityReflectance() const { return previousValue_; }
73
74 public Q_SLOTS:
75 bool start();
76 bool stop();
77
78 signals:
83 void dataAvailable(const Unsigned& data);
84
85 protected:
86 ProximitySensorChannel(const QString& id);
87 virtual ~ProximitySensorChannel();
88
89 private:
90 Bin* filterBin_;
91 Bin* marshallingBin_;
92 DeviceAdaptor* proximityAdaptor_;
93 BufferReader<ProximityData>* proximityReader_;
94 RingBuffer<ProximityData>* outputBuffer_;
95 ProximityData previousValue_;
96
97 void emitData(const ProximityData& value);
98 };
99
100 #endif // PROXIMITY_SENSOR_CHANNEL_H
BufferReader
Definition: accelerometersensor.h:38
ProximityData
Datatype for proximity measurements.
Definition: orientationdata.h:151
ProximitySensorChannelAdaptor
Definition: proximitysensor_a.h:37
ProximitySensorChannel
Sensor for accessing proximity sensor measurements.
Definition: proximitysensor.h:49
ProximitySensorChannel::proximityReflectance
Proximity proximityReflectance() const
Definition: proximitysensor.h:72
ProximitySensorChannel::start
bool start()
ProximitySensorChannel::stop
bool stop()
ProximitySensorChannel::dataAvailable
void dataAvailable(const Unsigned &data)
Sent when new measurement data has become available.
ProximitySensorChannel::proximityReflectance
Proximity proximityReflectance
Definition: proximitysensor.h:51
ProximitySensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for AbstractSensorChannel.
Definition: proximitysensor.h:59
ProximitySensorChannel::~ProximitySensorChannel
virtual ~ProximitySensorChannel()
ProximitySensorChannel::proximity
Unsigned proximity() const
Property for accessing the measured value.
Definition: proximitysensor.h:70
ProximitySensorChannel::proximity
Unsigned proximity
Definition: proximitysensor.h:50
ProximitySensorChannel::ProximitySensorChannel
ProximitySensorChannel(const QString &id)
Proximity
QObject facade for ProximityData.
Definition: proximity.h:38
Unsigned
QObject facae for TimedUnsigned.
Definition: unsigned.h:37
proximitysensor_a.h
D-Bus adaptor for ProximitySensor.
timedunsigned.h
Datatype for unsigned values.
unsigned.h
QObject based datatype for TimedUnsigned.