// // Created by xtkuang on 2025/5/6. // #ifndef CMVR_ES_DEVICE_MANAGER_H #define CMVR_ES_DEVICE_MANAGER_H #include #include #include #include #include "device_factory.h" #include "system_monitor.h" #include "../utils/base/thread_pool.h" namespace cmvr::device { using DeviceVariant = std::variant< std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr >; typedef struct { std::string version; std::string name; std::string description; std::string os; std::string kernel_version; std::string architecture; } SystemInfo; class DeviceManager { public: DeviceManager(const DeviceManager&) = delete; DeviceManager& operator=(const DeviceManager&) = delete; static DeviceManager& getInstance(const XmlNode &cfg); static DeviceManager& getInstance(); static void destroyInstance(); void start(); void restart(); void stop(); void updateParam(const std::string& id, const std::pair ¶m); void getDeviceList(std::list> &device_list); void getSystemInfo(SystemInfo &info) const; void getSystemStatus(device::SystemStatus &status) const; template std::shared_ptr getDevice(const std::string &device_id); private: static std::once_flag init_flag_; static std::shared_ptr instance_; XmlNode cfg_; SystemInfo info_; std::unordered_map devices_; std::unique_ptr dev_factory_; std::unique_ptr sys_monitor_; explicit DeviceManager(const XmlNode &cfg); void init_devices_(); void get_os_info_(); }; } // cmvr #endif //CMVR_ES_DEVICE_MANAGER_H