DIOSLogicDeviceStructure.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. #pragma once
  2. #include <stdlib.h>
  3. #include "Detector_Model_Def.h"
  4. #include "Generator_Model_Def.h"
  5. #define Gen_DEFAULT_PARAM_ZERO 0.0f
  6. #define Gen_DEFAULT_APPMODE APP_DR
  7. #define Gen_DEFAULT_EXAMMODE EXM_SINGLE
  8. #define Gen_DEFAULT_PARAM_KV 70.0f
  9. #define Gen_DEFAULT_PARAM_MAS 1.0f
  10. #define Gen_DEFAULT_PARAM_MA 10.0f
  11. #define Gen_DEFAULT_PARAM_MS 100.0f
  12. #define Gen_DEFAULT_PARAM_FOCUS -1
  13. #define Gen_DEFAULT_PARAM_WORKSTATION -1
  14. #define Gen_DEFAULT_PARAM_TECHMODE -1
  15. #define Gen_DEFAULT_PARAM_AECDENSITY 0.0f
  16. #define Gen_DEFAULT_PARAM_AECFIELD -1
  17. #define Gen_DEFAULT_PARAM_AECFILM -1
  18. #define Gen_DEFAULT_PARAM_POSTMS 0.0f
  19. #define Gen_DEFAULT_PARAM_POSTMAS 0.0f
  20. #define MAX_STRING 1024
  21. typedef enum _Application_Mode {
  22. APP_DR,
  23. APP_DX,
  24. APP_US,
  25. APP_MODE_MAX
  26. }APP_MODE;
  27. #define APPMODEDX ("DX")
  28. #define APPMODERF ("RF")
  29. //mamo
  30. #define APPMODEMG ("MG")
  31. typedef enum _Exam_Mode {
  32. EXM_ERROR = -1,
  33. EXM_SINGLE = 0,
  34. EXM_DUALENERGY,
  35. EXM_STITCH,
  36. EXM_AEC,
  37. EXM_HDR,
  38. EXM_GAIN,
  39. EXM_OFFSET,
  40. EXM_TOMO,
  41. EXM_MAMO_MANUAL,
  42. EXM_MAMO_SEMIAUTO,
  43. EXM_MAMO_AUTOMATIC,
  44. EXM_MAMO_AUTOFILTER,
  45. EXM_MAMO_TOMOSEMIAUTO,
  46. EXM_MAMO_TOMOAUTOMATIC,
  47. EXM_MODE_MAX
  48. }EXAM_MODE;
  49. #define EXAMMODE_SINGLE ("Single")
  50. #define EXAMMODE_STITCH ("Stitch")
  51. #define EXAMMODE_PF ("PulseSerial")
  52. #define EXAMMODE_CF ("CoutineSerial")
  53. #define EXAMMODE_TOMO ("TOMO")
  54. #define EXAMMODE_MAMO_MANUAL ("MANUAL")
  55. #define EXAMMODE_MAMO_SEMIAUTO ("SEMIAUTO")
  56. #define EXAMMODE_MAMO_AUTOMATIC ("AUTOMATIC")
  57. #define EXAMMODE_MAMO_AUTOFILTER ("AUTOFILTER")
  58. #define EXAMMODE_MAMO_TOMOSEMIAUTO ("TOMO_SEMIAUTO")
  59. #define EXAMMODE_MAMO_TOMOAUTOMATIC ("TOMO_AUTOMATIC")
  60. typedef enum _Ultral_Sound_Exam_Mode {
  61. EXM_BRIGHTNESS,
  62. EXM_COLOR_DOPPLER_FLOW,
  63. EXM_POWER_DOPPLER,
  64. EXM_DIRECTIONAL_POWER_DOPPLER,
  65. EXM_PULSE_WAVE,
  66. EXM_CONTINOUS_WAVE
  67. }US_EXAM_MODE;
  68. typedef enum _Result_SM {
  69. RESM_INVALID = -3,
  70. RESM_NOSUPPORT = -2,
  71. RESM_TIMEOUT = -1,
  72. RESM_FAILED = 0,
  73. RESM_SUCCEED,
  74. RESM_WARNING
  75. }RES_SM;
  76. typedef enum Image_Type {
  77. IMAGE_TYPE_2D,
  78. IMAGE_TYPE_3D,
  79. IMAGE_TYPE_1D
  80. }IMAGE_TYPE;
  81. typedef enum WorkStation_Type {
  82. WS_TABLE,
  83. WS_WALL,
  84. WS_CONVENTIONAL,
  85. WS_FREE,
  86. WS_TOMO,
  87. WS_TABLE_WALL,
  88. }WORKSTATION_TYPE;
  89. typedef enum Techmode_Type {
  90. TECHMODE_NOAEC_3P,
  91. TECHMODE_NOAEC_2P,
  92. TECHMODE_AEC_3P,
  93. TECHMODE_AEC_2P,
  94. TECHMODE_AEC_1P
  95. }TECHMODE_TYPE;
  96. typedef enum Focus_Type {
  97. FOCUS_SMALL,
  98. FOCUS_LARGE,
  99. FOCUS_AUTOMATIC
  100. }FOCUS_TYPE;
  101. typedef enum AECField_Type {
  102. FIELD_RIGHT = 1,
  103. FIELD_CENTER,
  104. FIELD_RIGHT_CENTER,
  105. FIELD_LEFT,
  106. FIELD_LEFT_RIGHT,
  107. FIELD_CENTER_LEFT,
  108. FIELD_LEFT_CENTER_RIGHT
  109. }AECFIELD_TYPE;
  110. typedef enum AECFilm_Type {
  111. FILM_SLOW,
  112. FILM_MEDIUM,
  113. FILM_FAST
  114. }AECFILM_TYPE;
  115. typedef enum _Gen_Param {
  116. Gen_APPMODE,
  117. Gen_EXAMMODE,
  118. Gen_Param_KV,
  119. Gen_Param_MAS,
  120. Gen_Param_MA,
  121. Gen_Param_MS,
  122. Gen_Param_FOCUS,
  123. Gen_Param_WORKSTATION,
  124. Gen_Param_TECHMODE,
  125. Gen_Param_AECDENSITY,
  126. Gen_Param_AECFIELD,
  127. Gen_Param_AECFILM,
  128. Gen_Param_POSTKV,
  129. Gen_Param_POSTMA,
  130. Gen_Param_POSTMS,
  131. Gen_Param_POSTMAS,
  132. Gen_Param_REPLAYWALLKV,
  133. Gen_Param_REPLAYWALLMA,
  134. Gen_Param_REPLAYWALLMS,
  135. Gen_Param_REPLAYTABLEKV,
  136. Gen_Param_REPLAYTABLEMA,
  137. Gen_Param_REPLAYTABLEMS,
  138. Gen_Param_APR,
  139. Gen_RESET,
  140. Gen_EXPOSURESTATUS,
  141. Gen_IMAGESTATUS,
  142. Gen_Param_CUREXPOSURESTEP,
  143. Gen_Param_TOTALEXPOSURESTEP,
  144. Gen_Param_CURMECHSIZE,
  145. Gen_Param_TOTALMECHSIZE,
  146. Gen_Param_STEPMECHSIZE,
  147. Gen_Param_EXPOSEDDOSE,
  148. Gen_Param_FLKV,
  149. Gen_Param_FLMA,
  150. Gen_Param_ABS,
  151. Gen_Param_EXO,
  152. Gen_Param_HE,
  153. Gen_Param_DAP,
  154. Gen_Param_PositionCode
  155. }GEN_PARAM;
  156. typedef enum _Gen_Exposure_Status {
  157. Gen_Infomation = 0,
  158. Gen_Warning,
  159. Gen_Error,
  160. Gen_PerHandSwitchPress, //First HandSwitch press
  161. Gen_SecondHandSwitchPress, //Second HandSwitch press
  162. Gen_Ready,
  163. Gen_XayOn,
  164. Gen_XayOff,
  165. Gen_SecondHandSwitchRelease, //Second HandSwitch press
  166. Gen_PerHandSwitchRelease, //First HandSwitch Release
  167. Gen_ExpDisEnable, //Device No Ready
  168. Gen_ExpEnable //Device Ready
  169. }GEN_EXPOSURE_STATUS;
  170. typedef enum US_Image_View_Type
  171. {
  172. IMAGE_B = 0,
  173. IMAGE_CDF,
  174. IMAGE_M
  175. }US_IMAGE_VIEW_TYPE;
  176. typedef enum _SM_Status
  177. {
  178. SM_SeqPrep = 0,
  179. SM_SeqReady,
  180. SM_FramePrep,
  181. SM_FrameReady,
  182. SM_FrameStart,
  183. SM_FrameIn,
  184. SM_FramePost,
  185. SM_FrameEnd,
  186. SM_FrameError,
  187. SM_SeqPost
  188. }SM_STATUS;
  189. typedef enum Calibration_Type
  190. {
  191. CAL_TYPE_NONE = 0,
  192. CAL_TYPE_OFFSET,
  193. CAL_TYPE_GAIN,
  194. CAL_TYPE_DEFECT
  195. }CAL_TYPE;
  196. typedef enum Calibration_Status
  197. {
  198. CAL_STATUS_NOTSTART = 0,
  199. CAL_STATUS_START,
  200. CAL_STATUS_COMPLETE
  201. }CAL_STATUS;
  202. typedef enum Offset_Type
  203. {
  204. OFT_NONE= 0,
  205. OFT_OOOEO, //AAAAAAAAAAA(A) + Exp + B
  206. OFT_O_PERIOD_E,//A__ + A__ + A__ + Exp//采集界面有offset超时
  207. OFT_OOO_PERIOD_E,//AAAAAAAA ____Exp1__Exp2__Exp3______AAAAAAAA//采集界面有offset超时
  208. OFT_PANEL
  209. }OFFSET_TYPE;
  210. typedef enum ECOM_FPD_State
  211. {
  212. ECOM_FPD_STATE_NOT_INI = 0,
  213. ECOM_FPD_STATE_ERR,
  214. ECOM_FPD_STATE_STANDBY,
  215. ECOM_FPD_STATE_PREPARE,
  216. ECOM_FPD_STATE_READY,
  217. ECOM_FPD_STATE_SLEEP,
  218. ECOM_FPD_STATE_SHUTDOWN,
  219. ECOM_FPD_STATE_EXIT
  220. }ECOM_FPD_STATE;
  221. typedef enum ECOM_GRID_State
  222. {
  223. ECOM_GRID_ABSENT = 0,
  224. ECOM_GRID_PRESENT,
  225. ECOM_GRID_120,
  226. ECOM_GRID_180,
  227. ECOM_GRID_UNKNOWN,
  228. ECOM_GRID_120_ROTATE,
  229. ECOM_GRID_PARALLEL,
  230. ECOM_GRID_100,
  231. ECOM_GRID_150,
  232. ECOM_GRID_PARTINSERT,
  233. ECOM_GRID_STATE_MAX
  234. }ECOM_GRID_STATE;
  235. typedef enum ECOM_Templerature_state
  236. {
  237. ECOM_TEM_STATE_TOO_LOW = 0,
  238. ECOM_TEM_STATE_LOW,
  239. ECOM_TEM_STAE_NORMAL,
  240. ECOM_TEM_STATE_HIGH,
  241. ECOM_TEM_STATE_TOO_HIGH
  242. }ECOM_TEMPERATURE_STATE;
  243. typedef enum ECOM_Battery_state
  244. {
  245. ECOM_BAT_STATE_TOO_LOW = 0,
  246. ECOM_BAT_STATE_LOW,
  247. ECOM_BAT_STAE_NORMAL,
  248. ECOM_BAT_STATE_GOOD,
  249. ECOM_BAT_STATE_FULL
  250. }ECOM_BATTERY_STATE;
  251. typedef enum ECOM_Wifi_state
  252. {
  253. ECOM_WIFI_STATE_TOO_LOW = 0,
  254. ECOM_WIFI_STATE_LOW,
  255. ECOM_WIFI_STAE_NORMAL,
  256. ECOM_WIFI_STATE_GOOD,
  257. ECOM_WIFI_STATE_FULL
  258. }ECOM_WIFI_STATE;
  259. typedef enum ECOM_Wifi_UNIT_TYPE
  260. {
  261. ECOM_WIFI_UNIT_PERCENTAGE= 0,
  262. ECOM_WIFI_UNIT_DBM
  263. }ECOM_WIFI_UNIT_TYPE;
  264. typedef enum ECOM_Battery_Charg_State
  265. {
  266. BATTERY_CHARG = 0,
  267. BATTERY_DISCHARG,
  268. BATTERY_CHARG_AND_DISCHARG
  269. }ECOM_BATTERY_CHARG_STATE;
  270. typedef struct _Xray_Cal_Attr_Struct
  271. {
  272. bool bExpired;
  273. bool bShowImage;
  274. bool bECOMCal;
  275. unsigned int nCalStatus;
  276. }Xray_Cal_Attr_Struct;
  277. typedef struct _Offset_Cal_Attr_Struct
  278. {
  279. bool bExpired;
  280. bool bShowImage;
  281. bool bECOMCal;
  282. unsigned int nCalStatus;
  283. unsigned int nOftType;
  284. }Offset_Cal_Attr_Struct;
  285. template<typename T> class AECInfo : public BaseJsonDataObject<T>
  286. {
  287. public:
  288. BaseJsonDataObject<int> m_AECDensity;
  289. BaseJsonDataObject<int> m_AECFiled;
  290. BaseJsonDataObject<int> m_AECFilm;
  291. BaseJsonDataObject<float> m_AECDose;
  292. AECInfo(void)
  293. {
  294. BaseJsonDataObject<T>::SetKey("AEC");
  295. m_AECDensity.SetKey("AECDensity");
  296. m_AECFiled.SetKey("AECFiled");
  297. m_AECFilm.SetKey("AECFilm");
  298. m_AECDose.SetKey("AECDose");
  299. }
  300. virtual ~AECInfo(void)
  301. {
  302. }
  303. virtual bool SetResDataObject(ResDataObject &obj)
  304. {
  305. bool ret = true;
  306. try {
  307. m_AECDensity = obj[m_AECDensity.GetKey()];
  308. m_AECFiled = obj[m_AECFiled.GetKey()];
  309. m_AECFilm = obj[m_AECFilm.GetKey()];
  310. m_AECDose = obj[m_AECDose.GetKey()];
  311. }
  312. catch (...)
  313. {
  314. ret = false;
  315. }
  316. return ret;
  317. };
  318. virtual void GetResDataObject(ResDataObject &obj)
  319. {
  320. //ResDataObject loca1;
  321. obj.add(m_AECDensity.GetKey(), m_AECDensity.GetVal());
  322. obj.add(m_AECFiled.GetKey(), m_AECFiled.GetVal());
  323. obj.add(m_AECFilm.GetKey(), m_AECFilm.GetVal());
  324. obj.add(m_AECDose.GetKey(), m_AECDose.GetVal());
  325. //obj.add(GetKey(), loca1);
  326. };
  327. virtual const char *GetVal()
  328. {
  329. ResDataObject obj;
  330. obj.add(m_AECDensity.GetKey(), m_AECDensity.GetVal());
  331. obj.add(m_AECFiled.GetKey(), m_AECFiled.GetVal());
  332. obj.add(m_AECFilm.GetKey(), m_AECFilm.GetVal());
  333. obj.add(m_AECDose.GetKey(), m_AECDose.GetVal());
  334. (m_ValString) = obj.encode();
  335. return m_ValString.c_str();
  336. };
  337. virtual bool SetVal(const char* pValString)
  338. {
  339. ResDataObject obj;
  340. if (obj.decode(pValString))
  341. {
  342. int idx;
  343. idx = obj.GetFirstOf(m_AECDensity.GetKey());
  344. if (idx >= 0)
  345. {
  346. m_AECDensity.SetVal(obj[idx]);
  347. }
  348. idx = obj.GetFirstOf(m_AECFiled.GetKey());
  349. if (idx >= 0)
  350. {
  351. m_AECFiled.SetVal(obj[idx]);
  352. }
  353. idx = obj.GetFirstOf(m_AECFilm.GetKey());
  354. if (idx >= 0)
  355. {
  356. m_AECFilm.SetVal(obj[idx]);
  357. }
  358. idx = obj.GetFirstOf(m_AECDose.GetKey());
  359. if (idx >= 0)
  360. {
  361. m_AECDose.SetVal(obj[idx]);
  362. }
  363. return true;
  364. }
  365. return false;
  366. };
  367. };
  368. class APRStruct : public BaseJsonDataObject<BOOL>
  369. {
  370. public:
  371. /* "FOCUS": "0",
  372. "TECHMODE" : "0",
  373. "AECFIELD" : "0",
  374. "AECFILM" : "0",
  375. "AECDENSITY" : "0",
  376. "KV" : "70",
  377. "MA" : "160.0",
  378. "MS" : "100.0",
  379. "MAS" : "16.0",
  380. "DOSE" : "0.0",
  381. "FILTER" : "0",
  382. "TUBELOAD" : "80.0"*/
  383. BaseJsonDataObject<int> m_KV;
  384. BaseJsonDataObject<float> m_MA;
  385. BaseJsonDataObject<float> m_MS;
  386. BaseJsonDataObject<float> m_MAS;
  387. BaseJsonDataObject<int> m_FOCUS;
  388. BaseJsonDataObject<int> m_TECHMODE;
  389. BaseJsonDataObject<int> m_AECFIELD;
  390. BaseJsonDataObject<int> m_AECFILM;
  391. BaseJsonDataObject<int> m_AECDENSITY;
  392. BaseJsonDataObject<float> m_TUBELOAD;
  393. BaseJsonDataObject<float> m_DOSE;
  394. BaseJsonDataObject<int> m_FILTER;
  395. //AECInfo<int> m_AEC;
  396. APRStruct(void)
  397. {
  398. SetKey("APR");
  399. m_KV.SetKey("KV");
  400. m_MA.SetKey("MA");
  401. m_MS.SetKey("MS");
  402. m_MAS.SetKey("MAS");
  403. m_FOCUS.SetKey("FOCUS");
  404. m_TECHMODE.SetKey("TECHMODE");
  405. m_AECFIELD.SetKey("AECFIELD");
  406. m_AECFILM.SetKey("AECFILM");
  407. m_AECDENSITY.SetKey("AECDENSITY");
  408. m_TUBELOAD.SetKey("TUBELOAD");
  409. m_DOSE.SetKey("DOSE");
  410. m_FILTER.SetKey("FILTER");
  411. }
  412. virtual ~APRStruct(void)
  413. {
  414. }
  415. virtual bool SetResDataObjectfromUI(ResDataObject &obj)
  416. {
  417. bool ret = true;
  418. try {
  419. if (obj.GetFirstOf(m_KV.GetKey()) >= 0)
  420. {
  421. m_KV = obj[m_KV.GetKey()];
  422. }
  423. if (obj.GetFirstOf(m_MA.GetKey()) >= 0)
  424. {
  425. m_MA = (float)atof((const char *)obj[m_MA.GetKey()]);
  426. }
  427. if (obj.GetFirstOf(m_MS.GetKey()) >= 0)
  428. {
  429. m_MS = (float)atof((const char *)obj[m_MS.GetKey()]);
  430. }
  431. if (obj.GetFirstOf(m_MAS.GetKey()) >= 0)
  432. {
  433. m_MAS = (float)atof((const char *)obj[m_MAS.GetKey()]);
  434. }
  435. if (obj.GetFirstOf(m_FOCUS.GetKey()) >= 0)
  436. {
  437. m_FOCUS = obj[m_FOCUS.GetKey()];
  438. }
  439. if (obj.GetFirstOf(m_TECHMODE.GetKey()) >= 0)
  440. {
  441. m_TECHMODE = obj[m_TECHMODE.GetKey()];
  442. }
  443. if (obj.GetFirstOf(m_AECFIELD.GetKey()) >= 0)
  444. {
  445. m_AECFIELD = obj[m_AECFIELD.GetKey()];
  446. }
  447. if (obj.GetFirstOf(m_AECFILM.GetKey()) >= 0)
  448. {
  449. m_AECFILM = obj[m_AECFILM.GetKey()];
  450. }
  451. if (obj.GetFirstOf(m_AECDENSITY.GetKey()) >= 0)
  452. {
  453. m_AECDENSITY = obj[m_AECDENSITY.GetKey()];
  454. }
  455. if (obj.GetFirstOf(m_TUBELOAD.GetKey()) >= 0)
  456. {
  457. m_TUBELOAD = (float)atof((const char *)obj[m_TUBELOAD.GetKey()]);
  458. }
  459. if (obj.GetFirstOf(m_DOSE.GetKey()) >= 0)
  460. {
  461. m_DOSE = (float)atof((const char *)obj[m_DOSE.GetKey()]);
  462. }
  463. if (obj.GetFirstOf(m_FILTER.GetKey()) >= 0)
  464. {
  465. m_FILTER = obj[m_FILTER.GetKey()];
  466. }
  467. }
  468. catch (...)
  469. {
  470. ret = false;
  471. }
  472. return ret;
  473. };
  474. virtual bool SetResDataObject(ResDataObject &obj)
  475. {
  476. bool ret = true;
  477. try {
  478. if (obj.GetFirstOf(m_KV.GetKey()) >= 0)
  479. {
  480. m_KV = obj[m_KV.GetKey()];
  481. }
  482. if (obj.GetFirstOf(m_MA.GetKey()) >= 0)
  483. {
  484. m_MA = obj[m_MA.GetKey()];
  485. }
  486. if (obj.GetFirstOf(m_MS.GetKey()) >= 0)
  487. {
  488. m_MS = obj[m_MS.GetKey()];
  489. }
  490. if (obj.GetFirstOf(m_MAS.GetKey()) >= 0)
  491. {
  492. m_MAS = obj[m_MAS.GetKey()];
  493. }
  494. if (obj.GetFirstOf(m_FOCUS.GetKey()) >= 0)
  495. {
  496. m_FOCUS = obj[m_FOCUS.GetKey()];
  497. }
  498. if (obj.GetFirstOf(m_TECHMODE.GetKey()) >= 0)
  499. {
  500. m_TECHMODE = obj[m_TECHMODE.GetKey()];
  501. }
  502. if (obj.GetFirstOf(m_AECFIELD.GetKey()) >= 0)
  503. {
  504. m_AECFIELD = obj[m_AECFIELD.GetKey()];
  505. }
  506. if (obj.GetFirstOf(m_AECFILM.GetKey()) >= 0)
  507. {
  508. m_AECFILM = obj[m_AECFILM.GetKey()];
  509. }
  510. if (obj.GetFirstOf(m_AECDENSITY.GetKey()) >= 0)
  511. {
  512. m_AECDENSITY = obj[m_AECDENSITY.GetKey()];
  513. }
  514. if (obj.GetFirstOf(m_TUBELOAD.GetKey()) >= 0)
  515. {
  516. m_TUBELOAD = obj[m_TUBELOAD.GetKey()];
  517. }
  518. if (obj.GetFirstOf(m_DOSE.GetKey()) >= 0)
  519. {
  520. m_DOSE = obj[m_DOSE.GetKey()];
  521. }
  522. if (obj.GetFirstOf(m_FILTER.GetKey()) >= 0)
  523. {
  524. m_FILTER = obj[m_FILTER.GetKey()];
  525. }
  526. }
  527. catch (...)
  528. {
  529. ret = false;
  530. }
  531. return ret;
  532. };
  533. virtual void GetResDataObject(ResDataObject &obj)
  534. {
  535. //ResDataObject loca1;
  536. //m_AEC.GetResDataObject(loca1);
  537. obj.add(m_KV.GetKey(), m_KV);
  538. obj.add(m_MA.GetKey(), m_MA);
  539. obj.add(m_MS.GetKey(), m_MS);
  540. obj.add(m_MAS.GetKey(), m_MAS);
  541. obj.add(m_FOCUS.GetKey(), m_FOCUS);
  542. obj.add(m_TECHMODE.GetKey(), m_TECHMODE);
  543. obj.add(m_FILTER.GetKey(), m_FILTER);
  544. obj.add(m_DOSE.GetKey(), m_DOSE);
  545. obj.add(m_AECDENSITY.GetKey(), m_AECDENSITY);
  546. //obj.add(m_AEC.GetKey(), loca1);
  547. //obj.add(GetKey(), loca1);
  548. };
  549. virtual const char *GetVal()
  550. {
  551. ResDataObject obj;
  552. obj.add(m_KV.GetKey(), m_KV.GetVal());
  553. obj.add(m_MA.GetKey(), m_MA.GetVal());
  554. obj.add(m_MS.GetKey(), m_MS.GetVal());
  555. obj.add(m_MAS.GetKey(), m_MAS.GetVal());
  556. obj.add(m_FOCUS.GetKey(), m_FOCUS.GetVal());
  557. obj.add(m_TECHMODE.GetKey(), m_TECHMODE.GetVal());
  558. obj.add(m_FILTER.GetKey(), m_FILTER.GetVal());
  559. obj.add(m_DOSE.GetKey(), m_DOSE.GetVal());
  560. //obj.add(m_AEC.GetKey(), m_AEC.GetVal());
  561. (m_ValString) = obj.encode();
  562. return m_ValString.c_str();
  563. };
  564. virtual bool SetVal(const char* pValString)
  565. {
  566. ResDataObject obj;
  567. if (obj.decode(pValString))
  568. {
  569. int idx;
  570. idx = obj.GetFirstOf(m_KV.GetKey());
  571. if (idx >= 0)
  572. {
  573. m_KV.SetVal(obj[idx]);
  574. }
  575. idx = obj.GetFirstOf(m_MA.GetKey());
  576. if (idx >= 0)
  577. {
  578. m_MA.SetVal(obj[idx]);
  579. }
  580. idx = obj.GetFirstOf(m_MS.GetKey());
  581. if (idx >= 0)
  582. {
  583. m_MS.SetVal(obj[idx]);
  584. }
  585. idx = obj.GetFirstOf(m_MAS.GetKey());
  586. if (idx >= 0)
  587. {
  588. m_MAS.SetVal(obj[idx]);
  589. }
  590. idx = obj.GetFirstOf(m_FOCUS.GetKey());
  591. if (idx >= 0)
  592. {
  593. m_FOCUS.SetVal(obj[idx]);
  594. }
  595. idx = obj.GetFirstOf(m_TECHMODE.GetKey());
  596. if (idx >= 0)
  597. {
  598. m_TECHMODE.SetVal(obj[idx]);
  599. }
  600. idx = obj.GetFirstOf(m_FILTER.GetKey());
  601. if (idx >= 0)
  602. {
  603. m_FILTER.SetVal(obj[idx]);
  604. }
  605. idx = obj.GetFirstOf(m_DOSE.GetKey());
  606. if (idx >= 0)
  607. {
  608. m_DOSE.SetVal(obj[idx]);
  609. }
  610. //idx = obj.GetFirstOf(m_AEC.GetKey());
  611. //if (idx >= 0)
  612. //{
  613. // m_AEC.SetVal(obj[idx]);
  614. //}
  615. return true;
  616. }
  617. return false;
  618. }
  619. //virtual void SetKey(const char* pKeyString)
  620. //{
  621. // SetKey(pKeyString);
  622. // //return true;
  623. //};
  624. };
  625. template<typename T> class FrameData : public BaseJsonDataObject<T>
  626. {
  627. public:
  628. BaseJsonDataObject<string> m_FrameID;
  629. APRStruct m_ExpData;
  630. FrameData(void)
  631. {
  632. BaseJsonDataObject<T>::SetKey("FrameData");
  633. m_FrameID.SetKey("FramID");
  634. m_ExpData.SetKey("EXPData");
  635. }
  636. virtual ~FrameData(void)
  637. {
  638. }
  639. virtual const char *GetVal()
  640. {
  641. ResDataObject obj;
  642. obj.add(m_FrameID.GetKey(), m_FrameID.GetVal());
  643. obj.add(m_ExpData.GetKey(), m_ExpData.GetVal());
  644. (m_ValString) = obj.encode();
  645. return m_ValString.c_str();
  646. };
  647. virtual bool SetVal(const char* pValString)
  648. {
  649. ResDataObject obj;
  650. if (obj.decode(pValString))
  651. {
  652. int idx;
  653. idx = obj.GetFirstOf(m_FrameID.GetKey());
  654. if (idx >= 0)
  655. {
  656. m_FrameID.SetVal(obj[idx]);
  657. }
  658. idx = obj.GetFirstOf(m_ExpData.GetKey());
  659. if (idx >= 0)
  660. {
  661. m_ExpData.SetVal(obj[idx]);
  662. }
  663. return true;
  664. }
  665. return false;
  666. }
  667. };
  668. template<typename T> class ExamDatalist : public BaseJsonDataObject<T>
  669. {
  670. public:
  671. vector<FrameData<T>>m_ExamDatalist;
  672. FrameData<T> temp;
  673. ExamDatalist(void)
  674. {
  675. BaseJsonDataObject<T>::SetKey("FrameData");
  676. }
  677. virtual ~ExamDatalist(void)
  678. {
  679. }
  680. virtual const char *GetVal()
  681. {
  682. ResDataObject obj;
  683. for (size_t i = 0; i<m_ExamDatalist.size(); i++)
  684. {
  685. obj.add(m_ExamDatalist[i].GetKey(), m_ExamDatalist[i].GetVal());
  686. }
  687. (m_ValString) = obj.encode();
  688. return m_ValString.c_str();
  689. };
  690. void AddVal(string pValString)
  691. {
  692. temp.SetVal(pValString.c_str());
  693. m_ExamDatalist.push_back(temp);
  694. }
  695. int DelVal(string pFameID)
  696. {
  697. ResDataObject obj;
  698. if (obj.decode(pValString))
  699. {
  700. int idx;
  701. for (int i = 0; i<m_ExamDatalist.size(); i++)
  702. {
  703. idx = obj.GetFirstOf(m_ExamDatalist[i].m_FrameID.GetKey());
  704. if (idx >= 0)
  705. {
  706. if (m_ExamDatalist[i].m_FrameID.GetVal() == obj[idx])
  707. {
  708. m_ExamDatalist.erase(i);
  709. return true;
  710. }
  711. }
  712. }
  713. }
  714. return false;
  715. }
  716. int Find(const char *pFameID)
  717. {
  718. ResDataObject obj;
  719. int index;
  720. if (obj.decode(pValString))
  721. {
  722. int idx;
  723. for (int i = 0; i<m_ExamDatalist.size(); i++)
  724. {
  725. idx = obj.GetFirstOf(m_ExamDatalist[i].m_FrameID.GetKey());
  726. if (idx >= 0)
  727. {
  728. if (m_ExamDatalist[i].m_FrameID.GetVal() == obj[idx])
  729. {
  730. index = i;
  731. return index;
  732. }
  733. }
  734. }
  735. }
  736. return false;
  737. }
  738. };
  739. template<typename T> class EXAMInfo : public BaseJsonDataObject<T>
  740. {
  741. public:
  742. BaseJsonDataObject<int> m_ExamMode;
  743. BaseJsonDataObject<int> m_WorkStation;
  744. BaseJsonDataObject<int> m_FrameID;
  745. EXAMInfo(void)
  746. {
  747. BaseJsonDataObject<T>::SetKey("EXAMInfo");
  748. m_ExamMode.SetKey("ExamMode");
  749. m_WorkStation.SetKey("WorkStation");
  750. m_FrameID.SetKey("FrameID");
  751. }
  752. virtual ~EXAMInfo(void)
  753. {
  754. }
  755. virtual bool SetResDataObject(ResDataObject &obj)
  756. {
  757. bool ret = true;
  758. try {
  759. m_ExamMode = obj[m_ExamMode.GetKey()];
  760. m_WorkStation = obj[m_WorkStation.GetKey()];
  761. m_FrameID = obj[m_FrameID.GetKey()];
  762. }
  763. catch (...)
  764. {
  765. ret = false;
  766. }
  767. return ret;
  768. };
  769. virtual void GetResDataObject(ResDataObject &obj)
  770. {
  771. obj.add(m_ExamMode.GetKey(), m_ExamMode);
  772. obj.add(m_WorkStation.GetKey(), m_WorkStation);
  773. obj.add(m_FrameID.GetKey(), m_FrameID);
  774. };
  775. virtual const char *GetVal()
  776. {
  777. ResDataObject obj;
  778. obj.add(m_ExamMode.GetKey(), m_ExamMode.GetVal());
  779. obj.add(m_WorkStation.GetKey(), m_WorkStation.GetVal());
  780. obj.add(m_FrameID.GetKey(), m_FrameID.GetVal());
  781. (m_ValString) = obj.encode();
  782. return m_ValString.c_str();
  783. };
  784. virtual bool SetVal(const char* pValString)
  785. {
  786. ResDataObject obj;
  787. if (obj.decode(pValString))
  788. {
  789. int idx;
  790. idx = obj.GetFirstOf(m_ExamMode.GetKey());
  791. if (idx >= 0)
  792. {
  793. m_ExamMode.SetVal(obj[idx]);
  794. }
  795. idx = obj.GetFirstOf(m_WorkStation.GetKey());
  796. if (idx >= 0)
  797. {
  798. m_WorkStation.SetVal(obj[idx]);
  799. }
  800. idx = obj.GetFirstOf(m_FrameID.GetKey());
  801. if (idx >= 0)
  802. {
  803. m_FrameID.SetVal(obj[idx]);
  804. }
  805. return true;
  806. }
  807. return false;
  808. };
  809. };
  810. class ImgInfoDef : public BaseJsonDataObject<bool>
  811. {
  812. public:
  813. BaseJsonDataObject<unsigned int> nWidth;//宽度
  814. BaseJsonDataObject<unsigned int> nHeight;//高度
  815. BaseJsonDataObject<unsigned int> nBit;//位数
  816. ImgInfoDef()
  817. {
  818. SetKey("ImgInfo");
  819. nWidth.SetKey("Width");
  820. nHeight.SetKey("Height");
  821. nBit.SetKey("Bit");
  822. }
  823. virtual ~ImgInfoDef(void)
  824. {
  825. }
  826. virtual void GetResDataObject(ResDataObject &obj)
  827. {
  828. obj.clear();
  829. obj.add(nWidth.GetKey(), nWidth.GetVal());
  830. obj.add(nHeight.GetKey(), nHeight.GetVal());
  831. obj.add(nBit.GetKey(), nBit.GetVal());
  832. //obj.add(GetKey(), loca1);
  833. };
  834. virtual bool SetResDataObject(ResDataObject &obj)
  835. {
  836. bool ret = true;
  837. try {
  838. nBit = obj[nBit.GetKey()];
  839. nHeight = obj[nHeight.GetKey()];
  840. nWidth = obj[nWidth.GetKey()];
  841. }
  842. catch (...)
  843. {
  844. ret = false;
  845. }
  846. return ret;
  847. };
  848. virtual const char *GetVal()
  849. {
  850. ResDataObject obj;
  851. obj.add(nWidth.GetKey(), nWidth.GetVal());
  852. obj.add(nHeight.GetKey(), nHeight.GetVal());
  853. obj.add(nBit.GetKey(), nBit.GetVal());
  854. (m_ValString) = obj.encode();
  855. return m_ValString.c_str();
  856. };
  857. virtual bool SetVal(const char* pValString)
  858. {
  859. ResDataObject obj;
  860. if (obj.decode(pValString))
  861. {
  862. int idx;
  863. idx = obj.GetFirstOf(nWidth.GetKey());
  864. if (idx >= 0)
  865. {
  866. nWidth.SetVal(obj[idx]);
  867. }
  868. idx = obj.GetFirstOf(nHeight.GetKey());
  869. if (idx >= 0)
  870. {
  871. nHeight.SetVal(obj[idx]);
  872. }
  873. idx = obj.GetFirstOf(nBit.GetKey());
  874. if (idx >= 0)
  875. {
  876. nBit.SetVal(obj[idx]);
  877. }
  878. return true;
  879. }
  880. return false;
  881. };
  882. virtual void SetKey(const char* pKeyString)
  883. {
  884. std::string temp = pKeyString;
  885. std::string keystring;
  886. BaseJsonDataObject<bool>::SetKey(pKeyString);
  887. //make key
  888. keystring = "Width";
  889. nWidth.SetKey(keystring.c_str());
  890. keystring = "Height";
  891. nHeight.SetKey(keystring.c_str());
  892. keystring = "Bit";
  893. nBit.SetKey(keystring.c_str());
  894. };
  895. };
  896. class ImgDataInfo : public BaseJsonDataObject<bool>
  897. {
  898. public:
  899. BaseJsonDataObject<unsigned int> nImageType;
  900. BaseJsonDataObject<unsigned int> nViewType;
  901. BaseJsonDataObject<unsigned long long> nShareMemID;
  902. BaseJsonDataObject<unsigned long long> nImageID;
  903. BaseJsonDataObject<unsigned int> nWidth;
  904. BaseJsonDataObject<unsigned int> nHeight;
  905. BaseJsonDataObject<unsigned int> nBit;
  906. ImgDataInfo(void)
  907. {
  908. const char* keystring = "ImageType";
  909. nImageType.SetKey(keystring);
  910. keystring = "Viewtype";
  911. nViewType.SetKey(keystring);
  912. keystring = "Sharememid";
  913. nShareMemID.SetKey(keystring);
  914. keystring = "Imageid";
  915. nImageID.SetKey(keystring);
  916. keystring = "Width";
  917. nWidth.SetKey(keystring);
  918. keystring = "Height";
  919. nHeight.SetKey(keystring);
  920. keystring = "Bit";
  921. nBit.SetKey(keystring);
  922. }
  923. virtual ~ImgDataInfo(void)
  924. {
  925. }
  926. virtual void GetResDataObject(ResDataObject &obj)
  927. {
  928. //ResDataObject loca1;
  929. obj.add(nImageType.GetKey(), nImageType.GetVal());
  930. obj.add(nViewType.GetKey(), nViewType.GetVal());
  931. obj.add(nShareMemID.GetKey(), nShareMemID.GetVal());
  932. obj.add(nImageID.GetKey(), nImageID.GetVal());
  933. obj.add(nWidth.GetKey(), nWidth.GetVal());
  934. obj.add(nHeight.GetKey(), nHeight.GetVal());
  935. obj.add(nBit.GetKey(), nBit.GetVal());
  936. //obj.add(GetKey(), loca1);
  937. };
  938. virtual bool SetResDataObject(ResDataObject &obj)
  939. {
  940. bool ret = true;
  941. try {
  942. nImageType = obj[nImageType.GetKey()];
  943. nViewType = obj[nViewType.GetKey()];
  944. nShareMemID = obj[nShareMemID.GetKey()];
  945. nImageID = obj[nImageID.GetKey()];
  946. nWidth = obj[nWidth.GetKey()];
  947. nHeight = obj[nHeight.GetKey()];
  948. nBit = obj[nBit.GetKey()];
  949. }
  950. catch (...)
  951. {
  952. ret = false;
  953. }
  954. return ret;
  955. };
  956. virtual const char *GetVal()
  957. {
  958. ResDataObject obj;
  959. obj.add(nImageType.GetKey(), nImageType.GetVal());
  960. obj.add(nViewType.GetKey(), nViewType.GetVal());
  961. obj.add(nShareMemID.GetKey(), nShareMemID.GetVal());
  962. obj.add(nImageID.GetKey(), nImageID.GetVal());
  963. obj.add(nWidth.GetKey(), nWidth.GetVal());
  964. obj.add(nHeight.GetKey(), nHeight.GetVal());
  965. obj.add(nBit.GetKey(), nBit.GetVal());
  966. (m_ValString) = obj.encode();
  967. return m_ValString.c_str();
  968. };
  969. virtual bool SetVal(const char* pValString)
  970. {
  971. ResDataObject obj;
  972. if (obj.decode(pValString))
  973. {
  974. int idx;
  975. idx = obj.GetFirstOf(nImageType.GetKey());
  976. if (idx >= 0)
  977. {
  978. nImageType.SetVal(obj[idx]);
  979. }
  980. idx = obj.GetFirstOf(nViewType.GetKey());
  981. if (idx >= 0)
  982. {
  983. nViewType.SetVal(obj[idx]);
  984. }
  985. idx = obj.GetFirstOf(nShareMemID.GetKey());
  986. if (idx >= 0)
  987. {
  988. nShareMemID.SetVal(obj[idx]);
  989. }
  990. idx = obj.GetFirstOf(nImageID.GetKey());
  991. if (idx >= 0)
  992. {
  993. nImageID.SetVal(obj[idx]);
  994. }
  995. idx = obj.GetFirstOf(nWidth.GetKey());
  996. if (idx >= 0)
  997. {
  998. nWidth.SetVal(obj[idx]);
  999. }
  1000. idx = obj.GetFirstOf(nHeight.GetKey());
  1001. if (idx >= 0)
  1002. {
  1003. nHeight.SetVal(obj[idx]);
  1004. }
  1005. idx = obj.GetFirstOf(nBit.GetKey());
  1006. if (idx >= 0)
  1007. {
  1008. nBit.SetVal(obj[idx]);
  1009. }
  1010. return true;
  1011. }
  1012. return false;
  1013. };
  1014. virtual void SetKey(const char* pKeyString)
  1015. {
  1016. BaseJsonDataObject<bool>::SetKey(pKeyString);
  1017. //make key
  1018. const char* keystring = "ImageType";
  1019. nImageType.SetKey(keystring);
  1020. keystring = "Viewtype";
  1021. nViewType.SetKey(keystring);
  1022. keystring = "Sharememid";
  1023. nShareMemID.SetKey(keystring);
  1024. keystring = "Imageid";
  1025. nImageID.SetKey(keystring);
  1026. keystring = "Width";
  1027. nWidth.SetKey(keystring);
  1028. keystring = "Height";
  1029. nHeight.SetKey(keystring);
  1030. keystring = "Bit";
  1031. nBit.SetKey(keystring);
  1032. };
  1033. };
  1034. class XRAY_CAL_ATTR : public BaseJsonDataObject<bool>
  1035. {
  1036. public:
  1037. BaseJsonDataObject<bool> bExpired;
  1038. BaseJsonDataObject<bool> bShowImage;
  1039. BaseJsonDataObject<bool> bECOMCal;
  1040. BaseJsonDataObject<unsigned int> nCalStatus;
  1041. XRAY_CAL_ATTR(void)
  1042. {
  1043. const char* keystring = "Expire";
  1044. bExpired.SetKey(keystring);
  1045. bShowImage = "ShowImage";
  1046. bShowImage.SetKey(keystring);
  1047. keystring = "ECOMCal";
  1048. bECOMCal.SetKey(keystring);
  1049. keystring = "CalStatus";
  1050. nCalStatus.SetKey(keystring);
  1051. bExpired = false;
  1052. bShowImage = false;
  1053. bECOMCal = false;
  1054. nCalStatus = CAL_TYPE_NONE;
  1055. }
  1056. virtual ~XRAY_CAL_ATTR(void)
  1057. {
  1058. }
  1059. virtual void GetResDataObject(ResDataObject &obj)
  1060. {
  1061. //ResDataObject loca1;
  1062. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1063. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1064. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1065. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1066. //obj.add(GetKey(), loca1);
  1067. };
  1068. virtual bool SetResDataObject(ResDataObject &obj)
  1069. {
  1070. bool ret = true;
  1071. try {
  1072. bExpired = obj[bExpired.GetKey()];
  1073. bShowImage = obj[bShowImage.GetKey()];
  1074. bECOMCal = obj[bECOMCal.GetKey()];
  1075. nCalStatus = obj[nCalStatus.GetKey()];
  1076. }
  1077. catch (...)
  1078. {
  1079. ret = false;
  1080. }
  1081. return ret;
  1082. };
  1083. virtual const char *GetVal()
  1084. {
  1085. ResDataObject obj;
  1086. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1087. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1088. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1089. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1090. (m_ValString) = obj.encode();
  1091. return m_ValString.c_str();
  1092. };
  1093. virtual bool SetVal(const char* pValString)
  1094. {
  1095. ResDataObject obj;
  1096. if (obj.decode(pValString))
  1097. {
  1098. int idx;
  1099. idx = obj.GetFirstOf(bExpired.GetKey());
  1100. if (idx >= 0)
  1101. {
  1102. bExpired.SetVal(obj[idx]);
  1103. }
  1104. idx = obj.GetFirstOf(bShowImage.GetKey());
  1105. if (idx >= 0)
  1106. {
  1107. bShowImage.SetVal(obj[idx]);
  1108. }
  1109. idx = obj.GetFirstOf(bECOMCal.GetKey());
  1110. if (idx >= 0)
  1111. {
  1112. bECOMCal.SetVal(obj[idx]);
  1113. }
  1114. idx = obj.GetFirstOf(nCalStatus.GetKey());
  1115. if (idx >= 0)
  1116. {
  1117. nCalStatus.SetVal(obj[idx]);
  1118. }
  1119. return true;
  1120. }
  1121. return false;
  1122. };
  1123. virtual void SetKey(const char* pKeyString)
  1124. {
  1125. BaseJsonDataObject<bool>::SetKey(pKeyString);
  1126. //make key
  1127. const char* keystring = "Expired";
  1128. bExpired.SetKey(keystring);
  1129. keystring = "ShowImage";
  1130. bShowImage.SetKey(keystring);
  1131. keystring = "ECOMCal";
  1132. bECOMCal.SetKey(keystring);
  1133. keystring = "CalStatus";
  1134. nCalStatus.SetKey(keystring);
  1135. };
  1136. };
  1137. class OFFSETT_CAL_ATTR : public BaseJsonDataObject<bool>
  1138. {
  1139. public:
  1140. BaseJsonDataObject<bool> bExpired;
  1141. BaseJsonDataObject<bool> bShowImage;
  1142. BaseJsonDataObject<bool> bECOMCal;
  1143. BaseJsonDataObject<unsigned int> nCalStatus;
  1144. BaseJsonDataObject<unsigned int> nOftType;
  1145. OFFSETT_CAL_ATTR(void)
  1146. {
  1147. const char* keystring = "Expire";
  1148. bExpired.SetKey(keystring);
  1149. bShowImage = "ShowImage";
  1150. bShowImage.SetKey(keystring);
  1151. keystring = "ECOMCal";
  1152. bECOMCal.SetKey(keystring);
  1153. keystring = "CalStatus";
  1154. nCalStatus.SetKey(keystring);
  1155. keystring = "OftType";
  1156. nOftType.SetKey(keystring);
  1157. bExpired = false;
  1158. bShowImage = false;
  1159. bECOMCal = false;
  1160. nCalStatus = CAL_TYPE_NONE;
  1161. nOftType = OFT_NONE;
  1162. }
  1163. virtual ~OFFSETT_CAL_ATTR(void)
  1164. {
  1165. }
  1166. virtual void GetResDataObject(ResDataObject &obj)
  1167. {
  1168. //ResDataObject loca1;
  1169. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1170. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1171. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1172. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1173. obj.add(nOftType.GetKey(), nOftType.GetVal());
  1174. //obj.add(GetKey(), loca1);
  1175. };
  1176. virtual bool SetResDataObject(ResDataObject &obj)
  1177. {
  1178. bool ret = true;
  1179. try {
  1180. bExpired = obj[bExpired.GetKey()];
  1181. bShowImage = obj[bShowImage.GetKey()];
  1182. bECOMCal = obj[bECOMCal.GetKey()];
  1183. nCalStatus = obj[nCalStatus.GetKey()];
  1184. nOftType = obj[nOftType.GetKey()];
  1185. }
  1186. catch (...)
  1187. {
  1188. ret = false;
  1189. }
  1190. return ret;
  1191. };
  1192. virtual const char *GetVal()
  1193. {
  1194. ResDataObject obj;
  1195. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1196. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1197. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1198. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1199. obj.add(nOftType.GetKey(), nOftType.GetVal());
  1200. (m_ValString) = obj.encode();
  1201. return m_ValString.c_str();
  1202. };
  1203. virtual bool SetVal(const char* pValString)
  1204. {
  1205. ResDataObject obj;
  1206. if (obj.decode(pValString))
  1207. {
  1208. int idx;
  1209. idx = obj.GetFirstOf(bExpired.GetKey());
  1210. if (idx >= 0)
  1211. {
  1212. bExpired.SetVal(obj[idx]);
  1213. }
  1214. idx = obj.GetFirstOf(bShowImage.GetKey());
  1215. if (idx >= 0)
  1216. {
  1217. bShowImage.SetVal(obj[idx]);
  1218. }
  1219. idx = obj.GetFirstOf(bECOMCal.GetKey());
  1220. if (idx >= 0)
  1221. {
  1222. bECOMCal.SetVal(obj[idx]);
  1223. }
  1224. idx = obj.GetFirstOf(nCalStatus.GetKey());
  1225. if (idx >= 0)
  1226. {
  1227. nCalStatus.SetVal(obj[idx]);
  1228. }
  1229. idx = obj.GetFirstOf(nOftType.GetKey());
  1230. if (idx >= 0)
  1231. {
  1232. nOftType.SetVal(obj[idx]);
  1233. }
  1234. return true;
  1235. }
  1236. return false;
  1237. };
  1238. virtual void SetKey(const char* pKeyString)
  1239. {
  1240. BaseJsonDataObject<bool>::SetKey(pKeyString);
  1241. //make key
  1242. const char* keystring = "Expired";
  1243. bExpired.SetKey(keystring);
  1244. keystring = "ShowImage";
  1245. bShowImage.SetKey(keystring);
  1246. keystring = "ECOMCal";
  1247. bECOMCal.SetKey(keystring);
  1248. keystring = "CalStatus";
  1249. nCalStatus.SetKey(keystring);
  1250. keystring = "OftType";
  1251. nOftType.SetKey(keystring);
  1252. };
  1253. };
  1254. //class MESSAGE_ERROR : public BaseJsonDataObject<bool>
  1255. //{
  1256. //public:
  1257. // BaseJsonDataObject<int> nCode;
  1258. // BaseJsonDataObject<string> strName;
  1259. // BaseJsonDataObject<string> strDescription;
  1260. // BaseJsonDataObject<string> strSolution;
  1261. // BaseJsonDataObject<int> nNotifyType;
  1262. // BaseJsonDataObject<string> strInterlock;
  1263. // BaseJsonDataObject<string> strBackCommand;
  1264. // MESSAGE_ERROR(void)
  1265. // {
  1266. // const char* keystring = "Code";
  1267. // nCode.SetKey(keystring);
  1268. // keystring = "Name";
  1269. // strName.SetKey(keystring);
  1270. // keystring = "Description";
  1271. // strDescription.SetKey(keystring);
  1272. // keystring = "Solution";
  1273. // strSolution.SetKey(keystring);
  1274. // keystring = "NotifyType";
  1275. // nNotifyType.SetKey(keystring);
  1276. // keystring = "Interlock";
  1277. // strInterlock.SetKey(keystring);
  1278. // keystring = "BackCommand";
  1279. // strBackCommand.SetKey(keystring);
  1280. // nCode = 0;
  1281. // strName = "";
  1282. // strDescription = "";
  1283. // strSolution = "";
  1284. // nNotifyType = 0;
  1285. // strInterlock = "";
  1286. // strBackCommand = "";
  1287. // }
  1288. // virtual ~MESSAGE_ERROR(void)
  1289. // {
  1290. // }
  1291. // virtual void GetResDataObject(ResDataObject &obj)
  1292. // {
  1293. // //ResDataObject loca1;
  1294. // obj.add(nCode.GetKey(), nCode.GetVal());
  1295. // obj.add(strName.GetKey(), strName.GetVal());
  1296. // obj.add(strDescription.GetKey(), strDescription.GetVal());
  1297. // obj.add(strSolution.GetKey(), strSolution.GetVal());
  1298. // obj.add(nNotifyType.GetKey(), nNotifyType.GetVal());
  1299. // obj.add(strInterlock.GetKey(), strInterlock.GetVal());
  1300. // obj.add(strBackCommand.GetKey(), strBackCommand.GetVal());
  1301. // };
  1302. // virtual bool SetResDataObject(ResDataObject &obj)
  1303. // {
  1304. // bool ret = true;
  1305. // try {
  1306. // nCode = obj[nCode.GetKey()];
  1307. // strName = (const char *)obj[strName.GetKey()];
  1308. // strDescription = (const char *)obj[strDescription.GetKey()];
  1309. // strSolution = (const char *)obj[strSolution.GetKey()];
  1310. // nNotifyType = obj[nNotifyType.GetKey()];
  1311. // strInterlock = (const char *)obj[strInterlock.GetKey()];
  1312. // strBackCommand = (const char *)obj[strBackCommand.GetKey()];
  1313. // }
  1314. // catch (...)
  1315. // {
  1316. // ret = false;
  1317. // }
  1318. // return ret;
  1319. // };
  1320. // virtual const char *GetVal()
  1321. // {
  1322. // ResDataObject obj;
  1323. // obj.add(nCode.GetKey(), nCode.GetVal());
  1324. // obj.add(strName.GetKey(), strName.GetVal());
  1325. // obj.add(strDescription.GetKey(), strDescription.GetVal());
  1326. // obj.add(strSolution.GetKey(), strSolution.GetVal());
  1327. // obj.add(nNotifyType.GetKey(), nNotifyType.GetVal());
  1328. // obj.add(strInterlock.GetKey(), strInterlock.GetVal());
  1329. // obj.add(strBackCommand.GetKey(), strBackCommand.GetVal());
  1330. // (m_ValString) = obj.encode();
  1331. // return m_ValString.c_str();
  1332. // };
  1333. // virtual bool SetVal(const char* pValString)
  1334. // {
  1335. // ResDataObject obj;
  1336. // if (obj.decode(pValString))
  1337. // {
  1338. // int idx;
  1339. // idx = obj.GetFirstOf(nCode.GetKey());
  1340. // if (idx >= 0)
  1341. // {
  1342. // nCode.SetVal(obj[idx]);
  1343. // }
  1344. // idx = obj.GetFirstOf(strName.GetKey());
  1345. // if (idx >= 0)
  1346. // {
  1347. // strName.SetVal(obj[idx]);
  1348. // }
  1349. // idx = obj.GetFirstOf(strDescription.GetKey());
  1350. // if (idx >= 0)
  1351. // {
  1352. // strDescription.SetVal(obj[idx]);
  1353. // }
  1354. // idx = obj.GetFirstOf(strSolution.GetKey());
  1355. // if (idx >= 0)
  1356. // {
  1357. // strSolution.SetVal(obj[idx]);
  1358. // }
  1359. // idx = obj.GetFirstOf(nNotifyType.GetKey());
  1360. // if (idx >= 0)
  1361. // {
  1362. // nNotifyType.SetVal(obj[idx]);
  1363. // }
  1364. // idx = obj.GetFirstOf(strInterlock.GetKey());
  1365. // if (idx >= 0)
  1366. // {
  1367. // strInterlock.SetVal(obj[idx]);
  1368. // }
  1369. // idx = obj.GetFirstOf(strBackCommand.GetKey());
  1370. // if (idx >= 0)
  1371. // {
  1372. // strBackCommand.SetVal(obj[idx]);
  1373. // }
  1374. // return true;
  1375. // }
  1376. // return false;
  1377. // };
  1378. // virtual void SetKey(const char* pKeyString)
  1379. // {
  1380. // BaseJsonDataObject<bool>::SetKey(pKeyString);
  1381. // //make key
  1382. // const char* keystring = "Code";
  1383. // nCode.SetKey(keystring);
  1384. // keystring = "Name";
  1385. // strName.SetKey(keystring);
  1386. // keystring = "Description";
  1387. // strDescription.SetKey(keystring);
  1388. // keystring = "Solution";
  1389. // strSolution.SetKey(keystring);
  1390. // keystring = "NotifyType";
  1391. // nNotifyType.SetKey(keystring);
  1392. // keystring = "Interlock";
  1393. // strInterlock.SetKey(keystring);
  1394. // keystring = "BackCommand";
  1395. // strBackCommand.SetKey(keystring);
  1396. // };
  1397. //};