- Posts: 34
- Thank you received: 1
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.
Subscription to events
thank you very much for you support.
I found the problem.
There was an error in the way I specify the monitored item; this line in the code:
Thank you again!!
Best regards,
Federica
Please Log in or Create an account to join the conversation.
I have reviewed your code and do not see anything obviously wrong with it.
Here are some options we can do - possibly all of them.
1. Can you try your code (with modified node ID) against our demo server?
2. Will you be able to write and test a short C# program instead, against your real server - just to find whether the problem is maybe in your code (the C# is much shorter and not so error prone, and I can point you to the right example).
3. I can instruct you to take Wireshark logs of the successful (OPCExpert) and unsuccessful communication, and we will try to analyze where is the difference.
Best regards
Please Log in or Create an account to join the conversation.
Inside the event handler
What could be the problem?
Do you know how can I check that all parms I specify are correct (for example, using UaExpert or another tool)?
Thank you
Please Log in or Create an account to join the conversation.
If you need different/more fields, you need to specify them using so-called Select Clauses - and use the "universal", all-capable method SubscribeMultipleMonitoredItems. You need to put together a UAAttributeFieldCollection with the attributes you are interested in, the create UAEventFilter where this collection will be in the SelectClauses property, create UAMonitoringParameters where you assign the EventFilter, and finally create UAMonitoredItemArguments where you assign the MonitoringParameters. We have some extension methods that make it easier in .NET, but in COM you need to go through the whole process.
There is currently no example for this in C++, but conceptually, you can use the following example we have made for Free Pascal (which is also COM-based):
Please Log in or Create an account to join the conversation.
But the field I receive are only the "base" fields.
I can access to some fields (heighlighted in green in the attached picture, as "/Message", "/Severity", "/EventId" or"/SourceNode") but not to the fields specific of my event (heighlighted in red in the attached picture).
It seem that the fields specific of the "StampingStrokeParametersEvent" are skipped and not available inside the _EasyUAEventNotificationEventArgs object. Is it possibile?
Please Log in or Create an account to join the conversation.
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ieldResultDictionary~Item.html
Have you tried casting the GetItem result to _ValueResultPtr, and what were the results?
Best regards
Please Log in or Create an account to join the conversation.
I receive no error but I can't cast the result of "GetItem" to any valid object because it should be a "KeyValuePair" object, I think (_UAAttributeField in the Key and _ValueResult in the Value, as you said), but "KeyValuePair" is not a COM object (as you can see from the definition: docs.microsoft.com/it-it/dotnet/api/system.collections.gener...uepair-2?view=netframework-4.8 ).
Please Log in or Create an account to join the conversation.
What error do you get from GetItem?
It should also be possible to enumerate the contents of the dictionary. The entries coming form the enumeration should have _UAAttributeField in the Key and _ValueResult in the Value.
Best regards
Please Log in or Create an account to join the conversation.
I'm sorry for my late answer.
I update you about my problem.
I developed a test application written in C++ (MFC C++, not managed C++) where I subscribe for events generated from the server.
I have a method which is called every time an event is generated from the server.
With the event, I receive some fields.
Now I have problem accessing this fields.
I have an "_UAFieldResultDictionaryPtr" object which contains all the fields but I can't extract data from this structure.
I also tried searching for an "_UAAttributeFieldPtr" object inside this structure using "GetItem" method but with no success...
Help please...!
Thank you,
Federica
Please Log in or Create an account to join the conversation.
please describe what the problem is. I do not quite understand what you mean by "I'm trying to use "SubscribeEvents" method but I can't use it in my C++ COM application.".
Certainly SubscribeEvents can be used from C++. Is the issue that you do not know what QuickOPC calls to make, or is the issue that you do not know how to translate it to C++? Or is it thaty you do not quite understand the Eventing in OPC UA in general?
Because, we do have examples for SubscribeEvents - but it's true that currently, there are none in C++. This is because the code is by far the longest and ugliest to write, from all the languages... Have you had a look at following examples (in other languages)?
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20to%20a%20single%20event.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20to%20a%20single%20event.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20to%20a%20single%20event.html
Some of these particular examples are also provided in Free Pascal, Object Pascal, VBScript or VB6, which are all COM based, meaning that in C++ you need the same sequence of calls, just written differently.
Best regards
Please Log in or Create an account to join the conversation.