Files
energy_storage/src/app/Device.h

47 lines
866 B
C
Raw Normal View History

2025-05-19 09:54:33 +08:00
#pragma once
#include <string>
#include <map>
#include <vector>
#include <memory>
#include "common/Fields.h"
class CommEntity;
class Device
{
public:
int deviceId = -1;
int type = -1;
std::string name;
std::string code;
2025-08-28 18:42:37 +08:00
std::string group;
bool isOpen = false;
std::string attrsJson = "";
int err = 0;
int online = 0;
int status = 0;
//std::map<std::string, std::string> mapAttrs;
Fields attrs;
// 通讯entity
std::shared_ptr<CommEntity> commEntity;
//int getAttrInt(std::string key);
//float getAttrFloat(std::string key);
//double getAttrDouble(std::string key);
//std::string getAttrStr(std::string key);
2025-09-04 19:31:04 +08:00
int64_t tsDataDate {};
std::map<int, double> mapCacheData;
// 启动通讯
int startComm();
static std::shared_ptr<Device> create(Fields& fields);
};