00001 #ifndef QVIBRA_H
00002 #define QVIBRA_H
00003
00004 #include <QObject>
00005
00006 class QVibraPrivate;
00007
00008 class QVibra : public QObject
00009 {
00010 Q_OBJECT
00011 Q_DECLARE_PRIVATE(QVibra)
00012 Q_ENUMS(Status)
00013 Q_ENUMS(EngineRotation)
00014 Q_ENUMS(Error)
00015 Q_PROPERTY(EngineRotation rotation READ rotation WRITE setRotation)
00016 Q_CLASSINFO("Author", "Sebastiano Galazzo")
00017 Q_CLASSINFO("Email", "sebastiano.galazzo@gmail.com")
00018
00019 public:
00020 QVibra(QObject *parent = 0);
00021 virtual ~QVibra();
00022
00023 static const int InfiniteDuration = 0;
00024 static const int MaxIntensity = 100;
00025 static const int DefaultIntensity = 100;
00026 static const int MinIntensity = 0;
00027
00028 enum Error {
00029 NoError = 0,
00030 OutOfMemoryError,
00031 ArgumentError,
00032 VibraInUseError,
00033 HardwareError,
00034 TimeOutError,
00035 VibraLockedError,
00036 AccessDeniedError,
00037 UnknownError = -1,
00038 NotCreated
00039 };
00040
00041 enum Status {
00042 StatusNotAllowed = 0,
00043 StatusOff,
00044 StatusOn
00045 };
00046
00047 enum EngineRotation {
00048 Positive,
00049 Negative
00050 };
00051
00052 Q_INVOKABLE QVibra::Status currentStatus() const;
00053 Q_INVOKABLE QVibra::Error error() const;
00054 Q_INVOKABLE QString errorString() const;
00055
00056 QVibra::EngineRotation rotation();
00057 void setRotation(EngineRotation);
00058
00059 signals:
00060 void statusChanged(QVibra::Status status);
00061
00062 public slots:
00068 bool start(int duration = InfiniteDuration, int intensity=MaxIntensity);
00069 bool stop();
00070 void reserve();
00071 void release();
00072
00073 private:
00074 EngineRotation m_rotation;
00075 QVibraPrivate *d;
00076
00077 private:
00078 friend class QVibraPrivate;
00079
00080 };
00081 #endif
00082
00083