Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
doip_client.h
1#ifndef DOIP_CLIENT_H
2#define DOIP_CLIENT_H
3
4#include <functional>
5#include <asyncbsdsocket/poller.h>
6#include <asyncbsdsocket/tcp_client.h>
7#include "../../ara/core/optional.h"
8#include "../../ara/com/helper/concurrent_queue.h"
9
10namespace application
11{
12 namespace doip
13 {
17 {
18 private:
19 static constexpr size_t cDoipPacketSize{64};
20
21 AsyncBsdSocketLib::Poller *const mPoller;
22 AsyncBsdSocketLib::TcpClient mClient;
23 const uint8_t cProtocolVersion;
24 const std::function<void(std::vector<uint8_t> &&)> mCallback;
26 ara::core::Optional<uint16_t> mLogicalAddress;
27
28 void handleVehicleIdResponse(
29 const std::vector<uint8_t> &serializedMessage);
30
31 void handleDiagMessageAck(
32 const std::vector<uint8_t> &serializedMessage) const;
33
34 void onSend();
35 void onReceive();
36
37 public:
46 AsyncBsdSocketLib::Poller *poller,
47 std::string ipAddress,
48 uint16_t port,
49 uint8_t protocolVersion,
50 std::function<void(std::vector<uint8_t> &&)> &&callback);
51
55 bool TrySendDiagMessage(std::vector<uint8_t> &&userData);
56
58 };
59 }
60}
61
62#endif
A class to send DoIP requests to a DoIP server.
Definition: doip_client.h:17
DoipClient(AsyncBsdSocketLib::Poller *poller, std::string ipAddress, uint16_t port, uint8_t protocolVersion, std::function< void(std::vector< uint8_t > &&)> &&callback)
Constructor.
Definition: doip_client.cpp:15
bool TrySendDiagMessage(std::vector< uint8_t > &&userData)
Try to send a diagnostic message to the DoIP server asynchronously.
Definition: doip_client.cpp:148
Thread-safe wrapper around STL queue using locking mechanism.
Definition: concurrent_queue.h:18
A wrapper around a possible value.
Definition: optional.h:16
AUTOSAR application namespace.
Definition: diag_message_handler.cpp:5