Class ExpressionWatchdog
java.lang.Object
org.eclipse.scanning.sequencer.watchdog.AbstractWatchdog<ExpressionWatchdogModel>
org.eclipse.scanning.sequencer.watchdog.ExpressionWatchdog
- All Implemented Interfaces:
EventListener,IDeviceWatchdog<ExpressionWatchdogModel>,IModelProvider<ExpressionWatchdogModel>,INameable,IPositionListener
public class ExpressionWatchdog
extends AbstractWatchdog<ExpressionWatchdogModel>
implements IPositionListener
Monitors an expression of scannables and if one of the values changes, reevaluates the expression.
Example XML configuration:
<!-- We assume that beam is available if the ring current is above background level -->
<!-- and the port shutter is open -->
<bean id="beam_available_model" class="org.eclipse.scanning.api.device.models.ExpressionWatchdogModel">
<property name="expression" value="ring_current >= 1.0 && !portshutter.equalsIgnoreCase("Closed")"/>
<property name="message" value="Beam has been lost"/>
</bean>
<bean id="beam_available_watchdog" class="org.eclipse.scanning.sequencer.watchdog.ExpressionWatchdog" init-method="activate">
<property name="name" value="beam_available_watchdog" />
<property name="model" ref="beam_available_model"/>
</bean>
-
Field Summary
Fields inherited from class org.eclipse.scanning.sequencer.watchdog.AbstractWatchdog
active, controller, model -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()Watchdog idbooleanReturns whether the watchdog is currently active in a scan and pausing that scan.voidvoidCalled on a thread when the position changes.voidCalled after a given position in a scan has been performed.voidsetExpressionService(IExpressionService eservice) static voidvoidvoidstart(org.osgi.service.component.ComponentContext context) voidstop()Methods inherited from class org.eclipse.scanning.sequencer.watchdog.AbstractWatchdog
activate, deactivate, getController, getModel, getName, getScannable, isActive, isEnabled, scanFinally, scanStarted, setController, setEnabled, setModel, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.scanning.api.IModelProvider
updateModelMethods inherited from interface org.eclipse.scanning.api.scan.event.IPositionListener
levelPerformed, positionMovePerformed, positionWillPerform
-
Constructor Details
-
ExpressionWatchdog
public ExpressionWatchdog() -
ExpressionWatchdog
-
-
Method Details
-
getId
Description copied from interface:IDeviceWatchdogWatchdog id- Specified by:
getIdin interfaceIDeviceWatchdog<ExpressionWatchdogModel>- Returns:
- id
-
positionChanged
Called on a thread when the position changes.- Specified by:
positionChangedin interfaceIPositionListener- Parameters:
evt-
-
positionPerformed
Description copied from interface:IPositionListenerCalled after a given position in a scan has been performed.- Specified by:
positionPerformedin interfaceIPositionListener- Parameters:
evt-
-
start
- Throws:
ScanningException
-
pointEnd
-
stop
public void stop() -
getExpressionService
-
setExpressionService
-
setTestExpressionService
-
start
public void start(org.osgi.service.component.ComponentContext context) -
isPausing
public boolean isPausing()Description copied from interface:IDeviceWatchdogReturns whether the watchdog is currently active in a scan and pausing that scan.- Specified by:
isPausingin interfaceIDeviceWatchdog<ExpressionWatchdogModel>
-