errors.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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_NO_FETCHABLE_FRAME,//39
  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. ERR_FILE_ATTR_READ=55, // read the file attribution failed.
  70. ERR_FILE_SIZE, //the size of file is 0 bytes.
  71. ERR_FILE_UNLINK, //the previous homonymous file can't be deleted.
  72. ERR_HAVE_MISSED_FRAME, //have unending
  73. //---------Socket Layer--------------
  74. //Socket layer error most happens in bad network state
  75. CR_CONN_DETECTOR_ERR = API_INDEX,
  76. CR_DISCONN_DETECTOR_ERR,
  77. CR_ALREADY_CONN_ERR,
  78. CR_ALREADY_DISCONN_ERR,
  79. CR_RECONN_ERROR,
  80. CR_CLOSE_SOCK_ERROR,
  81. CR_INIT_ERR,
  82. CR_CREATE_ERR,
  83. CR_GETOPT_ERR,
  84. CR_SETOPT_ERR,
  85. CR_SEND_ERR,
  86. CR_RECV_ERR,
  87. CR_CLOSE_ERR,
  88. CR_SET_VER_ERR,
  89. //---------Codec Layer--------------
  90. CR_COMID_ERR,
  91. CR_VER_ERR,
  92. CR_PARAM_ERR,
  93. //---------V_API Layer--------------
  94. CR_NULL_BUFFER_ERR,
  95. CR_READ_CONFIGFILE_ERR,
  96. CR_WRITE_CONFIGFILE_ERR,
  97. CR_USER_PARAM_ERR,
  98. CR_MODE_UNSELECT_ERR,
  99. CR_LOAD_DLL_ERR,
  100. CR_FREE_DLL_ERR,
  101. CR_CREATE_EVENT_ERR,
  102. CR_CLOSE_EVENT_ERR,
  103. CR_FUNCID_ERR,
  104. CR_GET_FUNC_ADDR_ERR,
  105. CR_CREATE_VTHREAD_ERR,
  106. CR_CREATE_RTTHREAD_ERR,
  107. CR_CREATE_HBTHREAD_ERR,
  108. CR_CREATE_OFSTTHREAD_ERR,
  109. CR_CREATE_CALTHREAD_ERR,
  110. CR_CREATE_LOGTHREAD_ERR,
  111. CR_CLOSE_THREAD_ERR,
  112. CR_ALCATE_BUFF_ERR,
  113. CR_VTHREAD_BUSY_ERR,
  114. CR_GET_IMAGE_ERR,
  115. CR_FILE_PATH_ERR,
  116. CR_OPEN_FILE_ERR,
  117. CR_READ_FILE_ERR,
  118. CR_WRITE_FILE_ERR,
  119. CR_EXCHANGEFILE_ERR,
  120. CR_GRAB_IN_PROCESS_ERR,
  121. CR_GRAB_NOT_WORK_ERR,
  122. CR_REC_IN_PROCESS_ERR,
  123. CR_REC_NOT_WORK_ERR,
  124. CR_INDEX_OUT_BOUNDARY_ERR,
  125. CR_GRAB_IMG_ERR,
  126. CR_REC_IMG_ERR,
  127. CR_RECV_IMGHEAD_ERR,
  128. CR_MODE_COMM_NOT_MATCH_ERR,
  129. CR_FLU_PARAM_UNSET_ERR,
  130. CR_CAL_IN_PROCESS_ERR,
  131. CR_OFFSET_THREAD_BUSY_ERR,
  132. CR_OFFSET_THREAD_STOP_ERR,
  133. CR_CAL_INTERUPT_ERR,
  134. CR_STRING_EMPTY,
  135. CR_GAIN_UNSET,
  136. CR_MACHINEID_EMPTY,
  137. //image self test errors
  138. CR_IMAGE_AVG_ERR,
  139. CR_IMAGE_STD_ERRO,
  140. CR_IMAGE_UNIFORM_ERR,
  141. CR_IMAGE_STRIP_ERR,
  142. CR_IMAGE_RCN_ERR,//行噪声分析错误
  143. CR_IMAGE_LINEAR_ERR,//图像线性度错误
  144. CR_IMAGE_DARK_GRAY_ERR,
  145. CR_IMAGE_SYNC_ERR, //图像是未同步下的
  146. CR_IMAGE_COLLIMATOR_ERR,//束光器设置错误
  147. CR_IMAGE_TUBE_ERR,//球管未对齐
  148. //Calibration parameters errors in application's config files
  149. CR_OFFSETCAL_NUM_ERR,
  150. CR_LINEAR_DOSENUM_ERR,
  151. CR_LINEAR_NUM_PERDOSE_ERR,
  152. CR_PORTABLEKV_ERR,
  153. CR_ADDPIXEL_MACHINE_ERR,
  154. CR_SEND_PCFILE_OLD_ERR,
  155. CR_SEND_PCFILE_MACHINEID_ERR,
  156. CR_CALIBRATION_FILE_NULL_ERR,
  157. CR_CREATE_AEC_ACQUIRE_THREAD_ERR,
  158. CR_ONEKEY_FIT_UNACCEPTABLE_ERR,
  159. CR_CREATE_MONITORTHREAD_ERR,//1080
  160. CR_CREATE_CLEARIMAGETHREAD_ERR,
  161. CR_AUTOSYNC_DARKIMAGE_ERR,
  162. CR_AUTOSYNC_RADIMAGE_ERR,
  163. CR_AUTOSYNC_INPUTIMAGES_ERR,
  164. CR_AUTOSYNC_BOUNDARYINDEXES_ERR,
  165. CR_POLYFIT_ORDERERROR,
  166. CR_EXPOSURE_UNIFORM_ERR,
  167. CR_1KEY_CALIBRATION_IMAGE_SNR_LOW,
  168. CR_OFFSET_CAL_FILE_NOT_MATCH_ERR,
  169. CAL_EFFECT_EXCELLENT, //add code here because we need provide description about calibration effect
  170. CAL_EFFECT_GOOD,
  171. CAL_EFFECT_BAD,
  172. CAL_MISS_LOCAL_RFIT_FILE,
  173. CR_FALSE_TRIGGERED_IMG_ERR
  174. };
  175. //Errors in detector, the indexes start from 0
  176. //0 means call success
  177. static const char *CrErrStrList_dtt[] = {
  178. "Normal exit without an error.",
  179. "Load device driver failed.",
  180. "Open detector failed.",
  181. "Map memory failed.",
  182. "Allocate memory failed.",
  183. "No enough space on SD card.", //5
  184. "No enough Space on Flash.",
  185. "File name is invalid, failed to exchange.",
  186. "File path is Invalid, failed to exchange.",
  187. "Read file error.",
  188. "Write file error.", //10
  189. "Bad XML file.",
  190. "Command can not be recognized.",
  191. "Software version does not match.",
  192. "Incorrect number of parameters.",
  193. "Send frame error, transmission pipeline closed.", //15
  194. "Execution Logic of API goes wrong.",
  195. "Have no select mode.",
  196. "Setting detector version failed.",
  197. "Undefined commandID.",
  198. "Undefined mode.", //20
  199. "HandSwitch in error state.",
  200. "setting detector time failed.",
  201. "access fpga register failed.",
  202. "update file failed.",
  203. "Invalid parameter.", //25
  204. "Forbid to change mode at current transfer state.",
  205. "Forbid this operation at current transfer state.",
  206. "Invalid license, Please contact this detector manufacturer.",
  207. "Error happens in the self-test phase.",
  208. "ioctl calling failed.", //30
  209. "frame stability test failed.",
  210. "Exchange config files error.",
  211. "Offset is unavailable.",
  212. "Creat thread failed.",
  213. "Error happens during readout.", //35
  214. "Function is not supported at present.",
  215. "Read image CRC failed.",
  216. "Software has expired.",
  217. "has no fetchable frame.",
  218. "read frame number from FE is invalid.",
  219. "read frame attribution failed.",
  220. "invalid acquisition option.",
  221. "read-frame sequence is empty.",
  222. "unavailable synchronization mode.",
  223. "unavailable acquisition mode.",
  224. "Real time Dark setting error.",
  225. "Undefined config file.",
  226. "Configure file not exist.",
  227. "Error to create file.",
  228. "CRC Check error.",
  229. "Configure file already exist.",
  230. "Fail to open file.",
  231. "",
  232. "",
  233. "Read the file attribution failed.",
  234. "The size of file is 0 bytes.",
  235. "The previous homonymous file can't be deleted.",
  236. "Have unending image to receive."
  237. };
  238. //Errors in API, the indexes start from API_INDEX
  239. static const char *CrErrStrList_pc[] = {
  240. //---------Socket Layer--------------
  241. "Unable to connect detector. Possible causes include, but not limited to, employment of incompatible SDK versions, wrong IP settings, network issue.",
  242. "Unable to disconnect detector.",
  243. "Warning: job aborted, detector already connected.",
  244. "Warning: job aborted, detector already disconnected.",
  245. "Error reconnecting socket.",
  246. "Error closing socket.",
  247. "Error initiating Winsock.",
  248. "Error creating socket.",
  249. "Error getting socket options.",
  250. "Error setting socket options.",
  251. "Error sending data.",//10
  252. "Error receiving data.",
  253. "Detector disconnected while receiving data.",
  254. "Mismatched versions between detector and SDK.",
  255. //---------Codec Layer--------------
  256. "Wrong command ID.",
  257. "Wrong version. This error will be obsoleted in a future release.",
  258. "Wrong parameter in a command package sent from API to detector.",
  259. //---------V_API Layer--------------
  260. "A NULL pointer must not be passed to a function.",
  261. "Error reading configure file.",
  262. "Error writing configure file.",
  263. "Wrong user parameter.",//20
  264. "Unspecified check mode. Select the check mode as one of RAD|BINNING|PREVIEW| FLUOROSCOPY (for future version).",
  265. "Error loading DLL files.",
  266. "Error freeing DLL files.",
  267. "Error creating an event.",
  268. "Error terminating an event.",
  269. "Mismatched function ID sent to the detector and replied back from it.",
  270. "Error getting function address.",
  271. "Error creating a thread for image acquisition.",
  272. "Error creating a real-time thread.",
  273. "Error creating a heartbeat thread.",//30
  274. "Error creating a thread for offset image acquisition.",
  275. "Error creating a thread for image calibration.",
  276. "Error creating a logger thread.",
  277. "Error terminating a thread.",
  278. "Error allocating memory.",
  279. "Warning: job aborted, image acquisition in process.",
  280. "Error acquiring an image.",
  281. "Error work directory path doesn't exist, missing CareRay folder or Chinese characters found in path.",
  282. "No calibration file found in the specified path, or wrong path.",
  283. "Error reading a file.",//40
  284. "Error writing a file.",
  285. "Error exchanging files with detector.",
  286. "Warning: job aborted, fluoroscopic image acquisition in process.",
  287. "Warning: job aborted, fluoroscopic image acquisition stopped.",
  288. "Warning: job aborted, fluoroscopic image recording in process.",
  289. "Warning: job aborted, fluoroscopic image recording stopped.",
  290. "Index out of boundary.",
  291. "Error acquiring fluoroscopic images.",
  292. "Error recording fluoroscopic images.",
  293. "Error receiving image header.",//50
  294. "Unspecified check mode. Select the check mode as one of RAD|BINNING|PREVIEW| FLUOROSCOPY (for future version).",
  295. "Unspecified fluoroscopy mode.",
  296. "Warning: job aborted, calibration in process.",
  297. "Warning: job aborted, the thread for offset image acquisition in process.",
  298. "Warning: job aborted, the thread for offset image acquisition stopped. This warning will be obsoleted in a future release.",
  299. "Error: calibration process interrupted.",
  300. "String or array must not be empty",
  301. "Unspecified gain image. This error will be obsoleted in a future release.",
  302. "No machine ID.",
  303. "Unqualified mean value of the image. This error will be obsoleted in a future release.",//60
  304. "Unqualified standard deviation of the image.",
  305. "Unqualified image uniformity.Please confirm: 1.No material is on the top of detector; 2.The collimator doesn't block X-ray; 3.The instance between detector and tube is large enough.",
  306. "Unqualified mean values of the image strips.",
  307. "Unqualified row correlated noise (RCN) of the image.",
  308. "Unqualified image linearity.",
  309. "Unqualified mean value of the image. This error will be obsoleted in a future release.",
  310. "Unsynchronized detector. This error will be obsoleted in a future release.",
  311. "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.",
  312. "Tube misaligned.",
  313. "Offset calibration requires more than 2 (inclusive) offset images.", //1070
  314. "Gain calibration requires a minimum number of 5 (inclusive) different doses and a maximum number of 9 (inclusive).",
  315. "Gain calibration requires acquiring more than 2 (inclusive) images at each dose.",
  316. "Wrong string for setting portable KV.",
  317. "Information of the bad pixels does not pair with the detector. Bad pixels are not obtained from this detector.",
  318. "A newer calibration file on detector must not be overwritten with an older version.",
  319. "Calibration file does not pair with the detector.",
  320. "No calibration files exist on PC or detector. Calibrate the detector to obtain the calibration files.",
  321. "Error creating AEC acquire thread.",
  322. "Warning:The calibration effect is not good, it may probably cause artifact when correcting image using these calibration files",
  323. "Error creating monitor thread.", //1080
  324. "Error creating clear image thread.",
  325. "Auto Sync input dark image error.",
  326. "Auto Sync input images sequence error.",
  327. "Auto Sync input images error, can't find reasonable band indexes.",
  328. "Auto Sync boundary indexes error, can't find reasonable boundary indexes.",
  329. "The order to do polyfit should not bigger than 6.",
  330. "Warning:The intensity of X-ray received by detector is not uniform enough.",//1087,CR_EXPOSURE_UNIFORM_ERR
  331. "Warning:The image SNR of one shot calibration is low! Please check: 1.if something on the detector; 2.The shutter shadow; 3.The uniformity of exposure.", //1088
  332. "Warning: cannot find an average dark / offset image that corresponds to the exposure time currently employed. In order to improve the quality of the resulting RAD image, it is highly recommended to walk through the calibration process to obtain an average dark / offset image with current exposure time. If you decide to skip the calibration step, the average dark / offset image with the default 500 ms exposure time will be used instead, and the image quality is expected to be degraded.",
  333. "The effect of calibration is excellent!",
  334. "The effect of calibration is good!",
  335. "The effect of calibration is not good enough, it is recommended to do the calibration again with the condition suggested.",
  336. "Fail to load calibration file generated by one shot calibration. It's strongly recommended to perform one shot calibration before acquisition.",
  337. "The image was false triggered and useless"
  338. };
  339. static const char *CrErrStrList(int index)
  340. {
  341. if(index < API_INDEX)
  342. {
  343. return CrErrStrList_dtt[index];
  344. }else if(index >= API_INDEX && index <= CR_FALSE_TRIGGERED_IMG_ERR)
  345. {
  346. return CrErrStrList_pc[index - API_INDEX];
  347. }else
  348. {
  349. return "";
  350. }
  351. }
  352. #endif // __ERROR_H__