errors.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. /*
  2. * error.h
  3. * Authors:
  4. * Liu Jieqing <jqing.liu@careray.com>
  5. * This file contains the error code and its comment string
  6. * 2009-12-14 Liu Jieqing file created.
  7. * Modification history:
  8. * 2013-01-21 modified
  9. */
  10. #ifndef __ERROR_H__
  11. #define __ERROR_H__
  12. #define API_INDEX 1000
  13. enum {
  14. CR_NO_ERR = 0,
  15. ERR_DRIVER,
  16. ERR_OPEN_DETECTOR_FAILED,
  17. ERR_MMAP_SPACE,
  18. ERR_MEM_ALLOC,
  19. ERR_NO_SD_SPACE, //5
  20. ERR_NO_FLASH_SPACE,
  21. ERR_FILE_NAME,
  22. ERR_FILE_PATH,
  23. ERR_FILE_READ,
  24. ERR_FILE_WRITE, //10
  25. ERR_XMLFILE,
  26. ERR_CODER_IDX, //undefined command ID at codec
  27. ERR_CODER_VER, //undefined parser version
  28. ERR_CODER_PRM, //command param error
  29. ERR_IMAGE_PIPE_BROKEN, //15
  30. ERR_LOGIC,
  31. ERR_NO_MODE_SELECTED,
  32. //ERR_ENCODE_COMM = 1,
  33. //ERR_DECODE_COMM = 2,
  34. ERR_SET_DTTVER,
  35. ERR_UNDEFINED_COMMID,
  36. ERR_UNDEFINED_MODE, //20
  37. ERR_HANDSWITCH_STATE,
  38. ERR_SET_DTTTIME,
  39. ERR_ACCESS_FPGA,
  40. ERR_UPFILE,
  41. ERR_BAD_PARAM, //25
  42. ERR_BAD_STATE, //forbid to change mode at current transfer state.
  43. ERR_BAD_ACTION_IN_CURRENT_MODE, //
  44. ERR_LICENSE,
  45. ERR_SYSTEM_SELFTEST,
  46. ERR_IOCTL_FAILED, //30
  47. ERR_TEST_FRAMES,
  48. ERR_EXCHANGE_CFGFILE,
  49. ERR_UNAVAILABLE_OFFSET, //
  50. ERR_CREATE_THREAD,
  51. ERR_READOUT, //35
  52. ERR_INVAILD_FEATHER,
  53. ERR_GET_CORR_IMGCRC, //37
  54. ERR_SOFTWARE_HAS_EXPIRED, //38
  55. ERR_FETCHABLE_NOT_TRUE,
  56. ERR_INVALID_FE_FRMNUMS,
  57. ERR_READ_FRAME_ATTR,
  58. ERR_INVALID_ACQ_OPTION,
  59. ERR_RDFRM_SQQ_IS_EMPTY,
  60. ERR_UNAVAILABLE_SYNCMODE,
  61. ERR_UNAVAILABLE_ACQMODE,
  62. ERR_REALTIME_DARK_SET,
  63. ERR_UNDEFINED_CONFIGFILE,
  64. ERR_NO_CONFIGFILE,
  65. ERR_FILE_CREATE,
  66. ERR_FILE_CRC,
  67. ERR_EXIST_CONFIGFILE,
  68. ERR_FILE_OPEN,
  69. //---------Socket Layer--------------
  70. //Socket layer error most happens in bad network state
  71. CR_CONN_DETECTOR_ERR = API_INDEX,
  72. CR_DISCONN_DETECTOR_ERR,
  73. CR_ALREADY_CONN_ERR,
  74. CR_ALREADY_DISCONN_ERR,
  75. CR_RECONN_ERROR,
  76. CR_CLOSE_SOCK_ERROR,
  77. CR_INIT_ERR,
  78. CR_CREATE_ERR,
  79. CR_GETOPT_ERR,
  80. CR_SETOPT_ERR,
  81. CR_SEND_ERR,
  82. CR_RECV_ERR,
  83. CR_CLOSE_ERR,
  84. CR_SET_VER_ERR,
  85. //---------Codec Layer--------------
  86. CR_COMID_ERR,
  87. CR_VER_ERR,
  88. CR_PARAM_ERR,
  89. //---------V_API Layer--------------
  90. CR_NULL_BUFFER_ERR,
  91. CR_READ_CONFIGFILE_ERR,
  92. CR_WRITE_CONFIGFILE_ERR,
  93. CR_USER_PARAM_ERR,
  94. CR_MODE_UNSELECT_ERR,
  95. CR_LOAD_DLL_ERR,
  96. CR_FREE_DLL_ERR,
  97. CR_CREATE_EVENT_ERR,
  98. CR_CLOSE_EVENT_ERR,
  99. CR_FUNCID_ERR,
  100. CR_GET_FUNC_ADDR_ERR,
  101. CR_CREATE_VTHREAD_ERR,
  102. CR_CREATE_RTTHREAD_ERR,
  103. CR_CREATE_HBTHREAD_ERR,
  104. CR_CREATE_OFSTTHREAD_ERR,
  105. CR_CREATE_CALTHREAD_ERR,
  106. CR_CREATE_LOGTHREAD_ERR,
  107. CR_CLOSE_THREAD_ERR,
  108. CR_ALCATE_BUFF_ERR,
  109. CR_VTHREAD_BUSY_ERR,
  110. CR_GET_IMAGE_ERR,
  111. CR_FILE_PATH_ERR,
  112. CR_OPEN_FILE_ERR,
  113. CR_READ_FILE_ERR,
  114. CR_WRITE_FILE_ERR,
  115. CR_EXCHANGEFILE_ERR,
  116. CR_GRAB_IN_PROCESS_ERR,
  117. CR_GRAB_NOT_WORK_ERR,
  118. CR_REC_IN_PROCESS_ERR,
  119. CR_REC_NOT_WORK_ERR,
  120. CR_INDEX_OUT_BOUNDARY_ERR,
  121. CR_GRAB_IMG_ERR,
  122. CR_REC_IMG_ERR,
  123. CR_RECV_IMGHEAD_ERR,
  124. CR_MODE_COMM_NOT_MATCH_ERR,
  125. CR_FLU_PARAM_UNSET_ERR,
  126. CR_CAL_IN_PROCESS_ERR,
  127. CR_OFFSET_THREAD_BUSY_ERR,
  128. CR_OFFSET_THREAD_STOP_ERR,
  129. CR_CAL_INTERUPT_ERR,
  130. CR_STRING_EMPTY,
  131. CR_GAIN_UNSET,
  132. CR_MACHINEID_EMPTY,
  133. //image self test errors
  134. CR_IMAGE_AVG_ERR,
  135. CR_IMAGE_STD_ERRO,
  136. CR_IMAGE_UNIFORM_ERR,
  137. CR_IMAGE_STRIP_ERR,
  138. CR_IMAGE_RCN_ERR,//行噪声分析错误
  139. CR_IMAGE_LINEAR_ERR,//图像线性度错误
  140. CR_IMAGE_DARK_GRAY_ERR,
  141. CR_IMAGE_SYNC_ERR, //图像是未同步下的
  142. CR_IMAGE_COLLIMATOR_ERR,//束光器设置错误
  143. CR_IMAGE_TUBE_ERR,//球管未对齐
  144. //Calibration parameters errors in application's config files
  145. CR_OFFSETCAL_NUM_ERR,
  146. CR_LINEAR_DOSENUM_ERR,
  147. CR_LINEAR_NUM_PERDOSE_ERR,
  148. CR_PORTABLEKV_ERR,
  149. CR_ADDPIXEL_MACHINE_ERR,
  150. CR_SEND_PCFILE_OLD_ERR,
  151. CR_SEND_PCFILE_MACHINEID_ERR,
  152. CR_CALIBRATION_FILE_NULL_ERR,
  153. CR_CREATE_AEC_ACQUIRE_THREAD_ERR,
  154. CR_ONEKEY_FIT_UNACCEPTABLE_ERR,
  155. CR_CREATE_MONITORTHREAD_ERR,//1080
  156. CR_CREATE_CLEARIMAGETHREAD_ERR,
  157. CR_AUTOSYNC_DARKIMAGE_ERR,
  158. CR_AUTOSYNC_RADIMAGE_ERR,
  159. CR_AUTOSYNC_INPUTIMAGES_ERR,
  160. CR_AUTOSYNC_BOUNDARYINDEXES_ERR,
  161. CR_POLYFIT_ORDERERROR,
  162. CR_EXPOSURE_UNIFORM_ERR
  163. };
  164. //Errors in detector, the indexes start from 0
  165. //0 means call success
  166. static const char *CrErrStrList_dtt[] = {
  167. "Normal exit without an error.",
  168. "Load device driver failed.",
  169. "Open detector failed.",
  170. "Map memory failed.",
  171. "Allocate memory failed.",
  172. "No enough space on SD card.", //5
  173. "No enough Space on Flash.",
  174. "File name is invalid, failed to exchange.",
  175. "File path is Invalid, failed to exchange.",
  176. "Read file error.",
  177. "Write file error.", //10
  178. "Bad XML file.",
  179. "Command can not be recognized.",
  180. "Software version does not match.",
  181. "Incorrect number of parameters.",
  182. "Send frame error, transmission pipeline closed.", //15
  183. "Execution Logic of API goes wrong.",
  184. "Have no select mode.",
  185. "Setting detector version failed.",
  186. "Undefined commandID.",
  187. "Undefined mode.", //20
  188. "HandSwitch in error state.",
  189. "setting detector time failed.",
  190. "access fpga register failed.",
  191. "update file failed.",
  192. "Invalid parameter.", //25
  193. "Forbid to change mode at current transfer state.",
  194. "Forbid this operation at current transfer state.",
  195. "Invalid license, Please contact this detector manufacturer.",
  196. "Error happens in the self-test phase.",
  197. "ioctl calling failed.", //30
  198. "frame stability test failed.",
  199. "Exchange config files error.",
  200. "Offset is unavailable.",
  201. "Creat thread failed.",
  202. "Error happens during readout.", //35
  203. "Function is not supported at present.",
  204. "Read image CRC failed.",
  205. "Software has expired.",
  206. "has no fetchable frame.",
  207. "read frame number from FE is invalid.",
  208. "read frame attribution failed.",
  209. "invalid acquisition option.",
  210. "read-frame sequence is empty.",
  211. "Current detector doesn't support this sync mode.",
  212. "Current detector doesn't support this acquisition mode.",
  213. "Real time Dark setting error.",
  214. "Undefined config file.",
  215. "Configure file not exist.",
  216. "Error to create file.",
  217. "CRC Check error.",
  218. "Configure file already exist.",
  219. "Fail to open file."
  220. };
  221. //Errors in API, the indexes start from API_INDEX
  222. static const char *CrErrStrList_pc[] = {
  223. //---------Socket Layer--------------
  224. "Unable to connect detector. Possible causes include, but not limited to, employment of incompatible SDK versions, wrong IP settings, network issue.",
  225. "Unable to disconnect detector.",
  226. "Warning: job aborted, detector already connected.",
  227. "Warning: job aborted, detector already disconnected.",
  228. "Error reconnecting socket.",
  229. "Error closing socket.",
  230. "Error initiating Winsock.",
  231. "Error creating socket.",
  232. "Error getting socket options.",
  233. "Error setting socket options.",
  234. "Error sending data.",//10
  235. "Error receiving data.",
  236. "Detector disconnected while receiving data.",
  237. "Mismatched versions between detector and SDK.",
  238. //---------Codec Layer--------------
  239. "Wrong command ID.",
  240. "Wrong version. This error will be obsoleted in a future release.",
  241. "Wrong parameter in a command package sent from API to detector.",
  242. //---------V_API Layer--------------
  243. "A NULL pointer must not be passed to a function.",
  244. "Error reading configure file.",
  245. "Error writing configure file.",
  246. "Wrong user parameter.",//20
  247. "Unspecified check mode. Select the check mode as one of RAD|BINNING|PREVIEW| FLUOROSCOPY (for future version).",
  248. "Error loading DLL files.",
  249. "Error freeing DLL files.",
  250. "Error creating an event.",
  251. "Error terminating an event.",
  252. "Mismatched function ID sent to the detector and replied back from it.",
  253. "Error getting function address.",
  254. "Error creating a thread for image acquisition.",
  255. "Error creating a real-time thread.",
  256. "Error creating a heartbeat thread.",//30
  257. "Error creating a thread for offset image acquisition.",
  258. "Error creating a thread for image calibration.",
  259. "Error creating a logger thread.",
  260. "Error terminating a thread.",
  261. "Error allocating memory.",
  262. "Warning: job aborted, image acquisition in process.",
  263. "Error acquiring an image.",
  264. "Chinese characters Found in path. Path must not contain Chinese characters.",
  265. "No calibration file found in the specified path, or wrong path.",
  266. "Error reading a file.",//40
  267. "Error writing a file.",
  268. "Error exchanging files with detector.",
  269. "Warning: job aborted, fluoroscopic image acquisition in process.",
  270. "Warning: job aborted, fluoroscopic image acquisition stopped.",
  271. "Warning: job aborted, fluoroscopic image recording in process.",
  272. "Warning: job aborted, fluoroscopic image recording stopped.",
  273. "Index out of boundary.",
  274. "Error acquiring fluoroscopic images.",
  275. "Error recording fluoroscopic images.",
  276. "Error receiving image header.",//50
  277. "Unspecified check mode. Select the check mode as one of RAD|BINNING|PREVIEW| FLUOROSCOPY (for future version).",
  278. "Unspecified fluoroscopy mode.",
  279. "Warning: job aborted, calibration in process.",
  280. "Warning: job aborted, the thread for offset image acquisition in process.",
  281. "Warning: job aborted, the thread for offset image acquisition stopped. This warning will be obsoleted in a future release.",
  282. "Error: calibration process interrupted.",
  283. "String or array must not be empty",
  284. "Unspecified gain image. This error will be obsoleted in a future release.",
  285. "No machine ID.",
  286. "Unqualified mean value of the image. This error will be obsoleted in a future release.",//60
  287. "Unqualified standard deviation of the image.",
  288. "Unqualified image uniformity.",
  289. "Unqualified mean values of the image strips.",
  290. "Unqualified row correlated noise (RCN) of the image.",
  291. "Unqualified image linearity.",
  292. "Unqualified mean value of the image. This error will be obsoleted in a future release.",
  293. "Unsynchronized detector. This error will be obsoleted in a future release.",
  294. "Part of the detector panel does not receive X-ray. Make sure the tube, the collimator, and the detector are properly aligned, and the generated X-ray illuminates the entire panel.",
  295. "Tube misaligned.",
  296. "Offset calibration requires more than 2 (inclusive) offset images.",
  297. "Gain calibration requires a minimum number of 5 (inclusive) different doses and a maximum number of 9 (inclusive).",
  298. "Gain calibration requires acquiring more than 2 (inclusive) images at each dose.",
  299. "Wrong string for setting portable KV.",
  300. "Information of the bad pixels does not pair with the detector. Bad pixels are not obtained from this detector.",
  301. "A newer calibration file on detector must not be overwritten with an older version.",
  302. "Calibration file does not pair with the detector.",
  303. "No calibration files exist on PC or detector. Calibrate the detector to obtain the calibration files.",
  304. "Error creating AEC acquire thread.",
  305. "One key fit result unacceptable",
  306. "Error creating monitor thread.",
  307. "Error creating clear image thread.",
  308. "Auto Sync input dark image error.",
  309. "Auto Sync input images sequence error.",
  310. "Auto Sync input images error, can't find reasonable band indexes.",
  311. "Auto Sync boundary indexes error, can't find reasonable boundary indexes.",
  312. "The order to do polyfit should not bigger than 6.",
  313. "Warning:The intensity of X-ray received by detector is not uniform enough."//1087,CR_EXPOSURE_UNIFORM_ERR
  314. };
  315. static const char *CrErrStrList(int index)
  316. {
  317. if(index < API_INDEX)
  318. {
  319. return CrErrStrList_dtt[index];
  320. }else if(index >= API_INDEX)
  321. {
  322. return CrErrStrList_pc[index-API_INDEX];
  323. }else
  324. {
  325. return "";
  326. }
  327. }
  328. #endif // __ERROR_H__