structures.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. /*
  2. * structures.h
  3. *
  4. * Authors:
  5. * Liu Jieqing <jqing.liu@careray.com>
  6. *
  7. * 2009-1-15 File created.
  8. *
  9. * This file is the structures commonly used throughout the
  10. * whole system. Need to increase and improve gradually.
  11. *
  12. *
  13. * Modification history:
  14. * 2013-01-21 modified, add some 1500P used structures
  15. * and others
  16. * 2013-02-28 modified, add Correction struct
  17. */
  18. #ifndef __STRUCTURES_H__
  19. #define __STRUCTURES_H__
  20. #define STRLEN 256
  21. #define DOSELENGTH 8192
  22. /*
  23. * Structures used to save the detector information
  24. *
  25. * rawImageWidth ¡ª The original image width of the detector
  26. * rawImageHeight ¡ª The original image height of the detector
  27. * maxPixelValue ¡ª The max value of each pixel
  28. * bitsPerPixel ¡ª Number of bits per pixel
  29. * hardWareVersion[STRLEN] ¡ª The version of hardware
  30. * softWareVersion[STRLEN] ¡ª The version of software
  31. * serialNumber[STRLEN] ¡ª The serial number of the detector
  32. * DetectorDescription[STRLEN] ¡ª A string that describes the detector, STRLEN is a macro definition, 256
  33. */
  34. struct DetectorInfo
  35. {
  36. int rawImageWidth;
  37. int rawImageHeight;
  38. int maxPixelValue;
  39. int bitsPerPixel;
  40. char hardWareVersion[STRLEN];
  41. char softWareVersion[STRLEN];
  42. char serialNumber[STRLEN];
  43. char detectorDescription[STRLEN];
  44. };
  45. /*
  46. * Structure used to save current detector temperature information
  47. * maxTemperature ¡ª Max detector temperature of temperature sensors currently
  48. * aveTemperature ¡ª Average detector temperature of temperature sensors currently
  49. * overhot_flag ¡ª Detector over hot flag
  50. */
  51. struct Temperature
  52. {
  53. float reserved[5];
  54. float maxTemperature;
  55. float aveTemperature;
  56. int overhot_flag; //Status infor, see enum TempStatus
  57. };
  58. //µç³ØÐÅÏ¢(Used for 1500P)
  59. struct BatteryInfo
  60. {
  61. int manu_access;
  62. int alarm_capa; //unit: mAh
  63. int alarm_time; //unit: min
  64. int mode; //range: 0x0000~0xffff
  65. int atrate; //-32768mA~32768mA
  66. int atrate_tofull; //unit: min
  67. int atrate_toempty; //unit: min
  68. int atrate_ok; //unit: min
  69. float temperature; //unit: C
  70. float voltage; //unit: V
  71. float current; //unit: A
  72. float ave_current; //unit: A
  73. float max_error;
  74. float relative_state_of_charge;
  75. float absolute_state_of_charge;
  76. int rest_capacity; //unit mAh
  77. int full_capacity; //unit mAh
  78. int run_time_to_empty;
  79. int ave_time_to_empty;
  80. float charging_current; //unit: A
  81. float charging_voltage; //unit: V
  82. int battery_status;
  83. int cycle_count;
  84. int design_capacity; //mAh
  85. float design_voltage; //V
  86. float cell4_voltage; //V
  87. float cell3_voltage; //V
  88. float cell2_voltage; //V
  89. float cell1_voltage; //V
  90. };
  91. struct WirelessInfo
  92. {
  93. char essid[32];
  94. char mode[16];
  95. char freq[16];
  96. char channel[16];
  97. char bit_rate[16];
  98. char encypt_key[64];
  99. char security_mode[16];
  100. char link_quality[16];
  101. char signal_level[16]; //signal level
  102. char noise_level[16];
  103. char sensitivity[16];
  104. char reserved1[16]; //the first 256 bytes
  105. unsigned long long tx_packets;
  106. unsigned long long rx_packets;
  107. unsigned long long tx_bytes;
  108. unsigned long long rx_bytes;
  109. int reserved[64]; //the second 256 bytes
  110. };
  111. struct WirelessStationConf
  112. {
  113. char wireless_station_SSID[STRLEN];
  114. char wireless_mode[STRLEN];
  115. char wireless_channel[STRLEN];
  116. };
  117. struct TrainHead
  118. {
  119. float temperature;
  120. int integTime;
  121. long generatedTime;
  122. int reserved[5];
  123. };
  124. /*
  125. * Structure used to save the current detector status information
  126. *
  127. * currentMode ¡ª Current mode of the detector
  128. * detectorState ¡ª Current detector state
  129. * frameRate ¡ª Current frame rate
  130. * temperature ¡ª Detector temperature of temperature sensors currently
  131. */
  132. struct StatusInfo
  133. {
  134. int checkMode;
  135. int detectorState;
  136. float frameRate;
  137. Temperature temperature;
  138. BatteryInfo batInfo;
  139. WirelessInfo wireless_info;
  140. };
  141. /*
  142. * Structure to save the current mode infomation.
  143. *
  144. * modeId ¡ª The mode id for the information retrieved.
  145. * acqType ¡ª Acquisition type. Variable is set to 0 for radiograph modes or 1 for fluoroscopy modes.
  146. * imageWidth ¡ª The number of column of an image in current mode.
  147. * imageHeight ¡ª The number of line of an image in current mode.
  148. * linesPerPixel ¡ª The number of lines per pixel, >1 when binning is used.
  149. * colsPerPixel ¡ª The number of column per pixel, >1 when binning is used.
  150. * imageSize ¡ª The size of image in byte.
  151. * maxFrameRate ¡ª The maximum allowed frame rate for the mode.
  152. * modeDescription ¡ª A string that describes the mode.
  153. */
  154. struct ModeInfo
  155. {
  156. int modeId;
  157. int acqType;
  158. int imageWidth;
  159. int imageHeight;
  160. int linesPerPixel;
  161. int colsPerPixel;
  162. int imageSize;
  163. float maxFrameRate;
  164. char modeDescription[STRLEN];
  165. };
  166. /*
  167. * Structure used to save the correction option.
  168. * fixedCorr ¡ª TRUE enable fixed method correction;FALSE disable
  169. * non_fixedCorr ¡ª TRUE enable portable method correction for fixed detector; FALSE disable.
  170. * portableCorr ¡ª TRUE enable portable method correction for mobile detector; FALSE disable.
  171. */
  172. struct UserCorrection
  173. {
  174. BOOL fixedCorr;
  175. BOOL non_fixedCorr;
  176. BOOL portableCorr;
  177. };
  178. /*
  179. * Structure used to get rad mode exposure parameters.
  180. *
  181. * expStatus ¡ª see ExposureStatus
  182. * inside_offs_corrflag ¡ª
  183. * realtime_offset ¡ª if contain offset image int the first image
  184. * frame_number ¡ª The number of frames acquired.
  185. * fetchable ¡ª The acquisition or calibration process is complete or not. FALSE: completed, TRUE: complete.
  186. * calComplete ¡ª TRUE: calibration complete, FALSE: calibration in progress or not in progress.
  187. * errorCode ¡ª Non zero means an error occured.
  188. * expose_flag ¡ª expose flag used in auto or manual sync
  189. */
  190. struct ExpProgress
  191. {
  192. int expStatus;
  193. BOOL inside_offs_corrflag;
  194. BOOL realtime_offset;
  195. int frame_number;
  196. BOOL fetchable;
  197. int errorCode;
  198. BOOL calComplete; //before is scan_phase
  199. BOOL expose_flag;
  200. };
  201. struct FrameAttr
  202. {
  203. int image_width; //!<The object image width of the detector
  204. int image_height; //!<The object image height of the detector
  205. int pixel_bits; //!<the number of every pixel of the object image.
  206. int image_datatype; //UINT_16 or UINT_32
  207. };
  208. struct UnuploadedImgInfo
  209. {
  210. BOOL existFlag; //resume image flag
  211. int width;
  212. int height;
  213. float finishedRate; //transferred rate
  214. BOOL withHead;
  215. int bitDepth;
  216. };
  217. struct CalParams
  218. {
  219. char gain_image_dir[STRLEN];
  220. char portable_cal_kv[STRLEN];//used for 1500Rm or 1500P and so on
  221. char normal_cal_kv[STRLEN]; //used for 1500R or 500M and so on
  222. int ofst_cal_num; //offset image number in dark calibration
  223. int linear_dose_num; //dose number in gain calibration
  224. int linear_num_per_dose; //exposure number per dose in gain calibration
  225. int time_interval; //every calibration image's time interval
  226. };
  227. struct DetectorActiveState
  228. {
  229. int detectorNum; //1, single; 2, dual detectors
  230. int detectorAType;
  231. int detectorBType;
  232. int activeDetectorID;
  233. BOOL detectorAstate; //TRUE, connected
  234. BOOL detectorBstate; //TRUE, connected
  235. };
  236. struct SurfaceFitResult
  237. {
  238. float R2; //calibration threshold
  239. int x0; //reserved
  240. int y0;//reserved
  241. float param1;//reserved
  242. float param2;//reserved
  243. float param3;//reserved
  244. float param4;//reserved
  245. };
  246. struct irDA
  247. {
  248. int irDAEnable;
  249. int irDAOffset;
  250. int irDAPulse;
  251. int irDAIHTL;
  252. int irDAILTL;
  253. int irDAGain;
  254. int irDADrive;
  255. };
  256. struct SHSParam
  257. {
  258. char hardwareVersion[STRLEN];
  259. char pairedID[STRLEN];
  260. int heartbeatInterval;
  261. int timeoutPeriod; //unit: min, timeout for detector to shut down
  262. int buzzerEnabled;
  263. int touchSensorEnabled;
  264. irDA irDACfg;
  265. int handSwitchEnabled;
  266. };
  267. struct SHSStatus
  268. {
  269. int connectedToDetector;
  270. int beingTouched;
  271. int batteryRemainingCapacity;
  272. int signalIntensity;
  273. int secondsLeft; //seconds left to shut down detector
  274. SHSParam handSwitchSettings;
  275. };
  276. enum DetectorType
  277. {
  278. CareView_1500R,
  279. CareView_1500Rm,
  280. CareView_1500P,
  281. CareView_1500C,
  282. CareView_1800R,
  283. CareView_500M,
  284. CareView_500I,
  285. CareView_500P,
  286. CareView_900F,
  287. CareView_1800I,
  288. CareView_1500L,
  289. CareView_1500Cw,
  290. CareView_300P,
  291. CareView_750M,
  292. CareView_1800L,
  293. CareView_1800RV2,
  294. CareView_1500PV2,
  295. CareView_750Cw,
  296. Unkown_Type //δ֪ÐͺÅ
  297. };
  298. /*
  299. * Enum for detector mode
  300. *
  301. * CR_RAD_MODE ¡ª Rad mode
  302. * CR_FLUORO_MODE ¡ª Fluoro mode
  303. * CR_LAGFLUORO_MODE ¡ª Lag testing mode
  304. * CR_CUSTFLUORO_MODE ¡ª Customized fluoro mode
  305. */
  306. enum CheckMode
  307. {
  308. MODE_UNDEFINED = 0,
  309. MODE_RAD=0x10,
  310. MODE_TEST = 0x14, //!<used just for self-test
  311. MODE_BIN22 = 0x15,
  312. MODE_NDT = 0x16, //NDT mode, for industry application.
  313. MODE_PREV= 0x17, //preview mode, for 500M
  314. MODE_MAXID
  315. };
  316. /*
  317. * Enum for detector state
  318. *
  319. * CR_BOOT ¡ª Detector is booting
  320. * CR_STANDBY ¡ª Detector is ready, waiting for command
  321. * CR_ACQUISTION ¡ª Detector is in image acquisition state
  322. * CR_SLEEP ¡ª Detector is in sleeping mode
  323. * CR_ERROR ¡ª An error occured
  324. */
  325. enum DetectorState
  326. {
  327. CR_BOOT,
  328. CR_STANDBY,
  329. CR_ACQUISTION,
  330. CR_SLEEP,
  331. CR_ERROR
  332. };
  333. /*
  334. * Enum for exposure state
  335. *
  336. * CR_EXP_ERROR ¡ª An error occurred
  337. * CR_EXP_INIT ¡ª Detector is initiating
  338. * CR_EXP_READY ¡ª Detector is ready for x-ray pulse
  339. * CR_EXP_WAIT_PERMISSION ¡ª X-ray pulse comes. Detector is waiting for PC¡®s exposure permission.
  340. * CR_EXP_PERMITTED ¡ª PC¡¯s permission is received
  341. * CR_EXP_EXPOSE ¡ª X-ray exposure is in progress
  342. * CR_EXP_COMPLETE ¡ª Exposure complete, image will be ready soon
  343. * EXP_STANDBY ¡ª no use
  344. */
  345. enum ExposureStatus
  346. {
  347. CR_EXP_ERROR = -1,
  348. CR_EXP_INIT,
  349. CR_EXP_READY,
  350. CR_EXP_WAIT_PERMISSION,
  351. CR_EXP_PERMITTED,
  352. CR_EXP_EXPOSE,
  353. CR_EXP_COMPLETE,
  354. };
  355. /*
  356. * Enum for progress type to query
  357. *
  358. * CR_RAD_PROG ¡ª Query rad acquisition progress
  359. * CR_CAL_PROG ¡ª Query calibration progress
  360. */
  361. enum ProgType
  362. {
  363. CR_RAD_PROG, //Query rad acquisition progress
  364. CR_CAL_PROG //Query calibration progress
  365. };
  366. //ͬ²½Ä£Ê½
  367. enum SyncMode
  368. {
  369. UNDEF_SYNC, //undefined sync mode
  370. EXT_SYNC, //external sync mode (exist sync cable)
  371. SOFT_SYNC, //software sync mode
  372. AUTO_SYNC, //auto sync mode
  373. MANUAL_SYNC, //manual sync mode
  374. SCAN_SYNC,
  375. AED_SYNC
  376. };
  377. /*!
  378. @enum POWER_MODE_ID
  379. @¹¦ºÄģʽ
  380. @brief power mode IDs, provide multiplex power management pattern for detector.
  381. */
  382. enum PowerMode
  383. {
  384. PWR_STANDBY, //set front-end into nap mode
  385. PWR_FULL_RUNNING, //set front-end into normal mode.
  386. PWR_SMART_RUNNING, //set front-end into nap mode at the integration phase.
  387. PWR_DOWN_FE = 4, //set front-end into power-down mode.
  388. PWR_SLEEPING, //unsupported
  389. PWR_DEEP_SLEEPING, //unsupported
  390. PWR_SUSPEND //unsupported
  391. };
  392. enum ImageDataType
  393. {
  394. UINT_16, //full image
  395. UINT_32,
  396. INT_16,
  397. INT_32,
  398. FLOAT_32,
  399. DOUBLE_64
  400. };
  401. enum TempStatus
  402. {
  403. IN_NORMAL_TEMP=0, //status indicator turns green
  404. IN_WARN_TEMP, //status indicator turns yellow
  405. OVER_MAX_TEMP_LIMIT, //status indicator turns red, and take the detector into low power, neither enter to 'ready' state.
  406. OVER_MIN_TEMP_LIMIT, //status indicator turns red.
  407. INVAILD_TEMP //invalid temperature turns orange
  408. };
  409. enum DetectorIndex
  410. {
  411. DETECTOR_I,
  412. DETECTOR_II
  413. };
  414. //////////////////////////////////////////////////////////////////////////
  415. enum event_id
  416. {
  417. EVT_DISCONNECT,
  418. EVT_READY,
  419. EVT_EXP_EN,
  420. EVT_IMAGE_ARRIVE,
  421. EVT_AEC_PREV_MODE_READY,
  422. EVT_AEC_RAD_MODE_READY,
  423. EVT_AEC_PREV_IMG_ARRIVE,
  424. EVT_AEC_RAD_IMG_ARRIVE,
  425. EVT_DETECTOR_ERROR,
  426. EVT_EXPOSE_FLAG_FALSE,
  427. EVT_EXPOSE_FLAG_TRUE,
  428. EVT_INITIAL,
  429. EVT_UNUPLOADED_IMG_EXIST,
  430. EVT_CONNECTED,
  431. EVT_SECOND_PANEL_CONNECTED,
  432. EVT_SECOND_PANEL_DISCONNECTED,
  433. EVT_SHS_STATUS_CHANGED
  434. };
  435. struct Event
  436. {
  437. int width;
  438. int height;
  439. int bits;
  440. void* data;
  441. };
  442. typedef void (__stdcall*eventCallback)(int eventID, Event* eventData);
  443. #endif // __STRUCTURES_H__