How SubscribeForModelChangeEvents is implemented in UaClient

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
jack_thomas
Hero Member
Hero Member
Posts: 32
Joined: 02 Sep 2016, 16:14

How SubscribeForModelChangeEvents is implemented in UaClient

Post by jack_thomas »

Dear expert,

I am implementing OPC UA Client and I wonder how can I implement Auto-browsing feature in my client. :-\
The Ua Demo Server implementation has dynamic node where in I can observer the node is dynamically update in UaExpert.
I want to implement similar feature in my basic client implementation.
Is it already provided in the example? Please give me the related links. :)

Thank you,
Jack
Thanks and best regards,
Jack

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: How SubscribeForModelChangeEvents is implemented in UaCl

Post by Support Team »

Hallo Jack,

There is no example for the client side.
You have to create a subscription and an EventMonitoredItem for the Server object. You have to select the Changes event field and add a WhereClause to receive only ModelChange events. After you receive the event notification, you can evaluate the value of Changes and rebrowse the node specified by Affected.
Best regards
Unified Automation Support Team

royfyhr
Jr. Member
Jr. Member
Posts: 1
Joined: 12 Oct 2017, 10:24

Re: How SubscribeForModelChangeEvents is implemented in UaCl

Post by royfyhr »

Hi,

I have tried to figure out how to implement the SelectClause and the WhereClause to fullfill the description provided below. I have managed to set up a EventMonitoredItem for the Server object and receives plenty of events when a new node is added dynamically to the model. Problem is that I have not managed to figure out how to use the SelecClause and the WhereClause to limit the events to GeneralModelChangeEventType events and get hold of the Changes property. Is it possible to get a small example showing how to do this?

Thanks
/Roy

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: How SubscribeForModelChangeEvents is implemented in UaCl

Post by Support Team »

Hello,

Here is a small example for setting the SelectClause and the WhereClaus:

Code: Select all

            NodeId eventTypeId = ObjectTypeIds.BaseModelChangeEventType;
            EventMonitoredItem monitoredItem = new EventMonitoredItem(ObjectIds.Server);
            monitoredItem.Filter.SelectClauses.Add(new QualifiedName(BrowseNames.Changes));
            monitoredItem.Filter.WhereClauses.Add(
                FilterOperator.OfType,
                new LiteralOperand()
                {
                    Value = new Variant(eventTypeId)
                });
Best regards
Unified Automation Support Team

Post Reply