public interface PV
When 'start'ed, the PV will attempt to connect or do whatever is needed to obtain the meta information like units, precision, ... Then it will subscribe to updates of the current value.
While the PVListener might receive events on a non-UI thread, all the calls to the PV should come from the UI
thread to prevent possible deadlocks. (The JNI CA client has deadlocked when both UI and non-UI threads called into
it at the 'same' time).
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(PVListener listener)
Add a new listener.
|
void |
blockUntilFirstUpdate(int timeout)
The calling thread will be blocked until the first update is received from the PV.
|
String |
getName()
Return the name of this PV.
|
String |
getStateInfo()
Internal state information on the PV.
|
IValue |
getValue()
Get the value.
|
IValue |
getValue(double timeoutSeconds)
Synchronous 'get'.
|
boolean |
isConnected()
Returns true if this PV is connected or false otherwise.
|
boolean |
isRunning()
Returns true if this PV has been started and not yet stopped.
|
boolean |
isWriteAllowed()
Returns true if we have write access to the PV or false if we cannot write to the PV.
|
void |
removeListener(PVListener listener)
Remove a listener.
|
void |
setValue(Object newValue)
Set PV to given value.
|
void |
start()
Start the PV: connect, get meta data, subscribe to updates, invoke
PVListener for incoming values, ... |
void |
stop()
Stop the PV: disconnect, ...
|
IValue getValue(double timeoutSeconds) throws PVException
Attempts to get a value within the given timeout. Either returns a value within the timeout, or throws an exception at the timeout.
When called for a new channel, i.e. on a channel where neither get nor start have been
called, it will also perform the connection attempt, and leave the channel connected after getting a value. To
force a disconnect, call stop.
timeoutSeconds - timeout in secondsPVException - on errorvoid addListener(PVListener listener)
listener - the listener to addvoid removeListener(PVListener listener)
listener - the listener to removevoid start()
throws PVException
PVListener for incoming values, ...PVException - if an error occurs during connectionboolean isRunning()
boolean isConnected()
true when connected. While isRunning, we are subscribed for value updates, but
we might still be disconnected, at least temporarily.boolean isWriteAllowed()
true if we have write access to the PVString getStateInfo()
Especially when isConnected() is false, this information might help to diagnose the
problem: Did the PV never connect? Was it once connected, but some error occurred?
void stop()
IValue getValue()
This is the most recent value. Check isConnected() to see if this is valid, or use inside a
PVListener.pvValueUpdate(PV).
null if there is none.void setValue(Object newValue) throws PVException
Double, Double[], Integer,
String, maybe more.newValue - Value to write to PVPVException - on errorString getName()
void blockUntilFirstUpdate(int timeout)
throws PVException
timeout - the maximum timeout to wait for the update in millisecondsPVException - if no value was received in the specified timeoutCopyright © 2023 European Spallation Source. All rights reserved.