sensorfw: adaptors/alsadaptor/alsadaptor.h Source File

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"
36#include "datatypes/timedunsigned.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;
62public:
63 enum DeviceType
64 {
65 DeviceUnknown = 0,
66 RM680,
67 RM696,
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
90protected:
91
96 ALSAdaptor(const QString& id);
97
98 ~ALSAdaptor();
99
100 void processSample(int pathId, int fd);
101
102private:
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
ALSAdaptor
Adaptor for internal ambient light sensor.
Definition alsadaptor.h:60
ALSAdaptor::startSensor
virtual bool startSensor()
ALSAdaptor::standby
virtual bool standby()
ALSAdaptor::factoryMethod
static DeviceAdaptor * factoryMethod(const QString &id)
Factory method for gaining a new instance of ALSAdaptor class.
Definition alsadaptor.h:77
ALSAdaptor::ALSAdaptor
ALSAdaptor(const QString &id)
Constructor.
ALSAdaptor::resume
virtual bool resume()
ALSAdaptor::processSample
void processSample(int pathId, int fd)
ALSAdaptor::stopSensor
virtual void stopSensor()
ALSAdaptor::DeviceType
DeviceType
Definition alsadaptor.h:64
ALSAdaptor::NCDK
@ NCDK
Definition alsadaptor.h:68
ALSAdaptor::DeviceUnknown
@ DeviceUnknown
Definition alsadaptor.h:65
ALSAdaptor::RM680
@ RM680
Definition alsadaptor.h:66
ALSAdaptor::RM696
@ RM696
Definition alsadaptor.h:67
ALSAdaptor::~ALSAdaptor
~ALSAdaptor()
timedunsigned.h
Datatype for unsigned values.