Ndstatustostring, Ndstatustostring -30, Funct – National Instruments CAN 372139B-01 User Manual

Page 194

Advertising
background image

Chapter 6

Automotive Diagnostic Command Set API for C

Automotive Diagnostic Command Set User Manual

6-30

ni.com

ndStatusToString

Purpose

Returns a description for an error code.

Format

void ndStatusToString(

long errorCode,

char message[],

long *len);

Input

errorCode

The status code (return value) of any other diagnostic functions.

Output

message

Returns a descriptive string for the error code.

len

On input,

len

must contain the

message

array length. On return, it contains the number

of valid data bytes in the

message

array.

Description

When the status code returned from an Automotive Diagnostic Command Set function is
nonzero, an error or warning is indicated. This function obtains an error/warning description
for debugging purposes.

The return code is passed into the

errorCode

parameter. The

len

parameter indicates the

number of bytes available in the string for the description. The description is truncated to size

len

if needed, but a size of 1024 characters is large enough to hold any description. The text

returned in

message

is null-terminated, so you can use it with ANSI C functions such as

printf

. For C or C++ applications, each Automotive Diagnostic Command Set function

returns a status code as a signed 32-bit integer. The following table summarizes the
Automotive Diagnostic Command Set use of this status.

Advertising