I am currently working with the ANSI C Client SDK. (version 1.7.0)
My software writes its value into a pointer, which is unique for each (subscribed) node.
So, for example, if a subscribed OPCUA node changes its data, It will write the latest value of the node into its corresponding pointer.
The UaClient_Subscription allows storage of this in 'user data'.
This goes fine when I create a subscription foreach node.
However, the OPCUA protocol allows me to add multiple node's into one subscription. (aka monitored items)
If I would create a MonitoredItem foreach node, (within the same subscription)
there is no 'user data' available to store my pointer into. (except one in the subscription)
This leaves us with my following questions:
- Is there any way to store 'user data' in a MonitoredItem, instead of UaClient_Subscription?
- What are the pro's and cons of using a UaClient_Subscription foreach MonitoredItem, instead of creating many UaClient_Subscriptions with one MonitoredItem in each?
All feedback is welcome.
Thanks in advance!
Userdata inside MonitoredItem or UaClient_Subscription
Moderator: uasdkc
-
- Full Member
- Posts: 8
- Joined: 21 Oct 2016, 14:12
- Support Team
- Hero Member
- Posts: 3070
- Joined: 18 Mar 2011, 15:09
Re: Userdata inside MonitoredItem or UaClient_Subscription
Hello caspervanzoest,
connecting monitored items to your custom information can be done by using the ClientHandle which you pass inside the RequestedParameters of an OpcUa_MonitoredItemCreateRequest. This handle can be chosen freely by you and is passed back to you in the OpcUa_MonitoredItemNotification of a DataChange callback. Using any kind of mapping (e.g. a list with the ClientHandle as index or a map) you can then determine your custom information belonging to the monitored item using the ClientHandle.
connecting monitored items to your custom information can be done by using the ClientHandle which you pass inside the RequestedParameters of an OpcUa_MonitoredItemCreateRequest. This handle can be chosen freely by you and is passed back to you in the OpcUa_MonitoredItemNotification of a DataChange callback. Using any kind of mapping (e.g. a list with the ClientHandle as index or a map) you can then determine your custom information belonging to the monitored item using the ClientHandle.
Best regards
Unified Automation Support Team
Unified Automation Support Team