DAQmxRegisterDoneEvent

NI-DAQmx C Functions

DAQmxRegisterDoneEvent

int32 DAQmxRegisterDoneEvent (TaskHandle taskHandle, uInt32 options, DAQmxDoneEventCallbackPtr callbackFunction, void *callbackData);

Purpose

Registers a callback function to receive an event when a task stops due to an error or when a finite acquisition task or finite generation task completes execution. A Done event does not occur when a task is stopped explicitly, such as by calling DAQmxStopTask.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task used in this function.
options uInt32 Use this parameter to set certain options. You can combine flags with the bitwise-OR operator ('|') to set multiple options. Pass a value of zero if no options need to be set.
Value Description
0 The callback function is called in a DAQmx thread. This is the default value.
DAQmx_Val_SynchronousEventCallbacks The callback function is called in the thread which registered the event. In order for the callback to occur, you must be processing messages.
Note If you are receiving synchronous events faster than you are processing them, then the user interface of your application might become unresponsive.
callbackFunction DAQmxDoneEventCallbackPtr The function that you want DAQmx to call when the event occurs. The function you pass in this parameter must have the following prototype:
int32 CVICALLBACK Callback (TaskHandle taskHandle, int32 status, void *callbackData);
Upon entry to the callback, the taskHandle parameter contains the handle to the task on which the event occurred. The status parameter contains the status of the task when the event occurred. If the status value is negative, it indicates an error. If the status value is zero, it indicates no error. If the status value is positive, it indicates a warning. The callbackData parameter contains the value you passed in the callbackData parameter of this function.
callbackData void * A value that you want DAQmx to pass to the callback function as the function data parameter. Do not pass the address of a local variable or any other variable that might not be valid when the function is executed.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.