public class UaVariableImpl extends UaInstanceImpl implements UaVariable
UaVariable.
It keeps all attributes in memory.
UaNode.ParametersaddressSpace, references, supportedAttributesMap| Modifier | Constructor and Description |
|---|---|
|
UaVariableImpl(AddressSpace addressSpace,
NodeId nodeId,
QualifiedName browseName,
LocalizedText displayName)
Create a new variable with dataTypeId initialized to BaseDataType.
|
|
UaVariableImpl(AddressSpace addressSpace,
NodeId nodeId,
QualifiedName browseName,
LocalizedText displayName,
LocalizedText description,
AttributeWriteMask writeMask,
AttributeWriteMask userWriteMask,
UaClientReference[] references,
UaProperty[] properties,
NodeId dataTypeId,
Integer valueRank,
UnsignedInteger[] arrayDimensions,
AccessLevelType accessLevel,
AccessLevelType userAccessLevel,
Double minimumSamplingInterval,
Boolean historizing) |
|
UaVariableImpl(AddressSpace addressSpace,
NodeId nodeId,
QualifiedName browseName,
LocalizedText displayName,
NodeId dataTypeId)
Create a new variable with a specific data type.
|
|
UaVariableImpl(AddressSpace addressSpace,
NodeId nodeId,
QualifiedName browseName,
LocalizedText displayName,
UaDataType dataType)
Create a new variable with a specific data type.
|
|
UaVariableImpl(AddressSpace addressSpace,
NodeId nodeId,
String name,
Locale locale,
NodeId dataTypeId)
Create a new variable with a specific data type.
|
|
UaVariableImpl(AddressSpace addressSpace,
NodeId nodeId,
String name,
Locale locale,
UaDataType dataType)
Create a new variable with a specific data type.
|
protected |
UaVariableImpl(UaNode.Parameters parameters) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDataChangeListener(DataChangeListener listener)
Not supported at the moment.
|
AccessLevelType |
getAccessLevel()
Defines the global read/write access of the Value attribute for all users.
|
UnsignedInteger[] |
getArrayDimensions()
This Attribute specifies the length of each dimension for an array value.
|
NodeAttributes |
getAttributes()
Returns the current attribute values of the node in a NodeAttributes structure.
|
protected VariableAttributes |
getAttributes(VariableAttributes attributes) |
protected void |
getAttributesMap(Map<UnsignedInteger,Object> map) |
UaDataType |
getDataType() |
NodeId |
getDataTypeId() |
Boolean |
getHistorizing() |
Double |
getMinimumSamplingInterval() |
NodeClass |
getNodeClass()
The NodeClass Attribute identifies the NodeClass of a Node.
|
AccessLevelType |
getUserAccessLevel()
Defines the user specific read/write access of the Value attribute.
|
DataValue |
getValue() |
Integer |
getValueRank()
This Attribute indicates whether the Value Attribute of the Variable is an array and how many
dimensions the array has.
|
boolean |
hasUserWriteAccess(UnsignedInteger attributeId)
Overrides the default to check access to Value attribute from AccessLevel.
|
boolean |
hasWriteAccess(UnsignedInteger attributeId)
Overrides the default to check access to Value attribute from AccessLevel.
|
protected void |
initSupportedAttributes(List<UnsignedInteger> l) |
protected void |
readAttributeValue(UnsignedInteger attributeId,
DataValue dataValue)
Read the value of an attribute.
|
DataValue |
readValue()
Reads the current value of the variable from the server.
|
void |
removeDataChangeListener(DataChangeListener listener)
Not supported at the moment.
|
void |
setAccessLevel(AccessLevelType accessLevel) |
void |
setArrayDimensions(UnsignedInteger[] arrayDimensions)
This Attribute specifies the length of each dimension for an array value.
|
void |
setAttribute(UnsignedInteger attributeId,
DataValue dataValue)
Unconditionally, set the value of the specified attribute.
|
void |
setAttributes(VariableAttributes variableAttributes) |
void |
setDataType(UaDataType dataType)
Set the Data Type node.
|
void |
setDataTypeId(NodeId dataTypeId)
Set the Data Type.
|
void |
setHistorizing(Boolean historizing) |
void |
setMinimumSamplingInterval(Double minimumSamplingInterval) |
void |
setUserAccessLevel(AccessLevelType userAccessLevel) |
void |
setValue(DataValue value)
The default Value for instances of this type.
|
void |
setValue(Object value)
Set value.
|
void |
setValueRank(int valueRank)
This Attribute indicates whether the Value Attribute of the VariableType is an array and how
many dimensions the array has.
|
String |
toString() |
protected void |
writeAttributeValue(UnsignedInteger attributeId,
Object value,
StatusCode statusCode,
DateTime sourceTime,
UnsignedShort sourcePicoseconds) |
boolean |
writeValue(Object value)
Writes the value to the variable in the server.
|
boolean |
writeValue(Object value,
boolean autoConvert)
Writes the value to the variable in the server.
|
getTypeDefinition, getTypeDefinitionId, setTypeDefinition, setTypeDefinitionId, setTypeDefinitionIdaddComponent, addProperties, addProperty, addReference, addReference, addReference, addReference, afterAddReference, afterDeleteReference, assertTypeSupport, assertTypeSupport, beforeAddReference, deleteReference, deleteReference, deleteReference, deleteReference, deleteReferences, doAddProperty, equals, findPlaceholders, getAddressSpace, getAttributes, getAttributesMap, getBrowseName, getComponent, getComponents, getDescription, getDescription, getDisplayName, getDisplayName, getMethod, getNodeId, getNodeVersion, getNodeVersionNode, getProperties, getProperty, getPropertyValue, getReference, getReferenceList, getReferences, getSupportedAttributes, getUaNodeId, getUserWriteMask, getWriteMask, hashCode, hasProperty, hasTypeDefinition, readAttribute, readAttribute, referenceTypeInherits, removeComponent, removeProperty, setAttributes, setBrowseName, setDescription, setDisplayName, setNodeVersion, setPropertyValue, setReferences, setUserWriteMask, setWriteMask, supportsAttribute, writeAttributegetForwardReferences, getInverseReferences, getReferences, getReferences, getReferencesAsList, getUserData, referenceTypeInherits, setUserDataclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTypeDefinition, getTypeDefinitionId, setTypeDefinition, setTypeDefinitionId, setTypeDefinitionIdaddComponent, addOrganizes, addProperty, addReference, addReference, addReference, addReference, addReference, addReference, deleteReference, deleteReference, deleteReference, deleteReference, getAddressSpace, getAttributesMap, getBrowseName, getBrowsePaths, getComponent, getComponents, getDescription, getDisplayName, getForwardReferences, getInverseReferences, getMethod, getNodeId, getNodeVersionNode, getOrganizedNode, getOrganizedNodes, getProperties, getProperty, getReference, getReferences, getReferences, getSupportedAttributes, getUaBrowsePaths, getUaNodeId, getUserData, getUserWriteMask, getWriteMask, readAttribute, readAttribute, removeComponent, removeProperty, setAttributes, setBrowseName, setDescription, setDisplayName, setReferences, setUserData, setUserWriteMask, setWriteMask, supportsAttribute, writeAttributepublic UaVariableImpl(AddressSpace addressSpace, NodeId nodeId, QualifiedName browseName, LocalizedText displayName)
nodeId - browseName - displayName - public UaVariableImpl(AddressSpace addressSpace, NodeId nodeId, QualifiedName browseName, LocalizedText displayName, LocalizedText description, AttributeWriteMask writeMask, AttributeWriteMask userWriteMask, UaClientReference[] references, UaProperty[] properties, NodeId dataTypeId, Integer valueRank, UnsignedInteger[] arrayDimensions, AccessLevelType accessLevel, AccessLevelType userAccessLevel, Double minimumSamplingInterval, Boolean historizing)
public UaVariableImpl(AddressSpace addressSpace, NodeId nodeId, QualifiedName browseName, LocalizedText displayName, NodeId dataTypeId)
nodeId - The variable ID.browseName - The name used for browseNamedisplayName - The name used for localized displayNamedataTypeId - The variable data type as a NodeId.public UaVariableImpl(AddressSpace addressSpace, NodeId nodeId, QualifiedName browseName, LocalizedText displayName, UaDataType dataType)
nodeId - The variable ID.browseName - The name used for browseNamedisplayName - The name used for localized displayNamedataTypeId - The variable data type.public UaVariableImpl(AddressSpace addressSpace, NodeId nodeId, String name, Locale locale, NodeId dataTypeId)
nodeId - The variable ID.name - The name used for browseName & displayNamelocale - The locale of displayNamedataTypeId - The variable data type as a NodeId.public UaVariableImpl(AddressSpace addressSpace, NodeId nodeId, String name, Locale locale, UaDataType dataType)
nodeId - The variable ID.name - The name used for browseName & displayNamelocale - The locale of displayNamedataType - The variable data type.protected UaVariableImpl(UaNode.Parameters parameters)
public void addDataChangeListener(DataChangeListener listener)
addDataChangeListener in interface UaVariablepublic AccessLevelType getAccessLevel()
UaVariableIn contrast to the WriteAccess this attribute only applies to the Value attribute.
getAccessLevel in interface UaVariableUaVariable.getUserAccessLevel()public UnsignedInteger[] getArrayDimensions()
UaValueNodeThe number of elements shall be equal to the value of the ValueRank Attribute. Shall be null if ValueRank <= 0.
A value of 0 for an individual dimension indicates that the dimension has a variable length.
For example, if a Variable is defined by the following C array: Int32 myArray[346];
then this Variable's DataType would point to an Int32, the Variable's ValueRank has the value 1 and the ArrayDimensions is an array with one entry having the value 346.
getArrayDimensions in interface UaValueNodeUaValueNode.setArrayDimensions(com.prosysopc.ua.stack.builtintypes.UnsignedInteger[])public NodeAttributes getAttributes()
UaNodegetAttributes in interface UaNodepublic UaDataType getDataType()
getDataType in interface UaValueNodeUaValueNode.getDataTypeId()public NodeId getDataTypeId()
getDataTypeId in interface UaValueNodepublic Boolean getHistorizing()
getHistorizing in interface UaVariablepublic Double getMinimumSamplingInterval()
getMinimumSamplingInterval in interface UaVariablepublic final NodeClass getNodeClass()
UaNodegetNodeClass in interface UaNodegetNodeClass in class UaNodeImplpublic AccessLevelType getUserAccessLevel()
UaVariableIn contrast to the UserWriteAccess this attribute only applies to the Value attribute.
getUserAccessLevel in interface UaVariableUaVariable.getAccessLevel()public DataValue getValue()
getValue in interface UaValueNodepublic Integer getValueRank()
UaValueNodeIt may have the following values:
getValueRank in interface UaValueNodeUaValueNode.setValueRank(int)public boolean hasUserWriteAccess(UnsignedInteger attributeId)
hasUserWriteAccess in interface UaNodehasUserWriteAccess in class UaNodeImplattributeId - public boolean hasWriteAccess(UnsignedInteger attributeId)
hasWriteAccess in interface UaNodehasWriteAccess in class UaNodeImplattributeId - public DataValue readValue() throws StatusException, ServiceException
StatusException - if the read operation failsServiceException - if the service call to the server failspublic void removeDataChangeListener(DataChangeListener listener)
removeDataChangeListener in interface UaVariablepublic void setAccessLevel(AccessLevelType accessLevel)
setAccessLevel in interface UaVariableaccessLevel - the access level to setUaVariable.getAccessLevel()public void setArrayDimensions(UnsignedInteger[] arrayDimensions)
UaValueNodeThe number of elements shall be equal to the value of the ValueRank Attribute. Shall be null if ValueRank <= 0.
A value of 0 for an individual dimension indicates that the dimension has a variable length.
For example, if a VariableType is defined by the following array:
Integer[] myArray = new Integer[346];
then this VariableType's DataType would point to the Int32 data type node, the VariableType's ValueRank has the value 1 and the ArrayDimensions is an array with one entry having the value 346.
setArrayDimensions in interface UaValueNodepublic void setAttribute(UnsignedInteger attributeId, DataValue dataValue) throws StatusException
UaNodeImplsetAttribute in interface UaNodesetAttribute in class UaNodeImplStatusExceptionpublic void setAttributes(VariableAttributes variableAttributes)
public void setDataType(UaDataType dataType)
UaValueNodesetDataType in interface UaValueNodeUaValueNode.setDataTypeId(NodeId)public void setDataTypeId(NodeId dataTypeId)
UaValueNodesetDataTypeId in interface UaValueNodeUaValueNode.setDataTypeId(NodeId)public void setHistorizing(Boolean historizing)
setHistorizing in interface UaVariablehistorizing - define that the variable has history - or notpublic void setMinimumSamplingInterval(Double minimumSamplingInterval)
setMinimumSamplingInterval in interface UaVariableminimumSamplingInterval - define the minimum sampling intervalpublic void setUserAccessLevel(AccessLevelType userAccessLevel)
setUserAccessLevel in interface UaVariableuserAccessLevel - the user access level to setUaVariable.getUserAccessLevel()public void setValue(DataValue value) throws StatusException
UaValueNodesetValue in interface UaValueNodevalue - the default value to setStatusExceptionpublic void setValue(Object value) throws StatusException
setValue in interface UaValueNodevalue - a new value. The value may be a DataValue, Variant or any "OPC UA compliant"
value, i.e. value which can be used to initialize a Variant.StatusException - if the value is invalid for the Value attributepublic void setValueRank(int valueRank)
UaValueNodeIt may have the following values:
setValueRank in interface UaValueNodevalueRank - the value rank to setpublic String toString()
toString in class UaInstanceImplpublic boolean writeValue(Object value) throws StatusException, ServiceException
value - the value to write to the server. The value may be a DataValue, Variant or any
"OPC UA compliant" value, i.e. value which can be used to initialize a Variant.ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo
and Bad_TooManyOperations.StatusException - If the server returns a bad status for the value. Read the exception
for the error details and diagnostics. Expected bad status codes are Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData,
Bad_WriteNotSupported, Bad_NotWritable, Bad_UserAccessDenied, Bad_OutOfRange,
Bad_TypeMismatchreadValue(),
UaClient.writeValue(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId, java.lang.Object)public boolean writeValue(Object value, boolean autoConvert) throws StatusException, ServiceException, DataTypeConversionException
value - the value to write to the server. The value may be a DataValue, Variant or any
"OPC UA compliant" value, i.e. value which can be used to initialize a Variant.autoConvert - if true, the value will be automatically converted to the DataType of the
variable. If false, value will be written as-is.ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo
and Bad_TooManyOperations.StatusException - If the server returns a bad status for the value. Read the exception
for the error details and diagnostics. Expected bad status codes are Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData,
Bad_WriteNotSupported, Bad_NotWritable, Bad_UserAccessDenied, Bad_OutOfRange,
Bad_TypeMismatchDataTypeConversionException - if the automatic DataType conversion failsreadValue(),
UaClient.writeValue(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId, java.lang.Object)protected VariableAttributes getAttributes(VariableAttributes attributes)
protected void getAttributesMap(Map<UnsignedInteger,Object> map)
getAttributesMap in class UaNodeImplprotected void initSupportedAttributes(List<UnsignedInteger> l)
initSupportedAttributes in class UaNodeImplprotected void readAttributeValue(UnsignedInteger attributeId, DataValue dataValue) throws StatusException
UaNodeImplreadAttributeValue in class UaNodeImplattributeId - the ID of the attribute to read.dataValue - the DataValue structure in which the value is set.StatusException - on failureprotected void writeAttributeValue(UnsignedInteger attributeId, Object value, StatusCode statusCode, DateTime sourceTime, UnsignedShort sourcePicoseconds) throws StatusException
writeAttributeValue in class UaNodeImplStatusExceptionCopyright © 2026. All rights reserved.