Class AnalogInput
- java.lang.Object
-
- org.wildstang.framework.io.inputs.Input
-
- org.wildstang.framework.io.inputs.AnalogInput
-
- Direct Known Subclasses:
WsAnalogGyro
,WsAnalogInput
,WsJoystickAxis
,WsRemoteAnalogInput
public abstract class AnalogInput extends Input
First abstraction of Input representing "analog" Inputs such as joysticks and gyros.
-
-
Constructor Summary
Constructors Constructor Description AnalogInput(java.lang.String p_name)
Constructor simply passes on name.AnalogInput(java.lang.String p_name, double p_default)
Constructor with default value.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description double
getValue()
Returns the latest stored value from the Input.protected void
readDataFromInput()
Processes raw value read from Input's hardware.protected abstract double
readRawValue()
Abstract function to request and return the raw value from hardware.void
setValue(double 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 Detail
-
AnalogInput
public AnalogInput(java.lang.String p_name)
Constructor simply passes on name.- Parameters:
p_name
- Name of the Input.
-
AnalogInput
public AnalogInput(java.lang.String p_name, double p_default)
Constructor with default value.- Parameters:
p_name
- Name of the Input.p_default
- Default value of the Input.
-
-
Method Detail
-
readDataFromInput
protected void readDataFromInput()
Processes raw value read from Input's hardware.- Specified by:
readDataFromInput
in classInput
-
setValue
public void setValue(double 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 value read for the Input.
-
readRawValue
protected abstract double readRawValue()
Abstract function to request and return the raw value from hardware.- Returns:
- The latest value read from hardware.
-
getValue
public double getValue()
Returns the latest stored value from the Input.- Returns:
- Latest value stored in the Input.
-
-