You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.1 KiB

#include "errorcode.hpp"
#define ERR2STR(code) \
case code: \
return #code;
namespace iflytop {
namespace err {
const char* error2str(int32_t code) {
switch (code) {
ERR2STR(ksucc);
ERR2STR(kfail);
ERR2STR(kparam_out_of_range);
ERR2STR(koperation_not_support);
ERR2STR(kdevice_is_busy);
ERR2STR(kdevice_is_offline);
ERR2STR(kovertime);
ERR2STR(knoack);
ERR2STR(kerrorack);
ERR2STR(kdevice_offline);
ERR2STR(kparse_json_err);
ERR2STR(ksubdevice_overtime);
ERR2STR(kbuffer_not_enough);
ERR2STR(kcmd_not_found);
ERR2STR(kcmd_param_num_error);
ERR2STR(kcheckcode_is_error);
ERR2STR(kcatch_exception);
ERR2STR(khwardware_error_fan_error);
ERR2STR(khwardware_error);
ERR2STR(ksys_error);
ERR2STR(ksys_create_file_error);
ERR2STR(ksys_create_dir_error);
ERR2STR(ksys_open_file_error);
ERR2STR(ksys_open_dir_error);
ERR2STR(ksys_read_file_error);
ERR2STR(ksys_write_file_error);
ERR2STR(ksys_close_file_error);
ERR2STR(ksys_close_dir_error);
ERR2STR(ksys_delete_file_error);
ERR2STR(ksys_delete_dir_error);
ERR2STR(ksys_copy_file_error);
ERR2STR(kmodule_not_inited);
ERR2STR(kmodule_not_found);
ERR2STR(kmodule_opeation_break_by_user);
ERR2STR(kmodule_error);
ERR2STR(kmodule_not_find_config_index);
ERR2STR(kmodule_not_find_state_index);
ERR2STR(kmodule_not_support_action);
ERR2STR(kmodule_not_find_reg);
ERR2STR(kmotor_not_found_zero_point);
ERR2STR(kmotor_did_not_go_zero);
ERR2STR(kmotor_over_temperature);
ERR2STR(kmotor_over_voltage);
ERR2STR(kxymotor_not_found_x_zero_point);
ERR2STR(kxymotor_not_found_y_zero_point);
ERR2STR(kxymotor_x_find_zero_edge_fail);
ERR2STR(kxymotor_y_find_zero_edge_fail);
ERR2STR(kmotor_run_overtime);
ERR2STR(kmotor_not_enable);
ERR2STR(kSMTP2_NoError);
ERR2STR(kSMTP2_InitFail);
ERR2STR(kSMTP2_InvalidCmd);
ERR2STR(kSMTP2_InvalidArg);
ERR2STR(kSMTP2_PressureSensorError);
ERR2STR(kSMTP2_OverPressure);
ERR2STR(kSMTP2_LLDError);
ERR2STR(kSMTP2_DeviceNotInit);
ERR2STR(kSMTP2_TipPopError);
ERR2STR(kSMTP2_PumpOverload);
ERR2STR(kSMTP2_TipDrop);
ERR2STR(kSMTP2_CanBusError);
ERR2STR(kSMTP2_InvalidChecksum);
ERR2STR(kSMTP2_EEPROMError);
ERR2STR(kSMTP2_CmdBufferEmpty);
ERR2STR(kSMTP2_CmdBufferOverflow);
ERR2STR(kSMTP2_TipBlock);
ERR2STR(kSMTP2_AirSuction);
ERR2STR(kSMTP2_Bubble);
ERR2STR(kSMTP2_VolumeError);
ERR2STR(kSMTP2_TipAlreadyLoad);
ERR2STR(kSMTP2_TipLoadFail);
ERR2STR(kmicro_noErr);
ERR2STR(kmicro_uartSendFail);
ERR2STR(kmicro_uartRecvFail);
ERR2STR(kmicro_adcRecvFail);
ERR2STR(kstep_motor_not_found_zero_point);
ERR2STR(kstep_motor_not_go_zero);
ERR2STR(kstep_motor_over_temperature);
ERR2STR(kstep_motor_over_voltage);
ERR2STR(kstep_motor_run_overtime);
ERR2STR(kstep_motor_not_enable);
ERR2STR(kstep_motor_ioindex_out_of_range);
ERR2STR(kmini_servo_not_enable);
default:
return "known";
break;
}
}
} // namespace err
} // namespace iflytop