vnx.opc_ua.Proxy

Module

The vnx.opc_ua.Proxy module provides a OPC-UA proxy to connect to a OPC-UA server.

It allows to call methods as well as read variables on the server.

Options

string address

OPC-UA server url to connect to, for example opc.tcp://127.0.0.1:4840.

bool block_until_connect = true

If to block client requests until first sucessful connect.

bool block_until_reconnect = false

If to block client requests until next sucessful reconnect, in case connection breaks down.

Functions

UA node ids are provided via a pair<ushort, Variant>, where the first value is the namespace index and the second value either an integer or a string.

In case a UA method returns more than one value the Variant return value will contain an array of variants, ie. vector<Variant>. See also vnx.Variant.

Variant call(string method, vector<Variant> args) const

Calls a global method with the given arguments and returns the result. The implicit object for this call is UA_NS0ID_OBJECTSFOLDER. Requires permission vnx.opc_ua.permission_e.CALL.

Variant object_call(pair<ushort, Variant> object, string method, vector<Variant> args) const

Calls a method on the object with the given arguments and returns the result. Requires permission vnx.opc_ua.permission_e.CALL.

Variant read_variable(pair<ushort, Variant> node) const

Reads the value of a given variable node.

Variant read_object_variable(pair<ushort, Variant> object, string variable) const

Reads the value of a given variable of the object.

void write_variable(pair<ushort, Variant> node, Variant value)

Writes a value to the given global variable node. Requires permission vnx.opc_ua.permission_e.WRITE.

void write_object_variable(pair<ushort, Variant> object, string variable, Variant value)

Writes a value to the given variable of the object. Requires permission vnx.opc_ua.permission_e.WRITE.

void browse_all()

Finds all available objects and variables on the server. Will be done automatically on every connect and re-connect.