Conceptual question about events
Posted: 19 Jul 2018, 09:38
Hello everybody. Tryed to ask same on OPC foundation forum, but post is awaiting moderation from yesterday. So, i've decided to ask here too...
The short question is next: two events have diffirent semantics, but same syntax (set of event parameters). Are these events should have two diffirent event types or same event type for both events?
Now the long explenation. We create model for welding machine. Welding machine has two events: “CurrentBecameGreaterThenZero” and “CurrentBacameZero”. These events do not have parameters. We develop our application using C#. In C# class we have two events of same type:
In C# we can subscribe to each event separately, so we can distinguish one event from other.
It seems in OPC-UA there are no analogues for C# events and we should subscribe to PowerSource. But, in this case, it seems we can’t distinguish one event from other if they both of same type.
So, we are thinking what to do with this. The one solution is to make new event type for each event. The second solution is to make single event type with argument like “EventName”. The third solution is to make single event type and two event containers (special nested empty objects for each event).
I want to ask what is recommended way for solving such problem?
The short question is next: two events have diffirent semantics, but same syntax (set of event parameters). Are these events should have two diffirent event types or same event type for both events?
Now the long explenation. We create model for welding machine. Welding machine has two events: “CurrentBecameGreaterThenZero” and “CurrentBacameZero”. These events do not have parameters. We develop our application using C#. In C# class we have two events of same type:
Code: Select all
public class PowerSource
public event EventHandler CurrentBecameGreaterThanZero;
public event EventHandler CurrentBecameZero;
It seems in OPC-UA there are no analogues for C# events and we should subscribe to PowerSource. But, in this case, it seems we can’t distinguish one event from other if they both of same type.
So, we are thinking what to do with this. The one solution is to make new event type for each event. The second solution is to make single event type with argument like “EventName”. The third solution is to make single event type and two event containers (special nested empty objects for each event).
I want to ask what is recommended way for solving such problem?