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 Type
    Method
    Description
    void
    addMonitorListener(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 a DBR.
    get()
    Get a value over CA.
    get(int numElements)
    Get numElements from the pv over CA.
    Get the most recent value monitored across CA.
     
    boolean
    Check if this PV is monitoring.
    void
    removeMonitorListener(gov.aps.jca.event.MonitorListener listener)
     
    void
    setValueMonitoring(boolean shouldMonitor)
    Configure this PV to start or stop monitoring.
    waitForValue(Predicate<T> predicate, double timeoutS)
    Waits for a value that meets the given Predicate (if-statement-like) condition and then returns it.

    Methods inherited from interface gda.observable.Observable

    addObserver, addObserver, removeObserver
  • Method Details

    • getPvName

      String getPvName()
    • get

      T get() throws IOException
      Get a value over CA.
      Throws:
      IOException - if an Epics CA exception of some sort has occurred
      InterruptedIOException - if an Epics CA operation has been interrupted
    • get

      T get(int numElements) throws IOException
      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 occurred
      InterruptedIOException - if an Epics CA operation has been interrupted
    • getLast

      T getLast() throws IOException
      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 with setValueMonitoring(boolean);
      Throws:
      IllegalStateException - if the PV is not configured to monitor with setValueMonitoring(boolean);
      IOException - if an Epics CA exception of some sort has occurred
      InterruptedIOException - 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 given Predicate (if-statement-like) condition and then returns it. The PV must have been configured to monitor with setValueMonitoring(boolean);
      Parameters:
      predicate - The predicate used to test each value
      timeoutS - 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 with setValueMonitoring(boolean);
      TimeoutException - if a value that passes the predicate does not appear within the provided timeoutS
      IOException - if an Epics CA exception of some sort has occurred
      InterruptedException
      InterruptedIOException - if an Epics CA operation has been interrupted
    • setValueMonitoring

      void setValueMonitoring(boolean shouldMonitor) throws IOException
      Configure this PV to start or stop monitoring. When monitoring, calls to get() 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 occurred
      InterruptedIOException - if an Epics CA operation has been interrupted
    • isValueMonitoring

      boolean isValueMonitoring()
      Check if this PV is monitoring. See setValueMonitoring(boolean)
      Returns:
      true if monitoring
    • addMonitorListener

      void addMonitorListener(gov.aps.jca.event.MonitorListener listener) throws IOException
      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 occurred
      InterruptedIOException - if an Epics CA operation has been interrupted
    • removeMonitorListener

      void removeMonitorListener(gov.aps.jca.event.MonitorListener listener)
    • extractValueFromDbr

      T extractValueFromDbr(gov.aps.jca.dbr.DBR dbr)
      Extacts a value from a DBR. Useful for writing MonitorListeners.
      Parameters:
      dbr -
      Returns:
      the value