OPC Studio User's Guide and Reference
UAUserInteractionParameters Class
Members 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Engine Namespace : UAUserInteractionParameters Class
Contains parameters that influence the interaction of the component with the user.
Object Model
UAUserInteractionParameters ClassUAUserInteractionParameters Class
Syntax
'Declaration
 
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.UA.Engine.ComTypes._UAUserInteractionParameters)>
<ComVisibleAttribute(True)>
<GuidAttribute("61BBC839-F826-4A00-A6D3-8C1E86B28580")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<CLSCompliantAttribute(True)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.81.0.48, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public Class UAUserInteractionParameters 
   Inherits OpcLabs.BaseLib.Parameters
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.ComTypes._Parameters, OpcLabs.EasyOpc.UA.Engine.ComTypes._UAUserInteractionParameters, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As UAUserInteractionParameters
[ComDefaultInterface(OpcLabs.EasyOpc.UA.Engine.ComTypes._UAUserInteractionParameters)]
[ComVisible(true)]
[Guid("61BBC839-F826-4A00-A6D3-8C1E86B28580")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[CLSCompliant(true)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.81.0.48, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public class UAUserInteractionParameters : OpcLabs.BaseLib.Parameters, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.ComTypes._Parameters, OpcLabs.EasyOpc.UA.Engine.ComTypes._UAUserInteractionParameters, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[ComDefaultInterface(OpcLabs.EasyOpc.UA.Engine.ComTypes._UAUserInteractionParameters)]
[ComVisible(true)]
[Guid("61BBC839-F826-4A00-A6D3-8C1E86B28580")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[CLSCompliant(true)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.81.0.48, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class UAUserInteractionParameters : public OpcLabs.BaseLib.Parameters, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.ComTypes._Parameters, OpcLabs.EasyOpc.UA.Engine.ComTypes._UAUserInteractionParameters, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks

In order to obtain or modify these parameters, access the UAClientServerEngineParameters.UserInteractionParameters property of EasyUAClientSharedParameters.EngineParameters property of static OpcLabs.EasyOpc.UA.EasyUAClientCore.SharedParameters.

 

Introduction

OPC Studio components may, under certain circumstances, display a user interface "by itself", without you having to make a specific method call. Such unsolicited user interaction only happens when the current process is running in user interactive mode, as reported by the Environment.UserInteractive Property. In non-interactive mode, the components assume reasonable default user responses. In addition, you can turn off specific user interactions by setting corresponding parameters in the code.

Usually, these are notifications or confirmations related to conditions that cannot be anticipated upfront, such as the certificate exchange in the OPC UA connection process.

In QuickOPC applications, the component controls the connections and disconnections automatically, and when subscriptions are in effect, also makes re-connections, you - as a developer - cannot generally predict when such user interaction may be needed. In OPC Wizard applications, the OPC UA clients that use your server are in control of connections and disconnections, and the user interaction associated with such connections can also happen at any time.

Interaction Types

There are following situations that may trigger an unsolicited user interaction related to OPC Unified Architecture (OPC UA) operations:

For an OPC UA client, the "peer" is an OPC UA server. For an OPC UA server, the "peer" is an OPC UA client.

There is no unsolicited user interaction related to OPC Classic operations.

Controlling the Interaction

In QuickOPC applications, the individual interaction types can be controlled as follows:

In OPC Wizard applications, the individual interaction types can be controlled as follows:

Interaction Providers

The way OPC Studio presents the unsolicited user interaction depends on the environment your application is running in. There is an interaction provider for each such supported environment. An application developed with OPC Studio interrogates the available interaction providers to see which one should perform the interaction, selects the appropriate interaction provider and then uses it to actually communicate with the user. Following interaction providers are available:

Each interaction provider (except for the Null Interaction Provider) can be turned on or off, and may have additional configurable parameters.

Examples

The example is provided for client-side development (QuickOPC). The same principle can be used with server-side development (OPC Wizard). You will use the EasyUAServer Class instead of the EasyUAClient Class in that case.

.NET

// This example shows how to completely turn off interaction in a console application.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.Engine;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples.Interaction
{
    partial class ConsoleInteraction
    {
        public static void TurnOff()
        {
            // Do not implicitly trust any endpoint URLs. 
            EasyUAClient.SharedParameters.EngineParameters.CertificateAcceptancePolicy.TrustedEndpointUrlStrings.Clear();

            // Completely disable the console interaction.
            EasyUAClient.SharedParameters.PluginSetups.FindName("UAConsoleInteraction").Enabled = false;

            // Define which server we will work with.
            UAEndpointDescriptor endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // Require secure connection, in order to enforce the certificate check.
            endpointDescriptor.EndpointSelectionPolicy = UAMessageSecurityModes.Secure;
            
            // Instantiate the client object.
            var client = new EasyUAClient();

            UAAttributeData attributeData;
            try
            {
                // Obtain attribute data.
                // The operation will fail, unless you set up mutual trust using certificate stores.
                attributeData = client.Read(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853");
            }
            catch (UAException uaException)
            {
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                return;
            }

            // Display results.
            Console.WriteLine("Value: {0}", attributeData.Value);
            Console.WriteLine("ServerTimestamp: {0}", attributeData.ServerTimestamp);
            Console.WriteLine("SourceTimestamp: {0}", attributeData.SourceTimestamp);
            Console.WriteLine("StatusCode: {0}", attributeData.StatusCode);
        }
    }
}
' This example shows how to completely turn off interaction in a console application.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.Engine
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace Interaction
    Partial Friend Class ConsoleInteraction
        Public Shared Sub TurnOff()
            ' Do not implicitly trust any endpoint URLs. 
            EasyUAClient.SharedParameters.EngineParameters.CertificateAcceptancePolicy.TrustedEndpointUrlStrings.Clear()

            ' Completely disable the console interaction.
            EasyUAClient.SharedParameters.PluginSetups.FindName("UAConsoleInteraction").Enabled = False

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' Require secure connection, in order to enforce the certificate check.
            endpointDescriptor.EndpointSelectionPolicy = UAMessageSecurityModes.Secure

            ' Instantiate the client object.
            Dim client = New EasyUAClient()

            Dim attributeData As UAAttributeData
            Try
                ' Obtain attribute data.
                ' The operation will fail, unless you set up mutual trust using certificate stores.
                attributeData = client.Read(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853")
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results.
            Console.WriteLine("Value: {0}", attributeData.Value)
            Console.WriteLine("ServerTimestamp: {0}", attributeData.ServerTimestamp)
            Console.WriteLine("SourceTimestamp: {0}", attributeData.SourceTimestamp)
            Console.WriteLine("StatusCode: {0}", attributeData.StatusCode)
        End Sub
    End Class
End Namespace

Python

# This example shows how to completely turn off interaction in a console application.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.Engine import *
from OpcLabs.EasyOpc.UA.OperationModel import *


# Do not implicitly trust any endpoint URLs. We want the user be asked explicitly.
EasyUAClient.SharedParameters.EngineParameters.CertificateAcceptancePolicy.TrustedEndpointUrlStrings.Clear()

# Completely disable the console interaction.
EasyUAClient.SharedParameters.PluginSetups.FindName('UAConsoleInteraction').Enabled = False

# Define which server we will work with.
endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# Require secure connection, in order to enforce the certificate check.
endpointDescriptor.EndpointSelectionPolicy = UAEndpointSelectionPolicy(UAMessageSecurityModes.Secure)

# Instantiate the client object.
client = EasyUAClient()

try:
    # Obtain attribute data.
    # The operation will fail, unless you set up mutual trust using certificate stores.
    attributeData = IEasyUAClientExtension.Read(client,
                                                endpointDescriptor,
                                                UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853'))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
print('Value: ', attributeData.Value)
print('ServerTimestamp: ', attributeData.ServerTimestamp)
print('SourceTimestamp: ', attributeData.SourceTimestamp)
print('StatusCode: ', attributeData.StatusCode)

print()
print('Finished.')

Interaction and Blocking

All unsolicited user interaction (with exception of rare messages and confirmations related to client application instance certificate checks) has a timeout associated with it, and a default user response is assumed should the user not respond in time. This means that under normal circumstances, the current activity cannot be blocked indefinitely if the user fails to respond. In fact, this behavior also guarantees that the activity will eventually proceed even if the Environment.UserInteractive Property incorrectly claimed that the process is running in user interactive mode. The timeout is configurable by the AcceptNotificationTimeout Property in the UAUserInteractionParameters Class. In order to obtain or modify this parameter, access the UserInteractionParameters Property of EngineParameters Property of EasyUAClient.SharedParameters Property.

Interaction and Licensing

When there is a problem with the license key, or when the trial license runtime expires. Instead, such problems are primarily reported as other errors, using the channels for the programming model used. For example, in Imperative Programming Model, the single-argument method throws an exception, a multiple-argument method returns the error in the Exception Property of the OperationResult Class, or with subscriptions, the error is reported in the Exception Property of the OperationEventArgs Class. It is up to the calling code to handle such situations.

In addition, in Windows Forms applications and certain other Windows desktop application, OPC Studio components display a notification in Windows system tray for certain license-related issues:

 

 

Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.BaseLib.Parameters
            OpcLabs.EasyOpc.UA.Engine.UAUserInteractionParameters

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also