Back to Aurora Vision Library Lite website

You are here: Start » System » OPC UA » OPCUAClient_ReadDoubleValue

OPCUAClient_ReadDoubleValue


Header: STD.h
Namespace: avl

Reads a Double compatible value of a variable node from a OPC UA server.

Syntax

void avl::OPCUAClient_ReadDoubleValue
(
	int inConnectionId,
	const avl::OpcUaNodeId& inNodeId,
	bool inAcceptBadStatus,
	atl::Conditional<double>& outValue,
	int& outStatusCode,
	atl::int64& outSourceTimestamp,
	atl::int64& outServerTimestamp
)

Parameters

Name Type Range Default Description
Input value inConnectionId int 0 - 99 0 Slot id of the open connection to the server
Input value inNodeId const OpcUaNodeId& Id of the variable node to read the value from
Input value inAcceptBadStatus bool False Accept variable value read Bad status code without generating an error
Output value outValue Conditional<double>& The value read from the variable node
Output value outStatusCode int& OPC UA status code of the variable value reported by the server
Output value outSourceTimestamp int64& OPC UA UtcTime value source timestamp reported by the server
Output value outServerTimestamp int64& OPC UA UtcTime server timestamp

Description

This filter is used to read a value of the "Value" property of a Variable Class node on a OPC UA server.

The inConnectionId input specifies the server connection slot id and must correspond to the value specified in the OPCUAClient_Connect filter.

The inNodeId input specifies the Node Id of the server node to read the value from (see OpcUaNodeId for details). The node pointed to by this id must be of Variable class and with a compatible value data type (see below), otherwise the filter will throw an IOError exception.

When the inAcceptBadStatus input is set to false, the filter will throw an IOError exception when the value read operation on the server fails or when the StatusCode, currently associated with the value on the server, is in the "Bad" severity range. When this input is set to true, the filter will throw an exception only on connection related errors and will finish successfully even when the read operation fails (e.g. the node id does not exists or the user has no access rights to read it), or when the value usability StatusCode is in the "Bad" severity range. In this case the StatusCode identifying the error will be reported on the outStatusCode output. This mode can be helpful when explicitly handling the value usability status (e.g. the value not yet set condition).

The read value is returned on the outValue output. This output has a conditional type and can return Nil when the source value on the server is equal to Null. Please note that the OPC UA data model allows for the value to be equal to Null on multiple levels (e.g. null string in a variant, or null variant). This filter does not distinguish those levels and returns a single conditional value that is equal to Nil in all those cases. When the inAcceptBadStatus is set to true, this output can also return Nil on read operation failure or when the value usability status severity is "Bad".

The outSourceTimestamp and outServerTimestamp outputs return timestamps associated with the value on the server. When the server does not supports the appropriate timestamp zero is returned in its place. Timestamps format is defined by the OPC UA UtcTime data type (number of 100 nanosecond intervals since January 1, 1601 Universal Time Coordinate). The OPCUA_FormatDateTime filter can be used to convert timestamps into a readable format.

This filter can access scalar variables with OPC UA basic data types of Float and Double (or derived from those). The value is internally converted to Double and returned on the outValue output.

Errors

This filter will throw an IOError exception on network connection errors, server service call errors and read operation errors.

See Also