QuickOPC User's Guide and Reference
AEConditionElement Class
Members  Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace Namespace : AEConditionElement Class
Contains information gathered about an OPC event condition.
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement)>
<ComVisibleAttribute(True)>
<FacetAttribute("OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Implementation.AEConditionElementContent, OpcLabs.EasyOpcForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   OpcLabs.BaseLib.Media.IContent, 
   "{A1DB0591-3E22-43A2-A072-2B76C04BE0C0}")>
<GuidAttribute("B25B39BE-F13F-42F3-972C-9AF835A4E383")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public NotInheritable Class AEConditionElement 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As AEConditionElement
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement)]
[ComVisible(true)]
[Facet("OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Implementation.AEConditionElementContent, OpcLabs.EasyOpcForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   OpcLabs.BaseLib.Media.IContent, 
   "{A1DB0591-3E22-43A2-A072-2B76C04BE0C0}")]
[Guid("B25B39BE-F13F-42F3-972C-9AF835A4E383")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public sealed class AEConditionElement : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement)]
[ComVisible(true)]
[Facet("OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Implementation.AEConditionElementContent, OpcLabs.EasyOpcForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   OpcLabs.BaseLib.Media.IContent, 
   "{A1DB0591-3E22-43A2-A072-2B76C04BE0C0}")]
[Guid("B25B39BE-F13F-42F3-972C-9AF835A4E383")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.63.115.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class AEConditionElement sealed : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.ComTypes._AEConditionElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks
This object is filled in and returned e.g. when you query for OPC event categories.

 

The EasyAEClient.QueryCategoryConditions method finds out out event conditions supported by given event category.

 

The EasyAEClient.QuerySourceConditions method finds out event conditions associated with the given event source.

// This example shows how to enumerate all event conditions associated with the specified event source.

using System;
using System.Diagnostics;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class QuerySourceConditions 
    { 
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AEConditionElementCollection conditionElements;
            try
            {
                conditionElements = client.QuerySourceConditions("", "OPCLabs.KitEventServer.2", 
                    "Simulation.ConditionState1");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AEConditionElement conditionElement in conditionElements)
            {
                Debug.Assert(conditionElement != null);
                Console.WriteLine("ConditionElements[\"{0}\"]: {1} subcondition(s)", 
                    conditionElement.Name, conditionElement.SubconditionNames.Length);
            }
        }
    } 
}
' This example shows how to enumerate all event conditions associated with the specified event source.

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents._EasyAEClient

    Friend Class QuerySourceConditions
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim conditionElements As AEConditionElementCollection
            Try
                conditionElements = client.QuerySourceConditions( _
                    "", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each conditionElement As AEConditionElement In conditionElements
                Debug.Assert(conditionElement IsNot Nothing)
                Console.WriteLine("ConditionElements[""{0}""]: {1} subcondition(s)", _
                                  conditionElement.Name, conditionElement.SubconditionNames.Length)
            Next conditionElement
        End Sub
    End Class

End Namespace
Rem This example shows how to enumerate all event conditions associated with the specified event source.

Option Explicit

Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

Dim SourceDescriptor: Set SourceDescriptor = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AENodeDescriptor")
SourceDescriptor.QualifiedName = "Simulation.ConditionState1"

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient")
On Error Resume Next
Dim ConditionElements: Set ConditionElements = Client.QuerySourceConditions(ServerDescriptor, SourceDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim ConditionElement: For Each ConditionElement In ConditionElements
    WScript.Echo "ConditionElements(" & ConditionElement.Name & "): " & (UBound(ConditionElement.SubconditionNames) + 1) & " subcondition(s)"
Next

 

 

 

 

Example
// This example shows information available about OPC event condition.

using System;
using System.Diagnostics;
using System.Collections.Generic;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._AEConditionElement 
{ 
    class Properties 
    {
        static void DumpSubconditionNames(IEnumerable<string> subconditionNames)
        {
            foreach (string name in subconditionNames) Console.WriteLine("            {0}", name);
        }

        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AECategoryElementCollection categoryElements;
            try
            {
                categoryElements = client.QueryEventCategories("", "OPCLabs.KitEventServer.2");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AECategoryElement categoryElement in categoryElements)
            {
                Debug.Assert(categoryElement != null);

                Console.WriteLine("Category {0}:", categoryElement);
                foreach (AEConditionElement conditionElement in categoryElement.ConditionElements)
                {
                    Debug.Assert(conditionElement != null);

                    Console.WriteLine("    Information about condition \"{0}\":", conditionElement);
                    Console.WriteLine("        .Name: {0}", conditionElement.Name);
                    Console.WriteLine("        .SubconditionNames:");
                    DumpSubconditionNames(conditionElement.SubconditionNames);
                }
            }
        }
    } 
}
' This example shows information available about OPC event condition.

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents._AEConditionElement

    Friend Class Properties
        Private Shared Sub DumpSubconditionNames(ByVal subconditionNames As IEnumerable(Of String))
            For Each name As String In subconditionNames
                Console.WriteLine("            {0}", name)
            Next name
        End Sub

        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim categoryElements As AECategoryElementCollection
            Try
                categoryElements = client.QueryEventCategories("", "OPCLabs.KitEventServer.2")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each categoryElement As AECategoryElement In categoryElements
                Debug.Assert(categoryElement IsNot Nothing)

                Console.WriteLine("Category {0}:", categoryElement)
                For Each conditionElement As AEConditionElement In categoryElement.ConditionElements
                    Debug.Assert(conditionElement IsNot Nothing)

                    Console.WriteLine("    Information about condition ""{0}"":", conditionElement)
                    Console.WriteLine("        .Name: {0}", conditionElement.Name)
                    Console.WriteLine("        .SubconditionNames:")
                    DumpSubconditionNames(conditionElement.SubconditionNames)
                Next conditionElement
            Next categoryElement
        End Sub
    End Class

End Namespace
Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.AEConditionElement

Requirements

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

See Also

Reference

AEConditionElement Members
OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace Namespace