OPC Studio User's Guide and Reference
PluginSetup Class
Members  Example 



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Extensibility Namespace : PluginSetup Class
Parameters of a plug-in setup.
Object Model
PluginSetup ClassPluginSetup Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.BaseLib.Extensibility.ComTypes._PluginSetup)>
<ComVisibleAttribute(True)>
<GuidAttribute("781363FD-60BD-4529-89B8-1A66BEABA315")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public Class PluginSetup 
   Inherits OpcLabs.BaseLib.Parameters
   Implements OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.ComTypes._Parameters, OpcLabs.BaseLib.Extensibility.ComTypes._PluginSetup, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As PluginSetup
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.BaseLib.Extensibility.ComTypes._PluginSetup)]
[ComVisible(true)]
[Guid("781363FD-60BD-4529-89B8-1A66BEABA315")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public class PluginSetup : OpcLabs.BaseLib.Parameters, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.ComTypes._Parameters, OpcLabs.BaseLib.Extensibility.ComTypes._PluginSetup, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.BaseLib.Extensibility.ComTypes._PluginSetup)]
[ComVisible(true)]
[Guid("781363FD-60BD-4529-89B8-1A66BEABA315")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class PluginSetup : public OpcLabs.BaseLib.Parameters, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.ComTypes._Parameters, OpcLabs.BaseLib.Extensibility.ComTypes._PluginSetup, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Example

.NET

.NET

COM

// 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 .

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 Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# 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.')
' 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 .

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
// Shows how to disable and enable the OPC UA Complex Data plug-in.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace UADocExamples.ComplexData._PluginSetup
{
    class Enabled
    {
        public static void Main1()
        {
            // Define which server and node we will work with.
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"
            UANodeDescriptor nodeDescriptor =
                "nsu=http://test.org/UA/Data/ ;i=10239"; // [ObjectsFolder]/Data.Static.Scalar.StructureValue


            // We will explicitly disable the Complex Data plug-in, and read a node which returns complex data. We will 
            // receive an object of type UAExtensionObject, which contains the encoded data in its binary form. In this 
            // form, the data cannot be easily further processed by your application.
            //
            // Disabling the Complex Data plug-in may be useful e.g. for licensing reasons (when the product edition you 
            // have does not support the Complex Data plug-in, and you want to avoid the associated error), or for
            // performance reasons (if you do not need the internal content of the value, for example if your code just
            // needs to take the value read, and write it elsewhere).

            var client1 = new EasyUAClient();
            client1.InstanceParameters.PluginSetups.FindName("UAComplexDataClient").Enabled = false;

            object value1;
            try
            {
                value1 = client1.ReadValue(endpointDescriptor, nodeDescriptor);
            }
            catch (UAException uaException)
            {
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                return;
            }
            Console.WriteLine(value1);


            // Now we will read the same value, but with the Complex Data plug-in enabled. This time we will receive an
            // object of type UAGenericObject, which contains the data in the decoded form, accessible for further 
            // processing by your application.
            //
            // Note that it is not necessary to explicitly enable the Complex Data plug-in like this, because it is enabled
            // by default.

            var client2 = new EasyUAClient();
            client2.InstanceParameters.PluginSetups.FindName("UAComplexDataClient").Enabled = true;

            object value2 = client2.ReadValue(endpointDescriptor, nodeDescriptor);
            Console.WriteLine(value2);


            // Example output:
            //
            // Binary Byte[1373]; {nsu=http://test.org/UA/Data/ ;i=11437}
            // (ScalarValueDataType) structured

            // On the first line, the type and length of the encoded data is shown, and the node ID is the encoding ID.
            // On the 2nd line, the kind (structured) and the name of the complex data type (ScalarValueDataType) is shown.
        }
    }
}
# Shows how to disable and enable the OPC UA Complex Data plug-in.
#
# 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 .
# 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.OperationModel import *


endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'

# [ObjectsFolder]/Data.Static.Scalar.StructureValue
nodeDescriptor = UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10239')


# We will explicitly disable the Complex Data plug-in, and read a node which returns complex data. We will
# receive an object of type UAExtensionObject, which contains the encoded data in its binary form. In this
# form, the data cannot be easily further processed by your application.
#
# Disabling the Complex Data plug-in may be useful e.g. for licensing reasons (when the product edition you
# have does not support the Complex Data plug-in, and you want to avoid the associated error), or for
# performance reasons (if you do not need the internal content of the value, for example if your code just
# needs to take the value read, and write it elsewhere).

client1 = EasyUAClient()
client1.InstanceParameters.PluginSetups.FindName('UAComplexDataClient').Enabled = False

try:
    value1 = IEasyUAClientExtension.ReadValue(client1, endpointDescriptor, nodeDescriptor)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()
print(value1)


# Now we will read the same value, but with the Complex Data plug-in enabled. This time we will receive an
# object of type UAGenericObject, which contains the data in the decoded form, accessible for further
# processing by your application.
#
# Note that it is not necessary to explicitly enable the Complex Data plug-in like this, because it is enabled
# by default.

client2 = EasyUAClient()
client2.InstanceParameters.PluginSetups.FindName('UAComplexDataClient').Enabled = True

try:
    value2 = IEasyUAClientExtension.ReadValue(client2, endpointDescriptor, nodeDescriptor)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()
print(value2)

print()
print('Finished.')
' Shows how to disable and enable the OPC UA Complex Data plug-in.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports System
Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace ComplexData._PluginSetup

    Friend Class Enabled

        Public Shared Sub Main1()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            ' Define which node we will work with.
            Dim nodeDescriptor As UANodeDescriptor = _
                "nsu=http://test.org/UA/Data/ ;i=10239"  ' [ObjectsFolder]/Data.Static.Scalar.StructureValue


            ' We will explicitly disable the Complex Data plug-in, and read a node which returns complex data. We will 
            ' receive an object of type UAExtensionObject, which contains the encoded data in its binary form. In this 
            ' form, the data cannot be easily further processed by your application.
            '
            ' Disabling the Complex Data plug-in may be useful e.g. for licensing reasons (when the product edition you 
            ' have does not support the Complex Data plug-in, and you want to avoid the associated error), or for
            ' performance reasons (if you do not need the internal content of the value, for example if your code just
            ' needs to take the value read, and write it elsewhere).

            Dim client1 = New EasyUAClient
            client1.InstanceParameters.PluginSetups.FindName("UAComplexDataClient").Enabled = False

            Dim value1 As Object
            Try
                value1 = client1.ReadValue(endpointDescriptor, nodeDescriptor)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try
            Console.WriteLine(value1)


            ' Now we will read the same value, but with the Complex Data plug-in enabled. This time we will receive an
            ' object of type UAGenericObject, which contains the data in the decoded form, accessible for further 
            ' processing by your application.
            '
            ' Note that it is not necessary to explicitly enable the Complex Data plug-in like this, because it is enabled
            ' by default.

            Dim client2 = New EasyUAClient
            client2.InstanceParameters.PluginSetups.FindName("UAComplexDataClient").Enabled = True

            Dim value2 As Object
            Try
                value2 = client2.ReadValue(endpointDescriptor, nodeDescriptor)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try
            Console.WriteLine(value2)


            ' Example output:
            '
            ' Binary Byte[1373]; {nsu=http://test.org/UA/Data/ ;i=11437}
            ' (ScalarValueDataType) structured

            ' On the first line, the type and length of the encoded data is shown, and the node ID is the encoding ID.
            ' On the 2nd line, the kind (structured) and the name of the complex data type (ScalarValueDataType) is shown.
        End Sub
    End Class
End Namespace
// Shows how to disable and enable the OPC UA Complex Data plug-in.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure Enabled.Main;
var
  Client1, Client2: _EasyUAClient;
  EndpointDescriptor: string;
  NodeDescriptor: string;
  Value1, Value2: OleVariant;
begin
  // Define which server and node we will work with.
  EndpointDescriptor := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  NodeDescriptor := 'nsu=http://test.org/UA/Data/ ;i=10239';  // [ObjectsFolder]/Data.Static.Scalar.StructureValue

  // We will explicitly disable the Complex Data plug-in, and read a node which returns complex data. We will
  // receive an object of type UAExtensionObject, which contains the encoded data in its binary form. In this
  // form, the data cannot be easily further processed by your application.
  //
  // Disabling the Complex Data plug-in may be useful e.g. for licensing reasons (when the product edition you
  // have does not support the Complex Data plug-in, and you want to avoid the associated error), or for
  // performance reasons (if you do not need the internal content of the value, for example if your code just
  // needs to take the value read, and write it elsewhere).
  Client1 := CoEasyUAClient.Create;
  Client1.InstanceParameters.PluginSetups.FindName('UAComplexDataClient').Enabled := false;

  try
    Value1 := Client1.ReadValue(EndpointDescriptor, NodeDescriptor);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;
  WriteLn(Value1);

  // Now we will read the same value, but with the Complex Data plug-in enabled. This time we will receive an
  // object of type UAGenericObject, which contains the data in the decoded form, accessible for further
  // processing by your application.
  //
  // Note that it is not necessary to explicitly enable the Complex Data plug-in like this, because it is enabled
  // by default.

  Client2 := CoEasyUAClient.Create;
  Client2.InstanceParameters.PluginSetups.FindName('UAComplexDataClient').Enabled := true;

  Value2 := Client2.ReadValue(EndpointDescriptor, NodeDescriptor);
  WriteLn(Value2);

  // Example output:
  //
  // Binary Byte[1373]; {nsu=http://test.org/UA/Data/ ;i=11437}
  // (ScalarValueDataType) structured

  // On the first line, the type and length of the encoded data is shown, and the node ID is the encoding ID.
  // On the 2nd line, the kind (structured) and the name of the complex data type (ScalarValueDataType) is shown.

end;
Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.BaseLib.Parameters
            OpcLabs.BaseLib.Extensibility.PluginSetup

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