public class Joystick extends Object implements Runnable, JoystickObserver
Responsible for finding any input devices attached. We know about at this writing the Logitech Freedom 2.4 device and the Macally airstick, and have mappings for those devices into command inputs for AVCL.
This implements a singleton pattern. To retrieve a joystick object, use Joystick.getJoystick();
Note that "Controller" is a net.java.games.input object.
To add a new type of joystick: 1) Determine its name, as retrieved by the controller.getName() in jinput 2) add the name to the knownJoystickNames array 3) add a mappings Map object, which matches the button press or joystick tilt axis named to the workbench operation we want to happen; 4) add that mappings object to the stickNameToJoystickEventCommandTypeMappings lookup
| Modifier and Type | Field and Description | 
|---|---|
| static Map<String,Map<String,String>> | componentToDescriptionMappingsKey is the name of the joystick ("Logitech Freedom 2.4"), value is the mappings
 hashmap of the user-picked description for the location of the control and control
 itself | 
| static Map<String,Map<String,Double>> | componentToScalingMappings | 
| List<JoystickEventListener> | joystickEventListenerListHolds list of objects that receive joystick events | 
| static String[] | knownJoystickNamesThe name, as returned by the controller.getName() method, of the joysticks that we have tested and support | 
| static String | selectedJoystickNameThe name of the joystick that has been selected from all the possible joysticks;
 the first available device that matches a name of the supported joysticks | 
| static float | SIGNIFICANT_JOYSTICK_VALUETreat joystick events with values below this as zero | 
| static Map<String,Map<String,JoystickEvent.CommandType>> | stickNameToJoystickEventCommandTypeMappingsKey is the name of the joystick ("Logitech Freedom 2.4"), value is the
 mappings hashmap for that joystick, which maps jinput-returned events to our AUV events | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addListener(JoystickEventListener newListener)JoystickObserver interface implementation. | 
| static Joystick | getJoystick()If a supported joystick is present it returns a joystick object
 object for that. | 
| String | getName()Return name of joystick | 
| boolean | isFound()Return name of joystick | 
| static boolean | isJoystickPresent()Returns true if there is a supported joystick present | 
| static void | listControllers()Debugging. | 
| static void | main(String[] args) | 
| void | removeAllListeners()Removes all objects that are listening for joystick events | 
| void | removeListener(JoystickEventListener listener)JoystickObserver interface implementation. removes an object
 that is listening for events. | 
| void | run() | 
| void | setRunning(boolean status) | 
| void | stopPollingThread()Causes the joystick polling thread to exit | 
public static final String[] knownJoystickNames
public static String selectedJoystickName
public static Map<String,Map<String,JoystickEvent.CommandType>> stickNameToJoystickEventCommandTypeMappings
public static Map<String,Map<String,String>> componentToDescriptionMappings
public final List<JoystickEventListener> joystickEventListenerList
public static final float SIGNIFICANT_JOYSTICK_VALUE
public static void main(String[] args)
public static boolean isJoystickPresent()
Joystick is connectedpublic static Joystick getJoystick()
Joystickpublic String getName()
public boolean isFound()
public static void listControllers()
public void addListener(JoystickEventListener newListener)
addListener in interface JoystickObservernewListener - public void removeListener(JoystickEventListener listener)
removeListener in interface JoystickObserverlistener - public void setRunning(boolean status)
public void removeAllListeners()
JoystickObserverremoveAllListeners in interface JoystickObserverpublic void stopPollingThread()
stopPollingThread in interface JoystickObserver