Package com.cosylab.epics.caj.cas.util
Class MemoryProcessVariable
- java.lang.Object
-
- gov.aps.jca.cas.ProcessVariable
-
- com.cosylab.epics.caj.cas.util.MemoryProcessVariable
-
public class MemoryProcessVariable extends ProcessVariable
Memory (what you write is what you get) process variable implementation. Implementation does not handle status, severity and alarms.
-
-
Field Summary
Fields Modifier and Type Field Description protected intcountPV count.protected String[]enumLabelsArray of labels for enum type PV.protected NumberlowerAlarmLimitLower alarm limit.protected NumberlowerCtrlLimitLower control limit.protected NumberlowerDispLimitLower display value.protected NumberlowerWarningLimitLower warning limit.protected shortprecisionPrecision.protected TimeStamptimestampTimestamp of set value.protected DBRTypetypePV type.protected StringunitsUnits (for value).protected NumberupperAlarmLimitUpper alarm limit.protected NumberupperCtrlLimitUpper control limit.protected NumberupperDispLimitUpper display limit.protected NumberupperWarningLimitUpper warning limit.protected ObjectvaluePV value.-
Fields inherited from class gov.aps.jca.cas.ProcessVariable
ackS, ackT, channelCount, eventCallback, interest, name
-
-
Constructor Summary
Constructors Constructor Description MemoryProcessVariable(String name, ProcessVariableEventCallback eventCallback, DBRType type, Object initialValue)Constructor of memory process variable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfillInDBR(DBR value)Set data (units, limits, ...) to DBR.intgetDimensionSize(int dimension)The methodgetDimensionSize(dimension)returns the maximum number of elements in a particular dimension of the hypercube as follows:String[]getEnumLabels()Get enum string labels.NumbergetLowerAlarmLimit()Get lower alarm limit.NumbergetLowerCtrlLimit()Get lower control limit.NumbergetLowerDispLimit()Get lower display limit.NumbergetLowerWarningLimit()Get lower warning limit.shortgetPrecision()Get precision (number of digits after decimal point).DBRTypegetType()The best type for clients to use when accessing the value of the PV.StringgetUnits()Get units (of value).NumbergetUpperAlarmLimit()Get upper alarm limit.NumbergetUpperCtrlLimit()Get upper control limit.NumbergetUpperDispLimit()Get upper display limit.NumbergetUpperWarningLimit()Get upper warning limit.CAStatusread(DBR value, ProcessVariableReadCallback asyncReadCallback)Read value.voidsetEnumLabels(String[] labels)Set labens.voidsetLowerAlarmLimit(Number lowerAlarmLimit)Set lower alarm limit.voidsetLowerCtrlLimit(Number lowerCtrlLimit)Set lower control limit.voidsetLowerDispLimit(Number lowerDispLimit)Set lower display limit.voidsetLowerWarningLimit(Number lowerWarningLimit)Set lower warning limit.voidsetPrecision(short precision)Set precision.voidsetUnits(String units)Set units (of value).voidsetUpperAlarmLimit(Number upperAlarmLimit)Set upper alarm limit.voidsetUpperCtrlLimit(Number upperCtrlLimit)Set upper control limit.voidsetUpperDispLimit(Number upperDispLimit)Set upper display limit.voidsetUpperWarningLimit(Number upperWarningLimit)Set upper warning limit.CAStatuswrite(DBR value, ProcessVariableWriteCallback asyncWriteCallback)Write value.-
Methods inherited from class gov.aps.jca.cas.ProcessVariable
createChannel, destroy, getAckS, getEventCallback, getMaxDimension, getName, interestDelete, interestRegister, isAckT, printInfo, printInfo, registerChannel, setAckS, setAckT, setEventCallback, unregisterChannel
-
-
-
-
Field Detail
-
type
protected DBRType type
PV type.
-
value
protected Object value
PV value.
-
count
protected int count
PV count.
-
timestamp
protected TimeStamp timestamp
Timestamp of set value.
-
units
protected String units
Units (for value).
-
upperDispLimit
protected Number upperDispLimit
Upper display limit.
-
lowerDispLimit
protected Number lowerDispLimit
Lower display value.
-
upperAlarmLimit
protected Number upperAlarmLimit
Upper alarm limit.
-
upperWarningLimit
protected Number upperWarningLimit
Upper warning limit.
-
lowerWarningLimit
protected Number lowerWarningLimit
Lower warning limit.
-
lowerAlarmLimit
protected Number lowerAlarmLimit
Lower alarm limit.
-
upperCtrlLimit
protected Number upperCtrlLimit
Upper control limit.
-
lowerCtrlLimit
protected Number lowerCtrlLimit
Lower control limit.
-
precision
protected short precision
Precision. Used for floating decimal value to string conversion.
-
enumLabels
protected String[] enumLabels
Array of labels for enum type PV.
-
-
Constructor Detail
-
MemoryProcessVariable
public MemoryProcessVariable(String name, ProcessVariableEventCallback eventCallback, DBRType type, Object initialValue)
Constructor of memory process variable.- Parameters:
name- name of the PV.eventCallback- event callback, where to report value changes ifinterestistrue.type- type of the PV (of initial value).initialValue- initial value, array is expected.
-
-
Method Detail
-
getType
public DBRType getType()
Description copied from class:ProcessVariableThe best type for clients to use when accessing the value of the PV. Only basic types e.g. BYTE, INTEGER and not STS_BYTE have to be returned.- Specified by:
getTypein classProcessVariable- Returns:
- best type for clients.
- See Also:
ProcessVariable.getType()
-
getDimensionSize
public int getDimensionSize(int dimension)
Description copied from class:ProcessVariableThe methodgetDimensionSize(dimension)returns the maximum number of elements in a particular dimension of the hypercube as follows:scalar - getDimensionCount() returns 0 array - getDimensionCount() returns 1 getDimensionSize(0) supplies number of elements in array plane - getDimensionCount() returns 2 getDimensionSize(0) supplies number of elements in X dimension getDimensionSize(1) supplies number of elements in Y dimension cube - getDimensionCount() returns 3 getDimensionSize(0) supplies number of elements in X dimension getDimensionSize(1) supplies number of elements in Y dimension getDimensionSize(2) supplies number of elements in Z dimension ...The default (base) "getDimensionSize()" returns one (scalar bounds) for all dimensions.- Overrides:
getDimensionSizein classProcessVariable- Parameters:
dimension- dimension for which to fecth its size.- Returns:
- requested dimenstion size.
- See Also:
ProcessVariable.getDimensionSize(int)
-
getLowerAlarmLimit
public Number getLowerAlarmLimit()
Get lower alarm limit.- Returns:
- lower alarm limit,
non-null.
-
setLowerAlarmLimit
public void setLowerAlarmLimit(Number lowerAlarmLimit)
Set lower alarm limit.- Parameters:
lowerAlarmLimit- lower alarm limit,non-null.
-
getLowerCtrlLimit
public Number getLowerCtrlLimit()
Get lower control limit.- Returns:
- lower control limit,
non-null.
-
setLowerCtrlLimit
public void setLowerCtrlLimit(Number lowerCtrlLimit)
Set lower control limit.- Parameters:
lowerCtrlLimit- lower control limit,non-null.
-
getLowerDispLimit
public Number getLowerDispLimit()
Get lower display limit.- Returns:
- lower display limit,
non-null.
-
setLowerDispLimit
public void setLowerDispLimit(Number lowerDispLimit)
Set lower display limit.- Parameters:
lowerDispLimit- lower display limit,non-null.
-
getLowerWarningLimit
public Number getLowerWarningLimit()
Get lower warning limit.- Returns:
- lower warning limit,
non-null.
-
setLowerWarningLimit
public void setLowerWarningLimit(Number lowerWarningLimit)
Set lower warning limit.- Parameters:
lowerWarningLimit- lower warning limit,non-null.
-
getUnits
public String getUnits()
Get units (of value).- Returns:
- get units,
non-null.
-
setUnits
public void setUnits(String units)
Set units (of value).- Parameters:
units- get units,non-null.
-
getUpperAlarmLimit
public Number getUpperAlarmLimit()
Get upper alarm limit.- Returns:
- upper alarm limit,
non-null.
-
setUpperAlarmLimit
public void setUpperAlarmLimit(Number upperAlarmLimit)
Set upper alarm limit.- Parameters:
upperAlarmLimit- upper alarm limit,non-null.
-
getUpperCtrlLimit
public Number getUpperCtrlLimit()
Get upper control limit.- Returns:
- upper control limit,
non-null.
-
setUpperCtrlLimit
public void setUpperCtrlLimit(Number upperCtrlLimit)
Set upper control limit.- Parameters:
upperCtrlLimit- upper control limit,non-null.
-
getUpperDispLimit
public Number getUpperDispLimit()
Get upper display limit.- Returns:
- upper display limit,
non-null.
-
setUpperDispLimit
public void setUpperDispLimit(Number upperDispLimit)
Set upper display limit.- Parameters:
upperDispLimit- upper display limit,non-null.
-
getUpperWarningLimit
public Number getUpperWarningLimit()
Get upper warning limit.- Returns:
- upper warning limit,
non-null.
-
setUpperWarningLimit
public void setUpperWarningLimit(Number upperWarningLimit)
Set upper warning limit.- Parameters:
upperWarningLimit- upper warning limit,non-null.
-
getPrecision
public short getPrecision()
Get precision (number of digits after decimal point). Use-1value as undefined precision.- Returns:
- precision.
-
setPrecision
public void setPrecision(short precision)
Set precision.- Parameters:
precision- precision to set (number of digits after decimal point).- See Also:
getPrecision()
-
getEnumLabels
public String[] getEnumLabels()
Description copied from class:ProcessVariableGet enum string labels. If process variable is type ofENUMit should override this method and return labels.- Overrides:
getEnumLabelsin classProcessVariable- Returns:
- enum string labels.
- See Also:
ProcessVariable.getEnumLabels()
-
setEnumLabels
public void setEnumLabels(String[] labels)
Set labens.- Parameters:
labels- the labels to set- See Also:
ProcessVariable.getEnumLabels()
-
read
public CAStatus read(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException
Read value. Fills-in DBR, sets timestamp (time when value was written) and copies value from local memory (array). No status and severity (alarms) are set - to be done infillInDBRmethod (extending it).- Specified by:
readin classProcessVariable- Parameters:
value- value of type (at least) DBR_TIME_where type is of getType().asyncReadCallback- if asynchronous completion is required method should returnnulland callProcessVariableReadCallback.processVariableReadCompleted()method.- Returns:
- CA status,
nullif request will complete asynchronously by calling method. - Throws:
CAException- See Also:
ProcessVariable.read(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableReadCallback)
-
fillInDBR
public void fillInDBR(DBR value)
Set data (units, limits, ...) to DBR. Data is obtained from this class accessors.- Parameters:
value- DBR to fill-in.
-
write
public CAStatus write(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException
Write value. Copies given value to local memory (array). If event interest flaginterestis set, an event is fired toeventCallback.- Specified by:
writein classProcessVariable- Parameters:
value- value of typegetType().asyncWriteCallback- if asynchronous completion is required method should returnnulland callProcessVariableWriteCallback.processVariableWriteCompleted()method.- Returns:
- CA status,
nullif request will complete asynchronously by calling method. - Throws:
CAException- See Also:
ProcessVariable.write(gov.aps.jca.dbr.DBR, gov.aps.jca.cas.ProcessVariableWriteCallback)
-
-