Package gda.device.monitor
Class EpicsMonitor
- All Implemented Interfaces:
ControllerRecord,Device,Monitor,Scannable,InitializationListener,Configurable,Findable,gda.observable.IObservable
- Direct Known Subclasses:
DummyEpicsMonitor,EpicsTypedMonitor
@ServiceInterface(Monitor.class)
public class EpicsMonitor
extends MonitorBase
implements InitializationListener, ControllerRecord
A class which monitors the value of single Epics PV. The value is then broadcast to IObservers of this object or can be retrieved via the getValue method.
This will not monitor changes to limits, alarms or status.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EpicsControllerprotected double[]protected Doubleprotected float[]protected Floatprotected int[]protected Integerprotected short[]protected Shortprotected doubleprotected floatprotected intprotected shortprotected Stringprotected gov.aps.jca.ChannelFields inherited from class gda.device.scannable.ScannableBase
__doc__, DEFAULT_INPUT_NAME, DEFAULT_OUTPUT_FORMAT, extraNames, inputNames, level, outputFormatFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.formatPosition(int format, double number) Does the same job as the other formatPosition method except rather than using a supplied format string, use the index of the array of formats this object holds.Gets the name of the controller record, e.g.gov.aps.jca.dbr.DBRTypegets the name of the device.intreturns the number of elements in this monitor.Returns the current position of the Scannable.Returns the name of the pv this object is monitoringdoubleReturns the sensitivity of updates from this monitor.protected ObjectgetUnit()gets the physical unit of the monitor.voidCalled when all critical channels are connected.booleanisPoll()check the poll flag.voidsetDeviceName(String deviceName) sets the name of the device.voidsetElementCount(int elementCount) voidsetPoll(boolean poll) Set poll to true to ensure Monitor.getPosition() always poll the data from hardware.voidSets the name of the pv this object monitors.voidsetSensitivity(double sensitivity) Sets the percentage sensitivity level of updates to IObservers from this object.voidsetType(gov.aps.jca.dbr.DBRType type) voidMethods inherited from class gda.device.monitor.MonitorBase
asynchronousMoveTo, isBusyMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, checkPositionValid, externalToInternal, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, rawGetPosition, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, stop, throwExceptionIfInvalidTarget, toFormattedString, toString, validateScannable, valueUnavailableString, waitWhileBusy, waitWhileBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObserversMethods inherited from interface gda.device.Scannable
atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, checkPositionValid, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, stop, toFormattedString, waitWhileBusy
-
Field Details
-
latestDblValue
protected volatile double latestDblValue -
latestIntValue
protected volatile int latestIntValue -
latestShtValue
protected volatile short latestShtValue -
latestFltValue
protected volatile float latestFltValue -
latestStrValue
-
lastDblValueReported
-
lastIntValueReported
-
lastShtValueReported
-
lastFltValueReported
-
lastDblArrayReported
protected volatile double[] lastDblArrayReported -
lastIntArrayReported
protected volatile int[] lastIntArrayReported -
lastShtArrayReported
protected volatile short[] lastShtArrayReported -
lastFltArrayReported
protected volatile float[] lastFltArrayReported -
theChannel
protected gov.aps.jca.Channel theChannel -
controller
-
-
Constructor Details
-
EpicsMonitor
public EpicsMonitor()Constructor
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
getPosition
Description copied from class:ScannableBaseReturns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it.- Specified by:
getPositionin interfaceScannable- Overrides:
getPositionin classScannableBase- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- Throws:
DeviceException
-
getSingularValue
- Throws:
DeviceException
-
formatPosition
Does the same job as the other formatPosition method except rather than using a supplied format string, use the index of the array of formats this object holds. This is to be used when an object has multiple elements which describe its position and those element require different formatting.- Parameters:
format- the index in the array of formats to usenumber- the number to format- Returns:
- a formatted string
-
getPvName
Returns the name of the pv this object is monitoring- Returns:
- the name of the pv
-
setPvName
Sets the name of the pv this object monitors. This must be called before the configure method makes the connections to the pv.- Parameters:
pvName-
-
getSensitivity
public double getSensitivity()Returns the sensitivity of updates from this monitor. The sensitivity is the percentage change which must occur in the pv value for the IObservers to be informed. This prevents unnecessary updating.- Returns:
- the sensitivity of updates from this monitor
-
setSensitivity
public void setSensitivity(double sensitivity) Sets the percentage sensitivity level of updates to IObservers from this object.- Parameters:
sensitivity-
-
initializationCompleted
public void initializationCompleted()Description copied from interface:InitializationListenerCalled when all critical channels are connected.- Specified by:
initializationCompletedin interfaceInitializationListener
-
getDeviceName
gets the name of the device.- Returns:
- String name
-
setDeviceName
sets the name of the device.- Parameters:
deviceName-
-
getElementCount
Description copied from interface:Monitorreturns the number of elements in this monitor.- Specified by:
getElementCountin interfaceMonitor- Overrides:
getElementCountin classMonitorBase- Returns:
- int the element count
- Throws:
DeviceException
-
setElementCount
public void setElementCount(int elementCount) - Parameters:
elementCount-
-
getUnit
Description copied from interface:Monitorgets the physical unit of the monitor.- Specified by:
getUnitin interfaceMonitor- Overrides:
getUnitin classMonitorBase- Returns:
- String the physical unit
-
setUnit
- Parameters:
unit-
-
getDBRType
public gov.aps.jca.dbr.DBRType getDBRType()- Returns:
- the DBRType that the object looks at
-
setType
public void setType(gov.aps.jca.dbr.DBRType type) - Parameters:
type-
-
isPoll
public boolean isPoll()check the poll flag.- Returns:
- Boolean
-
setPoll
public void setPoll(boolean poll) Set poll to true to ensure Monitor.getPosition() always poll the data from hardware. The default is false.- Parameters:
poll-
-
getControllerRecordName
Description copied from interface:ControllerRecordGets the name of the controller record, e.g. EPICS process variable name. For example, in NeXus this value can be written as the value of thecontroller_recordfield for theNXpositionerfor the scannable.- Specified by:
getControllerRecordNamein interfaceControllerRecord- Returns:
- controller record name
- See Also:
-