Package org.yamcs.studio.data
Class IPV
java.lang.Object
org.yamcs.studio.data.IPV
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(IPVListener listener) Add a listener to the PV, which will be notified on events of the PV in the given notify thread.getName()
getValue()
Get the most recent value of the PV in last update cycle that has values.boolean
Returns the 'connection' state of an individual PV.boolean
boolean
void
void
void
void
removeListener
(IPVListener listener) void
void
Set PV to a given value asynchronously.boolean
Set PV to a given value synchronously.void
start()
Start to connect and listen on the PV.void
stop()
Close the connection while keeping all listeners, so when it is restarted, it will work as before.toString()
-
Method Details
-
addListener
Add a listener to the PV, which will be notified on events of the PV in the given notify thread. -
removeListener
-
getName
-
getValue
Get the most recent value of the PV in last update cycle that has values.VTypeHelper
and ValueUtil can be used to get the number or string value, alarm, display, time stamp etc. from theVType
value and help to format the value.- Returns:
- value of the PV. Will be null if the PV is not started or connected. It can also be null even the PV is connected. For example, the value is not a VType, not prepared yet or it has null as the initial value.
-
isConnected
public boolean isConnected()Returns the 'connection' state of an individual PV. If the PV is an aggregate of multiple PVs, the connection state should be determined by the aggregator. For example, the aggregator countConnected(pv1, pv2, pv3,) should always return connected. -
notifyConnectionChange
public void notifyConnectionChange() -
notifyValueChange
public void notifyValueChange() -
notifyWritePermissionChange
public void notifyWritePermissionChange() -
isStarted
public boolean isStarted()If thestart()
has been called butstop()
has not been called. This method tells nothing if the pv is connected. To see if the PV is connected useisConnected()
.- Returns:
- true if the pv is started but not stopped.
-
isWriteAllowed
public boolean isWriteAllowed()- Returns:
true
if the PV is connected and allowed to write.
-
setValue
Set PV to a given value asynchronously. It will return immediately. Should accept number, number array,String
, maybe more. -
setInvalid
public void setInvalid() -
setValue
Set PV to a given value synchronously. It will block the current thread until write operation was submitted or timeout. Note that this call will only issue the write request, it will not await a put-callback to indicate complete processing of a write on the server.- Parameters:
value
- Value to write to the PV It is not necessary to callstart()
before calling this method, because it will handle the connection with timeout in this method. Should accept number, number array,String
, maybe more.timeout
- timeout in millisecond for both pv connection and write operation, so in very rare case, it could take maximum 2*timeout ms for the timeout.- Returns:
- true if write successful or false otherwise.
- Throws:
Exception
-
start
public void start()Start to connect and listen on the PV. To start an already started PV will get anIllegalStateException
. -
stop
public void stop()Close the connection while keeping all listeners, so when it is restarted, it will work as before. When the PV is no longer needed, one should stop it to release resources. To stop an already stopped PV or not started PV will do nothing but log a warning message. -
toString
-