Browse Source

update

master
zhaohe 1 year ago
parent
commit
9c37cfe8f0
  1. 15
      src/app/transmit_disinfection/transmitdisinfection.cpp
  2. 2
      src/protocol/zscanprotocol_com/zscanprotocol_com.hpp

15
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);
});

2
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; }
};

Loading…
Cancel
Save