public abstract class GenericHID extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GenericHID.Hand
Which hand the Human Interface Device is associated with.
|
static class |
GenericHID.HIDType |
static class |
GenericHID.RumbleType
Represents a rumble output on the JoyStick.
|
Constructor and Description |
---|
GenericHID(int port) |
Modifier and Type | Method and Description |
---|---|
int |
getAxisCount()
Get the number of axes for the HID.
|
int |
getAxisType(int axis)
Get the axis type of a joystick axis.
|
int |
getButtonCount()
For the current HID, return the number of buttons.
|
java.lang.String |
getName()
Get the name of the HID.
|
int |
getPort()
Get the port number of the HID.
|
int |
getPOV() |
int |
getPOV(int pov)
Get the angle in degrees of a POV on the HID.
|
int |
getPOVCount()
For the current HID, return the number of POVs.
|
double |
getRawAxis(int axis)
Get the value of the axis.
|
boolean |
getRawButton(int button)
Get the button value (starting at button 1).
|
boolean |
getRawButtonPressed(int button)
Whether the button was pressed since the last check.
|
boolean |
getRawButtonReleased(int button)
Whether the button was released since the last check.
|
GenericHID.HIDType |
getType()
Get the type of the HID.
|
double |
getX()
Get the x position of the HID.
|
abstract double |
getX(GenericHID.Hand hand)
Get the x position of HID.
|
double |
getY()
Get the y position of the HID.
|
abstract double |
getY(GenericHID.Hand hand)
Get the y position of the HID.
|
void |
setOutput(int outputNumber,
boolean value)
Set a single HID output value for the HID.
|
void |
setOutputs(int value)
Set all HID output values for the HID.
|
void |
setRumble(GenericHID.RumbleType type,
double value)
Set the rumble output for the HID.
|
public GenericHID(int port)
public final double getX()
public abstract double getX(GenericHID.Hand hand)
hand
- which hand, left or rightpublic final double getY()
public abstract double getY(GenericHID.Hand hand)
hand
- which hand, left or rightpublic boolean getRawButton(int button)
The buttons are returned in a single 16 bit value with one bit representing the state of each button. The appropriate button is returned as a boolean value.
button
- The button number to be read (starting at 1)public boolean getRawButtonPressed(int button)
button
- The button index, beginning at 1.public boolean getRawButtonReleased(int button)
button
- The button index, beginning at 1.public double getRawAxis(int axis)
axis
- The axis to read, starting at 0.public int getPOV(int pov)
The POV angles start at 0 in the up direction, and increase clockwise (eg right is 90, upper-left is 315).
pov
- The index of the POV to read (starting at 0)public int getPOV()
public int getAxisCount()
public int getPOVCount()
public int getButtonCount()
public GenericHID.HIDType getType()
public java.lang.String getName()
public int getAxisType(int axis)
public int getPort()
public void setOutput(int outputNumber, boolean value)
outputNumber
- The index of the output to set (1-32)value
- The value to set the output topublic void setOutputs(int value)
value
- The 32 bit output value (1 bit for each output)public void setRumble(GenericHID.RumbleType type, double value)
type
- Which rumble value to setvalue
- The normalized value (0 to 1) to set the rumble to