Node hierarchy in published event

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

Moderator: uasdknet

Post Reply
martenbyebye
Hero Member
Hero Member
Posts: 21
Joined: 03 Mar 2017, 16:08

Node hierarchy in published event

Post by martenbyebye »

Hi,

I have a variable type called MyVariableType that I want to reuse in the event type MyEventType. So I create the event type as having a child variable called Content that is of type MyVariableType. MyVariableType has the property Prop1:

MyEventType
- Content
--- Prop1

Now I don't know how to set the value to Content.Prop1 when publishing the event. It works OK with a flat hierarchy by using genericEvent.Set(browsePath, value).

1. Can this be done? If yes, how? Can the value be a whole node?

2. Can the UaExpert handle this, i.e. should I be able to see the Content node with its property Prop1 when looking at the published events?

martenbyebye
Hero Member
Hero Member
Posts: 21
Joined: 03 Mar 2017, 16:08

Re: Node hierarchy in published event

Post by martenbyebye »

I found that one can write

Code: Select all

genericEvent.Set("3:RandomName", "propertyValue")
and then to see the propertyValue in the client by subscribing to "3:RandomName", even if "RandomName" is not the name of any property or child node of MyEventType.

Code: Select all

            this.subscription = new Subscription(this.session);           
            this.subscription.Create();

            List<MonitoredItem> monitoredItems = new List<MonitoredItem>()
                {
                    new UnifiedAutomation.UaClient.EventMonitoredItem(ObjectIds.Server)
                        {
                            Filter = new ItemEventFilter() { SelectClauses = { "3:RandomName" } }
                        },
                };

            var statusCodes = this.subscription.CreateMonitoredItems(monitoredItems);
That the event is of a certain type does not seem to ensure type safety.

So my questions are now:
1. How does another client know how to subscibe to Prop1? Let's say he can read my complete information model, i.e. see MyEventType and its child node Content of type MyVariableType. What would a client be expecting?
2. Can I use the UA framework to subscribe to any event field, i.e. can clients discover the eventField "3:RandomName" ? If I remove the SelectClause from the above code, I see some event fields but "propertyValue" is not among them.

Post Reply