Package trclib.sensor
Class TrcTriggerDigitalInput
java.lang.Object
trclib.sensor.TrcTriggerDigitalInput
- All Implemented Interfaces:
TrcTrigger
This class implements a trigger for a digital input device. A digital input trigger consists of a digital input
device. It monitors the device state and notifies the callback handler if the state changes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface trclib.sensor.TrcTrigger
TrcTrigger.TriggerMode
-
Constructor Summary
ConstructorsConstructorDescriptionTrcTriggerDigitalInput
(String instanceName, TrcDigitalInput sensor) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method disarms the trigger.void
enableTrigger
(TrcTrigger.TriggerMode triggerMode, TrcEvent event) This method arms the trigger.void
enableTrigger
(TrcTrigger.TriggerMode triggerMode, TrcEvent.Callback callback) This method arms the trigger.boolean
This method reads the current digital sensor state.double
This method reads the current analog sensor value (not supported).boolean
This method checks if the trigger task is enabled.toString()
This method returns the instance name and its state.
-
Constructor Details
-
TrcTriggerDigitalInput
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.sensor
- specifies the digital input device.
-
-
Method Details
-
toString
This method returns the instance name and its state. -
enableTrigger
This method arms the trigger. It enables the task that monitors the sensor value.- Specified by:
enableTrigger
in interfaceTrcTrigger
- Parameters:
triggerMode
- specifies the trigger mode that will signal the event.event
- specifies the event to signal when the trigger state changed.
-
enableTrigger
This method arms the trigger. It enables the task that monitors the sensor value.- Specified by:
enableTrigger
in interfaceTrcTrigger
- Parameters:
triggerMode
- specifies the trigger mode that will trigger a callback.callback
- specifies the callback handler to notify when the trigger state changed.
-
disableTrigger
public void disableTrigger()This method disarms the trigger. It disables the task that monitors the sensor value.- Specified by:
disableTrigger
in interfaceTrcTrigger
-
isEnabled
public boolean isEnabled()This method checks if the trigger task is enabled.- Specified by:
isEnabled
in interfaceTrcTrigger
- Returns:
- true if enabled, false otherwise.
-
getSensorValue
public double getSensorValue()This method reads the current analog sensor value (not supported).- Specified by:
getSensorValue
in interfaceTrcTrigger
- Returns:
- current sensor value.
-
getSensorState
public boolean getSensorState()This method reads the current digital sensor state.- Specified by:
getSensorState
in interfaceTrcTrigger
- Returns:
- current sensor state.
-