Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::diag::routing::RequestTransfer Class Reference

Request data transfer in a certian direction (download/upload) More...

#include <request_transfer.h>

Inheritance diagram for ara::diag::routing::RequestTransfer:
ara::diag::routing::RoutableUdsService ara::diag::DownloadService ara::diag::UploadService

Public Member Functions

std::future< OperationOutputHandleMessage (const std::vector< uint8_t > &requestData, MetaInfo &metaInfo, CancellationHandler &&cancellationHandler) override
 Handle an UDS request message. More...
 
- Public Member Functions inherited from ara::diag::routing::RoutableUdsService
uint8_t GetSid () const noexcept
 Get SID. More...
 
ara::core::Result< void > Offer ()
 Offer handling DM requests. More...
 
bool IsOffered () const noexcept
 Get offering status of the service. More...
 
void StopOffer () noexcept
 Stop offering request handling.
 

Protected Member Functions

 RequestTransfer (const ara::core::InstanceSpecifier &specifier, ReentrancyType reentrancyType, uint8_t sid, TransferData &transferData, TransferDirection transferDirection)
 Constructor. More...
 
bool TryParseRequest (const std::vector< uint8_t > &requestData, uint8_t &dataFormatIdentifier, uint8_t &addressAndLengthFormatIdentifier, std::vector< uint8_t > &memoryAddressAndSize) const
 Try to parse a transfer request. More...
 
bool TryParseLengthFormat (uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, const std::vector< uint8_t > &memoryAddressAndSize, size_t &memoryAddress, size_t &memorySize) const
 Try to parse a memory length format. More...
 
bool TryRequestTransfer (size_t memoryAddress, size_t memorySize)
 Try to request a transfer in a certain direction (download/upload) More...
 
bool TryGeneratePositiveResponse (MetaInfo &metaInfo, OperationOutput &response) const
 Try to generate a positive response to a transfer request. More...
 
std::future< void > RequestDataTransfer (uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, std::vector< uint8_t > memoryAddressAndSize, MetaInfo &metaInfo, CancellationHandler &&cancellationHandler)
 Request diagnostic data transfer. More...
 
- Protected Member Functions inherited from ara::diag::routing::RoutableUdsService
 RoutableUdsService (const ara::core::InstanceSpecifier &specifier, uint8_t sid) noexcept
 Constructor. More...
 
void GenerateNegativeResponse (OperationOutput &response, uint8_t nrc) const
 Generate a negative response with a specific NRC. More...
 
template<class T >
bool TryExtractValue (MetaInfo &metaInfo, std::string key, T &value) const
 Try to extract a value from the given meta-info. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ara::diag::routing::RoutableUdsService
static const uint8_t cNegativeResponseCodeSid {0x7f}
 Negative response code service ID.
 
- Protected Attributes inherited from ara::diag::routing::RoutableUdsService
const uint8_t cSubFunctionNotSupported {0x12}
 Unsupported sub-function NRC.
 
const uint8_t cIncorrectMessageLength {0x13}
 Incorrect message length NRC.
 
const uint8_t cRequestSequenceError {0x24}
 Incorrect request sequence NRC.
 
- Static Protected Attributes inherited from ara::diag::routing::RoutableUdsService
static const uint8_t cPositiveResponseSidIncrement {0x40}
 SID increment for a positive response.
 

Detailed Description

Request data transfer in a certian direction (download/upload)

Constructor & Destructor Documentation

◆ RequestTransfer()

ara::diag::routing::RequestTransfer::RequestTransfer ( const ara::core::InstanceSpecifier specifier,
ReentrancyType  reentrancyType,
uint8_t  sid,
TransferData transferData,
TransferDirection  transferDirection 
)
protected

Constructor.

Parameters
specifierOwner instance specifier
reentrancyTypeService reentrancy type
sidUDS service ID
transferDataReference to a TransferData service
transferDirectionData transfer direction
Exceptions
std::invalid_argumentThrows when the transfer direction is not determined

Member Function Documentation

◆ HandleMessage()

std::future< OperationOutput > ara::diag::routing::RequestTransfer::HandleMessage ( const std::vector< uint8_t > &  requestData,
MetaInfo metaInfo,
CancellationHandler &&  cancellationHandler 
)
overridevirtual

Handle an UDS request message.

Parameters
requestDataRequest message byte array
metaInfoRequest message metainfo
cancellationHandlerCallback to be invoked when the current conversation is cancelled
Returns
Response byte array

Implements ara::diag::routing::RoutableUdsService.

◆ RequestDataTransfer()

std::future< void > ara::diag::routing::RequestTransfer::RequestDataTransfer ( uint8_t  dataFormatIdentifier,
uint8_t  addressAndLengthFormatIdentifier,
std::vector< uint8_t >  memoryAddressAndSize,
MetaInfo metaInfo,
CancellationHandler &&  cancellationHandler 
)
protected

Request diagnostic data transfer.

Parameters
dataFormatIdentifierDiagnostic data compression and/or encryption format ID
addressAndLengthFormatIdentifierMemory address and size length format ID
memoryAddressAndSizeMemory address and size length byte array
metaInfoMessage handling meta-info
cancellationHandlerMessage handling cancellation token
Returns
Future with a NRC exception in case of error

◆ TryGeneratePositiveResponse()

bool ara::diag::routing::RequestTransfer::TryGeneratePositiveResponse ( MetaInfo metaInfo,
OperationOutput response 
) const
protected

Try to generate a positive response to a transfer request.

Parameters
[in]metaInfoMessage handling meta-info
[out]responseGenerated positive response
Returns
True if the positive response is generated successfully, otherwise false

◆ TryParseLengthFormat()

bool ara::diag::routing::RequestTransfer::TryParseLengthFormat ( uint8_t  dataFormatIdentifier,
uint8_t  addressAndLengthFormatIdentifier,
const std::vector< uint8_t > &  memoryAddressAndSize,
size_t &  memoryAddress,
size_t &  memorySize 
) const
protected

Try to parse a memory length format.

Parameters
[in]dataFormatIdentifierData transfer encryption and/or compression format ID
[in]addressAndLengthFormatIdentifierParsed memory address and size format ID
[in]memoryAddressAndSizeMemory address and size length byte array to be parsed
[out]memoryAddressParsed memory address for data transfer
[out]memorySizeParsed memory size for data transfer
Returns
True if the length format is parsed successfully, otherwise false

◆ TryParseRequest()

bool ara::diag::routing::RequestTransfer::TryParseRequest ( const std::vector< uint8_t > &  requestData,
uint8_t &  dataFormatIdentifier,
uint8_t &  addressAndLengthFormatIdentifier,
std::vector< uint8_t > &  memoryAddressAndSize 
) const
protected

Try to parse a transfer request.

Parameters
[in]requestDataTransfer request byte array to be parsed
[out]dataFormatIdentifierParsed data transfer format ID
[out]addressAndLengthFormatIdentifierParsed memory address and size format ID
[out]memoryAddressAndSizeParsed memory and size length byte array
Returns
True if the request is parsed successfully, otherwise false

◆ TryRequestTransfer()

bool ara::diag::routing::RequestTransfer::TryRequestTransfer ( size_t  memoryAddress,
size_t  memorySize 
)
protected

Try to request a transfer in a certain direction (download/upload)

Parameters
memoryAddressMemory address for transfer
memorySizeMemory size for transfer
Returns
True if the request accepted, otherwise false