public abstract class NumericProcessVariable extends ProcessVariable
ackS, ackT, channelCount, eventCallback, interest, name| Constructor and Description |
|---|
NumericProcessVariable(String name,
ProcessVariableEventCallback eventCallback)
Numeric PV constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fillInDBR(DBR value)
Set data (units, limits, ...) to DBR.
|
Number |
getLowerAlarmLimit()
Get lower alarm limit.
|
Number |
getLowerCtrlLimit()
Get lower control limit.
|
Number |
getLowerDispLimit()
Get lower display limit.
|
Number |
getLowerWarningLimit()
Get lower warning limit.
|
String |
getUnits()
Get units.
|
Number |
getUpperAlarmLimit()
Get upper alarm limit.
|
Number |
getUpperCtrlLimit()
Get upper control limit.
|
Number |
getUpperDispLimit()
Get upper display limit.
|
Number |
getUpperWarningLimit()
Get upper warning limit.
|
CAStatus |
read(DBR value,
ProcessVariableReadCallback asyncReadCallback)
Read process variable value.
|
protected abstract CAStatus |
readValue(DBR value,
ProcessVariableReadCallback asyncReadCallback)
Read value.
|
CAStatus |
write(DBR value,
ProcessVariableWriteCallback asyncWriteCallback)
Write process variable value.
|
protected abstract CAStatus |
writeValue(DBR value,
ProcessVariableWriteCallback asyncWriteCallback)
Write value.
|
createChannel, destroy, getAckS, getDimensionSize, getEnumLabels, getEventCallback, getMaxDimension, getName, getType, interestDelete, interestRegister, isAckT, printInfo, printInfo, registerChannel, setAckS, setAckT, setEventCallback, unregisterChannelpublic NumericProcessVariable(String name, ProcessVariableEventCallback eventCallback)
name - process variable name.eventCallback - event callback, can be null.public String getUnits()
non-null.public Number getUpperDispLimit()
non-null.public Number getLowerDispLimit()
non-null.public Number getUpperAlarmLimit()
non-null.public Number getUpperWarningLimit()
non-null.public Number getLowerWarningLimit()
non-null.public Number getLowerAlarmLimit()
non-null.public Number getUpperCtrlLimit()
non-null.public Number getLowerCtrlLimit()
non-null.public CAStatus read(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException
ProcessVariable
The incoming DBR value is always (at least) of type DBR_TIME_[type] where type
is of getType(). If DBR_GR_value is instance of requested type.
Special cases:
DBR_TIME_Enum type is "upgraded" to an "artificial" TIME type DBR_TIME_LABELS_Enum.
This enables PV to set labels and time.
DBR_TIME_Double and DBR_TIME_Float are "upgraded" to an "artificial" TIME
type which also implements PRECISION interface, DBR_PRECISION_Double and DBR_PRECISION_Float.
This enables PV to set precision (-1, by default, means no precision set).
read in class ProcessVariablevalue - value of type (at least) DBR_TIME_getType().asyncReadCallback - if asynchronous completion is required method should return
null and call
ProcessVariableReadCallback.processVariableReadCompleted() method.null if request will complete
asynchronously by calling method.CAExceptionpublic void fillInDBR(DBR value)
isCTRLSupported returns true.value - DBR to fill-in.protected abstract CAStatus readValue(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException
{
// for async. completion, return null,
// set value (and status) to enumValue and
// report completion using asyncReadCallback callback.
// return null;
// BEGIN optional (to override defaults)
// set status and severity
value.setStatus(Status.<status>);
value.setSeverity(Severity.<severity>);
// set timestamp
value.setTimestamp(timestamp);
// END optional (to override defaults)
// set value to given DBR (example of copying value for DOUBLE type process variable)
// given DBR has already allocated an array of elements client has requested
// it contains maximum number of elements to fill
double[] arrayValue = (DBR_Double)value.getDoubleValue();
int elementCount = Math.min(<fromDoubleArray>.length, arrayValue.length);
System.arraycopy(<fromDoubleArray>, 0, arrayValue, 0, elementCount);
// return read completion status
return CAStatus.NORMAL;
}
public CAStatus write(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException
ProcessVariablegetType().write in class ProcessVariablevalue - value of type getType().asyncWriteCallback - if asynchronous completion is required method should return
null and call
ProcessVariableWriteCallback.processVariableWriteCompleted() method.null if request will complete
asynchronously by calling method.CAExceptionprotected abstract CAStatus writeValue(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException
{
// for async. completion, return null,
// set value (and status) from enumValue,
// notify if there is an interest and
// report completion using asyncWriteCallback callback.
// return null;
// set value from given DBR here
...
// notify, set appropirate Monitor mask (VALUE, LOG, ALARM)
if (status == CAStatus.NORMAL && interest)
{
DBR monitorDBR = AbstractCASResponseHandler.createDBRforReading(this);
((DBR_Double)monitorDBR).getDoubleValue()[0] = this.value;
fillInDBR(monitorDBR);
fillInStatusAndTime((TIME)monitorDBR);
eventCallback.postEvent(Monitor.VALUE|Monitor.LOG, value);
}
// return read completion status
return CAStatus.NORMAL;
}
Copyright © 2004-2020 EPICS. All Rights Reserved.