Purpose

Executes the ControlDTCSetting service. Modifies the generation behavior of selected Diagnostic Trouble Codes (DTCs).

Format

        long ndControlDTCSetting(
       TD1 *diagRef,
       unsigned short groupOfDTC,
       unsigned char dataIn[],
       long len,
       TD3 *DTCDescriptor,
       LVBoolean *success);
      

Input

diagRef

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

groupOfDTC

Specifies the group of diagnostic trouble codes to be controlled. The following values have a special meaning

0x0000 All powertrain DTCs
0x4000 All chassis DTCs
0x8000 All body DTCs
0xC000 All network related DTCs
0xFF00 All DTCs

dataIn

Specifies application-specific data that control DTC generation.

len

Must contain the number of valid data bytes in dataIn.

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. Default is 2.

StatusByteLength indicates the number of bytes the ECU sends for each DTC's status. 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)

The response byte stream is interpreted according to this description, and the resulting DTC records are returned in the DTCs struct array.

For this service, DTCByteLength and ByteOrder are used to format the groupOfDTC parameter correctly into the request message. Output

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.