19 changed files with 319 additions and 276 deletions
-
53app_protocols/apperrorcode/app_errorcode_mgr.hpp
-
7appsrc/appbase/appevent/app_warning_promopt_event.hpp
-
10appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp
-
3appsrc/appcomponents/canchannel/com/zscanprotocol_com.hpp
-
2appsrc/appconfig/basic/zappversion.hpp
-
8appsrc/baseservice/app_event_bus.hpp
-
9appsrc/baseservice/front_msg_processer/front_msg_processer.cpp
-
12appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp
-
175appsrc/internationalization.cpp
-
24appsrc/internationalization.hpp
-
2appsrc/service/app/add_liquid_service.cpp
-
2appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp
-
2appsrc/service/app/drain_liquid_service.cpp
-
63appsrc/service/app_core.cpp
-
177appsrc/service/debug_page_test_service.cpp
-
25appsrc/service/debug_page_test_service.hpp
-
4appsrc/service/device_monitor_service.cpp
-
5appsrc/service/disinfection_logs_service.cpp
-
12appsrc/service/hardware/device_io_ctrl_service.cpp
@ -1,3 +1,3 @@ |
|||||
#pragma once
|
#pragma once
|
||||
#define VERSION "3.1.3"
|
|
||||
|
#define VERSION "3.1.4"
|
||||
#define PROJECT_NAME "TRANSMIT_DM"
|
#define PROJECT_NAME "TRANSMIT_DM"
|
@ -0,0 +1,175 @@ |
|||||
|
#include "internationalization.hpp"
|
||||
|
|
||||
|
#include "app_protocols/apperrorcode/apperrorcode.hpp"
|
||||
|
using namespace iflytop; |
||||
|
using namespace std; |
||||
|
using namespace transmit_disfection_protocol; |
||||
|
using namespace iflytop::err; |
||||
|
class EcodeInfo { |
||||
|
public: |
||||
|
int code; |
||||
|
string info; |
||||
|
EcodeInfo(int code, const string& info) : code(code), info(info) {} |
||||
|
}; |
||||
|
|
||||
|
class CmdInfo { |
||||
|
public: |
||||
|
int cmdid; |
||||
|
string info; |
||||
|
CmdInfo(int cmdid, const string& info) : cmdid(cmdid), info(info) {} |
||||
|
}; |
||||
|
|
||||
|
static EcodeInfo chEcodeInfo[] = { |
||||
|
{kerr_overtime, "通信超时"}, |
||||
|
{kerr_invalid_param, "非法参数"}, |
||||
|
{kerr_invalid_param_num, "参数数量错误"}, |
||||
|
{kerr_subdevice_offline, "485总线设备异常"}, |
||||
|
{kerr_function_not_support, "代码错误方法不支持"}, |
||||
|
{kerr_subdevice_overtime, "485总线设备通信超时"}, |
||||
|
{kerr_motor_reset_error, "电机复位错误"}, |
||||
|
{kerr_motor_subdevice_offline, "电机子设备离线"}, |
||||
|
{kerr_motor_driver_error, "电机驱动器错误"}, |
||||
|
{kerr_motor_undervoltage_error, "电机欠压错误"}, |
||||
|
{kerr_motor_unkown_error, "电机未知错误"}, |
||||
|
{kerr_motor_overtemperature_flag, "电机过温"}, |
||||
|
{kerr_motor_overtemperature_pre_warning_flag, "电机过温预警"}, |
||||
|
{kerr_motor_short_to_ground_indicator_phase_A, "电机A相短接"}, |
||||
|
{kerr_motor_short_to_ground_indicator_phase_B, "电机B相短接"}, |
||||
|
{kerr_motor_open_load_indicator_phase_A, "电机A相过载"}, |
||||
|
{kerr_motor_open_load_indicator_phase_B, "电机B相过载"}, |
||||
|
{kerr_motor_standstill_indicator, "电机异常停止"}, |
||||
|
{kerr_AirBlowerError, "空压机异常"}, |
||||
|
{kerr_HeaterError, "加热片异常"}, |
||||
|
{kerr_BlowerError, "鼓风机异常"}, |
||||
|
{kerr_ProportionalValveError, "气密性测试专用空压机异常"}, |
||||
|
|
||||
|
{kappe_code_error, "代码错误"}, |
||||
|
{kappe_component_cfg_not_find, "组件配置未找到"}, |
||||
|
{kappe_cmd_not_support, "命令不支持"}, |
||||
|
{kappe_parse_json_err, "解析json错误"}, |
||||
|
{kappe_std_exception, "标准库异常"}, |
||||
|
{kappe_db_operate_error, "数据库操作错误"}, |
||||
|
{kappe_missing_param, "缺少参数"}, |
||||
|
{kappe_param_num_err, "参数个数错误"}, |
||||
|
{kappe_param_value_err, "参数值错误"}, |
||||
|
{kappe_user_not_exist, "用户不存在"}, |
||||
|
{kappe_passwd_error, "密码错误"}, |
||||
|
{kappe_user_exist, "用户已存在"}, |
||||
|
{kappe_disinfectant_insufficient, "消毒液不足"}, |
||||
|
{kappe_the_bottom_of_the_device_has_water, "硬件仓内有液体"}, |
||||
|
{kappe_the_evaporation_bin_has_water, "蒸发仓内有液体"}, |
||||
|
{kappe_the_sensor_is_prehearting, "传感器正在预热"}, |
||||
|
{kappe_not_detect_udisk, "未检测到U盘"}, |
||||
|
{kappe_udisk_wr_fail, "U盘读写错误"}, |
||||
|
{kappe_open_file_error, "文件操作错误"}, |
||||
|
{kappe_adding_liquid_is_already_in_place, "液体已加到位"}, |
||||
|
{kappe_adding_liquid_is_greater_than_the_maximum_capacity_of_the_device, "加液大于设备最大容量"}, |
||||
|
{kappe_sensor_is_pre_hearting, "传感器正在预热"}, |
||||
|
{kappe_state_is_busy, "设备忙"}, |
||||
|
{kappe_is_adding_liquid, "加液中"}, |
||||
|
{kappe_is_draining_liquid, "排液中"}, |
||||
|
{kappe_is_disinfecting, "消毒中"}, |
||||
|
{kappe_is_air_leak_detect_testing, "气密性测试中"}, |
||||
|
{kappe_setting_id_outof_range, "设置ID超出范围"}, |
||||
|
{kappe_exception_flag_is_setted, "设备硬件异常"}, |
||||
|
{kappe_disinfection_state_is_wrong, "消毒状态错误"}, |
||||
|
{kappe_liquid_ctrl_reboot, "液路板复位"}, |
||||
|
{kappe_power_control_reboot, "功率板复位"}, |
||||
|
{kappe_device_type_not_init, "设备未初始化"}, |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
static CmdInfo cmdInfo[] = { |
||||
|
{kfn_read_board_info, "读取子板信息"}, |
||||
|
{kfn_force_report, "强制上报"}, |
||||
|
{kfn_read_sysinfo, "读取子板系统信息"}, |
||||
|
{kfn_read_taskinfo, "读取子板任务信息"}, |
||||
|
{kfn_heart_ping, "心跳PING"}, |
||||
|
{kfn_clear_reset_flag, "清除复位标志"}, |
||||
|
{kfn_enable_report, "启用上报"}, |
||||
|
{kfn_reset_board, "复位子板"}, |
||||
|
{kreport_heatpacket_pong, "心跳PONG"}, |
||||
|
{kreport_exception_error, "异常错误上报"}, |
||||
|
{kreport_device_reset, "设备复位上报"}, |
||||
|
{kfn_pump_rotate, "泵机控制"}, |
||||
|
{kfn_pump_stop, "泵机控制"}, |
||||
|
{kfn_pump_set_ihold_irun_idelay, "泵机设置IHOLD参数"}, |
||||
|
{kfn_pump_set_acc, "泵机设置加速参数"}, |
||||
|
{kfn_pump_ping, "泵机PING"}, |
||||
|
{kfn_pump_set_ramp, "泵机设置RAMP"}, |
||||
|
{kfn_pump_set_tzw, "泵机设置TZW"}, |
||||
|
{kfn_pump_set_subic_reg, "泵机设置子IC寄存器"}, |
||||
|
{kfn_pump_get_subic_reg, "泵机获取子IC寄存器"}, |
||||
|
{kfn_pump_is_run, "泵机是否在运行"}, |
||||
|
{kfn_heater_ctrl, "加热片控制"}, |
||||
|
{kfn_heater_ctrl_safe_valve, "加热片安全阀控制"}, |
||||
|
{kfn_heater_read_ei, "读取加热片电流"}, |
||||
|
{kfn_heater_read_temperature_data, "读取加热片温度数据"}, |
||||
|
{kfn_heater_read_ei_adc_raw, "读取加热片电流ADC原始数据"}, |
||||
|
{kfn_heater_read_temperature_data_adc_raw, "读取加热片温度数据ADC原始数据"}, |
||||
|
{kfn_heater_is_open, "加热片是否开启"}, |
||||
|
{kfn_h2o2_sensor_read_calibration_date, "读取H2O2传感器校准日期"}, |
||||
|
{kfn_h2o2_sensor_read_sub_ic_errorcode, "读取H2O2传感器子IC错误码"}, |
||||
|
{kfn_h2o2_sensor_read_sub_ic_reg, "读取H2O2传感器子IC寄存器"}, |
||||
|
{kreport_h2o2_sensor_data, "H2O2传感器数据上报"}, |
||||
|
{kfn_triple_warning_light_ctl, "三色警示灯控制"}, |
||||
|
{kfn_triple_warning_light_read_state, "三色警示灯读取状态"}, |
||||
|
{kfn_evaporation_tank_water_sensor_read_state, "读取蒸发仓水位传感器状态"}, |
||||
|
{kfn_device_bottom_water_sensor_read_state, "读取设备底部水位传感器状态"}, |
||||
|
{kreport_evaporation_bin_water_sensor, "蒸发仓水位传感器上报"}, |
||||
|
{kreport_device_bottom_water_sensor, "设备底部水位传感器上报"}, |
||||
|
{kfn_blower_ctrl, "风机控制"}, |
||||
|
{kfn_blower_ctrl_safe_valve, "风机安全阀控制"}, |
||||
|
{kfn_blower_read_ei, "读取风机电流"}, |
||||
|
{kfn_blower_is_error, "读取风机电气异常状态"}, |
||||
|
{kfn_blower_read_ei_adc_raw, "读取风机电流ADC原始数据"}, |
||||
|
{kfn_blower_is_open, "读取风机是否开启"}, |
||||
|
{kfn_air_compressor_ctrl, "空压机控制"}, |
||||
|
{kfn_air_compressor_ctrl_safe_valve, "空压机安全阀控制"}, |
||||
|
{kfn_air_compressor_read_ei, "读取空压机电流"}, |
||||
|
{kfn_air_compressor_read_ei_adc_raw, "读取空压机电流ADC原始数据"}, |
||||
|
{kfn_air_compressor_is_open, "读取空压机是否开启"}, |
||||
|
{kfn_air_leak_detect_ac_ctrl, "空压机气密性测试控制"}, |
||||
|
{kfn_air_leak_detect_ac_is_open, "空压机气密性测试是否开启"}, |
||||
|
{kfn_psbus_read_data, "读取PSBUS数据"}, |
||||
|
{kfn_psbus_scan, "扫描PSBUS设备"}, |
||||
|
{kfn_psbus_start_report, "开始PSBUS设备上报"}, |
||||
|
{kfn_psbus_stop_report, "停止PSBUS设备上报"}, |
||||
|
{kreport_pressure_data, "压力数据上报"}, |
||||
|
{kfn_proportional_set_valve, "设置比例阀"}, |
||||
|
{kfn_proportional_read_pos, "读取比例阀位置"}, |
||||
|
{kfn_proportional_is_busy, "比例阀是否忙碌"}, |
||||
|
{kfn_air_leak_test_set_mode, "设置气密性测试模式"}, |
||||
|
{kfn_air_leak_test_get_mode, "读取气密性测试模式"}, |
||||
|
{kfn_ext_ch_selector_set_ch, "设置外部通道选择器通道"}, |
||||
|
{kfn_ext_ch_selector_get_ch, "获取外部通道选择器通道"}, |
||||
|
{kfn_set_add_fluid_channel_selector_valve, "设置加液通道选择阀"}, |
||||
|
{kfn_disinfectant_bucket_level_sensor_read_level, "读取消毒液桶液位传感器"}, |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
string Internationalization::ecode2description(int ecode) { |
||||
|
for (const auto& e : chEcodeInfo) { |
||||
|
if (e.code == ecode) { |
||||
|
return fmt::format("{}({})", e.info, e.code); |
||||
|
} |
||||
|
} |
||||
|
return fmt::format("错误码{}", ecode); |
||||
|
} |
||||
|
|
||||
|
string Internationalization::cmdid2str(int cmdid) { |
||||
|
for (const auto& c : cmdInfo) { |
||||
|
if (c.cmdid == cmdid) { |
||||
|
return fmt::format("{}({})", c.info, c.cmdid); |
||||
|
} |
||||
|
} |
||||
|
return fmt::format("命令ID{}", cmdid); |
||||
|
} |
||||
|
|
||||
|
string Internationalization::ecode2description(int ecode, int32_t toboard, int32_t cmdid, uint8_t* param, int32_t paramLen) { //
|
||||
|
if (cmdid == kfn_proportional_set_valve) { |
||||
|
int32_t subid = ((int32_t*)param)[0]; |
||||
|
return fmt::format("{},设置比例阀{}异常", ecode, subid); |
||||
|
} |
||||
|
return fmt::format("{},执行{}错误", ecode, cmdid2str(cmdid)); |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
#pragma once
|
||||
|
#include <fstream>
|
||||
|
#include <iostream>
|
||||
|
#include <list>
|
||||
|
#include <map>
|
||||
|
#include <memory>
|
||||
|
#include <set>
|
||||
|
#include <sstream>
|
||||
|
#include <string>
|
||||
|
|
||||
|
#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp"
|
||||
|
#include "iflytop/core/spdlogfactory/logger_factory.hpp"
|
||||
|
|
||||
|
namespace iflytop { |
||||
|
using namespace std; |
||||
|
class Internationalization { |
||||
|
public: |
||||
|
static string cmdid2str(int cmdid); |
||||
|
|
||||
|
static string ecode2description(int ecode); |
||||
|
static string ecode2description(int ecode, int32_t toboard, int32_t cmdid, uint8_t* param, int32_t paramLen); |
||||
|
}; |
||||
|
|
||||
|
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue