Class Button
java.lang.Object
io.github.roboblazers7617.buttonbox.Control
io.github.roboblazers7617.buttonbox.controls.Button
- Direct Known Subclasses:
PhysicalButton
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Determines how the state of the button should be updated when the button is pressed or released. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getState()
Gets button stateGet a trigger for the buttonvoid
setMode
(Button.ButtonMode buttonMode) Sets the button's modevoid
setPressed
(boolean pressed) Sets whether the button is pressed or not.void
setupNetworkTables
(NetworkTable table) Called by the Control class when the NetworkTable is set.void
Should set up any simulation-specific things.void
Updates the control's state on the client.void
Updates the control's state on the server.Methods inherited from class io.github.roboblazers7617.buttonbox.Control
getId, getTable, setTable, updateHardware, updateOnClient
-
Constructor Details
-
Button
Creates a new Button.- Parameters:
id
- The ID string for the Button to use.- See Also:
-
-
Method Details
-
setupSimulation
public void setupSimulation()Description copied from class:Control
Should set up any simulation-specific things.Called as a part of the constructor if the library is running in simulation.
- Overrides:
setupSimulation
in classControl
-
updateServer
public void updateServer()Description copied from class:Control
Updates the control's state on the server.This doesn't do anything by default, and should be overridden by the class inheritting this.
- Overrides:
updateServer
in classControl
-
updateClient
public void updateClient()Description copied from class:Control
Updates the control's state on the client. This should get any feedback from the server, but this should not interface with the buttonbox hardware.This doesn't do anything by default, and should be overridden by the class inheritting this.
- Overrides:
updateClient
in classControl
-
setupNetworkTables
Description copied from class:Control
Called by the Control class when the NetworkTable is set. Not intended to be called outside of the class.This should create all of the NetworkTables publishers and subscribers for the inheritting class.
- Overrides:
setupNetworkTables
in classControl
- Parameters:
table
-NetworkTable
-
getState
public boolean getState()Gets button state- Returns:
- button state (true = pushed, false = released)
-
setPressed
public void setPressed(boolean pressed) Sets whether the button is pressed or not.- Parameters:
pressed
- Is the button pressed?
-
getTrigger
Get a trigger for the button- Returns:
- trigger
-
setMode
Sets the button's mode- Parameters:
buttonMode
- mode to set the button to
-