Class EpicsChannelReaderService

java.lang.Object
ch.psi.wica.controlsystem.epics.io.EpicsChannelReaderService
All Implemented Interfaces:
AutoCloseable

@Service @ThreadSafe public class EpicsChannelReaderService extends Object implements AutoCloseable
A service which offers the possibility to get the metadata or value associated with an EPICS channel.
Implementation Note:
The current implementation uses PSI's CA EPICS client library to obtain a single shared EPICS CA Context per class instance. The EPICS CA context and all associated resources are disposed of when the service instance is closed.
  • Constructor Details

    • EpicsChannelReaderService

      public EpicsChannelReaderService(@Autowired EpicsChannelAccessContextSupplier epicsChannelAccessContextSupplier, @Autowired EpicsChannelMetadataGetter epicsChannelMetadataGetter, @Autowired EpicsChannelValueGetter epicsChannelValueGetter)
      Returns a new instance that will read and/or write information from EPICS channels of interest using the supplied value getter.
      Parameters:
      epicsChannelAccessContextSupplier - an object which can be used to obtain a Channel-Access context.
      epicsChannelMetadataGetter - an object that can get and build the returned metadata.
      epicsChannelValueGetter - an object that can get and build the returned value.
  • Method Details

    • readChannelMetadata

      public WicaChannelMetadata readChannelMetadata(EpicsChannelName epicsChannelName, long timeout, TimeUnit timeUnit)
      Returns the metadata associated with a channel.

      This method incurs the network cost of establishing a channel to the remote data source and performing a synchronous GET operation.

      Parameters:
      epicsChannelName - the name of the channel.
      timeout - the timeout to be applied when attempting to get the channel metadata from the underlying data source. If a timeout occurs the returned value will be WicaChannelMetadataUnknown.
      timeUnit - the time units to be used.
      Returns:
      the metadata.
    • readChannelValue

      public WicaChannelValue readChannelValue(EpicsChannelName epicsChannelName, long timeout, TimeUnit timeUnit)
      Returns the value of a channel.

      This method incurs the network cost of establishing a channel to the remote data source and performing a synchronous GET operation.

      Parameters:
      epicsChannelName - the name of the channel.
      timeout - the timeout to be applied when attempting to get the channel value from the underlying data source. If a timeout occurs the returned value will be WicaChannelValueDisconnected.
      timeUnit - the time units to be used.
      Returns:
      the value.
    • close

      public void close()
      Disposes of all resources associated with this class instance.
      Specified by:
      close in interface AutoCloseable