Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

joystickManager.h

00001 
00007 #ifndef JOYSTICKMANAGER_H
00008 #define JOYSTICKMANAGER_H
00009 
00010 #include <linux/joystick.h>
00011 #include <pthread.h>
00012 #include "screenManager.h"
00013 #include "JoystPacket.h"
00014 #include "sysLog.h"
00015 
00016 class JoystickManager{
00017         public:
00021         enum Status {
00022             //Listening to the controller to pass the high stick test
00023             LISTENING = 2,
00025             INITIALIZE = 3,
00027             CLOSED = 0,
00029             ERROR = -2,
00031             OPEN = 1
00032         };
00033 
00038                 static JoystickManager * theInstance();
00039         
00044                 int startJoystickCtrl();
00045         
00050                 int stopJoystickCtrl();
00051                 
00055         static void highStickThread();
00056 
00060                 static void joystickCtrl();
00061                 
00066         void setStatus(Status newStatus);
00067 
00072                 void highStickCheck();
00073                 
00078         void setInitWheel(int value);
00079 
00086         void convertToSC(int x, int y, int factor);
00087         
00092         void setXAxis(int x);
00093         
00098         void setYAxis(int y);
00099         
00104         void setMaxSpeed(int spd);
00105         
00112         void spin(int x, int y, int factor);
00113                 
00118         inline Status getStatus(){return status;}
00119         
00124                 inline int getfd(){return jsfd;}
00125                 
00130         inline unsigned char getAxes(){return axes;}
00131                 
00136         inline unsigned char getButtons(){return buttons;}
00137                 
00142         inline int getInitWheel(){return initWheel;}
00143 
00148         inline int getXAxis(){return xAxis;}
00149 
00154                 inline int getYAxis(){return yAxis;}
00155 
00160                 inline int getMaxSpeed(){return maxSpeed;}
00161         
00167         int reInit();
00168         
00169     protected:
00175         JoystickManager();
00176 
00180                 ~JoystickManager();
00181 
00182         private:
00184         Status status;
00186         static ScreenManager * screenManager;
00188                 static SysLog * systemLogger;   
00190                 pthread_t joystickThread;
00192                 int jsfd;
00194                 unsigned char axes;
00196                 unsigned char buttons;
00198                 int initWheel;
00200                 int xAxis;
00202         int yAxis;
00204         int maxSpeed;
00205 
00206 };
00207 
00208 #endif
00209 

Generated on Sat Mar 26 00:07:04 2005 for CS498EmbeddedSystemsProgramming by doxygen 1.3.6