Package trclib.sensor
Interface TrcTrigger
- All Known Implementing Classes:
TrcTriggerDigitalInput
,TrcTriggerThresholdRange
,TrcTriggerThresholdZones
public interface TrcTrigger
This interface specifies a collection of methods to implement an asynchronous trigger. For example, a trigger can
be generated by a digital sensor, an analog sensor or any value source. For a digital sensor, a trigger is
generated when it changes from an inactive state to an active state or vise versa. For an analog sensor, a trigger
is generated when the sensor value crosses a given set of thresholds. This class is intended to be implemented by
different sensor trigger classes.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method disarms the trigger.void
enableTrigger
(TrcTrigger.TriggerMode triggerMode, TrcEvent event) This method arms the digital trigger.void
enableTrigger
(TrcTrigger.TriggerMode triggerMode, TrcEvent.Callback callback) This method arms the digital trigger.boolean
This method reads the current digital sensor state.double
This method reads the current analog sensor value.boolean
This method checks if the trigger task is enabled.
-
Method Details
-
enableTrigger
This method arms the digital trigger. It enables the task that monitors the sensor state changes.- 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 digital trigger. It enables the task that monitors the sensor state changes.- Parameters:
triggerMode
- specifies the trigger mode that will trigger a callback.callback
- specifies the callback handler to notify when the trigger state changed.
-
disableTrigger
void disableTrigger()This method disarms the trigger. It disables the task that monitors the sensor value. -
isEnabled
boolean isEnabled()This method checks if the trigger task is enabled.- Returns:
- true if enabled, false otherwise.
-
getSensorValue
double getSensorValue()This method reads the current analog sensor value. For digital sensor trigger, it will throw a RuntimeException.- Returns:
- current sensor value.
-
getSensorState
boolean getSensorState()This method reads the current digital sensor state. For analog sensor trigger, it will throw a RuntimeException.- Returns:
- current sensor state.
-