.. _vnx.opc_ua.Proxy: vnx.opc_ua.Proxy ================ .. cpp:namespace:: 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 ------- .. cpp:member:: string address OPC-UA server url to connect to, for example ``opc.tcp://127.0.0.1:4840``. .. cpp:member:: string username Optional user name for server login. .. cpp:member:: string password Password for server login, required when ``username`` is set. .. cpp:member:: int connect_interval_ms = 1000 Interval to check for connection loss and reconnect. 0 to disable. .. cpp::member:: int response_timeout_ms = 5000 Response timeout in ms .. cpp:member:: int session_timeout_ms = 86400000 Session timeout in ms. .. cpp:member:: int keepalive_interval_ms = 10000 Connectivity check interval in ms. .. cpp:member:: int secure_channel_lifetime_ms = 600000 Secure channel life time in ms. .. cpp:member:: string certificate_file = "" Optional path to a client certificate file (DER format). .. cpp:member:: string private_key_file = "" Optional path to a client private key file (DER format). .. cpp:member:: string application_name = "pilot.opc_ua.proxy" Optional application name. .. cpp:member:: string application_uri = "urn:open62541.client.application" Must match the URI in the certificate. .. cpp:member:: vector trust_list Server certificate trust files (CRL format). This only has an effect if a client certificate is configured. If the list is empty, any certificate is accepted. .. cpp:member:: security_mode_e security_mode = ANY Required security for connections. See :ref:`vnx.opc_ua.security_mode_e`. .. cpp:member:: vector subscriptions A list of subscriptions to create on connect. See :ref:`vnx.opc_ua.subscription_t`. .. cpp:member:: bool block_until_connect = true If to block client requests until first sucessful connect. .. cpp:member:: 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``, 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``. See also :ref:`vnx.Variant`. .. cpp:function:: Variant call(string method, vector 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``. .. cpp:function:: Variant object_call(pair object, string method, vector args) const Calls a ``method`` on the ``object`` with the given arguments and returns the result. Requires permission ``vnx.opc_ua.permission_e.CALL``. .. cpp:function:: Variant read_variable(pair node) const Reads the value of a given variable ``node``. .. cpp:function:: Variant read_object_variable(pair object, string variable) const Reads the value of a given ``variable`` of the ``object``. .. cpp:function:: void write_variable(pair node, Variant value) Writes a value to the given global variable ``node``. Requires permission ``vnx.opc_ua.permission_e.WRITE``. .. cpp:function:: void write_object_variable(pair object, string variable, Variant value) Writes a value to the given ``variable`` of the ``object``. Requires permission ``vnx.opc_ua.permission_e.WRITE``. .. cpp:function:: void browse_all() Finds all available objects and variables on the server. Will be done automatically on every connect and re-connect.