Go to the documentation of this file.00001
00026 #ifndef ALS_SENSOR_CHANNEL_H
00027 #define ALS_SENSOR_CHANNEL_H
00028
00029 #include <QObject>
00030
00031 #include "deviceadaptor.h"
00032 #include "abstractsensor.h"
00033 #include "alssensor_a.h"
00034 #include "dataemitter.h"
00035 #include "datatypes/timedunsigned.h"
00036 #include "datatypes/unsigned.h"
00037
00038 class Bin;
00039 template <class TYPE> class BufferReader;
00040 class FilterBase;
00041
00042 #ifdef PROVIDE_CONTEXT_INFO
00043 #include <ContextProvider>
00044 #endif
00045
00052 class ALSSensorChannel :
00053 public AbstractSensorChannel,
00054 public DataEmitter<TimedUnsigned>
00055 {
00056 Q_OBJECT;
00057 Q_PROPERTY(Unsigned lux READ lux);
00058
00059 public:
00064 static AbstractSensorChannel* factoryMethod(const QString& id)
00065 {
00066 ALSSensorChannel* sc = new ALSSensorChannel(id);
00067 new ALSSensorChannelAdaptor(sc);
00068
00069 return sc;
00070 }
00071
00076 Unsigned lux() const { return previousValue_; }
00077
00078 public Q_SLOTS:
00079 bool start();
00080 bool stop();
00081
00082 signals:
00087 void ALSChanged(const Unsigned& value);
00088
00089 protected:
00090 ALSSensorChannel(const QString& id);
00091 virtual ~ALSSensorChannel();
00092
00093 private:
00094 TimedUnsigned previousValue_;
00095 Bin* filterBin_;
00096 Bin* marshallingBin_;
00097 DeviceAdaptor* alsAdaptor_;
00098 BufferReader<TimedUnsigned>* alsReader_;
00099 RingBuffer<TimedUnsigned>* outputBuffer_;
00100
00101 void emitData(const TimedUnsigned& value);
00102
00103 #ifdef PROVIDE_CONTEXT_INFO
00104 ContextProvider::Service service;
00105 ContextProvider::Property isDarkProperty;
00106 ContextProvider::Property isBrightProperty;
00107 ContextProvider::Group propertyGroup;
00108 #endif
00109 };
00110
00111 #endif // ALS_SENSOR_CHANNEL_H