public abstract class EnumProcessVariable
extends gov.aps.jca.cas.ProcessVariable
| Constructor and Description |
|---|
EnumProcessVariable(String name,
gov.aps.jca.cas.ProcessVariableEventCallback eventCallback)
Enum PV constructor.
|
| Modifier and Type | Method and Description |
|---|---|
gov.aps.jca.dbr.DBRType |
getType()
Return
DBRType.ENUM type as native type. |
gov.aps.jca.CAStatus |
read(gov.aps.jca.dbr.DBR value,
gov.aps.jca.cas.ProcessVariableReadCallback asyncReadCallback)
Casts
DBR to DBR_TIME_LABELS_Enum,
sets labels returned by getEnumLabels() and
delegates operation of reading a value to readValue method. |
protected abstract gov.aps.jca.CAStatus |
readValue(gov.aps.jca.dbr.DBR_TIME_LABELS_Enum value,
gov.aps.jca.cas.ProcessVariableReadCallback asyncReadCallback)
Read value.
|
gov.aps.jca.CAStatus |
write(gov.aps.jca.dbr.DBR value,
gov.aps.jca.cas.ProcessVariableWriteCallback asyncWriteCallback)
Casts
DBR to DBR_Enum and delegates operation of writing a value to writeValue method. |
protected abstract gov.aps.jca.CAStatus |
writeValue(gov.aps.jca.dbr.DBR_Enum value,
gov.aps.jca.cas.ProcessVariableWriteCallback asyncWriteCallback)
Write value.
|
createChannel, destroy, getAckS, getDimensionSize, getEnumLabels, getEventCallback, getMaxDimension, getName, interestDelete, interestRegister, isAckT, printInfo, printInfo, registerChannel, setAckS, setAckT, setEventCallback, unregisterChannelpublic EnumProcessVariable(String name, gov.aps.jca.cas.ProcessVariableEventCallback eventCallback)
name - process variable name.eventCallback - event callback, can be null.public gov.aps.jca.dbr.DBRType getType()
DBRType.ENUM type as native type.getType in class gov.aps.jca.cas.ProcessVariableProcessVariable.getType()public gov.aps.jca.CAStatus read(gov.aps.jca.dbr.DBR value,
gov.aps.jca.cas.ProcessVariableReadCallback asyncReadCallback)
throws gov.aps.jca.CAException
DBR to DBR_TIME_LABELS_Enum,
sets labels returned by getEnumLabels() and
delegates operation of reading a value to readValue method.read in class gov.aps.jca.cas.ProcessVariablegov.aps.jca.CAExceptionProcessVariable.read(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableReadCallback)protected abstract gov.aps.jca.CAStatus readValue(gov.aps.jca.dbr.DBR_TIME_LABELS_Enum value,
gov.aps.jca.cas.ProcessVariableReadCallback asyncReadCallback)
throws gov.aps.jca.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
enumValue.setStatus(Status.);
enumValue.setSeverity(Severity.);
// set timestamp
enumValue.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
short[] arrayValue = value.getEnumValue();
int elementCount = Math.min(.length, arrayValue.length);
System.arraycopy(, 0, arrayValue, 0, elementCount);
// return read completion status
return CAStatus.NORMAL;
}
gov.aps.jca.CAExceptionProcessVariable.read(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableReadCallback)public gov.aps.jca.CAStatus write(gov.aps.jca.dbr.DBR value,
gov.aps.jca.cas.ProcessVariableWriteCallback asyncWriteCallback)
throws gov.aps.jca.CAException
DBR to DBR_Enum and delegates operation of writing a value to writeValue method.write in class gov.aps.jca.cas.ProcessVariablegov.aps.jca.CAExceptionProcessVariable.write(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableWriteCallback)protected abstract gov.aps.jca.CAStatus writeValue(gov.aps.jca.dbr.DBR_Enum value,
gov.aps.jca.cas.ProcessVariableWriteCallback asyncWriteCallback)
throws gov.aps.jca.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 = value.getEnumValue()[0];
// notify, set appropirate Monitor mask (VALUE, LOG, ALARM)
if (status == CAStatus.NORMAL && interest)
{
DBR monitorDBR = AbstractCASResponseHandler.createDBRforReading(this);
((DBR_Enum)monitorDBR).getEnumValue()[0] = this.value;
// set labels
((LABELS)monitorDBR).setLabels(getEnumLabels());
// set status, severity and time here (see readValue method example)
fillInStatusAndTime((TIME)monitorDBR);
eventCallback.postEvent(Monitor.VALUE|Monitor.LOG, value);
}
// return read completion status
return CAStatus.NORMAL;
}
gov.aps.jca.CAExceptionProcessVariable.write(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableWriteCallback)Copyright © 2004-2013 Cosylab. All Rights Reserved.