![background image](http://html1.mh-extra.com/html/national-instruments/ni-can/ni-can_user-manual_3506864037.webp)
Chapter 2
Developing Your Application
2-10
ni.com
Checking Status of Function Calls
Each NI-CAN function returns a value that indicates the status of the
function call. Your application should check this status after each NI-CAN
function call. The following sections describe the NI-CAN status, and how
you can check it in your application.
NI-CAN Status Format
To provide the maximum amount of information, the status returned by
NI-CAN functions is encoded as a signed 32-bit integer. The format of this
integer is shown in Figure 2-2.
Figure 2-2.
Status Format
Error and Warning Indicators (Severity)
The error and warning bits ensure that all NI-CAN errors generate a
negative status, and all NI-CAN warnings generate a positive status. The
error bit is set when a function does not perform the expected behavior,
resulting in a negative status. The warning bit is set when the function
performed as expected, but a condition has arisen which may require your
attention. If no error or warning occurs, the entire status is set to zero to
indicate success. Table 2-1 summarizes the behavior of NI-CAN status.
Code
The code bits indicate the primary status code used for warning or errors.
Table 2-1.
Determining Severity of Status
Status
Result
Negative
Error. Function did not perform expected behavior.
Zero
Success. Function completed successfully.
Positive
Warning. Function performed as expected, but a
condition arose that may require your attention.
31 30
29–16
15–0
Error
Warning
Qualifier
Code