|
@ -48,6 +48,7 @@ void DeviceIoControlService::initialize() { |
|
|
m_zcanReceiverHost = m_zcanHost->getZCanReceiverHost(); |
|
|
m_zcanReceiverHost = m_zcanHost->getZCanReceiverHost(); |
|
|
m_zcanReceiverHost->registerReportMsgListener([this](uint8_t* packet, size_t len) { processReportPacket(packet, len); }); |
|
|
m_zcanReceiverHost->registerReportMsgListener([this](uint8_t* packet, size_t len) { processReportPacket(packet, len); }); |
|
|
m_workQueue.reset(new WorkQueue("DeviceIoControlServiceWorkQueue")); |
|
|
m_workQueue.reset(new WorkQueue("DeviceIoControlServiceWorkQueue")); |
|
|
|
|
|
m_workQueue->startWork(); |
|
|
|
|
|
|
|
|
startScan(); |
|
|
startScan(); |
|
|
} |
|
|
} |
|
@ -90,7 +91,7 @@ void DeviceIoControlService::startScan() { |
|
|
thisThread.sleepForMs(100); |
|
|
thisThread.sleepForMs(100); |
|
|
|
|
|
|
|
|
{ //
|
|
|
{ //
|
|
|
_pa = m_pressure_sensor_data[1].value / 1.0 /*pa*/; |
|
|
|
|
|
|
|
|
float _pa = m_pressure_sensor_data[1].value / 1.0 /*pa*/; |
|
|
|
|
|
|
|
|
float pa = _pa - 100; // 100当容器中没有液体时的压强
|
|
|
float pa = _pa - 100; // 100当容器中没有液体时的压强
|
|
|
if (pa < 0) pa = 0; |
|
|
if (pa < 0) pa = 0; |
|
@ -179,6 +180,8 @@ void DeviceIoControlService::processReportPacket(uint8_t* packet, size_t len) { |
|
|
if (cmdpacket->cmdid == kreport_h2o2_sensor_data) { |
|
|
if (cmdpacket->cmdid == kreport_h2o2_sensor_data) { |
|
|
report_h2o2_data_t* h2o2data = (report_h2o2_data_t*)cmdpacket->data; |
|
|
report_h2o2_data_t* h2o2data = (report_h2o2_data_t*)cmdpacket->data; |
|
|
report_h2o2_data_t h2o2datacache = *h2o2data; |
|
|
report_h2o2_data_t h2o2datacache = *h2o2data; |
|
|
|
|
|
// logger->info("[h2o2 sensor] id:{} h2o2:{} temp:{} humid:{} saturation:{}", //
|
|
|
|
|
|
// h2o2data->sensorid, h2o2data->h2o2, h2o2data->temp, h2o2data->humid, h2o2data->saturation);
|
|
|
|
|
|
|
|
|
m_workQueue->enQueue([this, h2o2datacache]() { //
|
|
|
m_workQueue->enQueue([this, h2o2datacache]() { //
|
|
|
report_h2o2_data_t h2o2datac_cpy = h2o2datacache; |
|
|
report_h2o2_data_t h2o2datac_cpy = h2o2datacache; |
|
|