Package gda.epics
Interface ReadOnlyPV<T>
- Type Parameters:
T-
- All Superinterfaces:
gda.observable.Observable<T>
- All Known Subinterfaces:
NoCallbackPV<T>,PV<T>
- All Known Implementing Classes:
DummyPV,DummyReadOnlyPV,PVWithSeparateReadback
public interface ReadOnlyPV<T>
extends gda.observable.Observable<T>
A read only Epics ProcessVariable. The
LazyPVFactory class provides convenient factory methods to create lazy PVs
which don't connect until the first request across CA is to be made.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddMonitorListener(gov.aps.jca.event.MonitorListener listener) Add A MonitorListener to the channel associated with the PV.extractValueFromDbr(gov.aps.jca.dbr.DBR dbr) Extacts a value from aDBR.get()Get a value over CA.get(int numElements) Get numElements from the pv over CA.getLast()Get the most recent value monitored across CA.booleanCheck if this PV is monitoring.voidremoveMonitorListener(gov.aps.jca.event.MonitorListener listener) voidsetValueMonitoring(boolean shouldMonitor) Configure this PV to start or stop monitoring.waitForValue(Predicate<T> predicate, double timeoutS) Waits for a value that meets the givenPredicate(if-statement-like) condition and then returns it.Methods inherited from interface gda.observable.Observable
addObserver, addObserver, removeObserver
-
Method Details
-
getPvName
String getPvName() -
get
Get a value over CA.- Throws:
IOException- if an Epics CA exception of some sort has occurredInterruptedIOException- if an Epics CA operation has been interrupted
-
get
Get numElements from the pv over CA.- Parameters:
numElements- Number of elements to be read- Throws:
IOException- if an Epics CA exception of some sort has occurredInterruptedIOException- if an Epics CA operation has been interrupted
-
getLast
Get the most recent value monitored across CA. If no value has yet been received, then get a value across CA. The PV must have been configured to monitor withsetValueMonitoring(boolean);- Throws:
IllegalStateException- if the PV is not configured to monitor withsetValueMonitoring(boolean);IOException- if an Epics CA exception of some sort has occurredInterruptedIOException- if an Epics CA operation has been interrupted
-
waitForValue
T waitForValue(Predicate<T> predicate, double timeoutS) throws IllegalStateException, TimeoutException, IOException, InterruptedException Waits for a value that meets the givenPredicate(if-statement-like) condition and then returns it. The PV must have been configured to monitor withsetValueMonitoring(boolean);- Parameters:
predicate- The predicate used to test each valuetimeoutS- The time in seconds to wait for a value that passes the predicate. A value of 0 or less results in an indefinite timeout.- Returns:
- the first value monitored that passed the predicate test
- Throws:
IllegalStateException- if the PV is not configured to monitor withsetValueMonitoring(boolean);TimeoutException- if a value that passes the predicate does not appear within the provided timeoutSIOException- if an Epics CA exception of some sort has occurredInterruptedExceptionInterruptedIOException- if an Epics CA operation has been interrupted
-
setValueMonitoring
Configure this PV to start or stop monitoring. When monitoring, calls toget()will returned the most recent value monitored across CA.- Parameters:
shouldMonitor- true to start monitoring values and caching them internally- Throws:
IOException- if an Epics CA exception of some sort has occurredInterruptedIOException- if an Epics CA operation has been interrupted
-
isValueMonitoring
boolean isValueMonitoring()Check if this PV is monitoring. SeesetValueMonitoring(boolean)- Returns:
- true if monitoring
-
addMonitorListener
Add A MonitorListener to the channel associated with the PV. Will create the channel if required.- Throws:
IOException- if an Epics CA exception of some sort has occurredInterruptedIOException- if an Epics CA operation has been interrupted
-
removeMonitorListener
void removeMonitorListener(gov.aps.jca.event.MonitorListener listener) -
extractValueFromDbr
Extacts a value from aDBR. Useful for writing MonitorListeners.- Parameters:
dbr-- Returns:
- the value
-