High Performance OPC UA Server SDK  1.7.1.383

Access for nodeclass variable specific attributes. More...

Functions

SERVER_EXPORT int ua_variable_set_datatype (ua_node_t node, struct ua_nodeid *datatype)
 Set the datatype attribute of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_builtindatatype (ua_node_t node, enum ua_variant_type type)
 Set the datatype attribute of a variable node to a builtin variant type. More...
 
SERVER_EXPORT int ua_variable_get_datatype (ua_node_t node, struct ua_nodeid *datatype)
 Get the datatype attribute of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_access_level (ua_node_t node, uint8_t accesslevel)
 Set the accesslevel attribute of a variable node. More...
 
SERVER_EXPORT uint8_t ua_variable_get_access_level (ua_node_t node)
 Get the accesslevel attribute of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_historizing (ua_node_t node, bool historizing)
 Set the historizing attribute of a variable node. More...
 
SERVER_EXPORT bool ua_variable_get_historizing (ua_node_t node)
 Get the historizing attribute of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_valuerank (ua_node_t node, int32_t valuerank)
 Set the valuerank attribute of a variable node. More...
 
SERVER_EXPORT int32_t ua_variable_get_valuerank (ua_node_t node)
 Get the valuerank attribute of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_arraydimensions (ua_node_t node, int32_t num_dimensions, uint32_t *dimensions)
 Sets or updates array dimensions of a variable. More...
 
SERVER_EXPORT int ua_variable_get_arraydimensions (ua_node_t node, int32_t *num_dimensions, uint32_t *dimensions)
 Returns the array dimensions for the given variable. More...
 
SERVER_EXPORT int ua_variable_set_minimum_sampling_interval (ua_node_t node, uint32_t minimum_sampling_interval)
 Set the minimum samplinginterval attribute of a variable node. More...
 
SERVER_EXPORT uint32_t ua_variable_get_minimum_sampling_interval (ua_node_t node)
 Get the minimum samplinginterval attribute of a variable node. More...
 
SERVER_EXPORT double ua_variable_get_minimum_sampling_interval_dbl (ua_node_t node)
 Get the minimum samplinginterval attribute of a variable node as double. More...
 
SERVER_EXPORT int ua_variable_set_store_index (ua_node_t node, uint8_t storeindex)
 Set the store index of a variable node. More...
 
SERVER_EXPORT int ua_variable_get_store_index (ua_node_t node, uint8_t *storeindex)
 Get the store index of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_value_index (ua_node_t node, unsigned int valueindex)
 Set the valueindex of a variable node. More...
 
SERVER_EXPORT int ua_variable_get_value_index (ua_node_t node, unsigned int *valueindex)
 Get the valueindex of a variable node. More...
 
SERVER_EXPORT int ua_variable_set_attributes (ua_node_t node, struct ua_nodeid *datatype_id, int32_t valuerank, uint8_t access_level, bool historizing)
 Set the mandatory attributes of a variable node. More...
 
SERVER_EXPORT int ua_variable_copy (ua_node_t dst, ua_node_t src)
 Copy the attributes specific to nodelcass variable from the node src to dst. More...
 
SERVER_EXPORT int ua_variable_get_access_level_store_value_index (ua_node_t node, uint8_t *accesslevel, uint8_t *storeindex, unsigned int *valueindex)
 Combines the functionality of ua_variable_get_access_level, ua_variable_get_store_index and ua_variable_get_value_index. More...
 
SERVER_EXPORT int ua_variable_get_access_level_address (ua_node_t node, uint8_t *accesslevel, struct ua_valuestore_address_info *address)
 Returns the accesslevel and value store address for the given node. More...
 
SERVER_EXPORT int ua_variable_set_value (ua_node_t node, struct ua_variant *val, ua_statuscode *presult)
 Convenience function for setting a new value for the given variable. More...
 
SERVER_EXPORT int ua_variable_get_value (ua_node_t node, struct ua_variant *val)
 Convenience function for reading the current value of the given variable. More...
 

Detailed Description

Access for nodeclass variable specific attributes.

Function Documentation

◆ ua_variable_copy()

SERVER_EXPORT int ua_variable_copy ( ua_node_t  dst,
ua_node_t  src 
)

Copy the attributes specific to nodelcass variable from the node src to dst.

If the value is readonly the valueindex and storeindex are copied, so the src and dst nodes point to the same value, for writeable values no valueindex and storeindex is set. The arraydimension are also not copied as these are not completely implemented yet.

Returns
Zero on success or errorcode on failure.

◆ ua_variable_get_access_level()

SERVER_EXPORT uint8_t ua_variable_get_access_level ( ua_node_t  node)

Get the accesslevel attribute of a variable node.

Parameters
nodeHandle of node to get the accesslevel.
Returns
Accesslevel of the node.
See also
ua_accesslevel

◆ ua_variable_get_access_level_address()

SERVER_EXPORT int ua_variable_get_access_level_address ( ua_node_t  node,
uint8_t *  accesslevel,
struct ua_valuestore_address_info address 
)

Returns the accesslevel and value store address for the given node.

This supersedes ua_variable_get_access_level_store_value_index.

Parameters
nodeNode of class variable to get the attributes.
accesslevelPointer to value where the access level is written to.
addressPointer to address info struct which receive the value address information.
Returns
Zero on success or errorcode on failure.

◆ ua_variable_get_access_level_store_value_index()

SERVER_EXPORT int ua_variable_get_access_level_store_value_index ( ua_node_t  node,
uint8_t *  accesslevel,
uint8_t *  storeindex,
unsigned int *  valueindex 
)

Combines the functionality of ua_variable_get_access_level, ua_variable_get_store_index and ua_variable_get_value_index.

This information is often needed at once and it is much more efficient to get it at once, so this function is a pure performance optimization.

Parameters
nodeNode of class variable to get the attributes.
accesslevelPointer to value where the access level is written to.
storeindexPointer to value where the store index is written to.
valueindexPointer to value where the value index is written to.
Returns
Zero on success or errorcode on failure.

◆ ua_variable_get_arraydimensions()

SERVER_EXPORT int ua_variable_get_arraydimensions ( ua_node_t  node,
int32_t *  num_dimensions,
uint32_t *  dimensions 
)

Returns the array dimensions for the given variable.

node must reference a variable nodeclass otherwise the function will return UA_EBADINVALIDARGUMENT. The dimension parameter is optional, if dimensions is NULL only the length of arraydimensions array will be returned.

Parameters
nodeNode handle which identifies the variable.
num_dimensionsPointer to length field. When calling the function *num_dimensions should be the (maximum) length of the dimensions array. When the function returns this will contain the number of used elements.
dimensionsPointer to preallocated dimensions array. May be NULL if only num_dimensions should be read.
Returns
UA_EGOOD on success. UA_EBADINVALIDARGUMENT if the node handle is invalid or num_dimensions is a NULL pointer. UA_EBADBUFTOOSMALL if the dimensions array is not big enought to receive all data.

◆ ua_variable_get_datatype()

SERVER_EXPORT int ua_variable_get_datatype ( ua_node_t  node,
struct ua_nodeid datatype 
)

Get the datatype attribute of a variable node.

Parameters
nodeHandle of node to get datatype.
datatypeNodeid representing the datatype of the node.
Returns
Zero on success or errorcode on failure

◆ ua_variable_get_historizing()

SERVER_EXPORT bool ua_variable_get_historizing ( ua_node_t  node)

Get the historizing attribute of a variable node.

Parameters
nodeHandle of node to get the historizing attribute.
Returns
True if historizing is enabled for the node, false otherwise.

◆ ua_variable_get_minimum_sampling_interval()

SERVER_EXPORT uint32_t ua_variable_get_minimum_sampling_interval ( ua_node_t  node)

Get the minimum samplinginterval attribute of a variable node.

Parameters
nodeHandle of node to get the the attribute.
Returns
Minimum samplinginterval

◆ ua_variable_get_minimum_sampling_interval_dbl()

SERVER_EXPORT double ua_variable_get_minimum_sampling_interval_dbl ( ua_node_t  node)

Get the minimum samplinginterval attribute of a variable node as double.

Parameters
nodeHandle of node to get the the attribute.
Returns
Minimum samplinginterval

◆ ua_variable_get_store_index()

SERVER_EXPORT int ua_variable_get_store_index ( ua_node_t  node,
uint8_t *  storeindex 
)

Get the store index of a variable node.

Parameters
nodeHandle of node to get store index.
storeindexPointer to value where the store index is written to.
Returns
Zero on success or errorcode on failure

◆ ua_variable_get_value()

SERVER_EXPORT int ua_variable_get_value ( ua_node_t  node,
struct ua_variant val 
)

Convenience function for reading the current value of the given variable.

This function gets store interface associated with the variable and calls the get function to get the variable's value from the configured store.

This only works for variables with an associated store.

This function is useful for retrieving single values for internal logic. For implementing the read service in a provider the function uaserver_read_internal is more appropriate.

Parameters
nodeVariable handle.
valReturns the read variant value. The returned value must be cleared using ua_variant_clear. If the operation fails the return value is undefined.
Returns
Zero on success. UA_EBADACCESSDENIED if the variable is not readable. UA_EBADINVALIDARGUMENT if no store is configured or store has no get function.

◆ ua_variable_get_value_index()

SERVER_EXPORT int ua_variable_get_value_index ( ua_node_t  node,
unsigned int *  valueindex 
)

Get the valueindex of a variable node.

Parameters
nodeHandle of node to get valueindex.
valueindexPointer to value where the valueindex is written to.
Returns
Zero on success or errorcode on failure

◆ ua_variable_get_valuerank()

SERVER_EXPORT int32_t ua_variable_get_valuerank ( ua_node_t  node)

Get the valuerank attribute of a variable node.

Parameters
nodeHandle of node to get the valuerank
Returns
Valuerank of the node.
See also
ua_valuerank

◆ ua_variable_set_access_level()

SERVER_EXPORT int ua_variable_set_access_level ( ua_node_t  node,
uint8_t  accesslevel 
)

Set the accesslevel attribute of a variable node.

Parameters
nodeHandle of node to set accesslevel.
accesslevelAccesslevel to set. Multiple accesslevels can be combined with the bitwise OR operator.
Returns
Zero on success or errorcode on failure
See also
ua_accesslevel

◆ ua_variable_set_arraydimensions()

SERVER_EXPORT int ua_variable_set_arraydimensions ( ua_node_t  node,
int32_t  num_dimensions,
uint32_t *  dimensions 
)

Sets or updates array dimensions of a variable.

This allocates a dimension object internal to store this information, if it does not exist already. To free these resources you can call this operation with num_dimensions=0 and dimensions=NULL, or just delete the node using ua_node_delete.

Parameters
nodeHandle of the variable node.
num_dimensionsNumber of dimensions which is the array length of dimensions.
dimensionsArray with the length for each dimension.

Even though it is allowed to set dimension info like {0} for unknown size it is recommended to not set this information, because this wastes memory.

◆ ua_variable_set_attributes()

SERVER_EXPORT int ua_variable_set_attributes ( ua_node_t  node,
struct ua_nodeid datatype_id,
int32_t  valuerank,
uint8_t  access_level,
bool  historizing 
)

Set the mandatory attributes of a variable node.

Parameters
nodeNode of class variable to set the attributes.
datatype_idNodeid of the datatype of the variable node.
valuerankValuerank of the variable node.
access_levelAccesslevel of the variable node.
historizingTrue if the variable supports history access.
Returns
0 on success or errorcode on failure.

◆ ua_variable_set_builtindatatype()

SERVER_EXPORT int ua_variable_set_builtindatatype ( ua_node_t  node,
enum ua_variant_type  type 
)

Set the datatype attribute of a variable node to a builtin variant type.

Parameters
nodeHandle of node to set the datatype.
typeVariant type to set as datatype.
Returns
Zero on success or errorcode on failure

◆ ua_variable_set_datatype()

SERVER_EXPORT int ua_variable_set_datatype ( ua_node_t  node,
struct ua_nodeid datatype 
)

Set the datatype attribute of a variable node.

Parameters
nodeHandle of node to set the datatype.
datatypeNodeid to set as datatype. The node must exist in the server addressspace.
Returns
Zero on success or errorcode on failure

◆ ua_variable_set_historizing()

SERVER_EXPORT int ua_variable_set_historizing ( ua_node_t  node,
bool  historizing 
)

Set the historizing attribute of a variable node.

Parameters
nodeHandle of node to set historizing attribute.
historizingTrue if historizing is enabled for the node, false otherwise.
Returns
Zero on success or errorcode on failure

◆ ua_variable_set_minimum_sampling_interval()

SERVER_EXPORT int ua_variable_set_minimum_sampling_interval ( ua_node_t  node,
uint32_t  minimum_sampling_interval 
)

Set the minimum samplinginterval attribute of a variable node.

Parameters
nodeHandle of node to set the the attribute.
minimum_sampling_intervalMinimum samplinginterval to set.
Returns
Zero on success or errorcode on failure

◆ ua_variable_set_store_index()

SERVER_EXPORT int ua_variable_set_store_index ( ua_node_t  node,
uint8_t  storeindex 
)

Set the store index of a variable node.

The storeindex may only be set values for which a store was registered with ua_valuestore_register_store.

Parameters
nodeHandle of node to set store index.
storeindexStore index to set.
Returns
Zero on success or errorcode on failure

◆ ua_variable_set_value()

SERVER_EXPORT int ua_variable_set_value ( ua_node_t  node,
struct ua_variant val,
ua_statuscode presult 
)

Convenience function for setting a new value for the given variable.

This function gets store interface associated with the variable and calls the attach function to store the variable's value in the configured store.

This only works for variables with an associated store.

This function is useful for setting single values for internal logic. For implementing the write service in a provider the function uaserver_write_internal is more appropriate.

Parameters
nodeVariable handle.
valVariant value to set. Note that this value gets attached and must not be freed by the caller. The variant argument to it initialized state, so that any variant_clear call afterwards becomes a NOP. Even if the operation fails to attach the value the variant gets cleared properly, so the caller can simply forget the variant and doesn't need to implement any cleanup for it.
presultReturns the store write result. This is only valid if zero is returned as function result. The argument may be NULL if not needed. A possible error might be UA_SCBADTYPEMISMATCH.
Returns
Zero on success. UA_EBADACCESSDENIED if the variable is not writable. UA_EBADINVALIDARGUMENT if no store is configured or store has no attach function.

◆ ua_variable_set_value_index()

SERVER_EXPORT int ua_variable_set_value_index ( ua_node_t  node,
unsigned int  valueindex 
)

Set the valueindex of a variable node.

The valueindex may be used in combination with a valuestore or freely by the user for an arbitrary index

Parameters
nodeHandle of node to set valueindex.
valueindexValue for the valueindex.
Returns
Zero on success or errorcode on failure

◆ ua_variable_set_valuerank()

SERVER_EXPORT int ua_variable_set_valuerank ( ua_node_t  node,
int32_t  valuerank 
)

Set the valuerank attribute of a variable node.

Parameters
nodeHandle of node to set the valuerank
valuerankValuerank to set. Possible values are:
  • UA_VALUERANK_SCALARORONEDIMENSION
  • UA_VALUERANK_ANY
  • UA_VALUERANK_SCALAR
  • UA_VALUERANK_ONEORMOREDIMENSIONS
  • UA_VALUERANK_ONEDIMENSION
  • UA_VALUERANK_TWODIMENSIONS
  • or any number>2 for higher dimensions.
Returns
Zero on success or errorcode on failure
See also
ua_valuerank