#ifndef APPLICATION_H #define APPLICATION_H #include "http/http_svr.h" #include "mqtt/mqtt_cli.h" #include "report_svr/report_svr.h" #include "oss/oss.h" #include "device_holder.h" #include "controller/test.h" #include "mqtt/mqtt_svr.h" namespace zsy { struct AppProperties { bool daemon{false}; uint32_t delay{0}; std::string name; bool embedMqtt{false}; }; inline void from_json(const nlohmann::json &j, AppProperties &o) { PARSE_JSON(daemon, o.daemon); PARSE_JSON(delay, o.delay); PARSE_JSON(name, o.name); PARSE_JSON(embedMqtt, o.embedMqtt); } class Application { const std::string configFile; std::string pidFilePath; std::string pid; static HANDLE STOP_EVENT; nlohmann::json config; void loadConfig(); void removePid(); void writePid(); public: // static std::shared_ptr threadPool; static std::shared_ptr eventManager; static std::shared_ptr httpSvr; static std::shared_ptr oss; static std::shared_ptr mqttSvr; static std::shared_ptr mqttCliHolder; static std::shared_ptr reportSvr; static std::shared_ptr deviceHolder; static std::shared_ptr test; Application(const std::string &configFile); static void run(); static void run(const std::string &configFile); static void stop(); ~Application(); }; } // zsy #endif //APPLICATION_H