Go to the documentation of this file.00001
00034 #ifndef QMSENSOR_H
00035 #define QMSENSOR_H
00036 #include <QtCore/qobject.h>
00037 #include "system_global.h"
00038
00039 QT_BEGIN_HEADER;
00040
00041 namespace MeeGo {
00042 class QmSensorPrivate;
00043
00047 class QmSensorReading
00048 {
00049 public:
00050 quint64 timestamp;
00051 };
00052
00056 class QmIntReading : public QmSensorReading
00057 {
00058 public:
00059 int value;
00060 };
00061
00105 class MEEGO_SYSTEM_EXPORT QmSensor : public QObject
00106 {
00107 Q_OBJECT;
00108 Q_PROPERTY(QString lastError READ lastError);
00109 Q_PROPERTY(int interval READ interval WRITE setInterval);
00110 Q_PROPERTY(bool standbyOverride READ standbyOverride WRITE setStandbyOverride);
00111
00112 public:
00113
00115 enum SessionType {
00116 SessionTypeNone,
00117 SessionTypeListen,
00118 SessionTypeControl
00119 };
00120
00121 virtual ~QmSensor();
00122
00128 SessionType sessionType();
00129
00135 bool verifySessionLevel(QmSensor::SessionType type);
00136
00143 bool start();
00144
00151 bool stop();
00152
00158 bool isRunning();
00159
00170 SessionType requestSession(SessionType type = SessionTypeControl);
00171
00176 void closeSession();
00177
00186 QString lastError() const;
00187
00188
00193 int interval();
00194
00202 void setInterval(int value);
00203
00209 bool standbyOverride();
00210
00218 void setStandbyOverride(bool value);
00219
00220 Q_SIGNALS:
00225 void errorSignal(QString error);
00226
00227 protected:
00231 QmSensor(QObject *parent);
00232 MEEGO_DECLARE_PROTECTED(QmSensor);
00233
00234 };
00235 }
00236
00237 QT_END_HEADER
00238
00239 #endif