sensorfw
alsadaptor.h
Go to the documentation of this file.
1 
31 #ifndef ALSADAPTOR_H
32 #define ALSADAPTOR_H
33 
34 #include "sysfsadaptor.h"
35 #include "deviceadaptorringbuffer.h"
37 #include <QTime>
38 #include <QDBusInterface>
39 
40 #ifdef SENSORFW_MCE_WATCHER
41 // these come from mce/mode-names.h
42 // and mce/dbus-names.h
43 #define MCE_SERVICE "com.nokia.mce"
44 #define MCE_REQUEST_PATH "/com/nokia/mce/request"
45 #define MCE_REQUEST_IF "com.nokia.mce.request"
46 #endif
47 
59 class ALSAdaptor : public SysfsAdaptor
60 {
61  Q_OBJECT;
62 public:
64  {
68  NCDK
69  };
70 
77  static DeviceAdaptor* factoryMethod(const QString& id)
78  {
79  return new ALSAdaptor(id);
80  }
81 
82  virtual bool startSensor();
83 
84  virtual void stopSensor();
85 
86  virtual bool standby();
87 
88  virtual bool resume();
89 
90 protected:
91 
96  ALSAdaptor(const QString& id);
97 
99 
100  void processSample(int pathId, int fd);
101 
102 private:
103 #ifdef SENSORFW_MCE_WATCHER
104  void enableALS();
105  void disableALS();
106 
107  QDBusInterface *dbusIfc;
108  bool alsEnabled;
109 #endif
110 
111  DeviceAdaptorRingBuffer<TimedUnsigned>* alsBuffer_;
112  DeviceType deviceType_;
113  QByteArray powerStatePath_;
114 };
115 
116 #endif
Adaptor for internal ambient light sensor.
Definition: alsadaptor.h:60
virtual bool startSensor()
virtual bool standby()
ALSAdaptor(const QString &id)
Constructor.
virtual bool resume()
void processSample(int pathId, int fd)
static DeviceAdaptor * factoryMethod(const QString &id)
Factory method for gaining a new instance of ALSAdaptor class.
Definition: alsadaptor.h:77
virtual void stopSensor()
@ DeviceUnknown
Definition: alsadaptor.h:65
Datatype for unsigned values.