diff --git a/src/app/transmit_disinfection/transmitdisinfection.cpp b/src/app/transmit_disinfection/transmitdisinfection.cpp index c2255c7..02869be 100644 --- a/src/app/transmit_disinfection/transmitdisinfection.cpp +++ b/src/app/transmit_disinfection/transmitdisinfection.cpp @@ -40,15 +40,20 @@ TransmitDisinfection::TransmitDisinfection(QWidget *parent) : QTabWidget(parent) ErrorCodeInitializer().regErrorcodeInfo(); CAN_MASTER->getCanProtocolCom()->regOnRawData([this](packet_type_t type, uint8_t from, uint8_t to, uint8_t *hex, uint32_t hexlen) { + zcanbus_packet_t *frame = (zcanbus_packet_t *)hex; + int paramLen = hexlen - sizeof(*frame); if (type == kcmd) { - zcanbus_packet_t *frame = (zcanbus_packet_t *)hex; - BSHOW("[CMD ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); // + BSHOW("[CMD ] [%d->%d],%s %s(%d)", from, to, zhex2str(hex, sizeof(*frame)).c_str(), // + zhex2str(frame->params, paramLen).c_str(), paramLen); // } else if (type == kerror_receipt) { - BSHOW("[E-RECEIPT] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); // + BSHOW("[E-RECEIPT] [%d->%d],%s %s(%d)", from, to, zhex2str(hex, sizeof(*frame)).c_str(), // + zhex2str(frame->params, paramLen).c_str(), paramLen); // } else if (type == kreceipt) { - BSHOW("[RECEIPT ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); // + BSHOW("[RECEIPT ] [%d->%d],%s %s(%d)", from, to, zhex2str(hex, sizeof(*frame)).c_str(), // + zhex2str(frame->params, paramLen).c_str(), paramLen); // } else if (type == kreport) { - BSHOW("[REPORT ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); // + BSHOW("[REPORT ] [%d->%d],%s %s(%d)", from, to, zhex2str(hex, sizeof(*frame)).c_str(), // + zhex2str(frame->params, paramLen).c_str(), paramLen); // } processReportPacket(type, from, to, hex, hexlen); }); diff --git a/src/protocol/zscanprotocol_com/zscanprotocol_com.hpp b/src/protocol/zscanprotocol_com/zscanprotocol_com.hpp index 5727a33..390c7a1 100644 --- a/src/protocol/zscanprotocol_com/zscanprotocol_com.hpp +++ b/src/protocol/zscanprotocol_com/zscanprotocol_com.hpp @@ -40,7 +40,7 @@ class Receipt { size_t receiptLen; zcanbus_packet_t *getPacket() { return (zcanbus_packet_t *)receipt; } - int32_t getContent(int index) { return getPacket()->params[index]; } + int32_t getContent(int index) { return ((int32_t *)(getPacket()->params))[index]; } uint8_t *getByte() { return (uint8_t *)getPacket()->params; } };