HbiError.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*---------------------------------------------------------------------------
  2. * Copyright (c) 2019 Shanghai Haobo Image Technology Co., Ltd
  3. * All rights reserved.
  4. *
  5. * File name: HbiError. h
  6. * Document ID:
  7. * Summary: flat-panel detector error message header file
  8. *
  9. * Current version: 3.0
  10. * Author: mhyang
  11. * Date: November 20, 2020
  12. ----------------------------------------------------------------------------*/
  13. #ifndef __HB_DLL_ERROR_H_
  14. #define __HB_DLL_ERROR_H_
  15. enum HBIRETCODE {
  16. HBI_SUCCSS = 0,
  17. HBI_ERR_ININT_FAILED = 8000,
  18. HBI_ERR_OPEN_DETECTOR_FAILED = 8001,
  19. HBI_ERR_INVALID_PARAMS = 8002,
  20. HBI_ERR_CONNECT_FAILED = 8003,
  21. HBI_ERR_MALLOC_FAILED = 8004,
  22. HBI_ERR_RELIMGMEM_FAILED = 8005,
  23. HBI_ERR_RETIMGMEM_FAILED = 8006,
  24. HBI_ERR_NODEVICE = 8007,
  25. HBI_ERR_DISCONNECT = 8008,
  26. HBI_ERR_DEVICE_BUSY = 8009,
  27. HBI_ERR_SENDDATA_FAILED = 8010,
  28. HBI_ERR_RECEIVE_DATA_FAILED = 8011,
  29. HBI_ERR_COMMAND_DISMATCH = 8012,
  30. HBI_ERR_NO_IMAGE_RAW = 8013,
  31. HBI_ERR_PTHREAD_ACTIVE_FAILED = 8014,
  32. HBI_ERR_STOP_ACQUISITION = 8015,
  33. HBI_ERR_INSERT_FAILED = 8016,
  34. HBI_ERR_GET_CFG_FAILED = 8017,
  35. HBI_NOT_SUPPORT = 8018,
  36. HBI_REGISTER_CALLBACK_FAILED = 8019,
  37. HBI_SEND_MESSAGE_FAILD = 8020,
  38. HBI_ERR_WORKMODE = 8021,
  39. HBI_FAILED = 8022,
  40. HBI_FILE_NOT_EXISTS = 8023,
  41. HBI_COMM_TYPE_ERR = 8024,
  42. HBI_TYPE_IS_NOT_EXISTS = 8025,
  43. HBI_SAVE_FILE_FAILED = 8026,
  44. HBI_INIT_PARAM_FAILED = 8027,
  45. HBI_INIT_FILE_NOT_EXIST = 8028,
  46. HBI_INVALID_FLAT_PANEL = 8029,
  47. HBI_INVALID_DLL_HANDLE = 8031,
  48. HBI_FPD_IS_DISCONNECT = 8032,
  49. HBI_ERR_DETECTOR_NUMBER = 8033,
  50. HBI_ERR_DATA_CHECK_FAILED = 8034,
  51. HBI_ERR_CFG_ISEMPTY = 8035,
  52. HBI_ERR_OPEN_WIZARD_FAILED = 8036,
  53. HBI_ERR_WIZARD_ALREADY_EXIST = 8037, // already exist
  54. HBI_DIRECTORY_NOT_EXISTS = 8038,
  55. HBI_UNREGISTER_CALLBACK = 8039,
  56. HBI_ERR_IMAGE_ISEMPTY = 8040,
  57. HBI_ERR_ABNORMMAL_IMAGE = 8041,
  58. HBI_PREPARATION_COMPLETE = 8042,
  59. HBI_ERR_FILE_EXCEPTION = 8043,
  60. HBI_ERR_COMM_TYPE = 8044,
  61. HBI_ERR_INVALID_MODE = 8045,
  62. HBI_ERR_FIRM_CONFIG_DATA = 8046,
  63. HBI_ERR_IS_NULL = 8047,
  64. HBI_ERR_ROM_PARAMETER = 8048,
  65. HBI_ERR_FILE_TYPE = 8049,
  66. HBI_ERR_PCIE_DEVICE_USED = 8050,
  67. HBI_ERR_CREATE_PATH = 8051,
  68. HBI_ERR_CREATE_FILE = 8052,
  69. HBI_ERR_ENV_NOT_EXIST = 8053,
  70. HBI_END = 8054
  71. };
  72. struct CodeStringTable
  73. {
  74. int num;
  75. int HBIRETCODE;
  76. const char *errString;
  77. };
  78. static const CodeStringTable CrErrStrList[] = {
  79. { 0, HBI_SUCCSS, "Success" },
  80. { 1, HBI_ERR_ININT_FAILED, "Init dll failed" },
  81. { 2, HBI_ERR_OPEN_DETECTOR_FAILED, "Open device driver failed" },
  82. { 3, HBI_ERR_INVALID_PARAMS, "Parameter error" },
  83. { 4, HBI_ERR_CONNECT_FAILED, "Connect failed" },
  84. { 5, HBI_ERR_MALLOC_FAILED, "Malloc memory failed" },
  85. { 6, HBI_ERR_RELIMGMEM_FAILED, "Releaseimagemem fail" },
  86. { 7, HBI_ERR_RETIMGMEM_FAILED, "ReturnImageMem fail" },
  87. { 8, HBI_ERR_NODEVICE, "No Init DLL Instance" },
  88. { 9, HBI_ERR_DISCONNECT, "Is Disconnect" },
  89. { 10, HBI_ERR_DEVICE_BUSY, "Fpd is busy" },
  90. { 11, HBI_ERR_SENDDATA_FAILED, "SendData failed" },
  91. { 12, HBI_ERR_RECEIVE_DATA_FAILED, "Receive Data failed" },
  92. { 13, HBI_ERR_COMMAND_DISMATCH, "Command dismatch" },
  93. { 14, HBI_ERR_NO_IMAGE_RAW, "No Image raw" },
  94. { 15, HBI_ERR_PTHREAD_ACTIVE_FAILED, "Pthread active failed" },
  95. { 16, HBI_ERR_STOP_ACQUISITION, "Pthread stop data acquisition failed" },
  96. { 17, HBI_ERR_INSERT_FAILED, "insert calibrate mode failed" },
  97. { 18, HBI_ERR_GET_CFG_FAILED, "get Fpd config failed" },
  98. { 19, HBI_NOT_SUPPORT, "not surport yet" },
  99. { 20, HBI_REGISTER_CALLBACK_FAILED, "failed to register callback function" },
  100. { 21, HBI_SEND_MESSAGE_FAILD, "send message failed" },
  101. { 22, HBI_ERR_WORKMODE, "switch work mode failed" },
  102. { 23, HBI_FAILED, "operation failed" },
  103. { 24, HBI_FILE_NOT_EXISTS, "file does not exist" },
  104. { 25, HBI_COMM_TYPE_ERR, "communication is not exist"},
  105. { 26, HBI_TYPE_IS_NOT_EXISTS, "this type is not exists"},
  106. { 27, HBI_SAVE_FILE_FAILED, "save file failed"},
  107. { 28, HBI_INIT_PARAM_FAILED, "Init dll param failed"},
  108. { 29, HBI_INIT_FILE_NOT_EXIST, "Init dll config file is not exist"},
  109. { 30, HBI_INVALID_FLAT_PANEL, "Invalid flat panel detector"},
  110. { 31, HBI_INVALID_DLL_HANDLE, "Invalid dll instance handle"},
  111. { 32, HBI_FPD_IS_DISCONNECT, "Fpd is disconnect"},
  112. { 33, HBI_ERR_DETECTOR_NUMBER, "Detector number error"},
  113. { 34, HBI_ERR_DATA_CHECK_FAILED, "Data Check failed"},
  114. { 35, HBI_ERR_CFG_ISEMPTY, "The configuration variable is empty"},
  115. { 36, HBI_ERR_OPEN_WIZARD_FAILED, "Open template wizard failed"},
  116. { 37, HBI_ERR_WIZARD_ALREADY_EXIST, "template wizard already exist"},
  117. { 38, HBI_DIRECTORY_NOT_EXISTS, "File directory is not exists"},
  118. { 39, HBI_UNREGISTER_CALLBACK, "Unregistered callbacke function"},
  119. { 40, HBI_ERR_IMAGE_ISEMPTY, "Image is empty"},
  120. { 41, HBI_ERR_ABNORMMAL_IMAGE, "Abnormal image"},
  121. { 42, HBI_PREPARATION_COMPLETE, "Preparation complete"},
  122. { 43, HBI_ERR_FILE_EXCEPTION, "File exception"},
  123. { 44, HBI_ERR_COMM_TYPE, "Wrong communication type"},
  124. { 45, HBI_ERR_INVALID_MODE, "This mode contains incorrect parameters"},
  125. { 46, HBI_ERR_FIRM_CONFIG_DATA, "Firmware parameter data is abnormal"},
  126. { 47, HBI_ERR_IS_NULL, "The pointer is NULL"},
  127. { 48, HBI_ERR_ROM_PARAMETER, "ROM includes incorrect parameters"},
  128. { 49, HBI_ERR_FILE_TYPE, "File type exception"},
  129. { 50, HBI_ERR_PCIE_DEVICE_USED, "PCIE device has been used"},
  130. { 51, HBI_ERR_CREATE_PATH, "Directory create failed"},
  131. { 52, HBI_ERR_CREATE_FILE, "File create failed"},
  132. { 53, HBI_ERR_ENV_NOT_EXIST, "Environment variable does not exist"},
  133. { 54, HBI_END, "Exit monitoring"}
  134. };
  135. ///*********************************************
  136. //*Description: Get the current error information through the return code
  137. //*Function: GetHbiErrorString
  138. //*Parameter: CodeStringTable * inTable returns the code table
  139. //*Int count Number of return codes
  140. //*Int recode return code
  141. //*Return value:
  142. //*Const char * Returns a string
  143. //*Remarks: BY MH.YANG 2019/12/09
  144. //*********************************************/
  145. //const char *GetHbiErrorString(CodeStringTable* inTable, int count, int recode)
  146. //{
  147. // const char *retString = "Unknown";
  148. // for(int i = 0; i < count; i++) {
  149. // if(inTable[i].HBIRETCODE == recode) {
  150. // retString = inTable[i].errString;
  151. // break;
  152. // }
  153. // }
  154. // return retString;
  155. //}
  156. //int main()
  157. //{
  158. // static const CodeStringTable CrErrStrList[] = {
  159. // { 0, HBI_SUCCSS, "Success" },
  160. // { 1, HBI_ERR_OPEN_DETECTOR_FAILED, "Open device driver failed" },
  161. // { 2, HBI_ERR_INVALID_PARAMS, "Parameter error" },
  162. // { 3, HBI_ERR_CONNECT_FAILED, "Connect failed" },
  163. // { 4, HBI_ERR_MALLOC_FAILED, "Malloc memory failed" },
  164. // { 5, HBI_ERR_RELIMGMEM_FAILED, "Releaseimagemem fail" },
  165. // { 6, HBI_ERR_RETIMGMEM_FAILED, "ReturnImageMem fail" },
  166. // { 7, HBI_ERR_NODEVICE, "No Device" },
  167. // { 8, HBI_ERR_DISCONNECT, "No Device,Try again" },
  168. // { 9, HBI_ERR_DEVICE_BUSY, "Device busy" },
  169. // { 10, HBI_ERR_SENDDATA_FAILED, "SendData failed" },
  170. // { 11, HBI_ERR_RECEIVE_DATA_FAILED, "Receive Data failed" },
  171. // { 12, HBI_ERR_COMMAND_DISMATCH, "Command dismatch" },
  172. // { 13, HBI_ERR_NO_IMAGE_RAW, "No Image raw" },
  173. // { 14, HBI_ERR_PTHREAD_ACTIVE_FAILED, "Pthread active failed" },
  174. // { 15, HBI_ERR_STOP_ACQUISITION, "Pthread stop data acquisition failed" },
  175. // { 16, HBI_ERR_INSERT_FAILED, "insert calibrate mode failed" },
  176. // { 17, HBI_ERR_GET_CFG_FAILED, "get device config failed" },
  177. // { 16, HBI_NOT_SUPPORT, "not surport yet" },
  178. // };
  179. // int nCode = 8001;
  180. // const char *tmpString = GetErrString(CodeStringTable, sizeof(CrErrStrList)/sizeof(CodeStringTable), uValue);
  181. // printf("nCode=%d,tmpString=%s\n", nCode, tmpString);
  182. // return 0;
  183. //}
  184. #endif // __HB_DLL_ERROR_H_