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 TypeMethodDescriptionvoidThis method disarms the trigger.voidenableTrigger(TrcTrigger.TriggerMode triggerMode, TrcEvent event) This method arms the trigger.voidenableTrigger(TrcTrigger.TriggerMode triggerMode, TrcEvent.Callback callback) This method arms the trigger.booleanThis method reads the current digital sensor state.doubleThis method reads the current analog sensor value (not supported).booleanThis 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:
enableTriggerin 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:
enableTriggerin 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:
disableTriggerin interfaceTrcTrigger
-
isEnabled
public boolean isEnabled()This method checks if the trigger task is enabled.- Specified by:
isEnabledin interfaceTrcTrigger- Returns:
- true if enabled, false otherwise.
-
getSensorValue
public double getSensorValue()This method reads the current analog sensor value (not supported).- Specified by:
getSensorValuein interfaceTrcTrigger- Returns:
- current sensor value.
-
getSensorState
public boolean getSensorState()This method reads the current digital sensor state.- Specified by:
getSensorStatein interfaceTrcTrigger- Returns:
- current sensor state.
-