OPC Studio User's Guide and Reference
GetMonitoredItemArgumentsDictionary Method (_EasyUAClient)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.ComTypes Namespace > _EasyUAClient Interface : GetMonitoredItemArgumentsDictionary Method
Obtains parameters of certain monitored item subscription.
Syntax
'Declaration
 
<NotNullAttribute()>
Function GetMonitoredItemArgumentsDictionary() As EasyUAMonitoredItemArgumentsDictionary
'Usage
 
Dim instance As _EasyUAClient
Dim value As EasyUAMonitoredItemArgumentsDictionary
 
value = instance.GetMonitoredItemArgumentsDictionary()
[NotNull()]
EasyUAMonitoredItemArgumentsDictionary GetMonitoredItemArgumentsDictionary()
[NotNull()]
EasyUAMonitoredItemArgumentsDictionary^ GetMonitoredItemArgumentsDictionary(); 

Return Value

Returns an object that holds all information pertaining to the monitored item subscription: attribute information, subscription parameters, and monitoring parameters.

This method never returns null (Nothing in Visual Basic).

The individual elements of the returned value are never null (Nothing in Visual Basic).

Exceptions
ExceptionDescription

One of the arguments provided to a method is not valid.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

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.

This method or property does not throw any exceptions, aside from execution exceptions such as System.Threading.ThreadAbortException or System.OutOfMemoryException.

Example

COM

Rem This example shows how to obtain dictionary of parameters of all monitored item subscriptions.
Rem
Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript .
Rem Missing some example? Ask us for it on our Online Forums, https://www.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

' Instantiate the client object and hook events
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")
WScript.ConnectObject Client, "Client_"

WScript.Echo "Subscribing..."

Dim MonitoredItemArguments1: Set MonitoredItemArguments1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments")
MonitoredItemArguments1.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
MonitoredItemArguments1.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10845"

Dim MonitoredItemArguments2: Set MonitoredItemArguments2 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments")
MonitoredItemArguments2.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
MonitoredItemArguments2.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10853"

Dim MonitoredItemArguments3: Set MonitoredItemArguments3 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments")
MonitoredItemArguments3.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
MonitoredItemArguments3.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10855"

Dim arguments(2)
Set arguments(0) = MonitoredItemArguments1
Set arguments(1) = MonitoredItemArguments2
Set arguments(2) = MonitoredItemArguments3

Dim handleArray: handleArray = Client.SubscribeMultipleMonitoredItems(arguments)

WScript.Echo "Getting monitored item arguments dictionary..."   
Dim MonitoredItemArgumentsDictionary: Set MonitoredItemArgumentsDictionary = Client.GetMonitoredItemArgumentsDictionary

Dim DictionaryEntry: For Each DictionaryEntry In MonitoredItemArgumentsDictionary
    Dim MonitoredItemArguments: Set MonitoredItemArguments = DictionaryEntry.Value
    WScript.Echo 
    WScript.Echo "NodeDescriptor: " & MonitoredItemArguments.NodeDescriptor
    WScript.Echo "SamplingInterval: " & MonitoredItemArguments.MonitoringParameters.SamplingInterval
    WScript.Echo "PublishingInterval: " & MonitoredItemArguments.SubscriptionParameters.PublishingInterval
Next

WScript.Echo "Waiting for 5 seconds..."
WScript.Sleep 5 * 1000

WScript.Echo "Unsubscribing..."
Client.UnsubscribeAllMonitoredItems

WScript.Echo "Waiting for 5 seconds..."
WScript.Sleep 5 * 1000



Sub Client_DataChangeNotification(Sender, e)
    ' Your code would do the processing here
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