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.

55 lines
1.6 KiB

1 year ago
1 year ago
1 year ago
  1. #pragma once
  2. #include <stdint.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define ERROR_CODE(errortype, suberrorcode) (errortype + suberrorcode)
  7. typedef enum {
  8. ksucc = ERROR_CODE(0, 0),
  9. kfail = ERROR_CODE(0, 1),
  10. kparam_out_of_range = ERROR_CODE(100, 2),
  11. kcmd_not_support = ERROR_CODE(100, 3),
  12. kdevice_is_busy = ERROR_CODE(100, 4),
  13. kdevice_is_offline = ERROR_CODE(100, 5),
  14. kovertime = ERROR_CODE(100, 6),
  15. knoack = ERROR_CODE(100, 7),
  16. kerrorack = ERROR_CODE(100, 8),
  17. kdevice_offline = ERROR_CODE(100, 9),
  18. ksubdevice_overtime = ERROR_CODE(100, 11),
  19. kbuffer_not_enough = ERROR_CODE(100, 12),
  20. kcmd_param_num_error = ERROR_CODE(100, 14),
  21. kcheckcode_is_error = ERROR_CODE(100, 15),
  22. killegal_operation = ERROR_CODE(100, 16),
  23. kstep_motor_not_found_zero_point = ERROR_CODE(600, 0),
  24. kstep_motor_not_go_zero = ERROR_CODE(600, 1),
  25. kstep_motor_over_temperature = ERROR_CODE(600, 2),
  26. kstep_motor_over_voltage = ERROR_CODE(600, 3),
  27. kstep_motor_run_overtime = ERROR_CODE(600, 4),
  28. kstep_motor_not_enable = ERROR_CODE(600, 5),
  29. kstep_motor_ioindex_out_of_range = ERROR_CODE(600, 6),
  30. kstep_motor_subic_reset = ERROR_CODE(600, 7),
  31. kstep_motor_drv_err = ERROR_CODE(600, 8),
  32. kstep_motor_uv_cp = ERROR_CODE(600, 9),
  33. kstep_motor_not_found_point_edge = ERROR_CODE(600, 10),
  34. } error_t;
  35. typedef struct {
  36. int index;
  37. const char* info;
  38. } ecode_table_item_t;
  39. const char* error2str(int32_t code);
  40. ecode_table_item_t* error_get_table();
  41. int error_get_table_size();
  42. #ifdef __cplusplus
  43. }
  44. #endif