public abstract class StringProcessVariable extends ProcessVariable
ackS, ackT, channelCount, eventCallback, interest, name| Constructor and Description |
|---|
StringProcessVariable(String name,
ProcessVariableEventCallback eventCallback)
String PV constructor.
|
| Modifier and Type | Method and Description |
|---|---|
DBRType |
getType()
Return
DBRType.STRING type as native type. |
CAStatus |
read(DBR value,
ProcessVariableReadCallback asyncReadCallback)
Casts
DBR to DBR_TIME_String and
delegates operation of reading a value to readValue method. |
protected abstract CAStatus |
readValue(DBR_TIME_String value,
ProcessVariableReadCallback asyncReadCallback)
Read value.
|
CAStatus |
write(DBR value,
ProcessVariableWriteCallback asyncWriteCallback)
Casts
DBR to DBR_String and delegates operation of writing a value to writeValue method. |
protected abstract CAStatus |
writeValue(DBR_String value,
ProcessVariableWriteCallback asyncWriteCallback)
Write value.
|
createChannel, destroy, getAckS, getDimensionSize, getEnumLabels, getEventCallback, getMaxDimension, getName, interestDelete, interestRegister, isAckT, printInfo, printInfo, registerChannel, setAckS, setAckT, setEventCallback, unregisterChannelpublic StringProcessVariable(String name, ProcessVariableEventCallback eventCallback)
name - process variable name.eventCallback - event callback, can be null.public DBRType getType()
DBRType.STRING type as native type.getType in class ProcessVariableProcessVariable.getType()public CAStatus read(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException
DBR to DBR_TIME_String and
delegates operation of reading a value to readValue method.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.CAExceptionProcessVariable.read(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableReadCallback)protected abstract CAStatus readValue(DBR_TIME_String 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(gov.aps.jca.dbr.Status);
value.setSeverity(gov.aps.jca.dbr.Severity);
// set timestamp
value.setTimestamp(timestamp);
// END optional (to override defaults)
// set value to given DBR (example of copying value)
// given DBR has already allocated an array of elements client has requested
// it contains maximum number of elements to fill
String[] arrayValue = value.getStringValue();
int elementCount = Math.min(\<fromStringArray\>.length, arrayValue.length);
System.arraycopy(\<fromStringArray\>, 0, arrayValue, 0, elementCount);
// return read completion status
return CAStatus.NORMAL;
}
public CAStatus write(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException
DBR to DBR_String and delegates operation of writing a value to writeValue method.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.CAExceptionProcessVariable.write(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableWriteCallback)protected abstract CAStatus writeValue(DBR_String 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 (scalar example)
this.value = ((DBR_String) value).getStringValue()[0];
// notify, set appropirate Monitor mask (VALUE, LOG, ALARM)
if (status == CAStatus.NORMAL && interest) {
DBR monitorDBR = AbstractCASResponseHandler.createDBRforReading(this);
((DBR_String) monitorDBR).getStringValue()[0] = this.value;
fillInStatusAndTime((TIME) monitorDBR);
eventCallback.postEvent(Monitor.VALUE | Monitor.LOG, value);
}
// return read completion status
return CAStatus.NORMAL;
}
Copyright © 2004-2020 EPICS. All Rights Reserved.