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.
-
string
username¶ Optional user name for server login.
-
string
password¶ Password for server login, required when
usernameis set.
-
int
connect_interval_ms= 1000¶ Interval to check for connection loss and reconnect. 0 to disable.
-
int
session_timeout_ms= 86400000¶ Session timeout in ms.
-
int
keepalive_interval_ms= 10000¶ Connectivity check interval in ms.
-
int
secure_channel_lifetime_ms= 600000¶ Secure channel life time in ms.
-
string
certificate_file= ""¶ Optional path to a client certificate file (DER format).
-
string
private_key_file= ""¶ Optional path to a client private key file (DER format).
-
string
application_name= "pilot.opc_ua.proxy"¶ Optional application name.
-
string
application_uri= "urn:open62541.client.application"¶ Must match the URI in the certificate.
-
vector<string>
trust_list¶ Server certificate trust files (CRL format). This only has an effect if a client certificate is configured.
-
security_mode_e
security_mode= ANY¶ Required security for connections. See vnx.opc_ua.security_mode_e.
-
vector<subscription_t>
subscriptions¶ A list of subscriptions to create on connect. See vnx.opc_ua.subscription_t.
-
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
methodwith the given arguments and returns the result. The implicit object for this call is UA_NS0ID_OBJECTSFOLDER. Requires permissionvnx.opc_ua.permission_e.CALL.
-
Variant
object_call(pair<ushort, Variant> object, string method, vector<Variant> args) const¶ Calls a
methodon theobjectwith the given arguments and returns the result. Requires permissionvnx.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
variableof theobject.
-
void
write_variable(pair<ushort, Variant> node, Variant value)¶ Writes a value to the given global variable
node. Requires permissionvnx.opc_ua.permission_e.WRITE.
-
void
write_object_variable(pair<ushort, Variant> object, string variable, Variant value)¶ Writes a value to the given
variableof theobject. Requires permissionvnx.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.