|
@ -20,6 +20,7 @@ void ZCanReceiverHost::initialize(string can_if_name, int baudrate, bool enablLo |
|
|
resetSocketCan(); |
|
|
resetSocketCan(); |
|
|
} |
|
|
} |
|
|
void ZCanReceiverHost::registerListener(onpacket_t onpacket) { m_onpacket = onpacket; } |
|
|
void ZCanReceiverHost::registerListener(onpacket_t onpacket) { m_onpacket = onpacket; } |
|
|
|
|
|
void ZCanReceiverHost::registerReportMsgListener(onreport_t onpacket) { m_onReportPacket = onpacket; } |
|
|
|
|
|
|
|
|
shared_ptr<ZCanReceiverCMD> ZCanReceiverHost::sendcmdblock(shared_ptr<ZCanReceiverCMD> cmd, int overtime_ms) { //
|
|
|
shared_ptr<ZCanReceiverCMD> ZCanReceiverHost::sendcmdblock(shared_ptr<ZCanReceiverCMD> cmd, int overtime_ms) { //
|
|
|
lock_guard<mutex> lock(m_txblocklock); |
|
|
lock_guard<mutex> lock(m_txblocklock); |
|
@ -140,14 +141,9 @@ void ZCanReceiverHost::processOnePacket(CanPacketRxBuffer *rxbuf, uint8_t *packe |
|
|
return; |
|
|
return; |
|
|
} else if (header->packetType == kpt_status_report) { |
|
|
} else if (header->packetType == kpt_status_report) { |
|
|
if (header->cmdid == kreport_h2o2_sensor_data) { |
|
|
if (header->cmdid == kreport_h2o2_sensor_data) { |
|
|
report_h2o2_data_t *h2o2data = (report_h2o2_data_t *)rx->data; |
|
|
|
|
|
logger->info("[h2o2 sensor] id:{} e:{} h2o2:{} temp:{} humid:{} saturation:{}", //
|
|
|
|
|
|
h2o2data->sensorid, h2o2data->sensor_error, h2o2data->h2o2, h2o2data->temp, h2o2data->humid, h2o2data->saturation); |
|
|
|
|
|
|
|
|
if (m_onReportPacket) m_onReportPacket(packet, len); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/**
|
|
|
|
|
|
* @brief 处理其他类型的消息 |
|
|
|
|
|
*/ |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ZCanReceiverHost::processRx(shared_ptr<SocketCanFrame> frame) { |
|
|
void ZCanReceiverHost::processRx(shared_ptr<SocketCanFrame> frame) { |
|
|