#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; int category; bool isOpen = false; std::string attrsJson = ""; int err = 0; int online = 0; int running = 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 mapCacheVoltage; std::map mapCacheCurrent; std::map mapCachePower; // 启动通讯 int startComm(); void getRuntimeParams(std::vector>& params); void getCacheVoltage(std::vector& vec); void getCacheCurrent(std::vector& vec); void getCachePower(std::vector& vec); static std::shared_ptr create(Fields& fields); };