Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
transfer_data.h
1#ifndef TRANSFER_DATA_H
2#define TRANSFER_DATA_H
3
4#include <array>
5#include "./routable_uds_service.h"
6
7namespace ara
8{
9 namespace diag
10 {
11 namespace routing
12 {
14 enum class TransferDirection : uint8_t
15 {
16 kNone = 0x00,
17 kDownload = 0x01,
18 kUpload = 0x02
19 };
20
23 {
24 private:
25 static const uint8_t cSid{0x36};
26 static const size_t cMemoryPoolSize{1024};
27 static const uint8_t cInitialBlockSequenceCounter{1};
28
29 const size_t cSequenceCounterIndex{1};
30 const size_t cRequestParameterOffset{2};
31
32 const uint8_t cWrongBlockSequenceCounter{0x73};
33
34 TransferDirection mTransferDirection;
35 size_t mMemoryAddress;
36 size_t mMemorySize;
37 std::array<uint8_t, cMemoryPoolSize> mMemoryPool;
38 uint8_t mCurrentBlockSequenceCounter;
39 uint8_t mNextBlockSequenceCounter;
40
41 bool tryValidateSequenceCounter(
42 OperationOutput &response, uint8_t counter) const;
43 bool tryTransfer(
44 uint8_t blockSequenceCounter,
45 const std::vector<std::uint8_t> &transferRequestParameterRecord,
46 std::promise<OperationOutput> &responsePromise);
47
48 public:
51 TransferData(const ara::core::InstanceSpecifier &specifier) noexcept;
52 ~TransferData() noexcept = default;
53
60 TransferDirection transferDirection,
61 size_t memoryAddress,
62 size_t memorySize) noexcept;
63
66 bool TryResetTransferConfiguration() noexcept;
67
68 std::future<OperationOutput> HandleMessage(
69 const std::vector<uint8_t> &requestData,
70 MetaInfo &metaInfo,
71 CancellationHandler &&cancellationHandler) override;
72 };
73 }
74 }
75}
76
77#endif
AUTOSAR shortname-path wrapper.
Definition: instance_specifier.h:14
A wrapper class around a conversation cancellation handler callback.
Definition: cancellation_handler.h:12
Diagnostic metainfo in different context.
Definition: meta_info.h:24
An UDS service to handle a diagnostic request by offering itself to a router.
Definition: routable_uds_service.h:28
A class to transfer data between diagnostic clients and the server.
Definition: transfer_data.h:23
TransferData(const ara::core::InstanceSpecifier &specifier) noexcept
Constructor.
Definition: transfer_data.cpp:14
bool TrySetTransferConfiguration(TransferDirection transferDirection, size_t memoryAddress, size_t memorySize) noexcept
Try to set the service transfer data configuration.
Definition: transfer_data.cpp:128
std::future< OperationOutput > HandleMessage(const std::vector< uint8_t > &requestData, MetaInfo &metaInfo, CancellationHandler &&cancellationHandler) override
Handle an UDS request message.
Definition: transfer_data.cpp:91
bool TryResetTransferConfiguration() noexcept
Try to reset the service transfer data configuration to default.
Definition: transfer_data.cpp:164
TransferDirection
Transfer data direction between diagnostic clients and the server.
Definition: transfer_data.h:15
@ kNone
Not specified transfer data direction.
@ kDownload
Transfer data from client to server.
@ kUpload
Transfer data from server to client.
Positive response of a handled UDS request.
Definition: routable_uds_service.h:17