Hi everyone,
i have a question about the subscription. I use the client_lesson02 as basis and modified these up to 4 monitored items. The code itself works fine but i have a problem in respect to identifying the item of the values.
The function "Subscription_CreateMonitoredItem" is called once and creates the 4 items. Every time the value of one or more item(s) changes, the function "Subscription_DataChange_CB" will be called. At this point i can not identify the item which causes the function call. The pointer "a_pMonitoredItems" has the value but i am not able to get an ID of it. The structure "OpcUa_MonitoredItemNotification" itself has variables like NodeID but they are all invalid (cxx0030 error expression cannot be evaluated).
Therefore, i checked the structure "OpcUa_MonitoredItemCreateRequest", cause i thought that i might have to add an ID. But again, i can not identify any variable for an ID.
Thanks for some hints.
Florian
---
I use VisualStudio 2010 on Windows7.
multiple monitoreditem in subscription
Moderator: uasdkc
-
- Full Member
- Posts: 8
- Joined: 21 Oct 2016, 14:12
Re: multiple monitoreditem in subscription
Dear Florian,
When recieving the "SampleSubscription_DataChange_CB'' function call,
the nodeID should be inside the 'a_pMonitoredItems'.
Use this variable to get the NodeID wich you are looking for.
Hope this helps.
Best regards,
Casper
When recieving the "SampleSubscription_DataChange_CB'' function call,
the nodeID should be inside the 'a_pMonitoredItems'.
Use this variable to get the NodeID wich you are looking for.
Hope this helps.
Best regards,
Casper
-
- Jr. Member
- Posts: 2
- Joined: 21 Nov 2017, 15:46
Re: multiple monitoreditem in subscription
Hi,
Is it possible that my OpcUa_MonitoredItemNotification does not contain the NodeId ?
Here is my structure:
typedef struct _OpcUa_MonitoredItemNotification
{
OpcUa_UInt32 ClientHandle;
OpcUa_DataValue Value;
}
OpcUa_MonitoredItemNotification;
This leads to the OP issue, I cannot identify the monitored node.
Thanks,
Félix
Is it possible that my OpcUa_MonitoredItemNotification does not contain the NodeId ?
Here is my structure:
typedef struct _OpcUa_MonitoredItemNotification
{
OpcUa_UInt32 ClientHandle;
OpcUa_DataValue Value;
}
OpcUa_MonitoredItemNotification;
This leads to the OP issue, I cannot identify the monitored node.
Thanks,
Félix
- Support Team
- Hero Member
- Posts: 3064
- Joined: 18 Mar 2011, 15:09
Re: multiple monitoreditem in subscription
Hello flapointe,
instead of with the NodeId, you can identify the notification using the ClientHandle of the MonitoredItemNotification. It is set to the ClientHandle you specified when the MonitoredItem was created (a_pItemsToCreate[n].RequestedParameters.ClientHandle).
The NodeId is not being returned in the MonitoredItemNotification, as sending the whole NodeId with every value would create needless overhead.
instead of with the NodeId, you can identify the notification using the ClientHandle of the MonitoredItemNotification. It is set to the ClientHandle you specified when the MonitoredItem was created (a_pItemsToCreate[n].RequestedParameters.ClientHandle).
The NodeId is not being returned in the MonitoredItemNotification, as sending the whole NodeId with every value would create needless overhead.
Best regards
Unified Automation Support Team
Unified Automation Support Team