Login  •  Register


How to check whether events are subscribed from the client?

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

How to check whether events are subscribed from the client?

Postby AnandPS » 25 May 2018, 11:05

I would like to know how to check (in the Server code) events are subscribed (event notifier object added to the client Event view) from the client, so that based on the event subscription the data collection from PLC/Controller will happen and the OPC events will be created and fired to the clients.

Regards,
Anand
AnandPS
Newbie
Newbie
 
Posts: 1
Joined: 25 May 2018, 10:52

Re: How to check whether events are subscribed from the clie

Postby Support Team » 03 Jul 2018, 16:42

Hello Anand,

there is not an out-of-box way to do that. You need to implement your own EventManager to handle this.
E.g. you could subclass EventManagerUaNode and override some of the methods on the EventManager interface to track the number of MonitoredItems that are possible consumers of Events that your namespace produces.
Candidates are beginStartMonitoring, beginModifyMonitoring, beginStopMonitoring.
Best regards
Unified Automation Support Team
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2397
Joined: 18 Mar 2011, 15:09

Re: How to check whether events are subscribed from the clie

Postby Syles » 11 Apr 2019, 14:31

Can you provide some sample code or snippets?
Do i have to register the subclassed EventManager? If so, where do i do that?
Let UaNodeId("notifierNode", 2) be a node, by which an event should be fired to all connected clients if a new client subscribes to this node. That would happen in beginStartMonitoring, right?
Syles
Newbie
Newbie
 
Posts: 4
Joined: 07 Nov 2018, 09:41

Re: How to check whether events are subscribed from the clie

Postby Syles » 26 Apr 2019, 14:35

Ah ok, i found a (simple) way to do that..

In my NodeManager, i'm subclassing from NodeManagerBase, which subclasses from EventManagerUaNode (if Event Subscription Server Facet is supported) which then subclasses from EventManagerBase.

So i can simply override EventManagerBase::beginStartMonitoring(OpcUa_Handle, OpcUa_UInt32, OpcUa_UInt32, EventCallback*, const EventMonitoringContextCreate&) and can check in there, which node is to be subscribed from a client and react to it.
Syles
Newbie
Newbie
 
Posts: 4
Joined: 07 Nov 2018, 09:41

Re: How to check whether events are subscribed from the clie

Postby koffeekingston » 05 Jun 2019, 08:47

This can be done with the help of https://errorcode0x.com/fixed-dell-printer-error-016-302/ as there's no issue while checking it.
koffeekingston
Newbie
Newbie
 
Posts: 2
Joined: 05 Jun 2019, 08:38


Return to C++ based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests