Connectivity Software User's Guide and Reference
_AESubscriptionFilter Interface
Members  Example 



OpcLabs.EasyOpcClassicCore Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.ComTypes Namespace : _AESubscriptionFilter Interface
Exposes OpcLabs.EasyOpc.AlarmsAndEvents.AESubscriptionFilter to COM clients.
Object Model
_AESubscriptionFilter InterfaceAEEventType Class
Syntax
'Declaration
 
<CLSCompliantAttribute(False)>
<ComVisibleAttribute(True)>
<GuidAttribute("B92E22F2-6DA2-4755-9842-3BE9F7139BF1")>
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)>
Public Interface _AESubscriptionFilter 
'Usage
 
Dim instance As _AESubscriptionFilter
[CLSCompliant(false)]
[ComVisible(true)]
[Guid("B92E22F2-6DA2-4755-9842-3BE9F7139BF1")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface _AESubscriptionFilter 
[CLSCompliant(false)]
[ComVisible(true)]
[Guid("B92E22F2-6DA2-4755-9842-3BE9F7139BF1")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface class _AESubscriptionFilter 
Remarks

This member or type is for use from COM. It is not meant to be used from .NET or Python. Refer to the corresponding .NET member or type instead, if you are developing in .NET or Python.

Example

COM

Rem This example shows how to set the filtering criteria to be used for the event subscription.
Rem
Rem Find all latest examples here: https://www.doc-that.com/files/onlinedocs/OPCLabs-ConnectivityStudio/Latest/examples.html .
Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-ConnectivityStudio-VBScript .
Rem Missing some example? Ask us for it on our Online Forums, https://forum.opclabs.com/forum/index ! You do not have to own
Rem a commercial license in order to use Online Forums, and we reply to every post.

Option Explicit

Dim DAClient: Set DAClient = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
Dim AEClient: Set AEClient = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient")
WScript.ConnectObject AEClient, "AEClient_"

WScript.Echo "Processing event notifications..."
Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"
Dim SubscriptionFilter: Set SubscriptionFilter = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AESubscriptionFilter")
Dim SourceDescriptor1: Set SourceDescriptor1 = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AENodeDescriptor")
SourceDescriptor1.QualifiedName = "Simulation.ConditionState1"
Dim SourceDescriptor2: Set SourceDescriptor2 = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AENodeDescriptor")
SourceDescriptor2.QualifiedName = "Simulation.ConditionState3"
SubscriptionFilter.Sources = Array(SourceDescriptor1, SourceDescriptor2)
Rem You can also filter using event types, categories, severity, and areas.
Dim SubscriptionParameters: Set SubscriptionParameters = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AESubscriptionParameters")
SubscriptionParameters.Filter = SubscriptionFilter
SubscriptionParameters.NotificationRate = 1000
Dim handle: handle = AEClient.SubscribeEvents(ServerDescriptor, SubscriptionParameters, True, Nothing)

Rem Allow time for initial refresh
WScript.Sleep 5*1000

WScript.Echo "Set some events to active state..."
On Error Resume Next
Rem The activation below will come from a source contained in a filter and the notification will arrive.
DAClient.WriteItemValue "", "OPCLabs.KitServer.2", "SimulateEvents.ConditionState1.Activate", True
Rem The activation below will come from a source that is not contained in a filter and the notification will not arrive.
DAClient.WriteItemValue "", "OPCLabs.KitServer.2", "SimulateEvents.ConditionState2.Activate", True
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

WScript.Sleep 10*1000

WScript.Echo "Unsubscribing..."
AEClient.UnsubscribeEvents handle



Rem Notification event handler
Sub AEClient_Notification(Sender, e)
    If Not (e.Succeeded) Then
        WScript.Echo "*** Failure: " & e.ErrorMessageBrief
        Exit Sub
    End If

    WScript.Echo 
    WScript.Echo "Refresh: " & e.Refresh
    WScript.Echo "RefreshComplete: " & e.RefreshComplete

    If Not (e.EventData Is Nothing) Then
        With e.EventData
            WScript.Echo "EventData.QualifiedSourceName: " & .QualifiedSourceName
            WScript.Echo "EventData.Message: " & .Message
            WScript.Echo "EventData.Active: " & .Active
            WScript.Echo "EventData.Acknowledged: " & .Acknowledged
        End With
    End If
End Sub
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