| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #pragma once
- #include <string>
- #include <fstream>
- #include "json.hpp"
- #include "rfid_client.h"
- #include "modbus_client.h"
- #include "bucket_manager.h"
- using json = nlohmann::json;
- struct AppConfig {
- // 应用信息
- std::string app_name = "钢包工位视频监测系统";
- // 通讯模块
- std::string module_type = "RFID"; // "RFID" 或 "Modbus"
- RfidConfig rfid;
- ModbusConfig modbus;
- // 视频
- float rtsp_timeout = 10.0f;
- // 空闲超时
- int idle_timeout = 5;
- // 自动重启
- bool auto_reboot_enabled = false;
- int auto_reboot_cycle = 1;
- std::string auto_reboot_time = "03:30";
- // Web
- int web_port = 8080;
- std::string web_username = "admin";
- std::string web_password = "admin";
- };
- class ConfigLoader {
- public:
- static json loadJson(const std::string& path);
- static void saveJson(const std::string& path, const json& j);
- static AppConfig loadConfig(const std::string& path);
- static void saveConfig(const std::string& path, const AppConfig& cfg, const json& buckets);
- };
|