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.

convert eventargs in delphi

More
01 Mar 2018 11:03 #6086 by support
Replied by support on topic convert eventargs in delphi
Hello,

I actually worked on this earlier when we discussed it. And, unfortunately, it turned out that I was wrong - it looks like that is not possible to do it with the current QuickOPC version.

The reason for it is minor, but critical: The serialization/deserialization works on "streams". The stream interfaces are properly exposed to COM from .NET, but the actual concrete stream objects have no default constructors and therefore cannot be created from COM.

It would be relatively easy to add COM-exposed .NET objects to QuickOPC that would enable the creation of streams from COM. But it would be an API/feature change that we never do into a released version - only into a new version.

So, if you are interested and can wait, I can put it into the plan and we will expose this functionality in QuickOPC 2018.2 or 2018.3. But currently, it seems impossible.

Regards

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

More
28 Feb 2018 22:42 #6084 by alr1976
Replied by alr1976 on topic convert eventargs in delphi
Hi!
You write me that if i have problem to Serialize/unserialize eventargs You help me to do It. Can You make a Simple example in Delphi?
Thanks

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

More
14 Feb 2018 16:29 #6046 by support
Replied by support on topic convert eventargs in delphi
I have had a further look at this. It looks like you cannot easily hook events to _EasyUAClient (I could probably put it together as well, but it really won't be as short as it should be). So, when you want to use events, I recommend to go back to TEasyUAClient, and free it explicitly.

Moreover, I now understand what you meant by mentioning TServerEventDispatch. It appears to be a memory leak caused by Delphi, though.

I wrote down what I have found so far, and the recommended approaches - including sample code. It is in the Knowledge Base article here: kb.opclabs.com/Reference_counting_in_Delphi .

Best regards

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

More
12 Feb 2018 21:41 #6037 by alr1976
Replied by alr1976 on topic convert eventargs in delphi
Ok with _EasyUACLient seem that works...Tomorrow i ll do other tests...
Problem now that _EasyUaClient don t have OnDataChangeNotification event..... So i can t riceive data from subscription.... Any idea?

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

More
12 Feb 2018 21:00 #6036 by support
Replied by support on topic convert eventargs in delphi
Thank you, I will have a look at that. But I cannot do it now, and I will be mainly out of office for a day, maybe two.

Can you, in the meantime, try the following?

1. Replace "write: TEasyUAClient;" by "write: _EasyUAClient;", AND
2. Remove "write.Free; write := nil;".

Doesn't that get rid of the memory leak?

Best regards

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

More
12 Feb 2018 20:37 #6034 by alr1976
Replied by alr1976 on topic convert eventargs in delphi
It is very Easy...
Install fastmm in Delphi debug show Memory leak
Create new form
create button in a form
Onclick
Insert

var
write: TEasyUAClient;

begin
write := TEasyUAClient.Create(nil);
try
try
write.WriteValue('opc.tcp://127.0.0.1/49320/,NodeId,Value);
except

end;
finally
write.Free;
write := nil;
end;

Close app and You have memoryleak
If You Press 100 times button u have 100x memoryleak

Nodeid = insert Ur nodeid
Value = insert Ur value

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

More
12 Feb 2018 20:12 #6032 by support
Replied by support on topic convert eventargs in delphi
It looks like that you are doing something differently from what we have in our examples. We do not use TServerEventDispatch (at least not directly), so I cannot comment on that.

Maybe you can send a piece of code that shows what you have in mind and how you are using it.

Best regards

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

More
12 Feb 2018 16:41 #6031 by alr1976
Replied by alr1976 on topic convert eventargs in delphi
Last Question...

When I create a TEasyUAClient
and when close app and free TEasyUaClient
it doesn t free TServerEventDispatch
so How can I free TServerEventDispatch in Delphi?

Thank you very much

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

More
12 Feb 2018 08:54 #6030 by support
Replied by support on topic convert eventargs in delphi
I do not have that much knowledge of Delphi. But I was under assumption that for interfaces, Delphi compiler takes care of the reference counting (and freeing when the count goes to zero), so there is actually no need to free eventArgs explicitly, assuming it is declared as _EasyUADataChangeNotificationEventArgs (an interface, not an object). But I might be wrong.

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

More
12 Feb 2018 08:17 #6029 by alr1976
Replied by alr1976 on topic convert eventargs in delphi
Ok it works but how to free eventargs after that I create it?

eventargs := CoEasyUADataChangeNotificationEventArgs.Create;
eventargs.Arguments := CoEasyUAMonitoredItemArguments.Create;
eventargs.Arguments.NodeDescriptor := CoUANodeDescriptor.Create;
eventargs.AttributeData := CoUaAttributeData.create;
eventargs.AttributeData.StatusCode := CoUaStatusCode.Create;

if I use freeandnil(eventargs) I have exception error

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

Moderators: support
Time to create page: 0.073 seconds