NI-IMAQ C Function Reference

imgSessionWaitSignalAsync3

  • Updated2023-02-21
  • 2 minute(s) read

Usage

rval imgSessionWaitSignalAsync3(SESSION_ID sid, IMG_SIGNAL_TYPE signalType, uInt32 signalIdentifier, uInt32 state, uInt32 timeout, CALL_BACK_PTR2 function, void* data);

Purpose

? Waits for a signal to be in a given state or for the specified timeout to expire. If the signal reaches the specified state before the timeout expires, calls a user-defined function; otherwise the IMG_ERR_TIMEOUT error code is returned.

Parameters

Name Type Direction
sid SESSION_ID input
signalType IMG_SIGNAL_TYPE input
signalIdentifier uInt32 input
state uInt32 input
timeout uInt32 input
function CALL_BACK_PTR input
data void* input
rval Int32 output

Parameter Discussion

sid: valid SESSION_ID.

signalType: type of signal to wait for. The signal can be one of the following constants:

Note Note  To use the ISO_IN or RS422_IN signals on the NI PCI-1426, select External as the Trigger Type for your function and choose ISO In or RS-422 In as the Signal Level for the trigger line in Measurement & Automation Explorer (MAX).
IMG_SIGNAL_EXTERNAL
IMG_SIGNAL_RTSI
IMG_SIGNAL_ISO_IN
IMG_SIGNAL_ISO_OUT
IMG_SIGNAL_STATUS

signalIdentifier: is the signal identifier. If the signal type is one of the triggers, then this value specifies which trigger line. If the signal type is IMG_SIGNAL_STATUS, signalIdentifier must be one of the following constants:

IMG_AQ_DONE
IMG_AQ_IN_PROGRESS
IMG_BUF_COMPLETE
IMG_FRAME_DONE
IMG_FRAME_START

state: state of the signal to wait for. state can be one of the following constants:

IMG_SIGNAL_STATE_RISINGWaits for a rising edge.
IMG_SIGNAL_STATE_FALLINGWaits for a falling edge.
IMG_SIGNAL_STATE_HIGHReturns immediately if the signal is high. Otherwise, waits for a rising edge.
IMG_SIGNAL_STATE_LOWReturns immediately if the signal is low. Otherwise, waits for a falling edge.

timeout: time, in milliseconds, to wait for the appropriate state. If the appropriate state does not occur within the timeout period, the function returns IMG_ERR_TIMEOUT. Use IMG_TIMEOUT_INFINITE to wait indefinitely.

function: pointer to the callback function. Your function should match the following prototype:

uInt32(*function)(SESSION_ID sid, IMG_ERR err, IMG_SIGNAL_TYPE signalType, uInt32 signalIdentifier, void* userdata)

Note  The return value of the callback function determines the behavior of the driver for subsequent signal assertions. Return zero to disregard future signal assertions. Return a non-zero value to continue to receive callbacks.

data value that is passed to the callback function. The value can be a pointer to user data.

Return Value

This function returns 0 on success. On failure, this function returns an error code. For information about the error code, call imgShowError.