QuickOPC User's Guide and Reference
QuerySourceConditions Method (IEasyAEClient)
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.AlarmsAndEvents Namespace > IEasyAEClient Interface : QuerySourceConditions Method
The OPC server involved in the operation.
A source node descriptor, usually expressed as qualified source name. Only the conditions associated with this source are returned.
Finds out event conditions associated with the specified source name. Uses server descriptor for specifying the OPC server.
Syntax
'Declaration
 
<ElementsNotNullAttribute()>
<NotNullAttribute()>
Function QuerySourceConditions( _
   ByVal serverDescriptor As ServerDescriptor, _
   ByVal sourceNodeDescriptor As AENodeDescriptor _
) As AEConditionElementCollection
'Usage
 
Dim instance As IEasyAEClient
Dim serverDescriptor As ServerDescriptor
Dim sourceNodeDescriptor As AENodeDescriptor
Dim value As AEConditionElementCollection
 
value = instance.QuerySourceConditions(serverDescriptor, sourceNodeDescriptor)
[ElementsNotNull()]
[NotNull()]
AEConditionElementCollection QuerySourceConditions( 
   ServerDescriptor serverDescriptor,
   AENodeDescriptor sourceNodeDescriptor
)

Parameters

serverDescriptor
The OPC server involved in the operation.
sourceNodeDescriptor
A source node descriptor, usually expressed as qualified source name. Only the conditions associated with this source are returned.

Return Value

A collection of condition elements, one element for each condition of the given source.
Exceptions
ExceptionDescription
The OPC "Classic" (or OPC XML-DA) operation has failed.
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
Example
// 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
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

IEasyAEClient Interface
IEasyAEClient Members