INFM HIL Interface
Interface between Artery simulation and DuTs
SimToDuTInterface.h
1
25#ifndef SIM_TO_DUT_INTERFACE_SIMTODUTINTERFACE_H
26#define SIM_TO_DUT_INTERFACE_SIMTODUTINTERFACE_H
27
28#include "DuT_Connectors/DuTConnector.h"
29#include "Sim_Communication/SimComHandler.h"
30#include <list>
31#include <iterator>
32
33namespace sim_interface {
34 // Forward declaration to avoid looping
35 class SimComHandler;
36
43 public:
48
53
58 void addConnector(std::shared_ptr<dut_connector::DuTConnector> duTConnector);
59
64 void setSimComHandler(SimComHandler *simComHandler);
65
69 void run();
70
77 friend std::ostream &operator<<(std::ostream &os, const SimToDuTInterface &interface);
78
83 std::shared_ptr<SharedQueue<SimEvent>> getQueueDuTToSim();
84
89 std::shared_ptr<SharedQueue<SimEvent>> getQueueSimToInterface();
90
91 private:
92 std::shared_ptr<SharedQueue<SimEvent>> queueDuTToSim;
93 std::shared_ptr<SharedQueue<SimEvent>> queueSimToInterface;
94 SimComHandler *simComHandler = nullptr;
95 std::list<std::shared_ptr<dut_connector::DuTConnector>> duTConnectors;
96 std::thread threadSimToInterface;
97 std::thread threadDuTToSim;
98 bool stopThreads = true;
99
100 void sendEventToConnector(const SimEvent &event);
101
102 void handleEventsFromSim();
103
104 void handleEventsFromDuT();
105 };
106}
107
108#endif //SIM_TO_DUT_INTERFACE_SIMTODUTINTERFACE_H
Handler between interface and simulation. Responsible for sending/receiving SimEvents to/from the sim...
Definition: SimComHandler.h:46
Event object used to communicate between simulation and DuTs.
Definition: SimEvent.h:47
An interface between a simulation and multiple DuT devices.
Definition: SimToDuTInterface.h:42
void run()
Definition: SimToDuTInterface.cpp:52
~SimToDuTInterface()
Definition: SimToDuTInterface.cpp:89
void addConnector(std::shared_ptr< dut_connector::DuTConnector > duTConnector)
Definition: SimToDuTInterface.cpp:33
SimToDuTInterface()
Definition: SimToDuTInterface.cpp:28
std::shared_ptr< SharedQueue< SimEvent > > getQueueDuTToSim()
Definition: SimToDuTInterface.cpp:57
friend std::ostream & operator<<(std::ostream &os, const SimToDuTInterface &interface)
Definition: SimToDuTInterface.cpp:43
void setSimComHandler(SimComHandler *simComHandler)
Definition: SimToDuTInterface.cpp:85
std::shared_ptr< SharedQueue< SimEvent > > getQueueSimToInterface()
Definition: SimToDuTInterface.cpp:61
Definition: CANConnector.cpp:29