Browse Source

update

master
zhaohe 1 year ago
parent
commit
0fd10e7d37
  1. 106
      protocol.md
  2. 12
      src/api/cmds/device_state_cmd_impl.cpp
  3. 6
      src/configs/project_setting.hpp
  4. 12
      src/main_control_service.cpp
  5. 2
      src/version.hpp

106
protocol.md

@ -146,4 +146,110 @@ ws://192.168.8.10:19001
] ]
} }
} }
```
<!-- -->
```json
// 消毒机拉杆箱
{
"command": "RealtimeSensorDataReport",
"sensor_data": {
"draw_bar_box_disinfection": {
"heatingStrip": {
"current": 0,
"temperature": 0
},
"pressure": [
0,
0
]
},
"h2o2_1": 0,
"h2o2_2": -1,
"h2o2_3": -1,
"h2o2_sensor_state_1": true,
"h2o2_sensor_state_2": false,
"h2o2_sensor_state_3": false,
"humid_1": 34,
"humid_2": -1,
"humid_3": -1,
"saturation_1": 32,
"saturation_2": 0,
"saturation_3": 0,
"temp_1": 30,
"temp_2": -1,
"temp_3": -1
},
"timeStamp": 1716281819391
}
{
"ackcode": 0,
"disinfectionConfig": {
"continued_gs": 0,
"continued_humi": 0,
"continued_satur": 0,
"injection_pump_speed": -441009434,
"loglevel": 0,
"stoped_gs": 0,
"stoped_humi": 0,
"stoped_satur": 0
},
"messageId": null,
"state": {
"disinfectionState": {
"dvalue": 0.0,
"estimatedRemainingTimeS": 0,
"id": "",
"nowlog": 0.0,
"preHeat": false,
"preHeatRaminTimeS": 0,
"targetlog": 0,
"workState": 5
},
"disinfectionWorkState": 5,
"disinfection_id": "",
"estimatedRemainingTimeS": 0,
"isLogin": false,
"loginuser": "",
"permissionLevel": 11,
"preHeat": false,
"preHeatRaminTimeS": 0,
"sensor_data": {
"draw_bar_box_disinfection": {
"heatingStrip": {
"current": 0,
"temperature": 0
},
"pressure": [
0,
0
]
},
"h2o2_1": 0,
"h2o2_2": -1,
"h2o2_3": -1,
"h2o2_sensor_state_1": true,
"h2o2_sensor_state_2": false,
"h2o2_sensor_state_3": false,
"humid_1": 35,
"humid_2": -1,
"humid_3": -1,
"saturation_1": 33,
"saturation_2": 0,
"saturation_3": 0,
"temp_1": 30,
"temp_2": -1,
"temp_3": -1
}
},
"subboardstate": {
"extChannelCtrlBoard": {
"online": 0
}
},
"timeStamp": 1716281920885
}
``` ```

12
src/api/cmds/device_state_cmd_impl.cpp

@ -48,7 +48,7 @@ json DeviceStateCmdImpl::createSensorDataJson() {
report["humid_3"] = m_deviceIoControlService->H2O2Sensor_readHumid(2); report["humid_3"] = m_deviceIoControlService->H2O2Sensor_readHumid(2);
report["saturation_3"] = m_deviceIoControlService->H2O2Sensor_readSaturation(2) + 1; //+1是为让曲线不重合 report["saturation_3"] = m_deviceIoControlService->H2O2Sensor_readSaturation(2) + 1; //+1是为让曲线不重合
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
#if (defined PROJECT_TYPE_PIPE_DISINFECTION)
report["AirInletProportionalValve"]["state"] = m_deviceIoControlService->AirInletProportionalValve_getState(); report["AirInletProportionalValve"]["state"] = m_deviceIoControlService->AirInletProportionalValve_getState();
report["AirOutletProportionalValve"]["state"] = m_deviceIoControlService->AirOutletProportionalValve_getState(); report["AirOutletProportionalValve"]["state"] = m_deviceIoControlService->AirOutletProportionalValve_getState();
@ -60,6 +60,16 @@ json DeviceStateCmdImpl::createSensorDataJson() {
report["pressure"][1] = m_deviceIoControlService->getPressureSensorData(2); // 空压机压力 report["pressure"][1] = m_deviceIoControlService->getPressureSensorData(2); // 空压机压力
report["pressure"][2] = m_deviceIoControlService->getPressureSensorData(3); // 加液泵 report["pressure"][2] = m_deviceIoControlService->getPressureSensorData(3); // 加液泵
report["pressure"][3] = m_deviceIoControlService->getPressureSensorData(4); // 喷射泵 report["pressure"][3] = m_deviceIoControlService->getPressureSensorData(4); // 喷射泵
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
#if (defined PROJECT_TYPE_DRAW_BAR_BOX)
report["draw_bar_box_disinfection"]["pressure"][0] = m_deviceIoControlService->DBDB__readPressureSensor(1); // 液位
report["draw_bar_box_disinfection"]["pressure"][1] = m_deviceIoControlService->DBDB__readPressureSensor(2); // 空压机压力
report["draw_bar_box_disinfection"]["heatingStrip"]["current"] = m_deviceIoControlService->DBDB__heaterReadElectricCurrent(); // 电流
report["draw_bar_box_disinfection"]["heatingStrip"]["temperature"] = m_deviceIoControlService->DBDB__heaterReadTemperatureData(); // 温度
#endif #endif
return report; return report;

6
src/configs/project_setting.hpp

@ -9,10 +9,16 @@
#define REG_DEVICE_ID 0x0001 // 重启标识 #define REG_DEVICE_ID 0x0001 // 重启标识
#define REG_EXCEPTION_FLAG 0x0100 // 异常标志位 #define REG_EXCEPTION_FLAG 0x0100 // 异常标志位
#if (!defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) && \
(!defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) && \
(!defined PROJECT_TYPE_PIPE_DISINFECTION) && \
(!defined PROJECT_TYPE_DRAW_BAR_BOX)
// #define PROJECT_TYPE_LARGE_SPACE_DISINFECTION 1 // 大空间 // #define PROJECT_TYPE_LARGE_SPACE_DISINFECTION 1 // 大空间
// #define PROJECT_TYPE_SMALL_SPACE_DISINFECTION 1 // 小空间 // #define PROJECT_TYPE_SMALL_SPACE_DISINFECTION 1 // 小空间
// #define PROJECT_TYPE_PIPE_DISINFECTION 1 // 管道消毒机 // #define PROJECT_TYPE_PIPE_DISINFECTION 1 // 管道消毒机
#define PROJECT_TYPE_DRAW_BAR_BOX 1 // 拉感箱 #define PROJECT_TYPE_DRAW_BAR_BOX 1 // 拉感箱
#endif
// #if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION) // #if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)

12
src/main_control_service.cpp

@ -64,8 +64,16 @@ void MainControlService::initialize() {
BUILD_AND_REG_SERRVICE(IflytopFrontEndService); BUILD_AND_REG_SERRVICE(IflytopFrontEndService);
GET_SERVICE(IflytopFrontEndService)->initialize("0.0.0.0"); GET_SERVICE(IflytopFrontEndService)->initialize("0.0.0.0");
GET_SERVICE(IflytopFrontEndService)->onMessage.connect([this](weak_ptr<WebSocket> webSocket, json& cmd, json& receipt) { GET_SERVICE(IflytopFrontEndService)->onMessage.connect([this](weak_ptr<WebSocket> webSocket, json& cmd, json& receipt) {
string cmdstr = cmd["command"];
if (cmdstr != "getState") logger->info("rx:{}", cmd.dump());
string cmdstr = cmd["command"];
bool disabledump = false;
if (cmdstr == "getState") disabledump = true;
if (cmdstr == "DBDBTestPage__heaterCtrlSafeValve") disabledump = true;
if (cmdstr == "DBDBTestPage__heaterReadElectricCurrent") disabledump = true;
if (cmdstr == "DBDBTestPage__readPressureSensor") disabledump = true;
if (!disabledump) logger->info("rx:{}", cmd.dump());
m_frontMsgProcesser->processMsg(cmd, receipt); m_frontMsgProcesser->processMsg(cmd, receipt);
}); });

2
src/version.hpp

@ -1,2 +1,2 @@
#pragma once #pragma once
#define VERSION "2.0"
#define VERSION "2.1"
Loading…
Cancel
Save