00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INPUTTHREAD_H
00020 #define INPUTTHREAD_H
00021
00022 #include "gluon_input_export.h"
00023 #include "gluonbuttons.h"
00024 #include "absval.h"
00025
00026 #include <QtCore/QThread>
00027 #include <QtCore/QObject>
00028 #include <QtCore/QMap>
00029 #include <QtCore/QSharedData>
00030
00031 #include <IOKit/IOKitLib.h>
00032 #include <IOKit/hid/IOHIDKeys.h>
00033 #include <IOKit/hid/IOHIDLib.h>
00034
00035 namespace GluonInput
00036 {
00037
00038 class InputThreadPrivate;
00039
00040 class GLUON_INPUT_EXPORT InputThread : public QThread
00041 {
00042 Q_OBJECT
00043 public:
00044 explicit InputThread( IOHIDDeviceRef pDevice, QObject* parent = 0 );
00045 ~InputThread();
00046
00047 static void deviceReport( void* inContext, IOReturn inResult, void* inSender, IOHIDValueRef inIOHIDValueRef );
00048
00049 int joystickXAxis();
00050 int joystickYAxis();
00051 int joystickZAxis();
00052
00053 void run();
00054 void stop();
00055
00056 int vendora() const;
00057 int product() const;
00058 int version() const;
00059 int bustype() const;
00060
00061 QList<int> buttonCapabilities() const;
00062 QList<int> absAxisCapabilities() const;
00063 QList<int> relAxisCapabilities() const;
00064 AbsVal axisInfo( int axisCode ) const;
00065
00066 const QString deviceName() const;
00067 GluonInput::DeviceFlag deviceType() const;
00068
00069 bool isEnabled() const;
00070
00071 bool error();
00072 QString msgError();
00073
00074 QObject* parent();
00075
00076 signals:
00077 void relAxisMoved( int axis, int distance );
00078 void absAxisMoved( int axis, int distance );
00079 void buttonStateChanged( int button, int value );
00080
00081 private:
00082 void readInformation();
00083
00084 QSharedDataPointer<InputThreadPrivate> d;
00085 };
00086 }
00087 #endif