#pragma once #include #include #include "common/Fields.h" class CommEntity { public: CommEntity() {} CommEntity(std::string type) : type(type) {} static std::shared_ptr create(Fields& data); void setType(std::string type) { this->type = type; } // 启动通讯连接 virtual int start() { return 0; }; // 关闭通讯连接 virtual void close() { isCloseRequest = true; }; std::string id() { return id_; } public: std::string id_; std::string type; int commtype = 0; bool alive = false; bool isConnected = false; bool isCloseRequest = false; };