|
|
@ -20,9 +20,7 @@ class Trace { |
|
|
|
* ======================================================宏定义======================================================= * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
/*********************************************************************************************************************
|
|
|
|
* ======================================================代码======================================================= * |
|
|
|
*********************************************************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
bool MainControlService::createIflytopHardwareWSPacket(shared_ptr<icps::Packet> packetin, json& jout) { |
|
|
|
if (!packetin) return false; |
|
|
@ -37,8 +35,8 @@ bool MainControlService::createIflytopHardwareWSPacket(shared_ptr<icps::Packet> |
|
|
|
"targetId": 128, // 128->255
|
|
|
|
"sourceId": 1, // 默认为1
|
|
|
|
"seq": 0, //0-65535,
|
|
|
|
"regAdd": 0, //0-65535
|
|
|
|
"regValue": 100 // -2^31->2^31-1
|
|
|
|
"ctrlPointAddr": 0, //0-65535
|
|
|
|
"ctrlPointVal": 100 // -2^31->2^31-1
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif
|
|
|
@ -49,17 +47,17 @@ bool MainControlService::createIflytopHardwareWSPacket(shared_ptr<icps::Packet> |
|
|
|
jout["channel"] = "can0"; |
|
|
|
} |
|
|
|
|
|
|
|
jout["protocol"] = "iflytopCanProtocolStackV1"; |
|
|
|
jout["message"]["attribute"] = packetin->getAttributeStr(); |
|
|
|
jout["message"]["priority"] = packetin->getPriority(); |
|
|
|
jout["message"]["type"] = packetin->getTypeStr(); |
|
|
|
jout["message"]["targetId"] = packetin->getTargetId(); |
|
|
|
jout["message"]["sourceId"] = packetin->getSourceId(); |
|
|
|
jout["message"]["seq"] = packetin->getSeq(); |
|
|
|
jout["message"]["regAdd"] = packetin->getRegAdd(); |
|
|
|
jout["message"]["regValue"] = packetin->getRegValue(); |
|
|
|
|
|
|
|
if (packetin->getTypeStr() == "receipt" && packetin->getRegAdd() == 0xffff) { |
|
|
|
jout["protocol"] = "iflytopCanProtocolStackV1"; |
|
|
|
jout["message"]["attribute"] = packetin->getAttributeStr(); |
|
|
|
jout["message"]["priority"] = packetin->getPriority(); |
|
|
|
jout["message"]["type"] = packetin->getTypeStr(); |
|
|
|
jout["message"]["targetId"] = packetin->getTargetId(); |
|
|
|
jout["message"]["sourceId"] = packetin->getSourceId(); |
|
|
|
jout["message"]["seq"] = packetin->getSeq(); |
|
|
|
jout["message"]["ctrlPointAddr"] = packetin->getRegAdd(); |
|
|
|
jout["message"]["ctrlPointVal"] = packetin->getRegValue(); |
|
|
|
|
|
|
|
if (packetin->getType() == icps::kerror_receipt) { |
|
|
|
jout["message"]["errorCode"] = icps::error_t2str((icps::error_t)packetin->getRegValue()); |
|
|
|
} |
|
|
|
jout["timestamp"] = zsystem_clock().getms(); |
|
|
@ -80,8 +78,8 @@ bool MainControlService::createICPSPacket(json jin, shared_ptr<icps::Packet>& pa |
|
|
|
_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->setRegAdd(jin["message"]["ctrlPointAddr"]); |
|
|
|
_packetout->setRegValue(jin["message"]["ctrlPointVal"]); |
|
|
|
packetout = _packetout; |
|
|
|
return true; |
|
|
|
} |
|
|
|