Interface IMalcolmDevice
- Type Parameters:
T- the type of the model for this malcolm device
- All Superinterfaces:
IConfigurable<IMalcolmModel>,IDeviceRoleActor,ILevel,IModelProvider<IMalcolmModel>,INameable,IPausableDevice<IMalcolmModel>,IResettableDevice,IRunnableDevice<IMalcolmModel>,IRunnableEventDevice<IMalcolmModel>,IValidator<IMalcolmModel>
- All Known Implementing Classes:
AbstractMalcolmDevice,DummyMalcolmDevice,MalcolmDevice,MalcolmDeviceProxy,ProcessingMalcolmDevice
The name malcolm is chosen for the middleware layer between the Java OSGi server and the hardware - inspired by the sitcom 'Malcolm in the Middle' https://en.wikipedia.org/wiki/Malcolm_in_the_Middle
This interface attempts to mirror how the hardware in the python looks, hence the fact that it does not look very 'Java'. So instead of setPaused(boolean) we have pause() and resume().
Note that interrupting the thread running a malcolm call has no effect. The interrupt
is ignored, except that the interrupt flag is set, i.e.
IRunnableDeviceService service = ... // OSGi serviceThread#isInterrupted()
returns true for the current thread. This is particularly important for
IRunnableDevice.run() as it is the only long-running method, and returning early while the
actual malcolm device is still running could cause subsequent scans to fail.
Usage:
IMalcolmDevice malcolm = service.getRunnableDevice("malc");
IMalcolmModel model = new MalcolmModel();
model.setExposureTime(0.1)
malcolm.configure(model);
malcolm.run(); // blocks until finished
final State state = malcolm.getState();
// ... We did something!

-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddMalcolmListener(IMalcolmEventListener listener) Add a listener to malcolm changes.voiddispose()Disposes of the malcolm device causing it to disconnect from the underlying malcolm device.Returns the axes that this malcolm device can move.Returns the axes that this malcolm device is currently configured to move.Returns aMalcolmTableobject describing the datasets that this malcolm device is configured to create during a scan.Returns theMalcolmDetectorInfos for the detectors controlled by this malcolm device, describing their current state.Get the directory where malcolm will write its h5 files to.IPointGenerator<? extends IScanPointGeneratorModel> Get the point generator that this malcolm device has been configured withReturns the version of this malcolm device.voidInitializes the connection to the actual malcolm device.booleanisLocked()Attempts to determine if the device is locked doing something like a configure or a run.voidremoveMalcolmListener(IMalcolmEventListener listener) Remove a listener to malcolm changes.voidsetOutputDir(String fileDir) Set the directory where malcolm will write its h5 files to.voidsetPointGenerator(IPointGenerator<? extends IScanPointGeneratorModel> pointGenerator) Set the point generator for the malcolm device.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.IPausableDevice
pause, resume, seekMethods inherited from interface org.eclipse.scanning.api.device.IResettableDevice
resetMethods inherited from interface org.eclipse.scanning.api.device.IRunnableDevice
abort, disable, getDeviceHealth, getDeviceState, getModel, isAlive, isDeviceBusy, latch, latch, run, run, setAlive, start, throwFirstRunExceptionMethods inherited from interface org.eclipse.scanning.api.device.IRunnableEventDevice
addRunListener, fireRunPerformed, fireRunWillPerform, fireWritePerformed, fireWriteWillPerform, removeRunListenerMethods inherited from interface org.eclipse.scanning.api.IValidator
setService, validate
-
Method Details
-
initialize
Initializes the connection to the actual malcolm device. This methods must be called before the malcolm device can be used.- Throws:
MalcolmDeviceException- if the malcolm device could not be initialized
-
isLocked
Attempts to determine if the device is locked doing something like a configure or a run.- Returns:
- true if not in locked state, otherwise false.
- Throws:
MalcolmDeviceException
-
getAvailableAxes
Returns the axes that this malcolm device can move.- Returns:
- the axes this malcolm device can move, never
null - Throws:
ScanningException
-
getConfiguredAxes
Returns the axes that this malcolm device is currently configured to move. Normally, the value returned is the same asgetAvailableAxes(), except if the last time that malcolm was configured by calling,invalid reference
IMalcolmDevice#configure(IMalcolmModel)IMalcolmModel.getAxesToMove()was non-null, in which case it is the- Returns:
- the axes that the malcolm device is currently configured to move
- Throws:
ScanningException
-
getDetectorInfos
Returns theMalcolmDetectorInfos for the detectors controlled by this malcolm device, describing their current state.- Returns:
- detector infos
- Throws:
MalcolmDeviceException
-
setPointGenerator
Set the point generator for the malcolm device.- Parameters:
pointGenerator- point generator
-
getPointGenerator
IPointGenerator<? extends IScanPointGeneratorModel> getPointGenerator()Get the point generator that this malcolm device has been configured with- Returns:
-
setOutputDir
Set the directory where malcolm will write its h5 files to. The directory should exist at the point that the malcolm device is configured, malcolm is not responsible for creating it. -
getOutputDir
String getOutputDir()Get the directory where malcolm will write its h5 files to. -
addMalcolmListener
Add a listener to malcolm changes.- Parameters:
listener-
-
removeMalcolmListener
Remove a listener to malcolm changes.- Parameters:
listener-
-
getDatasets
Returns aMalcolmTableobject describing the datasets that this malcolm device is configured to create during a scan. This method should only be called afterhas been called on this malcolm device.invalid reference
#configure(IMalcolmModel)- Returns:
- a table of the datasets created by this malcolm device
- Throws:
MalcolmDeviceException- if the datasets table could not be returned for any reason
-
getVersion
Returns the version of this malcolm device.- Returns:
- version
- Throws:
MalcolmDeviceException- if the version cannot be returned for any reason
-
dispose
Disposes of the malcolm device causing it to disconnect from the underlying malcolm device.- Throws:
MalcolmDeviceException
-