Class EpicsMonitor

All Implemented Interfaces:
ControllerRecord, Device, Monitor, Scannable, InitializationListener, Configurable, Findable, gda.observable.IObservable
Direct Known Subclasses:
DummyEpicsMonitor, EpicsTypedMonitor

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 Details

    • latestDblValue

      protected volatile double latestDblValue
    • latestIntValue

      protected volatile int latestIntValue
    • latestShtValue

      protected volatile short latestShtValue
    • latestFltValue

      protected volatile float latestFltValue
    • latestStrValue

      protected volatile String latestStrValue
    • lastDblValueReported

      protected volatile Double lastDblValueReported
    • lastIntValueReported

      protected volatile Integer lastIntValueReported
    • lastShtValueReported

      protected volatile Short lastShtValueReported
    • lastFltValueReported

      protected volatile Float 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

      protected EpicsController controller
  • Constructor Details

    • EpicsMonitor

      public EpicsMonitor()
      Constructor
  • Method Details

    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default 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:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • getPosition

      public Object getPosition() throws DeviceException
      Description copied from class: ScannableBase
      Returns 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:
      getPosition in interface Scannable
      Overrides:
      getPosition in class ScannableBase
      Returns:
      Current position with an element for each input and extra field. null if their are no fields.
      Throws:
      DeviceException
    • getSingularValue

      protected Object getSingularValue() throws DeviceException
      Throws:
      DeviceException
    • formatPosition

      public String 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. 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 use
      number - the number to format
      Returns:
      a formatted string
    • getPvName

      public String getPvName()
      Returns the name of the pv this object is monitoring
      Returns:
      the name of the pv
    • setPvName

      public void setPvName(String pvName)
      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: InitializationListener
      Called when all critical channels are connected.
      Specified by:
      initializationCompleted in interface InitializationListener
    • getDeviceName

      public String getDeviceName()
      gets the name of the device.
      Returns:
      String name
    • setDeviceName

      public void setDeviceName(String deviceName)
      sets the name of the device.
      Parameters:
      deviceName -
    • getElementCount

      public int getElementCount() throws DeviceException
      Description copied from interface: Monitor
      returns the number of elements in this monitor.
      Specified by:
      getElementCount in interface Monitor
      Overrides:
      getElementCount in class MonitorBase
      Returns:
      int the element count
      Throws:
      DeviceException
    • setElementCount

      public void setElementCount(int elementCount)
      Parameters:
      elementCount -
    • getUnit

      public String getUnit()
      Description copied from interface: Monitor
      gets the physical unit of the monitor.
      Specified by:
      getUnit in interface Monitor
      Overrides:
      getUnit in class MonitorBase
      Returns:
      String the physical unit
    • setUnit

      public void setUnit(String unit)
      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

      public String getControllerRecordName()
      Description copied from interface: ControllerRecord
      Gets 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 the controller_record field for the NXpositioner for the scannable.
      Specified by:
      getControllerRecordName in interface ControllerRecord
      Returns:
      controller record name
      See Also: