INFM HIL Interface
Interface between Artery simulation and DuTs
V2XConnector.h
1
28#ifndef SIM_TO_DUT_INTERFACE_V2XCONNECTOR_H
29#define SIM_TO_DUT_INTERFACE_V2XCONNECTOR_H
30
31#include "../DuTConnector.h"
32#include <curl/curl.h>
33#include <thread>
34#include "V2XConnectorConfig.h"
35
42 class V2XConnector : public DuTConnector {
43
44 public:
51 explicit V2XConnector(std::shared_ptr<SharedQueue < SimEvent>>
52
53 queueDuTToSim,
54 const V2XConnectorConfig &config
55 );
56
61
67 void handleEventSingle(const SimEvent &e) override;
68
75
76 private:
82 void receiveCallback(const std::vector<unsigned char> &msg);
83
87 void startReceive();
88
95 void onReceive(const boost::system::error_code &ec, std::size_t read_bytes);
96
103 static int getIfnameIndex(const std::string &ifname);
104
108 boost::asio::io_service ioService;
109
113 boost::asio::generic::raw_protocol::socket _socket;
114
118 std::vector<unsigned char> receiveBuffer;
119
123 boost::asio::generic::raw_protocol::endpoint receiveEndpoint;
124
128 std::thread sockRunner;
129
133 unsigned short ethernetFrameType;
134 };
135}
136
137
138#endif //SIM_TO_DUT_INTERFACE_V2XCONNECTOR_H
A thread save shared queue to communicate between multiple threads. The queue is a FIFO queue.
Definition: SharedQueue.h:40
Event object used to communicate between simulation and DuTs.
Definition: SimEvent.h:47
Some basic information about the connector device.
Definition: ConnectorInfo.h:37
Connector implementing all kinds of DuT devices.
Definition: DuTConnector.h:48
Configuration for the V2XConnector, contains all necessary setup configuration to open a raw socket a...
Definition: V2XConnectorConfig.h:40
Connector to a V2X network interface, opens a raw socket and passes received packages to simulation
Definition: V2XConnector.h:42
V2XConnector(std::shared_ptr< SharedQueue< SimEvent > > queueDuTToSim, const V2XConnectorConfig &config)
Definition: V2XConnector.cpp:37
~V2XConnector()
Definition: V2XConnector.cpp:77
ConnectorInfo getConnectorInfo() override
Definition: V2XConnector.cpp:122
void handleEventSingle(const SimEvent &e) override
Definition: V2XConnector.cpp:112
Definition: EthernetPacket.cpp:33