INFM HIL Interface
Interface between Artery simulation and DuTs
ReceiveEndpoint.h
1
26#ifndef SIM_TO_DUT_INTERFACE_RECEIVEENDPOINT_H
27#define SIM_TO_DUT_INTERFACE_RECEIVEENDPOINT_H
28
29
30#include <corvusoft/restbed/resource.hpp>
31#include <corvusoft/restbed/service.hpp>
32#include <memory>
33#include "../../Events/SimEvent.h"
34
41 class ReceiveApiResource : public restbed::Resource {
42 public:
48 explicit ReceiveApiResource(std::function<void(const SimEvent &)> function);
49
55 void PUT_method_handler(const std::shared_ptr<restbed::Session> &session);
56
57 private:
64 static SimEvent JsonToSimEvent(const std::string &json);
65
69 std::function<void(const SimEvent &)> eventToSimCallback;
70 };
71
77 class ReceiveEndpoint : public restbed::Service {
78 public:
85 void startService(int const &port, std::function<void(const SimEvent &)> function);
86
90 void stopService();
91
95 std::shared_ptr<ReceiveApiResource> m_spReceiveApiResource;
96 };
97}
98
99#endif //SIM_TO_DUT_INTERFACE_RECEIVEENDPOINT_H
Event object used to communicate between simulation and DuTs.
Definition: SimEvent.h:47
restbed REST resource describing the methods and paths the endpoint can process
Definition: ReceiveEndpoint.h:41
ReceiveApiResource(std::function< void(const SimEvent &)> function)
Definition: ReceiveEndpoint.cpp:53
void PUT_method_handler(const std::shared_ptr< restbed::Session > &session)
Definition: ReceiveEndpoint.cpp:59
restbed REST endpoint offering methods and paths described in
Definition: ReceiveEndpoint.h:77
void stopService()
Definition: ReceiveEndpoint.cpp:49
void startService(int const &port, std::function< void(const SimEvent &)> function)
Definition: ReceiveEndpoint.cpp:37
std::shared_ptr< ReceiveApiResource > m_spReceiveApiResource
Definition: ReceiveEndpoint.h:95
Definition: ReceiveEndpoint.cpp:36