#pragma once #include #include #include #include #include "common/Fields.h" class CommEntity; class Device { public: int deviceId = -1; int type = -1; std::string name; std::string code; std::string group; bool isOpen = false; std::string attrsJson = ""; int err = 0; int online = 0; int status = 0; //std::map mapAttrs; Fields attrs; // 通讯entity std::shared_ptr commEntity; //int getAttrInt(std::string key); //float getAttrFloat(std::string key); //double getAttrDouble(std::string key); //std::string getAttrStr(std::string key); int64_t tsDataDate {}; std::map mapCacheData; // 启动通讯 int startComm(); static std::shared_ptr create(Fields& fields); };