Purpose

Executes the WWH-OBD ReadDTCInformation service. Reads selected Diagnostic Trouble Codes (DTCs).

Format

        long ndWWHOBDRequestEmissionRelatedDTCS (
       TD1 *diagRef,
       unsigned char DTCSeverityMask,
       unsigned char DTCStatusMask,
       TD3 * DTCDescriptor,
       unsigned char *severityAvailabilityMask,
       unsigned char *statusAvailabilityMask,
       unsigned char *DTCFormatIdentifier,
       TD4 * DTCs[],
       long *len,
       LVBoolean *success);
      

Input

diagRef

Specifies the diagnostic session handle, obtained from ndOpenDiagnosticOnCANFD and passed to subsequent diagnostic functions. Normally, it is not necessary to manually manipulate the elements of this struct.

DTCSeverityMask

Defines the severity information of DTCs to be read. The values are application specific.

DTCStatusMask

Defines the status of DTCs to be read. The values are application specific.

DTCDescriptor

A struct that describes the DTC records the ECU delivers:

              typedef struct {
          long DTCByteLength;
          long StatusByteLength;
          long AddDataByteLength;
          unsigned short ByteOrder;
          } TD3;
      

DTCByteLength indicates the number of bytes the ECU sends for each DTC. The default is 3.

StatusByteLength indicates the number of bytes the ECU sends for each DTC's status. The default is 1.

AddDataByteLength indicates the number of bytes the ECU sends for each DTC's additional data. Usually, there are no additional data, so the default is 0.

ByteOrder indicates the byte ordering for multibyte items:

0: MSB_FIRST (Motorola), default

1: LSB_FIRST (Intel)

This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array. Output

severityAvailabilityMask

An application-specific value returned for all DTCs.

statusAvailabilityMask

An application-specific value returned for all DTCs.

DTCFormatIdentifier

An application-specific value returned for all DTCs.

DTCs

Returns the resulting DTCs as an array of structs:

              typedef struct {
          unsigned long DTC;
          unsigned long Status;
          unsigned long AddData;
          } TD4;
      

DTC is the resulting Diagnostic Trouble Code. You can use ndWWHOBDConvertDTCsToJ1939 or ndWWHOBDConvertDTCsToJ2012 to convert this to readable format as defined by SAE J1939 and SAE J2012.

Status is the DTC status. Usually, this is a bit field with following meaning:

Bit Meaning
0 testFailed
1 testFailedThisMonitoringCycle
2 pendingDTC
3 confirmedDTC
4 testNotCompletedSinceLastClear
5 testFailedSinceLastClear
6 testNotCompletedThisMonitoringCycle
7 warningIndicatorRequested

AddData contains optional additional data for this DTC. Usually, this does not contain valid information (refer to DTCDescriptor).

len

On input, len must contain the DTCs array length in elements. On return, it contains the number of valid elements in the DTCs array.

success

Indicates successful receipt of a positive response message for this diagnostic service.

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

The WWH-OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service (ISO 14229-1).