Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
rpc_client.h
1#ifndef RPC_CLIENT_H
2#define RPC_CLIENT_H
3
4#include <functional>
5#include <map>
6#include <stdint.h>
7#include <vector>
8#include "./someip_rpc_message.h"
9
10namespace ara
11{
12 namespace com
13 {
14 namespace someip
15 {
16 namespace rpc
17 {
20 {
21 public:
23 using HandlerType = std::function<void(const SomeIpRpcMessage &)>;
24
25 private:
26 const uint8_t mProtocolVersion;
27 const uint8_t mInterfaceVersion;
28 std::map<uint32_t, uint16_t> mSessionIds;
29 std::map<uint32_t, HandlerType> mHandlers;
30
31 protected:
36 uint8_t protocolVersion,
37 uint8_t interfaceVersion) noexcept;
38
41 void InvokeHandler(const std::vector<uint8_t> &payload) const;
42
45 virtual void Send(const std::vector<uint8_t> &payload) = 0;
46
47 public:
52 void SetHandler(
53 uint16_t serviceId, uint16_t methodId, HandlerType handler);
54
60 void Send(
61 uint16_t serviceId,
62 uint16_t methodId,
63 uint16_t clientId,
64 const std::vector<uint8_t> &rpcPayload);
65
66 virtual ~RpcClient() noexcept = default;
67 };
68 }
69 }
70 }
71}
72
73#endif
SOME/IP RPC abstract client.
Definition: rpc_client.h:20
virtual void Send(const std::vector< uint8_t > &payload)=0
Send a SOME/IP request to the RPC server.
void InvokeHandler(const std::vector< uint8_t > &payload) const
Invoke corresponding response handler at a message reception.
Definition: rpc_client.cpp:18
void SetHandler(uint16_t serviceId, uint16_t methodId, HandlerType handler)
Set a RPC response handler.
Definition: rpc_client.cpp:37
std::function< void(const SomeIpRpcMessage &)> HandlerType
SOME/IP RPC response handler type.
Definition: rpc_client.h:23
RpcClient(uint8_t protocolVersion, uint8_t interfaceVersion) noexcept
Constructor.
Definition: rpc_client.cpp:11
SOME/IP remote procedure call message.
Definition: someip_rpc_message.h:16