Go to the documentation of this file.00001
00030 #ifndef ALSADAPTOR_H
00031 #define ALSADAPTOR_H
00032
00033 #include "sysfsadaptor.h"
00034 #include "deviceadaptorringbuffer.h"
00035 #include "datatypes/timedunsigned.h"
00036 #include <QTime>
00037 #include <QDBusInterface>
00038
00039 #ifdef SENSORFW_MCE_WATCHER
00040 #include <mce/mode-names.h>
00041 #include <mce/dbus-names.h>
00042 #endif
00043
00055 class ALSAdaptor : public SysfsAdaptor
00056 {
00057 Q_OBJECT;
00058 public:
00059
00060 enum DeviceType
00061 {
00062 DeviceUnknown = 0,
00063 RM680,
00064 RM696
00065 };
00066
00073 static DeviceAdaptor* factoryMethod(const QString& id)
00074 {
00075 return new ALSAdaptor(id);
00076 }
00077
00078 virtual bool startSensor(const QString& sensorId);
00079
00080 virtual void stopSensor(const QString& sensorId);
00081
00082 virtual bool standby();
00083
00084 virtual bool resume();
00085
00086 protected:
00087
00092 ALSAdaptor(const QString& id);
00093
00094 ~ALSAdaptor();
00095
00096 void processSample(int pathId, int fd);
00097
00098 private:
00099 #ifdef SENSORFW_MCE_WATCHER
00100 void enableALS();
00101 void disableALS();
00102
00103 QDBusInterface *dbusIfc;
00104 bool alsEnabled;
00105 #endif
00106
00107 DeviceAdaptorRingBuffer<TimedUnsigned>* alsBuffer_;
00108 ALSAdaptor::DeviceType device;
00109 };
00110
00111 #endif