mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
实现策略配置功能
This commit is contained in:
28
src/protocol/CommEntity.cpp
Normal file
28
src/protocol/CommEntity.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "CommEntity.h"
|
||||
#include "TcpEntity.h"
|
||||
|
||||
std::shared_ptr<CommEntity> CommEntity::create(Fields& data)
|
||||
{
|
||||
std::string commType = data.value("commType");
|
||||
std::string ip = data.value("ip");
|
||||
int port = data.get<int>("port");
|
||||
int isclient = data.get<int>("isclient");
|
||||
|
||||
if (commType == "TCP")
|
||||
{
|
||||
auto entity = std::make_shared<TcpEntity>();
|
||||
entity->setHost(ip, port, isclient);
|
||||
return entity;
|
||||
}
|
||||
else if (commType == "MODBUS")
|
||||
{
|
||||
}
|
||||
else if (commType == "ACTIVEX")
|
||||
{
|
||||
}
|
||||
else if (commType == "SDK")
|
||||
{
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user