LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Processing different pending events in a DAQ callback

Hi,
In a DAQ callback function declared by 'DIG_Change_Message_Config', I want to wait for some data sent by a TCP /IP event. I tried to loop on the 'ProcessSystemEvents' function but it doesn't let the hand on a posted TCP message. How can I do?
Thanks in advance.
Laurent
0 Kudos
Message 1 of 5
(3,537 Views)
Hi,

As far as I know ProcessSystemEvents should be able to catch the TCP events; however you can try the ProcessTCPEvents() functions; that one should check for any enents TCP event.

Let me know how this goes.

Regards,
Juan Carlos
N.I.
0 Kudos
Message 2 of 5
(3,537 Views)
Hello

Generally,it is no recommended to have waits occur inside of callback functions. Callbacks should return as fast as possible, and this avoids any events being missed. You should move any waiting code into a seperate thread. Its simple to do using CmtScheduleThreadPoolFunction(). You can check for the DATA_READY flag to get set, and then do a TCP_Read() before exiting from the thread.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 3 of 5
(3,537 Views)
Thanks for your help and sorry for the delay I respond. The problem doesn't come from ProcessSystemEvents but from the DAQ Event function: when in this function I use the ProcessSystemEvents call, the other events are not processed. If I try in a timer event for example that works !!!

Regards.
Laurent
0 Kudos
Message 4 of 5
(3,537 Views)
Laurent,

Have you tried using the ProcessTCPEvents()? Another thing that you can try is calling ProcessSystemEvents in another thread; just create a wrapper function that checks for events and run it using CmtScheduleThreadPoolFunction().

Let me know how this goes.

Regards,

Juan Carlos

N.I.
0 Kudos
Message 5 of 5
(3,537 Views)