QuickOPC User's Guide and Reference
_EasyUAServerConditionChangedEventArgs Interface
Members  Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.OperationModel.ComTypes Namespace : _EasyUAServerConditionChangedEventArgs Interface
Exposes OpcLabs.EasyOpc.UA.OperationModel.EasyUAServerConditionChangedEventArgs to COM clients.
Object Model
_EasyUAServerConditionChangedEventArgs InterfaceExceptionCollection ClassUAEndpointDescriptor ClassNormalizedExceptionCollection ClassNormalizedException ClassNormalizedException ClassConnectedConditionStatistics Class
Syntax
'Declaration
 
<CLSCompliantAttribute(False)>
<ComVisibleAttribute(True)>
<GuidAttribute("EB380053-871B-4F51-932E-CB1E25C5154C")>
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)>
Public Interface _EasyUAServerConditionChangedEventArgs 
[CLSCompliant(false)]
[ComVisible(true)]
[Guid("EB380053-871B-4F51-932E-CB1E25C5154C")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface _EasyUAServerConditionChangedEventArgs 
[CLSCompliant(false)]
[ComVisible(true)]
[Guid("EB380053-871B-4F51-932E-CB1E25C5154C")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface class _EasyUAServerConditionChangedEventArgs 
Example

COM

Rem This example shows how to monitor connections to and disconnections from the OPC UA server with event pull mechanism.

Option Explicit

' Instantiate the client object.
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")

' Obtain the client connection monitoring service.
Dim ClientConnectionMonitoring: Set ClientConnectionMonitoring = Client.GetServiceByName("OpcLabs.EasyOpc.UA.Services.IEasyUAClientConnectionMonitoring, OpcLabs.EasyOpcUA")
If ClientConnectionMonitoring Is Nothing Then
    WScript.Echo "The client connection monitoring service is not available."
    WScript.Quit
End If

' In order to use event pull, you must set a non-zero queue capacity upfront.
ClientConnectionMonitoring.PullServerConditionChangedQueueCapacity = 1000

WScript.Echo "Reading (1)"
' The first read will cause a connection to the server.
Dim AttributeData1: Set AttributeData1 = Client.Read("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10853")
WScript.Echo AttributeData1

WScript.Echo "Reading (2)"
' The second read, because it closely follows the first one, will reuse the connection that is already open.
Dim AttributeData2: Set AttributeData2 = Client.Read("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10853")
WScript.Echo AttributeData2

WScript.Echo "Processing server condition changed events for 10 seconds..."
' Because we only started the processing after we have made the reads, there are now events related to opening the 
' connection already in the queue, and they will be consumed first.
' Since the connection is now not used for some time, it will be closed.
Dim endTime: endTime = Now() + 10*(1/24/60/60)
Do
    Dim EventArgs: Set EventArgs = ClientConnectionMonitoring.PullServerConditionChanged(2*1000)
    If Not (EventArgs Is Nothing) Then
        ' Handle the server condition changed event.
        WScript.Echo EventArgs
    End If    
Loop While Now() < endTime

WScript.Echo "Finished."
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