Class DigitalInput
java.lang.Object
org.wildstang.framework.io.inputs.Input
org.wildstang.framework.io.inputs.DigitalInput
- Direct Known Subclasses:
WsDigitalInput,WsDPadButton,WsJoystickButton,WsJoystickToggleButton,WsMotionProfileControl,WsRemoteDigitalInput
First abstraction of Input representing "digital" Inputs
such as buttons and limit switches.
-
Constructor Summary
ConstructorsConstructorDescriptionDigitalInput(String p_name) Constructor simply passes on name.DigitalInput(String p_name, boolean p_default) Constructor with default value.DigitalInput(String p_name, boolean p_debounced, int p_debounceCycles) Constructor with default value. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetValue()Returns the latest stored value from the Input.voidProcesses raw value read from Input's hardware.protected abstract booleanAbstract function to request and return the raw value from hardware.voidsetValue(boolean p_newValue) Takes a new value stores it and notifys listeners.Methods inherited from class org.wildstang.framework.io.inputs.Input
addInputListener, disable, enable, getInputListeners, getName, hasValueChanged, isEnabled, notifyListeners, removeAllListeners, removeInputListener, setValueChanged, update
-
Constructor Details
-
DigitalInput
Constructor simply passes on name.- Parameters:
p_name- Name of the Input.
-
DigitalInput
Constructor with default value.- Parameters:
p_name- Name of the Input.p_debounced- True if the Input should be "debounced". Used to clean up button presses.p_debounceCycles- Set the number of cycles value must be constant before determining no longer bouncing.
-
DigitalInput
Constructor with default value.- Parameters:
p_name- Name of the Input.p_default- Default value of the Input.
-
-
Method Details
-
readDataFromInput
public void readDataFromInput()Processes raw value read from Input's hardware. Also counts bounces for debouncing.- Specified by:
readDataFromInputin classInput
-
setValue
public void setValue(boolean p_newValue) Takes a new value stores it and notifys listeners. This is a public version of setNewValue() for manual value updating.- Parameters:
p_newValue- New binary value read for the Input.
-
readRawValue
protected abstract boolean readRawValue()Abstract function to request and return the raw value from hardware.- Returns:
- The latest binary value read from hardware.
-
getValue
public boolean getValue()Returns the latest stored value from the Input.- Returns:
- Latest binary value store in the Input.
-