sensorfw: sensors/alssensor/alssensor.h Source File

sensorfw

alssensor.h
Go to the documentation of this file.
1
26#ifndef ALS_SENSOR_CHANNEL_H
27#define ALS_SENSOR_CHANNEL_H
28
29#include <QObject>
30
31#include "deviceadaptor.h"
32#include "abstractsensor.h"
33#include "alssensor_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
42#ifdef PROVIDE_CONTEXT_INFO
43#include <ContextProvider>
44#endif
45
52 class ALSSensorChannel :
53 public AbstractSensorChannel,
54 public DataEmitter<TimedUnsigned>
55{
56 Q_OBJECT;
57 Q_PROPERTY(Unsigned lux READ lux);
58
59public:
64 static AbstractSensorChannel* factoryMethod(const QString& id)
65 {
66 ALSSensorChannel* sc = new ALSSensorChannel(id);
67 new ALSSensorChannelAdaptor(sc);
68
69 return sc;
70 }
71
76 Unsigned lux() const { return previousValue_; }
77
78public Q_SLOTS:
79 bool start();
80 bool stop();
81
82signals:
87 void ALSChanged(const Unsigned& value);
88
89protected:
90 ALSSensorChannel(const QString& id);
91 virtual ~ALSSensorChannel();
92
93private:
94 TimedUnsigned previousValue_;
95 Bin* filterBin_;
96 Bin* marshallingBin_;
97 DeviceAdaptor* alsAdaptor_;
98 BufferReader<TimedUnsigned>* alsReader_;
99 RingBuffer<TimedUnsigned>* outputBuffer_;
100
101 void emitData(const TimedUnsigned& value);
102
103#ifdef PROVIDE_CONTEXT_INFO
104 ContextProvider::Service service;
105 ContextProvider::Property isDarkProperty;
106 ContextProvider::Property isBrightProperty;
107 ContextProvider::Group propertyGroup;
108#endif
109};
110
111#endif // ALS_SENSOR_CHANNEL_H
alssensor_a.h
D-Bus adaptor for ALSSensor.
ALSSensorChannelAdaptor
Definition alssensor_a.h:37
ALSSensorChannel
Sensor for accessing the internal ambient light sensor measurements.
Definition alssensor.h:55
ALSSensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for ALSSensorChannel.
Definition alssensor.h:64
ALSSensorChannel::lux
Unsigned lux() const
Property for accessing the measured value.
Definition alssensor.h:76
ALSSensorChannel::start
bool start()
ALSSensorChannel::lux
Unsigned lux
Definition alssensor.h:57
ALSSensorChannel::stop
bool stop()
ALSSensorChannel::~ALSSensorChannel
virtual ~ALSSensorChannel()
ALSSensorChannel::ALSSensorChannel
ALSSensorChannel(const QString &id)
ALSSensorChannel::ALSChanged
void ALSChanged(const Unsigned &value)
Sent when a change in measured data is observed.
BufferReader
Definition accelerometersensor.h:38
TimedUnsigned
Datatype for unsigned integer value with timestamp.
Definition timedunsigned.h:34
Unsigned
QObject facae for TimedUnsigned.
Definition unsigned.h:37
timedunsigned.h
Datatype for unsigned values.
unsigned.h
QObject based datatype for TimedUnsigned.