LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

No Message Output in the Callback of the Register Event Callback

Solved!
Go to solution

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

0 Kudos
Message 1 of 11
(4,517 Views)
Solution
Accepted by Mugssysupersaiyanjin

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#...

0 Kudos
Message 2 of 11
(4,485 Views)

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

0 Kudos
Message 3 of 11
(4,445 Views)

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. 

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments
0 Kudos
Message 4 of 11
(4,375 Views)
Solution
Accepted by Mugssysupersaiyanjin

@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.

0 Kudos
Message 5 of 11
(4,370 Views)

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.

0 Kudos
Message 6 of 11
(4,367 Views)

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

0 Kudos
Message 7 of 11
(4,305 Views)

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.

0 Kudos
Message 8 of 11
(4,296 Views)

Hi Nathan,

 

Please refer see the RAR file as attached.

 

Thanks,

 

Mugssy

0 Kudos
Message 9 of 11
(4,269 Views)

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

0 Kudos
Message 10 of 11
(4,261 Views)