ndUDSTransferData
- Updated2025-10-07
- 2 minute(s) read
Purpose
Transfers data to/from the ECU in a download/upload process.
Format
long ndUDSTransferData (
TD1 *diagRef,
unsigned char *blockSequenceCounter,
unsigned char dataIn[],
long len,
unsigned char dataOut[],
long *len2,
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.
blockSequenceCounter
Used to number the data blocks to be transferred to/from the ECU. The block sequence counter value starts at 01 hex with the first ndUDSTransferData request that follows the ndUDSRequestDownload or ndUDSRequestUpload service. Its value is incremented by 1 for each subsequent ndUDSTransferData request. At the value of FF hex, the block sequence counter rolls over and starts at 00 hex with the next ndUDSTransferData request.
The block sequence counter is updated automatically, and the updated value is returned.
dataIn
Defines the data block to be written to the ECU.
For a download, this is a memory data block to be downloaded to the ECU.
For an upload, the meaning is implementation dependent.
len
Must be set to the buffer size for the dataIn parameter. Output
blockSequenceCounter
Returns the updated value of the block sequence counter (refer to the description in the Input section).
dataOut
Returns the memory data from the ECU.
For a download, this may contain a checksum or similar verification instrument; the meaning is implementation dependent.
For an upload, this is a memory data block uploaded from the ECU.
len2
Must be set to the buffer size for the dataOut parameter. On return, it contains the actual data size returned in dataOut.
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.
DescriptionndUDSTransferData executes the data transfer of a download process (initiated with a previous ndUDSRequestDownload request) or an upload process (initiated with a previous ndUDSRequestUpload request). The data transfer must occur in blocks of the size that has been returned in the blockSize parameter of the respective request service. After the data transfer completes, terminate the operation by calling the ndUDSRequestTransferExit service.