Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phJoystickData.h

Go to the documentation of this file.
00001 #ifndef PHJOYSTICK_H
00002 #define PHJOYSTICK_H
00003 
00004 #include <phLiveObject.h>
00005 
00006 /* ------------------------------------------------------------------------- */
00007 /*
00008  * http://www.nasm.si.edu/exhibitions/gal109/NEWHTF/HTF541B.HTM
00009  *
00010  *  Rotation around the front-to-back axis is called roll.
00011  *  Rotation around the side-to-side axis is called pitch.
00012  *  Rotation around the vertical axis is called yaw.
00013  */
00014 /* ------------------------------------------------------------------------- */
00015 #define phJOYSTICK_KEY_AXIS     1
00016 #define phJOYSTICK_KEY_BUTTON   2
00017 typedef struct ph_joystick_key_t
00018 {
00019     int         type;
00020     char        *name;
00021     uint32_t    index;
00022 } ph_joystick_key;
00023 
00024 /* ------------------------------------------------------------------------- */
00025 class phJoystickData : public phLiveObject
00026 {
00027 private:
00028     uint32_t m_axis_count;
00029     int32_t *m_axis;
00030     uint32_t m_axis_size;
00031 
00032     uint32_t m_button_count;
00033     int32_t *m_button;
00034     uint32_t m_button_size;
00035 
00036     ph_joystick_key *m_keys;
00037     uint32_t         m_key_count;
00038 
00039 protected:
00040     int setKeys(ph_joystick_key *keys, uint32_t key_count );
00041 
00042 public:
00043     phJoystickData();
00044     ~phJoystickData();
00045 
00046     int copy( phObject *copyto );
00047     int swap( phObject *data );
00048     
00049     int copyData( phJoystickData &copyfrom );
00050     int swapData( phJoystickData &data );
00051 
00052     int         reset           ( );
00053 
00054     int         set             (uint32_t naxis,
00055                                  int32_t *axis,
00056                                  uint32_t nbuttons,
00057                                  int32_t *button);
00058 
00059     int         setAxis         (uint32_t axis_id,
00060                                  int32_t axis);
00061     
00062     int         setButton       (uint32_t button_id,
00063                                  int32_t button);
00064 
00065     int32_t     getAxis         (uint32_t axis_id);
00066     uint32_t    getAxisCount    ();
00067     
00068     int32_t     getButton       (uint32_t button_id);
00069     uint32_t    getButtonCount  ();
00070 
00071     ph_joystick_key     *getKeys();
00072     uint32_t            getKeyCount();
00073     int32_t             get(const char *name);
00074 
00075     int32_t valueMax    ();
00076     int32_t valueMin    ();
00077 
00078     int32_t x           ();
00079     int32_t roll        ();
00080     int32_t y           ();
00081     int32_t pitch       ();
00082     int32_t z           ();
00083     int32_t yaw         ();
00084     
00085     void        print_data();
00086 };
00087 
00088 
00089 
00090 
00091 #endif /* PHJOYSTICK_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:07 2007 for phission by  doxygen 1.4.4