javaclient
Class JoystickInterface

java.lang.Object
  extended by javaclient.PlayerDevice
      extended by javaclient.JoystickInterface

public class JoystickInterface
extends PlayerDevice

The joystick interface provides access to the state of a joystick. It allows another driver or a (possibly off-board) client to read and use the state of a joystick.
This interface accepts no commands or configuration requests.

Version:
Author:
Radu Bogdan Rusu

Field Summary
 
Fields inherited from class javaclient.PlayerDevice
device, DIFFERENCE_SYNCH_FACTOR, index, is, os, pc, PLAYER_MAX_REQREP_SIZE, PLAYER_STXX, reserved, size, t_sec, t_usec, ts_sec, ts_usec
 
Constructor Summary
JoystickInterface(PlayerClient pc, short indexOfDevice)
          Constructor for JoystickInterface.
 
Method Summary
 int getButtons()
          Returns the current button states (bitmask).
 short getXPos()
          Returns the current X joystick position (unscaled).
 short getXScale()
          Returns the current X scaling factor.
 short getYPos()
          Returns the current Y joystick position (unscaled).
 short getYScale()
          Returns the current Y scaling factor.
 void readData()
          The joystick data packet, which contains the current state of the joystick.
 
Methods inherited from class javaclient.PlayerDevice
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleEARMessage, handleNARMessage, handleResponse, readHeader, sendHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoystickInterface

public JoystickInterface(PlayerClient pc,
                         short indexOfDevice)
Constructor for JoystickInterface.

Parameters:
pc - a reference to the PlayerClient object
indexOfDevice - the index of the device
Method Detail

readData

public void readData()
The joystick data packet, which contains the current state of the joystick.

Overrides:
readData in class PlayerDevice

getXPos

public short getXPos()
Returns the current X joystick position (unscaled).

Returns:
the current X joystick position as a short

getYPos

public short getYPos()
Returns the current Y joystick position (unscaled).

Returns:
the current Y joystick position as a short

getXScale

public short getXScale()
Returns the current X scaling factor.

Returns:
the current X scaling factor as a short

getYScale

public short getYScale()
Returns the current Y scaling factor.

Returns:
the current Y scaling factor as a short

getButtons

public int getButtons()
Returns the current button states (bitmask).

Returns:
the current button states as an integer