Package org.eclipse.scanning.api.device
Interface IRunnableDevice<T>
- All Superinterfaces:
IConfigurable<T>,IDeviceRoleActor,ILevel,IModelProvider<T>,INameable,IResettableDevice,IValidator<T>
- All Known Subinterfaces:
IMalcolmDevice,IPausableDevice<T>,IRunnableEventDevice<T>,IScanDevice,IWritableDetector<T>
- All Known Implementing Classes:
AbstractAreaDetectorRunnableDevice,AbstractMalcolmDevice,AbstractRunnableDevice,AreaDetectorRunnableDevice,AreaDetectorRunnableDeviceProxy,AreaDetectorRunnableDeviceWaitForArray,AreaDetectorWritingFilesRunnableDevice,ConstantVelocityDevice,DarkImageDetector,DummyMalcolmDevice,DummyMalcolmTriggeredDetector,ElectronAnalyserRunnableDevice,MalcolmDevice,MalcolmDeviceProxy,MandelbrotDetector,PosDetector,ProcessingMalcolmDevice,RandomIntDetector,RandomLineDevice,RunnableDeviceProxy,XmapRunnableDevice,XmapRunnableDeviceBase,XmapWritingFilesRunnableDevice,ZebraRunnableDevice
public interface IRunnableDevice<T>
extends IDeviceRoleActor, ILevel, IConfigurable<T>, IResettableDevice, IValidator<T>, IModelProvider<T>
An IDevice is the runner for the whole scan but also for individual
detectors. Detectors, for instance an IMalcolmDevice can be run in
the system as if it were an IDetector.
Anatomy of a CPU scan (non-malcolm)
_________
_| |________ collectData() Tell detector to collect
_________
_________| |_ readout() Tell detector to readout
_______
_________| |___ moveTo() Scannables move motors to new position
A MalcolmDevice is also an IDetector which may operate with an arbitrary model, usually driving hardware.

_________
_| |________ collectData() Tell detector to collect
_________
_________| |_ readout() Tell detector to readout
_______
_________| |___ moveTo() Scannables move motors to new position
A MalcolmDevice is also an IDetector which may operate with an arbitrary model, usually driving hardware.
IParserService pservice = ...// OSGi
// Parse the scan command, throws an exception
IParserResult parser = pservice.createParser(...)
// e.g. "scan x 0 5 0.1 analyser"
// Now use the parser to create a generator
IPointGeneratorService gservice = ...// OSGi
StepModel model = parser.getModel("x");
IPointGeneratorinvalid input: '<'?> gen = gservice.createGenerator(model)
// Now scan the point iterator
IDeviceService sservice = ...// OSGi
IRunnableDevice scanner = sservice.createScanner(...);
scanner.configure(model);
scanner.run();

-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Call to terminate the scan before it has finished.voiddisable()Call to disable the device, stopping all activity.getModel()The model being used for the device.booleanisAlive()Gets whether the device is 'alive' or not.booleandefault voidlatch()Latches until this run is complete if it was initiated from a start.default booleanLatches until this run is complete if it was initiated from a start, or the given waiting time elapses.default voidrun()This method is the same as calling run(null).voidBlocking call to execute the scan.voidsetAlive(boolean alive) Sets whether the device is alive or notdefault voidThe default implementation of start simply executes run in a thread named using the getName() value.default voidthrowFirstRunException(List<Throwable> exceptions) Creates an exception out of a list of exceptions and throws it if the list is not empty.Methods inherited from interface org.eclipse.scanning.api.IConfigurable
configureMethods inherited from interface org.eclipse.scanning.api.device.models.IDeviceRoleActor
getRole, getSupportedScanModes, setRoleMethods inherited from interface org.eclipse.scanning.api.IModelProvider
setModel, updateModelMethods inherited from interface org.eclipse.scanning.api.device.IResettableDevice
resetMethods inherited from interface org.eclipse.scanning.api.IValidator
setService, validate
-
Method Details
-
getDeviceState
- Returns:
- the current device State. This is not the same as the Status of the scan.
- Throws:
ScanningException
-
getDeviceHealth
- Returns:
- the current device Health.
- Throws:
ScanningException
-
isDeviceBusy
- Returns:
- the current value of the device 'busy' flag.
- Throws:
ScanningException
-
run
default void run() throws ScanningException, InterruptedException, TimeoutException, ExecutionExceptionThis method is the same as calling run(null). I.e. run without specifying start position. -
run
void run(IPosition position) throws ScanningException, InterruptedException, TimeoutException, ExecutionException Blocking call to execute the scan. The position specified may be null. -
start
default void start(IPosition pos) throws ScanningException, InterruptedException, TimeoutException, ExecutionException The default implementation of start simply executes run in a thread named using the getName() value.- Parameters:
pos-- Throws:
ScanningExceptionInterruptedExceptionTimeoutExceptionExecutionException
-
throwFirstRunException
default void throwFirstRunException(List<Throwable> exceptions) throws ScanningException, InterruptedException, TimeoutException, ExecutionException Creates an exception out of a list of exceptions and throws it if the list is not empty.- Parameters:
exceptions-- Throws:
ScanningExceptionInterruptedExceptionTimeoutExceptionExecutionException
-
abort
Call to terminate the scan before it has finished. -
disable
Call to disable the device, stopping all activity.- Throws:
ScanningException
-
latch
default void latch() throws ScanningException, InterruptedException, TimeoutException, ExecutionExceptionLatches until this run is complete if it was initiated from a start. If a device does not have a latch, then this method always throws an exception. -
latch
default boolean latch(long time, TimeUnit unit) throws ScanningException, InterruptedException, TimeoutException, ExecutionException Latches until this run is complete if it was initiated from a start, or the given waiting time elapses. If a device does not have a latch, this this method always throws an exception.- Parameters:
time-unit-- Returns:
trueif the countdown of the latch reached 0,falseif the specified waiting time elapsed- Throws:
ExecutionExceptionTimeoutExceptionInterruptedExceptionScanningException- See Also:
-
getModel
T getModel()The model being used for the device.- Specified by:
getModelin interfaceIModelProvider<T>- Returns:
-
isAlive
boolean isAlive()Gets whether the device is 'alive' or not. 'Alive' is taken to mean that the device is on and responding.- Returns:
-
setAlive
void setAlive(boolean alive) Sets whether the device is alive or not- Parameters:
alive-
-