QuickOPC 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.72.465.1, 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.72.465.1, 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.72.465.1, 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 EasyUASharedParameters.EngineParameters property of static OpcLabs.EasyOpc.UA.EasyUAClientCore.SharedParameters.

 

Introduction

QuickOPC 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. As QuickOPC controls the connections and diconnections 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.

Interaction Types

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

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

Interaction Providers

The way QuickOPC presents the unsolicited user interaction depends on the environment your application is running in. There is an interaction provider for each such supported environment. QuickOPC 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.

Example

// This example shows how to completely turn off interaction in a console application.

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.

# 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, QuickOPC 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