Package frclib.driverio
Class FrcButtonPanel
java.lang.Object
trclib.driverio.TrcGameController
frclib.driverio.FrcButtonPanel
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This interface, if provided, will allow this class to do a notification callback when there are button activities.static enum
Nested classes/interfaces inherited from class trclib.driverio.TrcGameController
TrcGameController.DriveMode
-
Field Summary
Fields inherited from class trclib.driverio.TrcGameController
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionFrcButtonPanel
(String instanceName, int port) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionint
This method returns the button states in an integer by combining all the button states.protected void
notifyButtonEvent
(int buttonValue, boolean pressed) This method is called when a button event is detected.void
setButtonEventHandler
(FrcButtonPanel.ButtonEventHandler buttonEventHandler) This method sets the button event handler.Methods inherited from class trclib.driverio.TrcGameController
adjustAnalogControl, adjustAnalogControl, getDirectionDegrees, getDirectionRadians, getMagnitude, init, setButtonEventEnabled, setExponent, setSamplingPeriod, toString
-
Constructor Details
-
FrcButtonPanel
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
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 classTrcGameController
- 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 classTrcGameController
- Parameters:
buttonValue
- specifies the button value that generated the event.pressed
- specifies true if the button is pressed, false if it is released.
-