Class FrcButtonPanel

java.lang.Object
trclib.driverio.TrcGameController
frclib.driverio.FrcButtonPanel

public class FrcButtonPanel extends TrcGameController
This class implements the platform dependent button panel. It provides monitoring of the panel buttons. If the caller of this class provides a button notification handler, it will call it when there are button events.
  • Constructor Details

    • FrcButtonPanel

      public FrcButtonPanel(String instanceName, int port)
      Constructor: Create an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      port - specifies the USB port the joystick is plugged into.
  • Method Details

    • setButtonEventHandler

      public void setButtonEventHandler(FrcButtonPanel.ButtonEventHandler buttonEventHandler)
      This method sets the button event handler.
      Parameters:
      buttonEventHandler - specifies button event notification handler, null to disable event notification.
    • getButtons

      public int getButtons()
      This method returns the button states in an integer by combining all the button states.
      Specified by:
      getButtons in class TrcGameController
      Returns:
      button states.
    • notifyButtonEvent

      protected void notifyButtonEvent(int buttonValue, boolean pressed)
      This method is called when a button event is detected. It translates the button value into button type and calls the button event handler.
      Specified by:
      notifyButtonEvent in class TrcGameController
      Parameters:
      buttonValue - specifies the button value that generated the event.
      pressed - specifies true if the button is pressed, false if it is released.