Line data Source code
1 : /********************************************************************************
2 : * Copyright (c) 2026 Accenture
3 : *
4 : * This program and the accompanying materials are made available under the
5 : * terms of the Apache License Version 2.0 which is available at
6 : * https://www.apache.org/licenses/LICENSE-2.0
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : ********************************************************************************/
10 :
11 : #pragma once
12 :
13 : #include "someip/NetworkChannel.h"
14 : #include "someip/SomeIpMessage.h"
15 :
16 : #include <etl/array.h>
17 : #include <etl/span.h>
18 : #include <cstdint>
19 :
20 : namespace someip
21 : {
22 : /**
23 : * Implementation of a TP sender.
24 : */
25 : class TpSender
26 : {
27 : public:
28 : enum class TpResult : uint8_t
29 : {
30 : TP_OK,
31 : TP_ERROR
32 : };
33 :
34 : TpResult send(NetworkChannel& channel, SomeIpMessage const& message);
35 :
36 : protected:
37 18 : explicit TpSender(::etl::span<uint8_t> const& buffer) : _buffer(buffer) {}
38 :
39 : private:
40 : ::etl::span<uint8_t> _buffer;
41 : };
42 :
43 : namespace declare
44 : {
45 : template<size_t BufferSize>
46 : class TpSender : public ::someip::TpSender
47 : {
48 : public:
49 15 : TpSender() : ::someip::TpSender(_buffer), _buffer() {}
50 :
51 : private:
52 : ::etl::array<uint8_t, BufferSize> _buffer;
53 : };
54 : } // namespace declare
55 : } // namespace someip
|