Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

OPC UA .NET C# - pass callback when subscribing multiple items

More
19 Sep 2022 15:05 #11095 by support
The SubscribeMultipleDataChanges method is available since QuickOPC 2021.3: kb.opclabs.com/What%27s_new_in_QuickOPC_2021.3#OPC_UA_Client-Server .

Either upgrade QuickOPC, or use the approach from the code I provided to achieve the same.

Best regards
The following user(s) said Thank You: amlynar

Please Log in or Create an account to join the conversation.

More
19 Sep 2022 14:36 #11094 by amlynar
OPC Labs QuickOPC 2020.3

Please Log in or Create an account to join the conversation.

More
19 Sep 2022 14:28 #11093 by support
Hello.

Which QuickOPC version are you using?

Regards

Please Log in or Create an account to join the conversation.

More
19 Sep 2022 14:02 #11092 by amlynar
The SubscribeMultipleDataChanges extension method seems to be documented on the link you sent, but it doesn't recognize it in my program. Below is the error I receive with the directives I am using. Can you provide an example for passing a DataChangeCallback in the EasyUAMonitoredArguments.

using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.OperationModel;

"Error CS1061 'EasyUAClient' does not contain a definition for 'SubscribeMultipleDataChanges' and no accessible extension method 'SubscribeMultipleDataChanges' accepting a first argument of type 'EasyUAClient' could be found (are you missing a using directive or an assembly reference?)

Please Log in or Create an account to join the conversation.

More
17 Sep 2022 12:34 #11091 by support
Hello.

you are probably looking for the SubscribeMultipleDataChanges extension method: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User's...scribeMultipleDataChanges.html .

The other way to do this is to use the DataChangeCallback property (opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User's...uments~DataChangeCallback.html ) in each of the the EasyUAMonitoredArguments passed to the SubscribeMultipleMonitoredItems method.

This is what, internally, the SubscribeMultipleDataChanges does anyway. Its implementation (the code is simplified) looks like this:

 
static public int[] SubscribeMultipleDataChanges(
this IEasyUAClient client,
UAMonitoredItemArguments[] monitoredItemArgumentsArray,
EasyUADataChangeNotificationEventHandler dataChangeCallback)
{
return client.SubscribeMultipleMonitoredItems(monitoredItemArgumentsArray
.Select(arguments => new EasyUAMonitoredItemArguments(dataChangeCallback, arguments)).ToArray());
}
 


Best regards/S pozdravem

Please Log in or Create an account to join the conversation.

More
16 Sep 2022 18:56 - 17 Sep 2022 11:14 #11089 by amlynar
OPC UA .NET C# was created by amlynar
I am switching from OPC DA to OPC UA. In OPC DA the SubscribeMultipleItems method comes with a callback argument. For OPC UA the SubscribeMultipleMonitoredItems method does not come with a callback argument. How can I implement a callback for SubscribeMultipleMonitoredItems in OPC UA?

OPC DA Example:
 
easyDAClient1.SubscribeMultipleItems(items.ToArray(), (_, e) => {
if (e.Vtq != null && e.Vtq.HasValue)
{
String tag = e.Arguments.ItemDescriptor.ItemId.ToString();
object value = e.Vtq.Value;
itemChanged(tag, value);
}
});
 
 

OPC UA Example:
 
easyUAClient1.SubscribeMultipleMonitoredItems(items.ToArray());
 
Last edit: 17 Sep 2022 11:14 by support. Reason: code formatting

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.158 seconds