Files
energy_storage/src/protocol/Communicator.cpp
2025-08-22 19:06:50 +08:00

28 lines
613 B
C++

#include "Communicator.h"
#include "TcpEntity.h"
std::shared_ptr<CommEntity> Communicator::createEntity(Fields& data)
{
std::string commType = data.value("commType");
std::string ip = data.value("ip");
int port = data.getInt("port");
int isclient = data.getInt("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;
}