Processes and stores incoming data blocks during write file transfers in the application.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: eacdeba00b95ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Processes and stores incoming data blocks during write file transfers in the application.
Class ara::diag::DataTransferWriteHandler serves in AUTOSAR Adaptive for application-side processing of write file transfers initiated by RequestWriteFile in modes AddFile, ResumeFile, or ReplaceFile[SWS_DM_01539]. Incoming data packets are written asynchronously into memory via Write() and the session is subsequently terminated using ExitWrite(). An instance is strictly bound to a single transfer session and must under no circumstances be destroyed before ExitWrite() is called [SWS_DM_01541].
Context
In the AUTOSAR Adaptive Platform, the abstract base class ara::diag::DataTransferWriteHandler defines the interface for write file transfers [SWS_DM_01539] (AUTOSAR_AP_SWS_Diagnostics §8.10.6 “Class: DataTransferWriteHandler”). It serves for the application-side processing of data transfers initiated in the context of RequestWriteFile via operating modes AddFile, ResumeFile, or ReplaceFile.
Within the diagnostic architecture, the handler interacts with the external UDS client, the diagnostic middleware, and the application. The client transmits segmented data blocks that are received by a derived implementation of the handler and stored in application memory [SWS_DM_01546]. Presumably, the platform's Diagnostic Management handles the UDS protocol coordination and forwards the payload to the target application via the handler interface. Question Q-484dc9dd80e56af4 (open)
Lifecycle
Instantiation of ara::diag::DataTransferWriteHandler is performed exclusively by specialized subclasses of the application: the parameterless constructor is defined with protected and noexcept=default[SWS_DM_01540], which prevents direct instantiation of the base class. A handler instance is strictly bound to a single file transfer session ("one way usage i.e. per single file transfer session"). For this reason, copy constructor [SWS_DM_01544] (AUTOSAR_AP_SWS_Diagnostics §8.10.6.1.2.1 “DataTransferWriteHandler”) and copy assignment operator [SWS_DM_01545] are deleted (=delete).
For tearing down the instance, a binding precondition applies: an instance of this class must under no circumstances be destroyed before method ExitWrite() was called [SWS_DM_01541] (AUTOSAR_AP_SWS_Diagnostics §8.10.6.1.1.2 “Destructor”). Only after ExitWrite() has been fully executed may the virtual destructor ~DataTransferWriteHandler() be called. The member functions and the destructor are specified as not thread-safe (not thread-safe) [SWS_DM_01541], [SWS_DM_01546], [SWS_DM_01547].
State diagram: Lifecycle and call sequence of a DataTransferWriteHandler instance. Sources: [SWS_DM_01541], [SWS_DM_01544].
Usage Path
The regular sequence of a write transfer comprises the step-by-step receipt of data blocks and the subsequent termination of the session:
For each incoming data segment, the diagnostic system calls the pure virtual method Write()[SWS_DM_01546] (AUTOSAR_AP_SWS_Diagnostics §8.10.6.1.3.2 “Write”). The data is passed as ara::core::Span<ara::core::Byte>. The validity of this memory area persists until the associated Promise is fulfilled or the operation is cancelled. The application appends the data to the internal buffer and returns a ara::core::Future<void>.
After all segments have been transferred, the platform calls the pure virtual method ExitWrite()[SWS_DM_01547] (AUTOSAR_AP_SWS_Diagnostics §8.10.6.1.3.1 “ExitWrite”). Passed are the termination reason (DataTransferExitType), vehicle-manufacturer-specific parameters (transferRequestParameterRecord), metaInfo, and a CancellationHandler.
Method ExitWrite() returns a ara::core::Future<ara::core::Vector<ara::core::Byte>>. Upon successful completion, the data contained therein is inserted as transferResponseParameterRecord after the service ID into the positive UDS response message [SWS_DM_01547].
Sequence diagram: Call sequence of Write and ExitWrite operations during a transfer session. Sources: [SWS_DM_01546], [SWS_DM_01547].
Error Scenarios
Errors during data processing and transfer are managed via standardized return values and cancellation mechanisms:
If writing a data block or terminating the transfer fails, the respective Future is provided with a ara::core::ErrorCode from DiagUdsNrcErrc[SWS_DM_01546], [SWS_DM_01547]. This leads to the generation of a corresponding negative UDS response (NRC according to ISO 14229-1) to the client.
Both methods provide a CancellationHandler. The application can check via cancellationHandler.IsCanceled() whether the conversation was cancelled, or register a notification function using cancellationHandler.SetNotifier() that is executed upon cancellation of the conversation [SWS_DM_01546], [SWS_DM_01547].
If the instance is destroyed before calling ExitWrite(), this constitutes a violation of the specified lifecycle rule [SWS_DM_01541], which presumably leads to an undefined system state and incomplete files. Question Q-cc032c11ac89a5b1 (open) In addition, unprotected concurrent access leads to data inconsistencies, as the interface is explicitly not thread-safe.
This guide was created by an AI curation assistant based on AUTOSAR R25-11.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 459b3563e8d0Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The virtual member function ara::diag::DataTransferWriteHandler::ExitWrite terminates an ongoing data transfer session for write accesses [SWS_DM_01547] (AUTOSAR_AP_SWS_Diagnostics §8.10.6.1.3.1 “ExitWrite”, header #include "ara/diag/data_transfer.h"). The call parameters comprise:
exitType: Determines the reason for terminating the session [SWS_DM_01547].
transferRequestParameterRecord: Vehicle-manufacturer-specific parameters to support the data transfer; the validity of the span must persist until the associated promise is fulfilled or the operation is canceled [SWS_DM_01547].
metaInfo: Meta-information of the diagnostic request [SWS_DM_01547].
cancellationHandler: Allows querying the cancellation status via cancellationHandler.IsCanceled() as well as registering a notifier via cancellationHandler.SetNotifier()[SWS_DM_01547].
The function operates asynchronously and returns a ara::core::Future<ara::core::Vector<ara::core::Byte>>, whose result data, in the case of success, is inserted as transferResponseParameterRecord after the SID into the positive response message [SWS_DM_01547].
Error handling
If completion fails, the future must be provided with an appropriate Negative Response Code (NRC) in accordance with ISO 14229-1 via DiagUdsNrcErrc[SWS_DM_01547]. The function is specified as noexcept and exception-safe [SWS_DM_01547].
Concurrency and Interaction
The implementation is not thread-safe [SWS_DM_01547]. Regarding the object lifecycle, there is a strict sequencing condition: an instance of the handler class must not be destroyed until after ExitWrite() has been called [SWS_DM_01541].
This usage note was generated automatically based on the AUTOSAR specifications for Release R25-11.
This parameter record contains parameter(s), which are required by the server to support the transfer of data. Format and length of this parameter(s) are vehicle manufacturer specific. Lifetime: Valid until Promise is fulfilled or the processing is cancelled by the cancellationHandler.
metaInfo
MetaInfo of the request.
cancellationHandler
This parameter is used to • Query the current cancellation status by calling cancellationHandler.IsCanceled. Returns true in case, the current conversation has been cancelled and false otherwise. • Register a notifier function by calling cancellationHandler.SetNotifier. The registered notifier is called if the current conversation is cancelled.
Returns a Future, which either gets readied to OperationOutput (transferResponseParameterRecord for a positive response message) or readied with ErrorCode from DiagUdsNrcErrc (for an negative response message) Data in OperationOutput.response_ data will be placed after SID as transferResponseParameterRecord in the positive response.
Fehler
Fehlercode
Beschreibung
Please use an applicable NRC, as defined in ISO 14229-1, using DiagUdsNrcErrc.
Request a governed re-review of this record. The record is not changed immediately.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: a81be0f54500ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Method Write of interface ara::diag::DataTransferWriteHandler is used to append received data blocks to the application's memory area during a UDS file transfer [SWS_DM_01546]. The call is made by the Diagnostic Server instance when a UDS request TransferData (0x36) is received within an operation initiated by RequestFileTransfer (0x38) [SWS_DM_01317].
Parameters and Semantics
The file contents to be written are passed via requestData as a ara::core::Span<ara::core::Byte>; the referenced buffer remains valid until the associated promise is fulfilled or processing is canceled [SWS_DM_01546]. Parameter metaInfo provides meta-information of the diagnostic request. Via cancellationHandler, the current cancellation status can be checked using IsCanceled or a notification callback can be registered via SetNotifier[SWS_DM_01546].
Error Handling and Concurrency
The result is returned asynchronously as a ara::core::Future<void>. In case of success, the future is completed empty; in case of errors, it must be completed with an appropriate Negative Response Code (NRC) from DiagUdsNrcErrc according to ISO 14229-1 [SWS_DM_01546]. The function is specified as exception safe, but explicitly as not thread-safe[SWS_DM_01546]; the Diagnostic Server is therefore likely to guarantee sequential calls for the same session. Question Q-e60d55fe09b9a2c5 (open)
Interaction and Sequence
The write handler is registered via template constructors within the DataTransferWriteSession[SWS_DM_01317]. As soon as the transfer is concluded with RequestTransferExit (0x37), the server calls the Exit method of the same handler [SWS_DM_01318]. The element is distinguished from DID-related write methods as defined in [SWS_DM_00598] or [SWS_DM_00637].
This text was created automatically. Technical statements are supported by specification references.
The first or subsequent file content chunk received from the UDS client to be written into the file. Lifetime: Valid until Promise is fulfilled or the processing is cancelled by the cancellationHandler.
metaInfo
MetaInfo of the request.
cancellationHandler
This parameter is used to • Query the current cancellation status by calling cancellationHandler.IsCanceled. Returns TRUE in case, the current conversation has been cancelled and FALSE otherwise. • Register a notifier function by calling cancellationHandler.SetNotifier. The registered notifier is called if the current conversation is cancelled.
gemini-3.8-flash-low· 2026-10-13 · German original