Package xal.ca
Class MonitorController
java.lang.Object
xal.ca.MonitorController
Creates a monitor for a channel when the channel is connected and dispatches
monitor and channel connection events to registered listeners.
- Author:
- t6p
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Channel
The channel to wrapprotected ConnectionListener
connection listenerprotected final Object
synchronization lockprotected MonitorEventListener
proxy for posting channel eventsprotected ChannelTimeRecord
last record capturedprotected MessageCenter
event message centerprotected Monitor
The monitor for the channelprotected final int
the monitor mask to use when initializing the monitor (Monitor.VALUE, Monitor.LOG, Monitor.ALARM) -
Constructor Summary
ConstructorsConstructorDescriptionConstructor creating a channel from the specified PV and using the default monitor mask (Monitor.VALUE).MonitorController
(String pv, int monitorMask) Constructor creating a channel from the specified PV and applying the specified monitor mask.MonitorController
(Channel channel) Constructor using the default monitor mask (Monitor.VALUE).MonitorController
(Channel channel, int monitorMask) Primary constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMonitorEventListener
(MonitorEventListener listener) Register the listener as a receiver of channel events from this controller.void
dispose()
Dispose of the channel wrapper resources by clearing the monitor (if any) and disposing of of the messaging resources.Get this instance's controlled channel.Get the latest channel record.getPV()
Get the PV for the controlled channel.boolean
Determine if the channel is connected.protected void
Create a monitor to listen for new channel records.void
Remove the listener as a receiver of channel events from this controller.void
Request that the channel be connected.
-
Field Details
-
monitorMask
protected final int monitorMaskthe monitor mask to use when initializing the monitor (Monitor.VALUE, Monitor.LOG, Monitor.ALARM) -
eventLock
synchronization lock -
messageCenter
event message center -
eventProxy
proxy for posting channel events -
channel
The channel to wrap -
monitor
The monitor for the channel -
lastRecord
last record captured -
connectionListener
connection listener
-
-
Constructor Details
-
MonitorController
Primary constructor.- Parameters:
channel
- The channel to wrap.monitorMask
- The monitor mask to apply when instantiating the monitor.
-
MonitorController
Constructor using the default monitor mask (Monitor.VALUE).- Parameters:
channel
- The channel to wrap.
-
MonitorController
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
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
Register the listener as a receiver of channel events from this controller.- Parameters:
listener
- The listener to receive channel events
-
removeMonitorEventListener
Remove the listener as a receiver of channel events from this controller.- Parameters:
listener
- The listener to remove from receiving channel events
-
getPV
Get the PV for the controlled channel.- Returns:
- the PV
-
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
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.
-