Chapter 6 Automotive Diagnostic Command Set API for C
© National Instruments Corporation 6-27 Automotive Diagnostic Command Set User Manual
Output
diagRefOut
A struct containing all necessary information about the diagnostic session. This is passed
as a handle to all subsequent diagnostic functions, and you must close it using
ndCloseDiagnostic.
Return Value
The return value indicates the function call status as a signed 32-bit integer. Zero means the
function executed successfully. A negative value specifies an error, which means the function
did not perform the expected behavior. A positive value specifies a warning, which means the
function performed as expected, but a condition arose that may require attention.
Use the
ndStatusToString function to obtain a descriptive string for the return value.
Description
ndOpenDiagnostic opens a diagnostic communication channel to an ECU. This function
initializes the CAN port specified as input and stores a handle to it (among other internal data)
into
diagRefOut, which serves as reference for further diagnostic functions.
No communication to the ECU takes place at this point. To open a diagnostic session on the
ECU, call
ndStartDiagnosticSession or ndUDSDiagnosticSessionControl.
In general, you do not need to manipulate the
diagRefOut struct contents, except if you use
the ISO TP—Mixed Mode transport protocol, in which case you must store the address
extensions for transmit and receive in the appropriate members of that struct.