04-08-2016 10:43 AM
Hi Everyone,
Good Day. I created a Block Diagram that uses the DLL File of our Customer. I have a Hard time to create it because I dont any background or experience of this level of .expertise that involves DLL FIles. The DLL File is a .Net Assembly type of code. The DLL File will be used for sending specific Commands (i.e. reading Firmware Version, Serial Numbers, etc) using a NFC Reader (Sony S380). That is the only way of communication to the product which is a Digital Watch. The problem is on the Callback VI Ref which involves a Dialog Box & a Message String from the Property Node of "DebugResponseReceived", There is no Message Output But the Dialog Box gives me a a correct message or info that I need to get. If I put a BreakPoint at the Unbundle By Name "e", it gives a message output at the Property Node & the Dialog Box. both the Message at the property Node & Dialog Box have the same Output. Please refer my Code.
I will appreciate your help.
Thanks,
Leo
Solved! Go to Solution.
04-08-2016 01:44 PM
A callback cannot directly return values. You need to use the User Parameter input of Register Event Callback to pass in a reference to a queue, user event, or some other way to pass data back to main application. Searching on this forum will turn up examples, for example here's one I posted years ago (note that the screenshots are right, but the attached VIs aren't; look further down the thread for corrected ones): http://forums.ni.com/t5/LabVIEW/How-to-interaction-with-Main-VI-from-Net-event-callback/m-p/1064515#...
04-09-2016 05:43 AM
Hi nathan,
Thanks for the information that you gave me.it is very helpful. I have one concern. when the execution of the command have no Output or waiting for the message from callback, how to stop it & proceed to the next execution? I try to put a Stop Button on the Event structure but it doesnt stop even the Main Stop of the LabVIEW. I need to Close it in the task manager & open it again.
Best regards,
Mugssy
04-11-2016 05:10 PM
Hi ,
If you're using an event structure, one way to solve this could be to create a timeout event. I may not be fully understanding what you're doing so this may not be as simple as that.
04-11-2016 05:21 PM
@Mugssysupersaiyanjin wrote:Thanks for the information that you gave me.it is very helpful. I have one concern. when the execution of the command have no Output or waiting for the message from callback, how to stop it & proceed to the next execution? I try to put a Stop Button on the Event structure but it doesnt stop even the Main Stop of the LabVIEW. I need to Close it in the task manager & open it again.
I'd have to see your code to understand what you're asking. If you can't abort from within LabVIEW, it sounds like your code is getting stuck in the callback.
04-11-2016 05:34 PM
Callback is called when registered event (DebugResponseReceived) happens. No event - no callback call.
If program is frozen inside dll, it is inside DLL, not inside callback. Especially when you can not close it with abort button.
DLL should have means to abort execution of the command or specify timeout. Cancellation token looks like from the word Cancel, may be it is it. May be DLL is sending some other message (you need to register smth like "ReadError" callback), saying that it is waiting for you to process some error.
There are many options, should be in DLL manual.
04-15-2016 12:05 PM
Hi Nathan,
Good Day. as you can see in the block diagram, the ExecuteDebugCommandAsync is the one sending commands to a device via DLL File using NFC Reader to the Device. the Device will respond to the Callback. But the thing when the Device have no replies, it stuck. I try to look on the "Token" for Cancellation but no use & I cant find hoow to Cancel the Execution. May I know your email address so that I can send to you the DLL File & other files that support the DLL Files? I try to send it here in a ZIP or RAR File but NI block it.
Best regards,
Mugssy
04-15-2016 12:59 PM
There should be no problem uploading a ZIP archive here. What error do you get when you try? Can you use a different web browser? Please keep the discussion on this thread; I will not provide personal contact information.
04-15-2016 07:48 PM
Hi Nathan,
Please refer see the RAR file as attached.
Thanks,
Mugssy
04-15-2016 08:05 PM
Hi Nathan,
The DLL file is the Adidas.Teddi.ProductionTestingAccessLibrary.dll File that I use on the Block Diagram, This is is also the Main Source in this attachment.
Best regards,
Leo