#include <opcua_basevariabletype.h>
Public Member Functions | |
BaseVariableType (UaNode *pParentNode, UaVariable *pInstanceDeclarationVariable, NodeManagerConfig *pNodeConfig, UaMutexRefCounted *pSharedMutex=NULL) | |
BaseVariableType (const UaNodeId &nodeId, const UaString &name, OpcUa_UInt16 browseNameNameSpaceIndex, const UaVariant &initialValue, OpcUa_Byte accessLevel, NodeManagerConfig *pNodeConfig, UaMutexRefCounted *pSharedMutex=NULL) | |
virtual | ~BaseVariableType () |
UaReferenceLists * | getUaReferenceLists () const |
UaStatus | browse (const ServiceContext &serviceContext, BrowseContext &browseContext, UaReferenceDescriptions &References) |
UaNodeId | nodeId () const |
virtual UaQualifiedName | browseName () const |
virtual UaLocalizedText | displayName (Session *pSession) const |
virtual OpcUa_Boolean | isDescriptionSupported () const |
virtual UaLocalizedText | description (Session *pSession) const |
virtual OpcUa_Boolean | isWriteMaskSupported () const |
virtual OpcUa_UInt32 | writeMask () const |
virtual OpcUa_Boolean | isUserWriteMaskSupported () const |
virtual OpcUa_UInt32 | userWriteMask (Session *pSession) const |
virtual UaDataValue | value (Session *pSession) |
virtual UaStatus | setValue (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
virtual UaNodeId | dataType () const |
virtual OpcUa_Int32 | valueRank () const |
virtual OpcUa_Boolean | isArrayDimensionsSupported () const |
virtual void | arrayDimensions (UaUInt32Array &arrayDimensions) const |
virtual OpcUa_Byte | accessLevel () const |
virtual OpcUa_Byte | userAccessLevel (Session *pSession) const |
virtual OpcUa_Boolean | isMinimumSamplingIntervalSupported () const |
virtual OpcUa_Double | minimumSamplingInterval () const |
virtual OpcUa_Boolean | historizing () const |
virtual void | setBrowseName (const UaQualifiedName &browseName) |
virtual void | setDisplayName (const UaLocalizedText &displayName) |
virtual void | setDescription (const UaLocalizedText &description) |
virtual void | setWriteMask (OpcUa_UInt32 writeMask) |
virtual void | setDataType (const UaNodeId &dataType) |
virtual void | setValueRank (OpcUa_Int32 valueRank) |
virtual void | setArrayDimensions (const UaUInt32Array &arrayDimensions) |
virtual void | setAccessLevel (OpcUa_Byte accessLevel) |
virtual void | setMinimumSamplingInterval (OpcUa_Double minimumSamplingInterval) |
virtual void | setHistorizing (OpcUa_Boolean historizing) |
virtual void | setModellingRuleId (const UaNodeId &modellingRuleId) |
virtual UaNodeId | modellingRuleId () const |
UaNode * | getUaNode () const |
virtual OpcUa_UInt32 | valueHandling () const |
void | setValueHandling (OpcUa_UInt32 valueHandling) |
virtual UaStatus | setAttributeValue (Session *pSession, OpcUa_Int32 attributeId, const UaDataValue &dataValue, OpcUa_Boolean checkWriteMask) |
Static Public Member Functions | |
static void | createTypes () |
static void | clearStaticMembers () |
Base class for all classes representing UA Variables
OpcUa::BaseVariableType::BaseVariableType | ( | UaNode * | pParentNode, |
UaVariable * | pInstanceDeclarationVariable, | ||
NodeManagerConfig * | pNodeConfig, | ||
UaMutexRefCounted * | pSharedMutex = NULL |
||
) |
Constructs an instance of the class BaseVariableType based on an instance declaration variable.
This constructor is used if the variable is created based on an instance declaration of an object or variable type. Since the only difference between the instance declaration variable and the instance variable are the NodeId and the Value, the pointer to the instance declaration node is used to get the attribute values other than the attributes NodeId and Value from the instance declaration node.
The variable is reference counted and can not be deleted directly. The reference counter is set to one after the variable is created. If the variable was successfully added to a NodeManager using the methods NodeManagerConfig::addUaNode or NodeManagerConfig::addNodeAndReference the NodeManager will release this reference during shut down. If the variable was not added to a NodeManager, it must be deleted using the releaseReference method. If the interface pointer is used in other places, the availablity of the variable must be ensured by incrementing the reference counter with addReference when the pointer is stored somewhere and decremented with releaseReference if the interface pointer is not longer needed.
[in] | pParentNode | Parent node of the new variable |
[in] | pInstanceDeclarationVariable | UaVariable interface of the instance declaration node used to provide attribute values other than NodeId and Value |
[in] | pNodeConfig | Interface pointer to the NodeManagerConfig interface used to add and delete node and references in the address space |
[in] | pSharedMutex | Shared mutex object used to synchronize access to the variable. Can be NULL if no shared mutex is provided |
OpcUa::BaseVariableType::BaseVariableType | ( | const UaNodeId & | nodeId, |
const UaString & | name, | ||
OpcUa_UInt16 | browseNameNameSpaceIndex, | ||
const UaVariant & | initialValue, | ||
OpcUa_Byte | accessLevel, | ||
NodeManagerConfig * | pNodeConfig, | ||
UaMutexRefCounted * | pSharedMutex = NULL |
||
) |
Constructs an instance of the class BaseVariableType with the passed attribute values.
This constructor is used if the variable is not created based on an instance declaration. It defines the name, nodeId, initial value and access level of the variable. Additional language specific names and other attribute values can be set with set methods provided by the class. The variable is reference counted and can not be deleted directly. The reference counter is set to one after the variable is created. If the variable was successfully added to a NodeManager using the methods NodeManagerConfig::addUaNode or NodeManagerConfig::addNodeAndReference the NodeManager will release this reference during shut down. If the variable was not added to a NodeManager, it must be deleted using the releaseReference method. If the interface pointer is used in other places, the availablity of the variable must be ensured by incrementing the reference counter with addReference when the pointer is stored somewhere and decremented with releaseReference if the interface pointer is not longer needed.
[in] | nodeId | NodeId of the new variable |
[in] | name | Name of the new variable. Used as browse name and also as display name if no additional language specific names are set. |
[in] | browseNameNameSpaceIndex | Namespace index used for the browse name |
[in] | initialValue | Initial value for the Variable |
[in] | accessLevel | Access level for the Variable |
[in] | pNodeConfig | Interface pointer to the NodeManagerConfig interface used to add and delete node and references in the address space |
[in] | pSharedMutex | Shared mutex object used to synchronize access to the variable. Can be NULL if no shared mutex is provided |
OpcUa::BaseVariableType::~BaseVariableType | ( | ) | [virtual] |
Destruction
OpcUa_Byte OpcUa::BaseVariableType::accessLevel | ( | ) | const [virtual] |
Get the AccessLevel for the DataVariable.
Implements UaVariable.
void OpcUa::BaseVariableType::arrayDimensions | ( | UaUInt32Array & | arrayDimensions ) | const [virtual] |
Get the arrayDimensions value for the passed UaNode.
arrayDimensions | the arrayDimensions value for the passed UaNode. |
Implements UaVariable.
UaStatus OpcUa::BaseVariableType::browse | ( | const ServiceContext & | serviceContext, |
BrowseContext & | browseContext, | ||
UaReferenceDescriptions & | References | ||
) | [virtual] |
Discover the references of a specified node of a view. This method is used to return a list of references and target nodes for the passed node to browse for the services Browse and BrowseNext.
serviceContext | General context for the service calls containing information like the session object, return diagnostic mask and timeout hint. |
browseContext | Browse context for the first browse or the following browse with continuation point. |
References | Array of ReferenceDescription results for the browsed node. |
Implements UaNode.
UaQualifiedName OpcUa::BaseVariableType::browseName | ( | ) | const [virtual] |
Get the browseName as QualifiedName of the current Node.
Implements UaNode.
void OpcUa::BaseVariableType::clearStaticMembers | ( | ) | [static] |
Clear the static members of the class
Reimplemented in OpcUa::AnalogItemTypeBase, OpcUa::BaseDataVariableTypeBase, OpcUa::ConditionVariableTypeBase, OpcUa::DataItemTypeBase, OpcUa::DiscreteItemTypeBase, OpcUa::MultiStateDiscreteTypeBase, OpcUa::PropertyTypeBase, OpcUa::StateVariableTypeBase, OpcUa::TwoStateDiscreteTypeBase, and OpcUa::TwoStateVariableTypeBase.
void OpcUa::BaseVariableType::createTypes | ( | ) | [static] |
Create the related type nodes
Reimplemented in OpcUa::AnalogItemTypeBase, OpcUa::BaseDataVariableTypeBase, OpcUa::ConditionVariableTypeBase, OpcUa::DataItemTypeBase, OpcUa::DiscreteItemTypeBase, OpcUa::MultiStateDiscreteTypeBase, OpcUa::PropertyTypeBase, OpcUa::StateVariableTypeBase, OpcUa::TwoStateDiscreteTypeBase, and OpcUa::TwoStateVariableTypeBase.
UaNodeId OpcUa::BaseVariableType::dataType | ( | ) | const [virtual] |
Get the DataType for the DataVariable.
Implements UaVariable.
UaLocalizedText OpcUa::BaseVariableType::description | ( | Session * | pSession ) | const [virtual] |
UaLocalizedText OpcUa::BaseVariableType::displayName | ( | Session * | pSession ) | const [virtual] |
UaNode * OpcUa::BaseVariableType::getUaNode | ( | ) | const [virtual] |
UaReferenceLists * OpcUa::BaseVariableType::getUaReferenceLists | ( | ) | const [virtual] |
Get a ReferenceList where all the Nodes are in.
Reimplemented from UaNode.
OpcUa_Boolean OpcUa::BaseVariableType::historizing | ( | ) | const [virtual] |
Indicates if historizing is available or not.
Implements UaVariable.
OpcUa_Boolean OpcUa::BaseVariableType::isArrayDimensionsSupported | ( | ) | const [virtual] |
Check if the Node is ArrayDimensionsSupported.
Implements UaVariable.
OpcUa_Boolean OpcUa::BaseVariableType::isDescriptionSupported | ( | ) | const [virtual] |
OpcUa_Boolean OpcUa::BaseVariableType::isMinimumSamplingIntervalSupported | ( | ) | const [virtual] |
Check wether a minimum sampling interval is supported.
Implements UaVariable.
OpcUa_Boolean OpcUa::BaseVariableType::isUserWriteMaskSupported | ( | ) | const [virtual] |
Check if Node is UserWriteMaskSupported.
Implements UaNode.
OpcUa_Boolean OpcUa::BaseVariableType::isWriteMaskSupported | ( | ) | const [virtual] |
OpcUa_Double OpcUa::BaseVariableType::minimumSamplingInterval | ( | ) | const [virtual] |
Get the minimum sampling interval of the Node.
Implements UaVariable.
UaNodeId OpcUa::BaseVariableType::modellingRuleId | ( | ) | const [virtual] |
Get NodeId of the modelling rule for this node. Only instance declaration nodes like Objects, Variables or Methodss have modelling rulestype definition nodes. This method provides a shortcut to get the modelling rule of a node. This information is available for a client by following the HasModellingRule reference (Browse or TranslateBrowsePathToNodeIds) from this node. The HasModellingRule reference is normally not contained in the list of references for the nodes and is handled by the SDK using this method. Creating the reference as normal reference instead of using this shortcut is also possible. The default implemenation of this method returns a null NodeId which means there is no modelling rule defined. The method must be overwritten in a derived class to return a modelling rule.
Reimplemented from UaNode.
UaNodeId OpcUa::BaseVariableType::nodeId | ( | ) | const [virtual] |
void OpcUa::BaseVariableType::setAccessLevel | ( | OpcUa_Byte | accessLevel ) | [virtual] |
Sets the access level attribute value.
void OpcUa::BaseVariableType::setArrayDimensions | ( | const UaUInt32Array & | arrayDimensions ) | [virtual] |
Sets the array dimensions attribute value.
UaStatus OpcUa::BaseVariableType::setAttributeValue | ( | Session * | pSession, |
OpcUa_Int32 | attributeId, | ||
const UaDataValue & | dataValue, | ||
OpcUa_Boolean | checkWriteMask | ||
) | [virtual] |
Sets the value of an attribute of the Node.
[in] | pSession | Interface to the Session context for the method call |
[in] | attributeId | Attribute id indicating the attribute to set |
[in] | dataValue | New value for the attribute |
[out] | checkWriteMask | Flag indicating if the write mask of the node should be checked before setting the new value |
Reimplemented from UaVariable.
void OpcUa::BaseVariableType::setBrowseName | ( | const UaQualifiedName & | browseName ) | [virtual] |
Sets the browse name attribute value.
void OpcUa::BaseVariableType::setDataType | ( | const UaNodeId & | dataType ) | [virtual] |
Sets the data type attribute value.
void OpcUa::BaseVariableType::setDescription | ( | const UaLocalizedText & | description ) | [virtual] |
Sets the description attribute value.
void OpcUa::BaseVariableType::setDisplayName | ( | const UaLocalizedText & | displayName ) | [virtual] |
Sets the display name attribute value.
void OpcUa::BaseVariableType::setHistorizing | ( | OpcUa_Boolean | historizing ) | [virtual] |
Sets the historizing attribute value.
void OpcUa::BaseVariableType::setMinimumSamplingInterval | ( | OpcUa_Double | minimumSamplingInterval ) | [virtual] |
Sets the minimum sampling interval attribute value.
void OpcUa::BaseVariableType::setModellingRuleId | ( | const UaNodeId & | modellingRuleId ) | [virtual] |
Set NodeId of the modelling rule for this node.
UaStatus OpcUa::BaseVariableType::setValue | ( | Session * | pSession, |
const UaDataValue & | dataValue, | ||
OpcUa_Boolean | checkAccessLevel | ||
) | [virtual] |
Sets the current value for the DataVariable.
pSession | Interface to the Session context for the method call |
dataValue | Cached value of the DataVariable. |
checkAccessLevel | checks the Access Level of the current Session. |
Implements UaVariable.
void OpcUa::BaseVariableType::setValueHandling | ( | OpcUa_UInt32 | valueHandling ) |
Set the mode for the handling of the value attribute.
The value is a bit mask with the following values
UaVariable_Value_None = 0x0 - There is no value stored in the variable. The access to the value attribute must be implemented by the user of the SDK
UaVariable_Value_Cache = 0x1 - The variable has a cached value but normal read and data monitoring will not use the value directly. If only this flag is set all read and sampling access uses IOManagerUaNode::readValues that needs to be implemented in the custom NodeManager. All write operations to this variable are using IOManagerUaNode::writeValues. The cache value is not updated by the SDK. The custom code is responsible for updating the cache to allow the SDK to return values that are not older than the MaxAge parameter in the Read.
UaVariable_Value_CacheIsSource = 0x2 - If this flag is set, the value in the variable node is the data source and all read, data monitoring and write operations are using the value without requiring any custom code. Value changes can be provided with the method UaVariable::setValue(). IOManagerUaNode::beforeSetAttributeValue and IOManagerUaNode::afterSetAttributeValue can be used to control writing of attributes or to get informed about a successful write of an attribute. This requires overwriting these functions in the custom NodeManager implementation class.
UaVariable_Value_CacheIsUpdatedOnRequest = 0x4 - If this flag is set, the custom code is responsible for updating the cache value for variables monitored by one or more clients and to handle read and write operations. Value changes can be provided with the method UaVariable::setValue(). The custom code gets informed about monitoring changes for items of this type by overwriting IOManagerUaNode::variableCacheMonitoringChanged in the custom NodeManager implementation. In addition it is required to implement IOManagerUaNode::readValues and IOManagerUaNode::writeValues for read and write operations. This option allows optimizing cyclic access to devices for data monitoring independent of read operations.
void OpcUa::BaseVariableType::setValueRank | ( | OpcUa_Int32 | valueRank ) | [virtual] |
Sets the value rank attribute value.
The ValueRank Attribute indicates whether the Value Attribute of the Variable is an array and how many dimensions the array has. It may have the following values:
void OpcUa::BaseVariableType::setWriteMask | ( | OpcUa_UInt32 | writeMask ) | [virtual] |
Sets the write mask attribute value.
OpcUa_Byte OpcUa::BaseVariableType::userAccessLevel | ( | Session * | pSession ) | const [virtual] |
Get the UserAccessLevel for the DataVariable.
pSession | Interface to the Session context for the method call |
Implements UaVariable.
OpcUa_UInt32 OpcUa::BaseVariableType::userWriteMask | ( | Session * | pSession ) | const [virtual] |
UaDataValue OpcUa::BaseVariableType::value | ( | Session * | pSession ) | [virtual] |
Gets the current value for the DataVariable.
pSession | Interface to the Session context for the method call |
Implements UaVariable.
OpcUa_UInt32 OpcUa::BaseVariableType::valueHandling | ( | ) | const [virtual] |
Get the mode for the handling of the value attribute.
The value is a bit mask with the following values
UaVariable_Value_None = 0x0 - There is no value stored in the variable. The access to the value attribute must be implemented by the user of the SDK
UaVariable_Value_Cache = 0x1 - The variable has a cached value but normal read and data monitoring will not use the value directly. If only this flag is set all read and sampling access uses IOManagerUaNode::readValues that needs to be implemented in the custom NodeManager. All write operations to this variable are using IOManagerUaNode::writeValues. The cache value is not updated by the SDK. The custom code is responsible for updating the cache to allow the SDK to return values that are not older than the MaxAge parameter in the Read.
UaVariable_Value_CacheIsSource = 0x2 - If this flag is set, the value in the variable node is the data source and all read, data monitoring and write operations are using the value without requiring any custom code. Value changes can be provided with the method UaVariable::setValue(). IOManagerUaNode::beforeSetAttributeValue and IOManagerUaNode::afterSetAttributeValue can be used to control writing of attributes or to get informed about a successful write of an attribute. This requires overwriting these functions in the custom NodeManager implementation class.
UaVariable_Value_CacheIsUpdatedOnRequest = 0x4 - If this flag is set, the custom code is responsible for updating the cache value for variables monitored by one or more clients and to handle read and write operations. Value changes can be provided with the method UaVariable::setValue(). The custom code gets informed about monitoring changes for items of this type by overwriting IOManagerUaNode::variableCacheMonitoringChanged in the custom NodeManager implementation. In addition it is required to implement IOManagerUaNode::readValues and IOManagerUaNode::writeValues for read and write operations. This option allows optimizing cyclic access to devices for data monitoring independent of read operations.
Reimplemented from UaVariableCache.
OpcUa_Int32 OpcUa::BaseVariableType::valueRank | ( | ) | const [virtual] |
Get the ValueRank for the DataVariable.
The ValueRank Attribute indicates whether the Value Attribute of the Variable is an array and how many dimensions the array has. It may have the following values:
Implements UaVariable.
OpcUa_UInt32 OpcUa::BaseVariableType::writeMask | ( | ) | const [virtual] |