GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
载入中...
搜索中...
未找到
remote_logger.hpp
1#pragma once
2
3#include "device/network_protocol.hpp"
4#include "io/udp_server.hpp"
5
6namespace roboctrl::device {
7
10public:
11 struct info_type {
12 using key_type = std::string;
14 std::string key_;
15 std::string udp_name;
16 std::string address{"127.0.0.1"};
17 std::uint16_t port{8080};
18 const std::string& key() const { return key_; }
19 };
20 explicit remote_logger(const info_type& info);
21 void connect();
22 void start();
23 awaitable<void> push_value(std::string name, double value);
24 awaitable<void> push_console_message(std::string message);
25 awaitable<void> push_message_box(std::string message);
26 std::string desc() const { return std::format("remote logger {}", info_.key_); }
27private:
28 info_type info_;
29 io::udp_server* udp_{};
30 io::udp_server::endpoint peer_;
31 bool started_{};
32};
33} // namespace roboctrl::device
asio::awaitable< T > awaitable
协程任务类型。
Definition async.hpp:46