#include #include #include int main() { using msg1_t = mcc::network::MccNetMessage; using msg2_t = mcc::network::MccNetMessage; mcc::network::MccNetMessage msg3("ACK"); std::string_view sv{"TARGET 11:22:33.212; -0.23876984; RADEC "}; std::vector arr{sv.begin(), sv.end()}; msg1_t msg1; msg1.fromCharRange(arr); std::println("msg.key = <{}>", msg1.keyword()); std::println("msg.par[1] = <{}>", msg1.param(1)); std::vector vd{1.1, 2.2, 3.3}; msg2_t msg2("ACK", 12.43298042, "EEE", std::chrono::seconds(10), vd); // msg2_t msg2("ACK"); std::println("msg.bytes = <{}>",msg2.byteRepr()); std::println("msg.key = <{}>", msg2.keyword()); std::println("msg.par[1] = <{}>", msg2.param(1)); std::println("msg.par[2] = <{}>", msg2.param(2)); auto p2 = msg2.paramValue(2); std::println("msg.parvalue[2] = <{}>", p2.value_or(std::chrono::seconds{})); std::print("msg.parvalue[3] = <"); auto p3 = msg2.paramValue(3); if (p3.has_value()) { for (auto const& el : p3.value()) { std::print("{} ", el); } } std::println(">"); std::println("msg.par[1-2] joined = <{}>", msg2.params(1, 2)); auto vv = msg2.params>(1, 3); std::print("msg.par[1-3] array = <"); for (auto const& el : vv) { std::print("{} ", el); } std::println(">"); std::println("\n\n"); mcc::impl::MccSkyPoint spt(mcc::impl::MccSkyRADEC_APP{"10:00:00.0"_hms, 12.098687_degs}); msg2.construct("ACK", "MOUNT", spt); std::println("msg2.bytes = <{}>", msg2.byteRepr()); auto spt_d = msg2.paramValue(1); if (spt_d){ std::println("msg2.parvalue(1).epoch() = {}", spt_d->epoch().MJD()+mcc::MCC_MJD_ZERO); } else { std::println("cannot deserialize MccSkyPoint value!"); } return 0; }