| 40 | // that |
| 41 | |
| 42 | int main() { |
| 43 | std::cout << "UdpEndpointTest::start" << std::endl; |
| 44 | UDPEndpoint udpEndpoint("UdpEndpoint", OHD_GROUND_CLIENT_UDP_PORT_OUT, |
| 45 | OHD_GROUND_CLIENT_UDP_PORT_IN); |
| 46 | auto cb = [](const std::vector<MavlinkMessage> messages) { |
| 47 | for (const auto& msg : messages) { |
| 48 | debugMavlinkMessage(msg.m, "Udp"); |
| 49 | } |
| 50 | }; |
| 51 | udpEndpoint.registerCallback(cb); |
| 52 | // now mavlink messages should come in. Try disconnecting and reconnecting, |
| 53 | // and see if messages continue |
| 54 | const auto start = std::chrono::steady_clock::now(); |
| 55 | while ((std::chrono::steady_clock::now() - start) < std::chrono::minutes(5)) { |
| 56 | openhd::log::get_default()->debug( |
| 57 | "Alive:{}", OHDUtil::yes_or_no(udpEndpoint.isAlive())); |
| 58 | auto heartbeat = MExampleMessage::heartbeat(); |
| 59 | udpEndpoint.sendMessages({heartbeat}); |
| 60 | auto position = MExampleMessage::position(); |
| 61 | udpEndpoint.sendMessages({position}); |
| 62 | auto attitude = MExampleMessage::attitude(); |
| 63 | udpEndpoint.sendMessages({attitude}); |
| 64 | std::this_thread::sleep_for(std::chrono::seconds(1)); |
| 65 | } |
| 66 | std::cout << "UdpEndpointTest::end" << std::endl; |
| 67 | return 0; |
| 68 | } |
nothing calls this directly
no test coverage detected