Class JoystickData


  • public class JoystickData
    extends java.lang.Object
    This class is an intermediate data structure used in OI and in RobotInspector. It holds information parsed out of the OI map for a particular joystick.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<ButtonData> buttons()
      Get an immutable list of buttons on the joystick.
      java.lang.Class<?> mapClass()
      Get the class used to declare the joystick.
      java.lang.String name()
      Get a string representation of the name of the joystick.
      int port()
      Get the port the joystick is plugged into
      MapJoystick.Role role()
      Get the role of the joystick
      MapJoystick.Type type()
      Get the physical type of the joystick
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JoystickData

        public JoystickData​(int port,
                            MapJoystick.Role role,
                            MapJoystick.Type type,
                            java.lang.Class<?> mapClass,
                            java.util.List<ButtonData> buttons)
        Construct a new JoystickData object with the given parameters
        Parameters:
        port - the port the joystick is plugged into
        role - the role the joystick fills
        type - the physical type of joystick
        mapClass - the class inside the oi map representing the joystick
        buttons - a list of buttons which are part of the joystick. This object makes an immutable reference to the list passed in.
    • Method Detail

      • port

        public int port()
        Get the port the joystick is plugged into
        Returns:
        the port the joystick is plugged into
      • role

        public MapJoystick.Role role()
        Get the role of the joystick
        Returns:
        the role of the joystick
      • type

        public MapJoystick.Type type()
        Get the physical type of the joystick
        Returns:
        the type of the joystick
      • name

        public java.lang.String name()
        Get a string representation of the name of the joystick. This is the simple name of the class representing the joystick
        Returns:
        The name of the joystick
      • mapClass

        public java.lang.Class<?> mapClass()
        Get the class used to declare the joystick. This should be a public static class in the oi map which had a MapJoystick annotation
        Returns:
        The class of the joystick
      • buttons

        public java.util.List<ButtonData> buttons()
        Get an immutable list of buttons on the joystick. This is actually a list of button/command mappings, so a single button number may be counted twice if there are multiple commands on it.
        Returns:
        A list of button/command mappings