Class GenericHID

    • Constructor Detail

      • GenericHID

        public GenericHID​(int port)
    • Method Detail

      • getX

        public final double getX()
        Get the x position of the HID.
        Returns:
        the x position of the HID
      • getX

        public abstract double getX​(GenericHID.Hand hand)
        Get the x position of HID.
        Parameters:
        hand - which hand, left or right
        Returns:
        the x position
      • getY

        public final double getY()
        Get the y position of the HID.
        Returns:
        the y position
      • getY

        public abstract double getY​(GenericHID.Hand hand)
        Get the y position of the HID.
        Parameters:
        hand - which hand, left or right
        Returns:
        the y position
      • getRawButton

        public boolean getRawButton​(int button)
        Get the button value (starting at button 1).

        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.

        Parameters:
        button - The button number to be read (starting at 1)
        Returns:
        The state of the button.
      • getRawButtonPressed

        public boolean getRawButtonPressed​(int button)
        Whether the button was pressed since the last check. Button indexes begin at 1.
        Parameters:
        button - The button index, beginning at 1.
        Returns:
        Whether the button was pressed since the last check.
      • getRawButtonReleased

        public boolean getRawButtonReleased​(int button)
        Whether the button was released since the last check. Button indexes begin at 1.
        Parameters:
        button - The button index, beginning at 1.
        Returns:
        Whether the button was released since the last check.
      • getRawAxis

        public double getRawAxis​(int axis)
        Get the value of the axis.
        Parameters:
        axis - The axis to read, starting at 0.
        Returns:
        The value of the axis.
      • getPOV

        public int getPOV​(int pov)
        Get the angle in degrees of a POV on the HID.

        The POV angles start at 0 in the up direction, and increase clockwise (eg right is 90, upper-left is 315).

        Parameters:
        pov - The index of the POV to read (starting at 0)
        Returns:
        the angle of the POV in degrees, or -1 if the POV is not pressed.
      • getPOV

        public int getPOV()
      • getAxisCount

        public int getAxisCount()
        Get the number of axes for the HID.
        Returns:
        the number of axis for the current HID
      • getPOVCount

        public int getPOVCount()
        For the current HID, return the number of POVs.
      • getButtonCount

        public int getButtonCount()
        For the current HID, return the number of buttons.
      • getType

        public GenericHID.HIDType getType()
        Get the type of the HID.
        Returns:
        the type of the HID.
      • getName

        public String getName()
        Get the name of the HID.
        Returns:
        the name of the HID.
      • getAxisType

        public int getAxisType​(int axis)
        Get the axis type of a joystick axis.
        Returns:
        the axis type of a joystick axis.
      • getPort

        public int getPort()
        Get the port number of the HID.
        Returns:
        The port number of the HID.
      • setOutput

        public void setOutput​(int outputNumber,
                              boolean value)
        Set a single HID output value for the HID.
        Parameters:
        outputNumber - The index of the output to set (1-32)
        value - The value to set the output to
      • setOutputs

        public void setOutputs​(int value)
        Set all HID output values for the HID.
        Parameters:
        value - The 32 bit output value (1 bit for each output)
      • setRumble

        public void setRumble​(GenericHID.RumbleType type,
                              double value)
        Set the rumble output for the HID. The DS currently supports 2 rumble values, left rumble and right rumble.
        Parameters:
        type - Which rumble value to set
        value - The normalized value (0 to 1) to set the rumble to