#pragma once #include #ifdef __cplusplus extern "C" { #endif #define ERROR_CODE(errortype, suberrorcode) (errortype + suberrorcode) typedef enum { ksucc = ERROR_CODE(0, 0), kfail = ERROR_CODE(0, 1), kparam_out_of_range = ERROR_CODE(100, 2), kcmd_not_support = ERROR_CODE(100, 3), kdevice_is_busy = ERROR_CODE(100, 4), kdevice_is_offline = ERROR_CODE(100, 5), kovertime = ERROR_CODE(100, 6), knoack = ERROR_CODE(100, 7), kerrorack = ERROR_CODE(100, 8), kdevice_offline = ERROR_CODE(100, 9), ksubdevice_overtime = ERROR_CODE(100, 11), kbuffer_not_enough = ERROR_CODE(100, 12), kcmd_param_num_error = ERROR_CODE(100, 14), kcheckcode_is_error = ERROR_CODE(100, 15), killegal_operation = ERROR_CODE(100, 16), kstep_motor_not_found_zero_point = ERROR_CODE(600, 0), kstep_motor_not_go_zero = ERROR_CODE(600, 1), kstep_motor_over_temperature = ERROR_CODE(600, 2), kstep_motor_over_voltage = ERROR_CODE(600, 3), kstep_motor_run_overtime = ERROR_CODE(600, 4), kstep_motor_not_enable = ERROR_CODE(600, 5), kstep_motor_ioindex_out_of_range = ERROR_CODE(600, 6), kstep_motor_subic_reset = ERROR_CODE(600, 7), kstep_motor_drv_err = ERROR_CODE(600, 8), kstep_motor_uv_cp = ERROR_CODE(600, 9), kstep_motor_not_found_point_edge = ERROR_CODE(600, 10), } error_t; typedef struct { int index; const char* info; } ecode_table_item_t; const char* error2str(int32_t code); ecode_table_item_t* error_get_table(); int error_get_table_size(); #ifdef __cplusplus } #endif