OpcUaSupport

OpcUaSupport — provides helper methods for communicating with the OPC UA plugin.

Synopsis

class OpcUaSupport
{
    app;
    pluginName = "OPCUA";
    pluginInstance;
}
    

Instance Variables

app

The Application instance used for event handling and communication with the DataHub.

pluginName

Default value: "OPCUA". The name of the OPC UA plugin. The default value is "OPCUA" and is used to construct plugin command strings.

pluginInstance

The name of the OPC UA connection instance that this support object communicates with.

Methods

constructor(app, connectionName)

This method is invoked by the new operator when creating an instance of the class. It initializes the OpcUaSupport instance by storing the Application instance and the OPC UA connection name. These are used by all subsequent method calls to communicate with the correct plugin instance. The app argument is normally assigned the built-in application instance variable “self”.

EnableClients(enabled)

Globally enables or disables all OPC UA client connections by sending a UAEnableClient command. The enable state of individual connections is not modified by this method. The enabled parameter is normalized to a boolean before sending the command.

EnableServer(enabled)

Enables or disables the OPC UA server by sending a UAEnableServer command. The enabled parameter is normalized to a boolean before sending the command.

AddMethod(triggerPoint, feedbackPoint, parentNodePath, methodName, triggerType, args?...=nil)

Creates an OPC UA method call that is automatically invoked whenever the value of the trigger data point changes, depending on the trigger type chosen.

AddMethod2(triggerPoint, feedbackPoint, parentNodePath, methodName, triggerType, onSuccess, onFailure, args?...=nil)

Creates an OPC UA method call bound to a triggering data point, with additional onSuccess and onFailure callback expressions. This works the same as AddMethod, but when the method call completes, the onSuccess expression is evaluated on success or the onFailure expression on failure. During callback evaluation, the variables uaMethod, args, result, and _last_error_ are available.