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



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.AlarmsAndEvents Namespace > EasyAEClient Class : 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
 
Public Function QuerySourceConditions( _
   ByVal serverDescriptor As ServerDescriptor, _
   ByVal sourceNodeDescriptor As AENodeDescriptor _
) As AEConditionElementCollection
'Usage
 
Dim instance As EasyAEClient
Dim serverDescriptor As ServerDescriptor
Dim sourceNodeDescriptor As AENodeDescriptor
Dim value As AEConditionElementCollection
 
value = instance.QuerySourceConditions(serverDescriptor, 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
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
The OPC "Classic" (or OPC XML-DA) operation has failed.
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 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 R2, Windows Server 2016; .NET: Linux, macOS, Microsoft Windows

See Also