| 29 | #include "openhd_spdlog_include.h" |
| 30 | |
| 31 | UDPEndpoint::UDPEndpoint(const std::string& TAG, int senderPort, |
| 32 | int receiverPort, std::string senderIp, |
| 33 | std::string receiverIp) |
| 34 | : MEndpoint(TAG), |
| 35 | SEND_PORT(senderPort), |
| 36 | RECV_PORT(receiverPort), |
| 37 | SENDER_IP(std::move(senderIp)), |
| 38 | RECV_IP(std::move(receiverIp)) { |
| 39 | m_console = openhd::log::create_or_get(TAG); |
| 40 | assert(m_console); |
| 41 | const auto cb = [this](const uint8_t* payload, |
| 42 | const std::size_t payloadSize) mutable { |
| 43 | this->parseNewData(payload, (int)payloadSize); |
| 44 | }; |
| 45 | m_receiver_sender = |
| 46 | std::make_unique<openhd::UDPReceiver>(RECV_IP, RECV_PORT, cb); |
| 47 | m_receiver_sender->runInBackground(); |
| 48 | } |
| 49 | |
| 50 | UDPEndpoint::~UDPEndpoint() { m_receiver_sender->stopBackground(); } |
| 51 |
nothing calls this directly
no test coverage detected