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