00001 #ifndef PHLINUXJOYSTICK_H 00002 #define PHLINUXJOYSTICK_H 00003 00004 #include <phThread.h> 00005 #include <phJoystickData.h> 00006 00007 #define phLinuxJoystick_NAMELENGTH 255 00008 00009 /* ------------------------------------------------------------------------ */ 00010 class phLinuxJoystick : public phThread 00011 { 00012 private: 00013 char *m_path; 00014 uint32_t m_path_size; 00015 00016 int m_fd; 00017 00018 uint8_t m_axis_count; 00019 uint8_t m_button_count; 00020 char m_name[phLinuxJoystick_NAMELENGTH]; 00021 00022 uint8_t m_ver_maj; 00023 uint8_t m_ver_min; 00024 uint8_t m_ver_rev; 00025 00026 phJoystickData m_data; 00027 00028 int open(); 00029 int close(); 00030 00031 protected: 00032 int wakeup(); 00033 int run(); 00034 00035 public: 00036 phLinuxJoystick(const char *path = NULL); 00037 ~phLinuxJoystick(); 00038 00039 int isOpen(); 00040 00041 int setPath(const char *path); 00042 const char *getPath(); 00043 00044 uint8_t getVersionMajor (); 00045 uint8_t getVersionMinor (); 00046 uint8_t getVersionRevision (); 00047 uint8_t getAxisCount (); 00048 uint8_t getButtonCount (); 00049 const char *getName (); 00050 00051 int getData( phJoystickData &data ); 00052 00053 phJoystickData *getSource(); 00054 }; 00055 00056 #endif /* PHLINUXJOYSTICK_H */
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |