Class EpicsChannelWriterService
java.lang.Object
ch.psi.wica.controlsystem.epics.io.EpicsChannelWriterService
- All Implemented Interfaces:
AutoCloseable
A service which offers the possibility to write to a String value to 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 Summary
ConstructorsConstructorDescriptionEpicsChannelWriterService
(EpicsChannelAccessContextSupplier epicsChannelAccessContextSupplier) Returns a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Disposes of all resources associated with this class instance.boolean
writeStringValue
(EpicsChannelName epicsChannelName, String channelValue, long timeout, TimeUnit timeUnit) Sets the value of a channel.
-
Constructor Details
-
EpicsChannelWriterService
public EpicsChannelWriterService(@Autowired EpicsChannelAccessContextSupplier epicsChannelAccessContextSupplier) Returns a new instance.- Parameters:
epicsChannelAccessContextSupplier
- an object which can be used to obtain a Channel-Access context.
-
-
Method Details
-
writeStringValue
public boolean writeStringValue(EpicsChannelName epicsChannelName, String channelValue, long timeout, TimeUnit timeUnit) Sets the value of a channel. This method incurs the network cost of establishing a channel to the remote data source and performing a synchronous (= confirmed) PUT operation.- Parameters:
epicsChannelName
- the channel name.channelValue
- the channel value.timeout
- the timeout to be applied when attempting to put the channel value to the underlying data source. If a timeout occurs the returned value will be false.timeUnit
- the time units to be used.- Returns:
- boolean set true when the put completed successfully.
- Throws:
NullPointerException
- if any of the reference object arguments were null.
-
close
public void close()Disposes of all resources associated with this class instance.- Specified by:
close
in interfaceAutoCloseable
-