|
|
@ -61,21 +61,22 @@ bool MainControlService::createIflytopHardwareWSPacket(shared_ptr<icps::Packet> |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
bool MainControlService::createICPSPacket(json jin, shared_ptr<icps::Packet>& packetin) { //
|
|
|
|
shared_ptr<icps::Packet> packetout(new icps::Packet()); |
|
|
|
bool MainControlService::createICPSPacket(json jin, shared_ptr<icps::Packet>& packetout) { //
|
|
|
|
shared_ptr<icps::Packet> _packetout(new icps::Packet()); |
|
|
|
if (jin["protocol"] != "iflytopCanProtocolStackV1") { |
|
|
|
logger->error("create ICPSPacket failed, protocol not match,protocol:{}", jin["protocol"].get<string>()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
packetin->setAttributeByStr(jin["message"]["attribute"]); |
|
|
|
packetin->setPriority(jin["message"]["priority"]); |
|
|
|
packetin->setTypeByStr(jin["message"]["type"]); |
|
|
|
packetin->setTargetId(jin["message"]["targetId"]); |
|
|
|
packetin->setSourceId(jin["message"]["sourceId"]); |
|
|
|
packetin->setSeq(jin["message"]["seq"]); |
|
|
|
packetin->setRegAdd(jin["message"]["regAdd"]); |
|
|
|
packetin->setRegValue(jin["message"]["regValue"]); |
|
|
|
_packetout->setAttributeByStr(jin["message"]["attribute"]); |
|
|
|
_packetout->setPriority(jin["message"]["priority"]); |
|
|
|
_packetout->setTypeByStr(jin["message"]["type"]); |
|
|
|
_packetout->setTargetId(jin["message"]["targetId"]); |
|
|
|
_packetout->setSourceId(jin["message"]["sourceId"]); |
|
|
|
_packetout->setSeq(jin["message"]["seq"]); |
|
|
|
_packetout->setRegAdd(jin["message"]["regAdd"]); |
|
|
|
_packetout->setRegValue(jin["message"]["regValue"]); |
|
|
|
packetout = _packetout; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -110,6 +111,7 @@ void MainControlService::websocketServerInitialize() { |
|
|
|
json message = json::parse(msgtext); |
|
|
|
processIflytopWSMsg(message); |
|
|
|
} catch (const std::exception& e) { |
|
|
|
logger->error("m_iflytopWSService:onMessag,parse json failed,exception:{},{}", e.what(), msgtext); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|