public class PVUtil
extends java.lang.Object
Constructor and Description |
---|
PVUtil() |
Modifier and Type | Method and Description |
---|---|
static org.csstudio.simplepv.IPV |
createPV(java.lang.String name,
org.csstudio.opibuilder.editparts.AbstractBaseEditPart widget)
Create a PV and start it.
|
static double |
getDouble(org.csstudio.simplepv.IPV pv)
Try to get a double number from the PV.
|
static double |
getDouble(org.csstudio.simplepv.IPV pv,
int index)
Try to get a double-typed array element from the Value.
|
static double[] |
getDoubleArray(org.csstudio.simplepv.IPV pv)
Try to get a double-typed array from the pv.
|
static java.lang.String |
getFullString(org.csstudio.simplepv.IPV pv)
Get the full info from the pv in this format
|
static java.lang.Long |
getLong(org.csstudio.simplepv.IPV pv)
Try to get a long integer number from the PV.
|
static long[] |
getLongArray(org.csstudio.simplepv.IPV pv)
Try to get an integer-typed array from the pv.
|
static int |
getSeverity(org.csstudio.simplepv.IPV pv)
Get severity of the pv as an integer value.
|
static java.lang.String |
getSeverityString(org.csstudio.simplepv.IPV pv)
Get severity of the PV as a string.
|
static double |
getSize(org.csstudio.simplepv.IPV pv)
Get the size of the pv's value
|
static java.lang.String |
getStatus(org.csstudio.simplepv.IPV pv)
Get the status text that might describe the severity.
|
static java.lang.String |
getString(org.csstudio.simplepv.IPV pv)
Converts the given pv's value into a string representation.
|
static double |
getTimeInMilliseconds(org.csstudio.simplepv.IPV pv)
Get milliseconds since epoch, i.e.
|
static java.lang.String |
getTimeString(org.csstudio.simplepv.IPV pv)
Get the timestamp string of the pv
|
static void |
writePV(java.lang.String pvName,
java.lang.Object value)
Write a PV in a background job.
|
static void |
writePV(java.lang.String pvName,
java.lang.Object value,
int timeout)
Write a PV in a background job.
|
public static final org.csstudio.simplepv.IPV createPV(java.lang.String name, org.csstudio.opibuilder.editparts.AbstractBaseEditPart widget) throws java.lang.Exception
ScriptUtil.execInUI(Runnable, AbstractBaseEditPart)
.
The monitor's maximum update rate is 50hz. If the PV updates faster than this rate, some updates
will be discarded.
from org.csstudio.opibuilder.scriptUtil import PVUtil from org.csstudio.simplepv import IPVListener class MyPVListener(IPVListener): def valueChanged(self, pv): widget.setPropertyValue("text", PVUtil.getString(pv)) pv = PVUtil.createPV("sim://noise", widget) pv.addListener(MyPVListener())
name
- name of the PV.widget
- the reference widget. The PV will stop when the widget is deactivated,
so it is not needed to stop the pv in script.java.lang.Exception
- the exception that might happen while creating the pv.public static final double getDouble(org.csstudio.simplepv.IPV pv)
Some applications only deal with numeric data, so they want to interprete integer, enum and double values all the same.
pv
- the PV.Double.NaN
in case the value type
does not decode into a number, or
Double.NEGATIVE_INFINITY
if the value's severity
indicates that there happens to be no useful value.public static final java.lang.Long getLong(org.csstudio.simplepv.IPV pv)
Some applications only deal with numeric data, so they want to interprete integer, enum and double values all the same.
pv
- the PV.public static final double getDouble(org.csstudio.simplepv.IPV pv, int index)
pv
- The PV.index
- The array index, 0 ... getSize()-1.Double.NaN
in case the value type
does not decode into a number, or
Double.NEGATIVE_INFINITY
if the value's severity
indicates that there happens to be no useful value.#getSize(PV)
,
#getDouble(PV)
public static final double[] getDoubleArray(org.csstudio.simplepv.IPV pv)
pv
- the pv.getSize(IPV)
,
getDouble(IPV)
public static final long[] getLongArray(org.csstudio.simplepv.IPV pv)
pv
- the pv.getSize(IPV)
,
getLong(IPV)
public static final double getSize(org.csstudio.simplepv.IPV pv)
pv
- the pv.1
for scalars.public static final java.lang.String getString(org.csstudio.simplepv.IPV pv)
IValue#format()
method is called and its result returned.pv
- the pv.public static final java.lang.String getFullString(org.csstudio.simplepv.IPV pv)
timestamp value severity, status
pv
- public static final java.lang.String getTimeString(org.csstudio.simplepv.IPV pv)
pv
- the pvpublic static final double getTimeInMilliseconds(org.csstudio.simplepv.IPV pv)
Note that we always return milliseconds relative to this UTC epoch, even if the original control system data source might use a different epoch (example: EPICS uses 1990), because the 1970 epoch is most compatible with existing programming environments.
pv
- the pvpublic static final int getSeverity(org.csstudio.simplepv.IPV pv)
pv
- the PV.public static final java.lang.String getSeverityString(org.csstudio.simplepv.IPV pv)
pv
- the PV.public static final java.lang.String getStatus(org.csstudio.simplepv.IPV pv)
pv
- the PV.public static final void writePV(java.lang.String pvName, java.lang.Object value, int timeout)
pvName
- name of the PV.value
- value to write.timeout
- maximum time to try connection.public static final void writePV(java.lang.String pvName, java.lang.Object value)
pvName
- name of the PV.value
- value to write.