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



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.ComTypes Namespace > _EasyUAClient Interface : BrowseNotifiers Method
Endpoint descriptor. Identifies the OPC-UA server.

The value represents an OPC UA endpoint descriptor string. Any string can be passed to this parameter (i.e. will not cause System.ArgumentException), but not all values make sense and will work when an operation using them is attempted. The OPC UA endpoint descriptor string is typically the URL of the server endpoint.

The value of this parameter can be null (Nothing in Visual Basic).

Node Id.

The value of this parameter can be null (Nothing in Visual Basic).

Browses the Notifiers, specifying an endpoint descriptor, and a starting Node Id.
Syntax
'Declaration
 
<NotNullAttribute()>
Function BrowseNotifiers( _
   ByVal endpointDescriptorString As String, _
   ByVal nodeDescriptorString As String _
) As UANodeElementCollection
'Usage
 
Dim instance As _EasyUAClient
Dim endpointDescriptorString As String
Dim nodeDescriptorString As String
Dim value As UANodeElementCollection
 
value = instance.BrowseNotifiers(endpointDescriptorString, nodeDescriptorString)

Parameters

endpointDescriptorString
Endpoint descriptor. Identifies the OPC-UA server.

The value represents an OPC UA endpoint descriptor string. Any string can be passed to this parameter (i.e. will not cause System.ArgumentException), but not all values make sense and will work when an operation using them is attempted. The OPC UA endpoint descriptor string is typically the URL of the server endpoint.

The value of this parameter can be null (Nothing in Visual Basic).

nodeDescriptorString
Node Id.

The value of this parameter can be null (Nothing in Visual Basic).

Return Value

The method returns a node element collection, which contains OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement values. Each element contains information about a particular node found.

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

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

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

// This example shows how to browse objects under the "Objects" node and display notifiers.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in Object Pascal (Delphi) on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-OP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

class procedure BrowseNotifiers.Main;
var
  ObjectNodeId: _UANodeId;
begin
  ObjectNodeId := CoUANodeId.Create;
  ObjectNodeId.StandardName := 'Objects';
  try
    BrowseFrom(ObjectNodeId);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;
end;

class procedure BrowseNotifiers.BrowseFrom(NodeId: _UANodeId);
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: string;
  NotifierNodeElement: _UANodeElement;
  NotifierNodeElementEnumerator: IEnumVariant;
  NotifierNodeElements: _UANodeElementCollection;
  ObjectNodeElement: _UANodeElement;
  ObjectNodeElementEnumerator: IEnumVariant;
  ObjectNodeElements: _UANodeElementCollection;
begin
  EndpointDescriptor := 'opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer';

  WriteLn;
  WriteLn;
  WriteLn('Parent node: ', NodeId.ToString);

  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  // Obtain notifiers
  NotifierNodeElements := Client.BrowseNotifiers(EndpointDescriptor, NodeId.ExpandedText);

  // Display notifires
  if NotifierNodeElements.Count <> 0 then
  begin
    WriteLn;
    WriteLn('Notifiers:');
    NotifierNodeElementEnumerator := NotifierNodeElements.GetEnumerator;
    while (NotifierNodeElementEnumerator.Next(1, Element, Count) = S_OK) do
    begin
      NotifierNodeElement := IUnknown(Element) as _UANodeElement;
      WriteLn(NotifierNodeElement.ToString);
    end;
  end;

  // Obtain objects
  ObjectNodeElements := Client.BrowseObjects(EndpointDescriptor, NodeId.ExpandedText);

  // Recurse
  ObjectNodeElementEnumerator := ObjectNodeElements.GetEnumerator;
  while (ObjectNodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    ObjectNodeElement := IUnknown(Element) as _UANodeElement;
    BrowseFrom(ObjectNodeElement.NodeId);
  end;
end;

// Example output (truncated):
//
//
//Parent node: ObjectsFolder
//
//
//Parent node: Server
//
//Notifiers:
//Green -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
//Yellow -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
//
//
//Parent node: Server_ServerCapabilities
//...
// This example shows how to browse objects under the "Objects" node and display notifiers.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in PHP on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PHP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.


// Start browsing from the "Objects" node
$ObjectNodeId = new COM("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId");
$ObjectNodeId->StandardName = "Objects";
try
{
    BrowseFrom($ObjectNodeId);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    exit();
}

function BrowseFrom($NodeId) {
    $EndpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer";

    printf("\n");
    printf("\n");
    printf("Parent node: %s\n", $NodeId);

    // Instantiate the client object
    $Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient");

    // Obtain notifiers
    $NotifierNodeElements = $Client->BrowseNotifiers($EndpointDescriptor, $NodeId->ExpandedText);

    // Display notifires
    if ($NotifierNodeElements->Count != 0) {
        printf("\n");
        printf("Notifiers:\n");
        foreach ($NotifierNodeElements as $NotifierNodeElement)
        {
             printf("%s\n", $NotifierNodeElement);
        }
    }

    // Obtain objects
    $ObjectNodeElements = $Client->BrowseObjects($EndpointDescriptor, $NodeId->ExpandedText);

    // Recurse
    foreach ($ObjectNodeElements as $ObjectNodeElement)
    {
         BrowseFrom($ObjectNodeElement->NodeId);
    }
}

// Example output (truncated):
//
//
//Parent node: ObjectsFolder
//
//
//Parent node: Server
//
//Notifiers:
//Green -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
//Yellow -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
//
//
//Parent node: Server_ServerCapabilities
//...
Rem This example shows how to browse objects under the "Objects" node and display notifiers.
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

' Start browsing from the "Objects" node
Dim ObjectsNodeId: Set ObjectsNodeId = CreateObject("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId")
ObjectsNodeId.StandardName = "Objects"
On Error Resume Next
BrowseFrom ObjectsNodeId
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0



Sub BrowseFrom(NodeId)
    Dim endpointDescriptor
    endpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer"

    WScript.Echo 
    WScript.Echo 
    WScript.Echo "Parent node: " & NodeId

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

    ' Obtain notifiers
    Dim NotifierNodeElementCollection: Set NotifierNodeElementCollection = Client.BrowseNotifiers( _
        endpointDescriptor, NodeId.ExpandedText)

    ' Display notifiers
    If NotifierNodeElementCollection.Count <> 0 Then
        WScript.Echo 
        WScript.Echo "Notifiers:"
        Dim NotifierNodeElement: For Each NotifierNodeElement In NotifierNodeElementCollection
            WScript.Echo NotifierNodeElement
        Next
    End If
    
    ' Obtain objects
    Dim ObjectNodeElementCollection: Set ObjectNodeElementCollection = Client.BrowseObjects( _
        endpointDescriptor, NodeId.ExpandedText)

    ' Recurse
    Dim ObjectNodeElement: For Each ObjectNodeElement In ObjectNodeElementCollection
        BrowseFrom ObjectNodeElement.NodeId
    Next
End Sub



' Example output (truncated):
'
'
'Parent node: ObjectsFolder
'
'
'Parent node: Server
'
'Notifiers:
'Green -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
'Yellow -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
'
'
'Parent node: Server_ServerCapabilities
'...
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