Package xal.ca

Class MonitorController

java.lang.Object
xal.ca.MonitorController

public class MonitorController extends Object
Creates a monitor for a channel when the channel is connected and dispatches monitor and channel connection events to registered listeners.
Author:
t6p
  • Field Details

    • monitorMask

      protected final int monitorMask
      the monitor mask to use when initializing the monitor (Monitor.VALUE, Monitor.LOG, Monitor.ALARM)
    • eventLock

      protected final Object eventLock
      synchronization lock
    • messageCenter

      protected MessageCenter messageCenter
      event message center
    • eventProxy

      protected MonitorEventListener eventProxy
      proxy for posting channel events
    • channel

      protected Channel channel
      The channel to wrap
    • monitor

      protected Monitor monitor
      The monitor for the channel
    • lastRecord

      protected ChannelTimeRecord lastRecord
      last record captured
    • connectionListener

      protected ConnectionListener connectionListener
      connection listener
  • Constructor Details

    • MonitorController

      public MonitorController(Channel channel, int monitorMask)
      Primary constructor.
      Parameters:
      channel - The channel to wrap.
      monitorMask - The monitor mask to apply when instantiating the monitor.
    • MonitorController

      public MonitorController(Channel channel)
      Constructor using the default monitor mask (Monitor.VALUE).
      Parameters:
      channel - The channel to wrap.
    • MonitorController

      public MonitorController(String pv, int monitorMask)
      Constructor creating a channel from the specified PV and applying the specified monitor mask.
      Parameters:
      pv - The PV for which to create a channel.
      monitorMask - The monitor mask to apply when instantiating the monitor.
    • MonitorController

      public MonitorController(String pv)
      Constructor creating a channel from the specified PV and using the default monitor mask (Monitor.VALUE).
      Parameters:
      pv - The PV for which to create a channel.
  • Method Details

    • addMonitorEventListener

      public void addMonitorEventListener(MonitorEventListener listener)
      Register the listener as a receiver of channel events from this controller.
      Parameters:
      listener - The listener to receive channel events
    • removeMonitorEventListener

      public void removeMonitorEventListener(MonitorEventListener listener)
      Remove the listener as a receiver of channel events from this controller.
      Parameters:
      listener - The listener to remove from receiving channel events
    • getPV

      public String getPV()
      Get the PV for the controlled channel.
      Returns:
      the PV
    • getChannel

      public Channel getChannel()
      Get this instance's controlled channel.
      Returns:
      the wrapped channel
    • isConnected

      public boolean isConnected()
      Determine if the channel is connected.
      Returns:
      true if the channel is connected and false if not.
    • getLatestRecord

      public ChannelTimeRecord getLatestRecord()
      Get the latest channel record.
      Returns:
      the latest channel record or null if none has been published or the channel is not connected.
    • requestMonitor

      public void requestMonitor()
      Request that the channel be connected. When the channel connection occurs, create a monitor.
    • makeMonitor

      protected void makeMonitor()
      Create a monitor to listen for new channel records. An instance of an internal, anonymous class is the listener of the monitor events and caches the latest channel record.
    • dispose

      public void dispose()
      Dispose of the channel wrapper resources by clearing the monitor (if any) and disposing of of the messaging resources.