| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- /*
- * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
- * @Date: 2025-06-11 14:39:19
- * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
- * @LastEditTime: 2025-06-17 16:36:20
- * @FilePath: /yancheng/SimpleConfig.h
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- */
- #pragma once
- #include <string>
- #include <nlohmann/json.hpp>
- struct NetworkConfig {
- struct Udp {
- std::string target_ip;
- int target_port;
- bool enabled;
- } udp;
- struct Zmq {
- int gps_publish_port;
- int imu_publish_port;
- int fused_publish_port;
- bool enabled;
- } zmq;
- };
- struct DeviceConfig {
- struct Gps {
- std::string serial_port;
- int timeout_ms;
- bool enabled;
- } gps;
- struct Imu {
- std::string serial_port;
- int polling_rate_hz;
- bool enabled;
- } imu;
- struct Camera {
- int device_index;
- int width;
- int height;
- int jpeg_quality;
- int fps;
- bool enabled;
- } camera;
- };
- class SimpleConfig {
- public:
- SimpleConfig() = default;
- static SimpleConfig& getInstance();
-
- bool load(const std::string& filepath);
- const NetworkConfig& getNetwork() const { return network_; }
- const DeviceConfig& getDevices() const { return devices_; }
- private:
- NetworkConfig network_;
- DeviceConfig devices_;
- };
|