GEN.DEV.IDETEC_Almax.cpp 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737
  1. #include "stdafx.h"
  2. #include "GEN.DEV.IDETEC_Almax.h"
  3. namespace nsGEN = CCOS::Dev::Detail::Generator;
  4. #define Almax_LoopDefHBTime 1000
  5. //生成命令校验和:cmdData 为 <CMD> [<,> <ARG>]...<,> 其长度要多出3个字符用于存放 STX、CSUM、ETX
  6. char ComputeCheckSum(char* cmdData, int& size)
  7. {
  8. if (size + 3 >= Almax_Com_ReSendLen)
  9. {
  10. return 0x00;
  11. }
  12. int AsciiSum = Almax_STX + Almax_ETX;
  13. char TempCMD[Almax_Com_ReSendLen] = { 0 };
  14. TempCMD[0] = Almax_STX;
  15. for (int i = 0; i < size; i++) //每字节相加
  16. {
  17. AsciiSum += cmdData[i];
  18. TempCMD[i + 1] = cmdData[i];
  19. }
  20. TempCMD[size + 1] = (char)Almax_ETX;
  21. //if (0x00 <= AsciiSum && AsciiSum <= 0xFF)
  22. {
  23. TempCMD[size + 2] = (char)AsciiSum;
  24. memcpy(cmdData, TempCMD, size + 4);
  25. size += 3;
  26. FDEBUG("ComputeCheckSum:[0x{$:x}]", AsciiSum);
  27. return (char)AsciiSum;
  28. }
  29. //else
  30. //{
  31. // FDEBUG("ComputeCheckSum:[0x00]");
  32. // return 0x00;
  33. //}
  34. //return 0xFF;
  35. }
  36. //-----------------------------------------------------------------------------
  37. // CGEN_DEV_IDETEC_Almax
  38. //-----------------------------------------------------------------------------
  39. atomic<int> nsGEN::CGEN_DEV_IDETEC_Almax::m_iLoopTime = Almax_LoopDefHBTime;
  40. CcosAttrKey::UNIT_CTRL_TYPE nsGEN::CGEN_DEV_IDETEC_Almax::m_nNotifyType = CcosAttrKey::CTRL_CallBackFun;
  41. nsGEN::CGEN_DEV_IDETEC_Almax::CGEN_DEV_IDETEC_Almax(string configfile)
  42. {
  43. //其余属性初始化
  44. ResDataObject temp;
  45. temp.loadFile(configfile.c_str());
  46. m_GenConfig = temp["CONFIGURATION"];
  47. m_pHardwareStatusThread = NULL;
  48. m_bExpEnable = false;
  49. m_iHeartBeats = 0;
  50. m_bConnectFlag = true;
  51. m_pDevicePath = "UniversalUnit";
  52. //日志方式
  53. string version;
  54. if (GetVersion(version, hMyModule))
  55. FINFO("\n===============log begin : version:{$} ===================\n", version.c_str());
  56. else
  57. FINFO("\n===============log begin : version:0.0.0.0 ===================\n");
  58. //设置发生器属性集合各个值的范围及精度
  59. //硬件参数
  60. m_TubeInfo.reset(new StringMould(CcosAttrKey::TUBEINFO, "unKnow"));
  61. m_TubeTargetMaterial.reset(new StringMould(CcosAttrKey::TUBETARGETMATERIAL, CcosAttrKey::TYPE::MO));
  62. m_TubeAngle.reset(new IntMould(CcosAttrKey::TUBEANGLE,0.0, -180.0, 180.0, 1.0));
  63. m_TubeHE.reset(new FloatMould(CcosAttrKey::TUBEHEAT, 0.0, 0.0, 100.0, 1.0));
  64. m_GenHE.reset(new FloatMould(CcosAttrKey::DENHEAT, 0.0, 0.0, 100.0, 1.0));
  65. m_BatteryChargeState.reset(new IntMould(CcosAttrKey::BATTERYCHARGESTATE, CcosAttrKey::CHARGE_STATUS_OFF, CcosAttrKey::CHARGE_STATUS_OFF, CcosAttrKey::CHARGE_STATUS_MAX, 1));
  66. m_BatteryPowerState.reset(new IntMould(CcosAttrKey::BATTERYPOWERSTATE, 100, 0, 100, 1));
  67. m_GenSynState.reset(new IntMould(CcosAttrKey::GENHANDSWITCH, CcosAttrKey::GENERATOR_RAD_OFF, CcosAttrKey::GENERATOR_SYNC_ERR, CcosAttrKey::GENERATOR_SYNC_MAX, 1));
  68. m_GenState.reset(new IntMould(CcosAttrKey::GENSTATE, CcosAttrKey::GENERATOR_STATUS_STANDBY, CcosAttrKey::GENERATOR_STATUS_SHUTDOWN, CcosAttrKey::GENERATOR_STATUS_MAX, 1.0));
  69. m_Handswitch.reset(new IntMould(CcosAttrKey::GENHANDSWITCH, CcosAttrKey::HANDSWITCH_STATUS_Release, CcosAttrKey::HANDSWITCH_STATUS_Release, CcosAttrKey::HANDSWITCH_STATUS_MAX, 1.0));
  70. m_Footswitch.reset(new IntMould(CcosAttrKey::GENFOOTSWITCH, CcosAttrKey::FOOTSWITCH_STATUS_Release, CcosAttrKey::FOOTSWITCH_STATUS_Release, CcosAttrKey::FOOTSWITCH_STATUS_MAX, 1.0));
  71. //点片参数
  72. m_RadKV.reset(new FloatMould(CcosAttrKey::RADKV, 40.0, 40.0, 150.0, 1.0)); //接口协议范围:20-49
  73. m_RadMA.reset(new FloatMould(CcosAttrKey::RADMA, 10.0, 10.0, 1000.0, 1.0));
  74. m_RadMS.reset(new FloatMould(CcosAttrKey::RADMS, 1.0, 1.0, 6300, 1.0));
  75. m_RadMAS.reset(new FloatMould(CcosAttrKey::RADMAS, 0.1, 0.1, 1000.0, 1.0));
  76. m_RadTechmode.reset(new IntMould(CcosAttrKey::RADTECHMODE, CcosAttrKey::TECHMODE_NOAEC_2P, CcosAttrKey::TECHMODE_NOAEC_3P, CcosAttrKey::TECHMODE_MAX, 1));
  77. m_RadFocus.reset(new IntMould(CcosAttrKey::RADFOCUS, CcosAttrKey::FOCUS_SMALL, CcosAttrKey::FOCUS_SMALL, CcosAttrKey::FOCUS_MAX, 1));
  78. m_RadAECField.reset(new IntMould(CcosAttrKey::RADAECFIELD, 0, 0, 111, 1));
  79. m_RadAECFilm.reset(new IntMould(CcosAttrKey::RADAECFILM, 0, 0, 2, 1));
  80. m_RadAECDensity.reset(new FloatMould(CcosAttrKey::RADAECDENSITY, 0, -4, 4, 1));
  81. m_RadFrameRate.reset(new IntMould(CcosAttrKey::FRAMERATE, 0, 0, 16, 1));
  82. m_PostKV.reset(new FloatMould(CcosAttrKey::POSTKV, 0.0, 0.0, 50.0, 1.0));
  83. m_PostMA.reset(new FloatMould(CcosAttrKey::POSTMA, 0.0, 0.0, 200.0, 0.1));
  84. m_PostMS.reset(new FloatMould(CcosAttrKey::POSTMS, 0.0, 0.0, 12000.0, 0.01));
  85. m_PostMAS.reset(new FloatMould(CcosAttrKey::POSTMAS, 0.0, 0.0, 600.0, 0.01));
  86. m_ExpMode.reset(new StringMould(CcosAttrKey::EXPMODE, CcosAttrKey::TYPE::Single));
  87. m_EXAMMode.reset(new StringMould(CcosAttrKey::EXAMMODE, CcosAttrKey::TYPE::MANUAL));
  88. //透视参数
  89. m_FluKV.reset(new FloatMould(CcosAttrKey::FLUKV, 40.0, 40.0, 125.0, 1.0));
  90. m_FluMA.reset(new FloatMould(CcosAttrKey::FLUMA, 0.5, 0.5, 20.0, 1.0));
  91. m_FluMS.reset(new FloatMould(CcosAttrKey::FLUMS, 1.0, 1.0, 1000.0, 1.0));
  92. m_FluMAS.reset(new FloatMould(CcosAttrKey::FLUMAS, 0.5, 0.5, 1000.0, 1.0));
  93. m_FluPPS.reset(new IntMould(CcosAttrKey::FLUPPS, 0, 0, 16, 1));
  94. m_FluABSStatus.reset(new IntMould(CcosAttrKey::FLUABSStatus, 0, 0, 4, 1));
  95. m_FluDoseLever.reset(new IntMould(CcosAttrKey::FLUDoseLevel, 0, 0, 10, 1));
  96. m_FluFMode.reset(new IntMould(CcosAttrKey::FLUMode, CcosAttrKey::GENERATOR_FLMODE_NOTFLU, CcosAttrKey::GENERATOR_FLMODE_NOTFLU, CcosAttrKey::GENERATOR_FLMODE_MAX, 1));
  97. m_FluIntTime.reset(new FloatMould(CcosAttrKey::FLUIntTime, 0.0, 0.0, 300000.0, 1.0));
  98. m_FluAccTime.reset(new FloatMould(CcosAttrKey::FLUAccTime, 0.0, 0.0, 300000.0, 1.0));
  99. //发生器告警及错误消息
  100. m_MSGUnit.reset(new nsDetail::MSGUnit(m_pDevicePath));
  101. //读取配置固定值
  102. GetUnitHWValueFromCFG();
  103. glo_nCMDType_WaitTime = glo_tDelivermodule.SetPriority(true, false, false, true, 100);
  104. glo_nCMDType_HB = glo_tDelivermodule.SetPriority(false, true, false, true, 50);
  105. glo_nCMDType_WaitACK = glo_tDelivermodule.SetPriority(true, false, 3, false, 0, true, 1000);
  106. FINFO("m_nCMDType_WaitTime[{$}]m_nCMDType_HB[{$}] m_nCMDType_WaitACK[{$}]", glo_nCMDType_WaitTime, glo_nCMDType_HB, glo_nCMDType_WaitACK);
  107. //配置响应操作对照表 供发生器回传的数据触发相应的操作
  108. OnCallBack();
  109. //重置发生器
  110. Reset();
  111. Sleep(500);
  112. //以下进行默认设置,需要注意默认值是否正确
  113. RefreshData(); //刷新初始数值
  114. //启动硬件状态轮询进程
  115. StartHardwareStatusThread();
  116. }
  117. nsGEN::CGEN_DEV_IDETEC_Almax::~CGEN_DEV_IDETEC_Almax()
  118. {
  119. FINFO("\n===============log GEN end ===================\n");
  120. if (m_pHardwareStatusThread != NULL)
  121. {
  122. TerminateThread(m_pHardwareStatusThread, 0);
  123. m_pHardwareStatusThread = NULL;
  124. }
  125. glo_arFrame.clear();
  126. }
  127. std::string nsGEN::CGEN_DEV_IDETEC_Almax::GetGUID()
  128. {
  129. FINFO("===============GetGUID : {$} ===================\n", GeneratorUnitType);
  130. return GeneratorUnitType;
  131. }
  132. std::string nsGEN::CGEN_DEV_IDETEC_Almax::GetResource()
  133. {
  134. return "";
  135. }
  136. void nsGEN::CGEN_DEV_IDETEC_Almax::GetUnitHWValueFromCFG()
  137. {
  138. //发生器模块消息上报方式
  139. if (m_GenConfig.GetKeyCount("NotifyType") > 0)
  140. {
  141. int tempValue = (int)m_GenConfig["NotifyType"];
  142. m_nNotifyType = (CcosAttrKey::UNIT_CTRL_TYPE)tempValue;
  143. switch (m_nNotifyType)
  144. {
  145. case CcosAttrKey::CTRL_PlatformInterface:
  146. {
  147. FDEBUG("NotifyType:PlatformInterface");
  148. }break;
  149. case CcosAttrKey::CTRL_Center:
  150. {
  151. FDEBUG("NotifyType:Center");
  152. m_EventCenter.reset(new IOEventCenter);
  153. }break;
  154. case CcosAttrKey::CTRL_CallBackFun:
  155. {
  156. FDEBUG("NotifyType:CallBackFun");
  157. }break;
  158. default:
  159. break;
  160. }
  161. }
  162. //同步模式
  163. m_arrWSMap.clear();
  164. if (m_GenConfig.GetKeyCount("WSTable") > 0)
  165. {
  166. int WSNamber = (int)m_GenConfig["WSTable"];
  167. EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNTable"]);
  168. m_arrWSMap[cfgWorkStationKey("Table", CcosAttrKey::TABLE)] = cfgWorkStationData("Table", WSNamber, WSSYN);
  169. FDEBUG("cfg Table WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
  170. }
  171. if (m_GenConfig.GetKeyCount("WSWall") > 0)
  172. {
  173. int WSNamber = (int)m_GenConfig["WSWall"];
  174. EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNWall"]);
  175. m_arrWSMap[cfgWorkStationKey("Wall", CcosAttrKey::WALL)] = cfgWorkStationData("Wall", WSNamber, WSSYN);
  176. FDEBUG("cfg Wall WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
  177. }
  178. if (m_GenConfig.GetKeyCount("WSFree") > 0)
  179. {
  180. int WSNamber = (int)m_GenConfig["WSFree"];
  181. EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNFree"]);
  182. m_arrWSMap[cfgWorkStationKey("Free", CcosAttrKey::MOBILE)] = cfgWorkStationData("Free", WSNamber, WSSYN);
  183. FDEBUG("cfg Free WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
  184. }
  185. if (m_GenConfig.GetKeyCount("WSTomo") > 0)
  186. {
  187. int WSNamber = (int)m_GenConfig["WSTomo"];
  188. EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNTomo"]);
  189. m_arrWSMap[cfgWorkStationKey("Tomo", CcosAttrKey::TOMO)] = cfgWorkStationData("Tomo", WSNamber, WSSYN);
  190. FDEBUG("cfg Tomo WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
  191. }
  192. if (m_GenConfig.GetKeyCount("WSConventional") > 0)
  193. {
  194. int WSNamber = (int)m_GenConfig["WSConventional"];
  195. EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNConventional"]);
  196. m_arrWSMap[cfgWorkStationKey("Direct", CcosAttrKey::CONVENTIONAL)] = cfgWorkStationData("Direct", WSNamber, WSSYN);
  197. FDEBUG("cfg Conventional WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
  198. }
  199. //球管信息
  200. if (m_GenConfig.GetKeyCount(CcosConfKey::CcosTubeInfo) > 0)
  201. {
  202. string tempValue = m_GenConfig[CcosConfKey::CcosTubeInfo];
  203. m_TubeInfo->Update(tempValue);
  204. FireNotify(m_TubeInfo->GetKey(), m_TubeInfo->JSGet());
  205. }
  206. if (m_GenConfig.GetKeyCount(CcosConfKey::CcosFocusSmall) > 0)
  207. {
  208. float tempValue = (float)m_GenConfig[CcosConfKey::CcosFocusSmall];
  209. m_FocusSmall = tempValue;
  210. }
  211. if (m_GenConfig.GetKeyCount(CcosConfKey::CcosFocusLarge) > 0)
  212. {
  213. float tempValue = (float)m_GenConfig[CcosConfKey::CcosFocusLarge];
  214. m_FocusLarge = tempValue;
  215. }
  216. }
  217. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetWS(const string value) //发生器无此设置
  218. {
  219. FDEBUG("Enter SetWS {$}", value.c_str());
  220. int tempws = 1;
  221. string strWS = "";
  222. cfgWorkStationKey trWS = cfgWorkStationKey(value.c_str());
  223. if (m_arrWSMap.find(trWS) != m_arrWSMap.end())
  224. {
  225. m_strCurrentWSName = trWS;
  226. tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
  227. strWS = m_arrWSMap[m_strCurrentWSName].strWSNAme;
  228. FDEBUG("Set WS number [{$}][{$}]", strWS.c_str(), tempws);
  229. }
  230. else
  231. {
  232. FDEBUG("Set WS number default 1");
  233. m_strCurrentWSName = cfgWorkStationKey(1);
  234. }
  235. char temp[50] = { 0 };
  236. sprintf_s(temp, "WS%1d", tempws);
  237. return HWSendWaittimeCMD(temp, strlen(temp));
  238. }
  239. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpSYN(EnSYNMode value)
  240. {
  241. FDEBUG("Enter SetExpSYN {$}", (int)value);
  242. int tempws = 0;
  243. switch (value)
  244. {
  245. case EnSYNMode::EXPOSURE_SYNMODE_HARDWARE_SYNBOX:
  246. case EnSYNMode::EXPOSURE_SYNMODE_DIRCETCONNECT_NOSYNBOX:
  247. tempws = 0;
  248. break;
  249. case EnSYNMode::EXPOSURE_SYNMODE_SOFTWARE_NOSYNBOX:
  250. tempws = 1;
  251. break;
  252. default:
  253. break;
  254. }
  255. char temp[50] = { 0 };
  256. sprintf_s(temp, "EXM%1d", tempws);
  257. return HWSendWaittimeCMD(temp, strlen(temp));
  258. }
  259. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpEnable() //发生器无此设置
  260. {
  261. return HWSendWaittimeCMD("EXB1", 4);
  262. }
  263. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpDisable() //发生器无此设置
  264. {
  265. return HWSendWaittimeCMD("EXB0", 4);
  266. }
  267. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::Reset()
  268. {
  269. FDEBUG("Enter Reset");
  270. //int level = 0;
  271. //m_MSGUnit->DelErrorMessage("0", level, "clear all errors");
  272. return HWSendWaittimeCMD("ERE", 1);//仅重置错误状态
  273. }
  274. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::RefreshData()
  275. {
  276. FDEBUG("Enter RefreshData");
  277. //HWSendWaittimeCMD("ERS", 3);
  278. //HWSendWaittimeCMD("RR", 2);
  279. //HWSendWaittimeCMD("RF", 2);
  280. return RET_STATUS::RET_SUCCEED;
  281. }
  282. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetGenSynState(int value) //发生器无此设置:AEC二阶段曝光使用
  283. {
  284. FDEBUG("Enter SetGenSynState[{$}]->[{$}]", m_GenSynState->Get(), value);
  285. switch (value)
  286. {
  287. case CcosAttrKey::GENERATOR_RAD_OFF:
  288. {}break;
  289. case CcosAttrKey::GENERATOR_RAD_PREPARE:
  290. {}break;
  291. case CcosAttrKey::GENERATOR_RAD_READY:
  292. {
  293. if (value == 3)
  294. {
  295. if (m_arrWSMap.find(m_strCurrentWSName) != m_arrWSMap.end())
  296. {
  297. if (m_arrWSMap[m_strCurrentWSName].nWSSYN == EXPOSURE_SYNMODE_SOFTWARE_NOSYNBOX)
  298. {
  299. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_XRAYON))
  300. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  301. FDEBUG("SetGenSynState: in softSYN,turn to RAD_XRAYON and send XR1");
  302. char temp[50] = { 0 };
  303. sprintf_s(temp, "EXP%01d", 1);
  304. return HWSendWaittimeCMD(temp, strlen(temp));
  305. }
  306. else
  307. {
  308. FDEBUG("SetGenSynState:WS[{$}:{$}] can't use SOFTWARE_NOSYNBOX", m_arrWSMap[m_strCurrentWSName].strWSNAme.c_str(), (int)m_arrWSMap[m_strCurrentWSName].nWSSYN);
  309. }
  310. }
  311. else
  312. {
  313. FDEBUG("SetGenSynState:WS[{$}] not config", m_strCurrentWSName.nWSID);
  314. }
  315. }
  316. else
  317. {
  318. FDEBUG("SetGenSynState: generator is not in ready status, can't send XR1 command");
  319. }
  320. }break;
  321. case CcosAttrKey::GENERATOR_RAD_XRAYON:
  322. {}break;
  323. case CcosAttrKey::GENERATOR_RAD_XRAYOFF:
  324. {}break;
  325. case CcosAttrKey::GENERATOR_FLU_OFF:
  326. {}break;
  327. case CcosAttrKey::GENERATOR_FLU_READY:
  328. {}break;
  329. case CcosAttrKey::GENERATOR_FLU_XRAYON:
  330. {}break;
  331. case CcosAttrKey::GENERATOR_FLU_XRAYOFF:
  332. {}break;
  333. default:
  334. break;
  335. }
  336. if (m_GenSynState->Update(value))
  337. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  338. return RET_STATUS::RET_SUCCEED;
  339. }
  340. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetGenState(int value) //发生器无此设置
  341. {
  342. FDEBUG("Enter SetGenSynState[{$}]->[{$}]", m_GenState->Get(), value);
  343. switch (value)
  344. {
  345. case CcosAttrKey::GENERATOR_STATUS_SHUTDOWN:
  346. {}break;
  347. case CcosAttrKey::GENERATOR_STATUS_INIT:
  348. {}break;
  349. case CcosAttrKey::GENERATOR_STATUS_SLEEP:
  350. {}break;
  351. case CcosAttrKey::GENERATOR_STATUS_CHARGING:
  352. {}break;
  353. case CcosAttrKey::GENERATOR_STATUS_STANDBY:
  354. {}break;
  355. case CcosAttrKey::GENERATOR_STATUS_EXP:
  356. {}break;
  357. case CcosAttrKey::GENERATOR_STATUS_ERROR:
  358. {}break;
  359. default:
  360. break;
  361. }
  362. if (m_GenState->Update(value))
  363. FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
  364. return RET_STATUS::RET_SUCCEED;
  365. }
  366. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::Clear_DAP()
  367. {
  368. //char temp[50] = { 0 };
  369. //sprintf_s(temp, "EDZ");
  370. return HWSendWaittimeCMD("EDZ", 3);
  371. }
  372. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetValue_DAP(float& value)
  373. {
  374. //char temp[50] = { 0 };
  375. //sprintf_s(temp, "EDA");
  376. return HWSendWaittimeCMD("EDA", 3);
  377. }
  378. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetDetectorWindow(bool value)
  379. {
  380. char temp[50] = { 0 };
  381. sprintf_s(temp, "TIC%1d", value);
  382. return HWSendWaittimeCMD(temp, strlen(temp));
  383. }
  384. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExposurePermit(bool value)
  385. {
  386. char temp[50] = { 0 };
  387. sprintf_s(temp, "EXO%1d", value);
  388. return HWSendWaittimeCMD(temp, strlen(temp));
  389. }
  390. void nsGEN::CGEN_DEV_IDETEC_Almax::SetNotifyCallBack(callBackFun fun)
  391. {
  392. m_funV2DynamicCallBackFun = fun;
  393. }
  394. //发生器支持的通用点片命令
  395. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadKV()
  396. {
  397. if (!m_RadKV->CanInc()) return RET_STATUS::RET_FAILED;
  398. //char temp[50] = { 0 };
  399. //sprintf_s(temp, "RKVI");
  400. return HWSendWaittimeCMD("RKVI", 4);
  401. }
  402. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadKV()
  403. {
  404. if (!m_RadKV->CanDec()) return RET_STATUS::RET_FAILED;
  405. //char temp[50] = { 0 };
  406. //sprintf_s(temp, "RKVD");
  407. return HWSendWaittimeCMD("RKVD", 4);
  408. }
  409. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadKV(float value)
  410. {
  411. if (!m_RadKV->Verify(value)) return RET_STATUS::RET_FAILED;
  412. char temp[50] = { 0 };
  413. sprintf_s(temp, "RKV%04d", (int)(value*10));
  414. return HWSendWaittimeCMD(temp, strlen(temp));
  415. }
  416. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadMA()
  417. {
  418. if (!m_RadMA->CanInc()) return RET_STATUS::RET_FAILED;
  419. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
  420. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
  421. {
  422. FINFO("Techmode is 2Point, Cannot inc MA \n");
  423. return RET_STATUS::RET_FAILED;
  424. }
  425. //char temp[50] = { 0 };
  426. //sprintf_s(temp, "RMAI");
  427. return HWSendWaittimeCMD("RMAI", 4);
  428. }
  429. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadMA()
  430. {
  431. if (!m_RadMA->CanDec()) return RET_STATUS::RET_FAILED;
  432. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
  433. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
  434. {
  435. FINFO("Techmode is 2Point, Cannot dec MA \n");
  436. return RET_STATUS::RET_FAILED;
  437. }
  438. //char temp[50] = { 0 };
  439. //sprintf_s(temp, "RMAD");
  440. return HWSendWaittimeCMD("RMAD", 4);
  441. }
  442. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadMA(float value)
  443. {
  444. if (!m_RadMA->Verify(value)) return RET_STATUS::RET_FAILED;
  445. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
  446. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
  447. {
  448. FINFO("Techmode is 2Point, Cannot set MA \n");
  449. return RET_STATUS::RET_FAILED;
  450. }
  451. char temp[50] = { 0 };
  452. sprintf_s(temp, "RMA%06d", (int)(value*100));
  453. return HWSendWaittimeCMD(temp, strlen(temp));
  454. }
  455. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadMS()
  456. {
  457. if (!m_RadMS->CanInc()) return RET_STATUS::RET_FAILED;
  458. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
  459. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
  460. {
  461. FINFO("Techmode is 2Point, Cannot inc MS \n");
  462. return RET_STATUS::RET_FAILED;
  463. }
  464. //char temp[50] = { 0 };
  465. //sprintf_s(temp, "RMSI");
  466. return HWSendWaittimeCMD("RMSI", 4);
  467. }
  468. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadMS()
  469. {
  470. if (!m_RadMS->CanDec()) return RET_STATUS::RET_FAILED;
  471. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
  472. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
  473. {
  474. FINFO("Techmode is 2Point, Cannot dec MS \n");
  475. return RET_STATUS::RET_FAILED;
  476. }
  477. //char temp[50] = { 0 };
  478. //sprintf_s(temp, "RMSD");
  479. return HWSendWaittimeCMD("RMSD", 4);
  480. }
  481. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadMS(float value)
  482. {
  483. if (!m_RadMS->Verify(value)) return RET_STATUS::RET_FAILED;
  484. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
  485. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
  486. {
  487. FINFO("Techmode is 2Point, Cannot set MS \n");
  488. return RET_STATUS::RET_FAILED;
  489. }
  490. char temp[50] = { 0 };
  491. sprintf_s(temp, "RMS%07d", (int)(value*100));
  492. return HWSendWaittimeCMD(temp, strlen(temp));
  493. }
  494. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadMAS()
  495. {
  496. if (!m_RadMAS->CanInc()) return RET_STATUS::RET_FAILED;
  497. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
  498. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_3P)
  499. {
  500. FINFO("Techmode is 3Point, Cannot inc MAS \n");
  501. return RET_STATUS::RET_FAILED;
  502. }
  503. //char temp[50] = { 0 };
  504. //sprintf_s(temp, "RMXI");
  505. return HWSendWaittimeCMD("RMXI", 4);
  506. }
  507. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadMAS()
  508. {
  509. if (!m_RadMAS->CanDec()) return RET_STATUS::RET_FAILED;
  510. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
  511. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_3P)
  512. {
  513. FINFO("Techmode is 3Point, Cannot dec MAS \n");
  514. return RET_STATUS::RET_FAILED;
  515. }
  516. //char temp[50] = { 0 };
  517. //sprintf_s(temp, "RMXD");
  518. return HWSendWaittimeCMD("RMXD", 4);
  519. }
  520. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadMAS(float value)
  521. {
  522. if (!m_RadMAS->Verify(value)) return RET_STATUS::RET_FAILED;
  523. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
  524. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_3P)
  525. {
  526. FINFO("Techmode is 3Point, Cannot set MAS \n");
  527. return RET_STATUS::RET_FAILED;
  528. }
  529. char temp[50] = { 0 };
  530. sprintf_s(temp, "RMX%07d", (int)(value * 1000));
  531. return HWSendWaittimeCMD(temp, strlen(temp));
  532. }
  533. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFocus(int value)
  534. {
  535. if (!m_RadFocus->Verify(value)) return RET_STATUS::RET_FAILED;
  536. char temp[50] = { 0 };
  537. sprintf_s(temp, "RFO%01d", (int)value);
  538. return HWSendWaittimeCMD(temp, strlen(temp));
  539. }
  540. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetTechmode(int value)
  541. {
  542. if (!m_RadTechmode->Verify(value)) return RET_STATUS::RET_FAILED;
  543. char temp[50] = { 0 };
  544. sprintf_s(temp, "RET%01d", (int)value);
  545. return HWSendWaittimeCMD(temp, strlen(temp));
  546. }
  547. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAECDensity(int value) //发生器无此设置
  548. {
  549. if (!m_RadAECDensity->Verify(value)) return RET_STATUS::RET_FAILED;
  550. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
  551. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P)
  552. {
  553. FINFO("Techmode is not AEC, Cannot set Density \n");
  554. return RET_STATUS::RET_FAILED;
  555. }
  556. char temp[50] = { 0 };
  557. sprintf_s(temp, "RFN%+1d", value);
  558. return HWSendWaittimeCMD(temp, strlen(temp));
  559. }
  560. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAECField(int value) //发生器无此设置
  561. {
  562. if (!m_RadAECField->Verify(value)) return RET_STATUS::RET_FAILED;
  563. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
  564. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P)
  565. {
  566. FINFO("Techmode is not AEC, Cannot set Field \n");
  567. return RET_STATUS::RET_FAILED;
  568. }
  569. char temp[50] = { 0 };
  570. sprintf_s(temp, "RFS%03d", value);
  571. return HWSendWaittimeCMD(temp, strlen(temp));
  572. }
  573. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAECFilm(int value) //发生器无此设置
  574. {
  575. if (!m_RadAECFilm->Verify(value)) return RET_STATUS::RET_FAILED;
  576. if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
  577. m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P)
  578. {
  579. FINFO("Techmode is not AEC, Cannot set Film \n");
  580. return RET_STATUS::RET_FAILED;
  581. }
  582. char temp[50] = { 0 };
  583. sprintf_s(temp, "RFS%1d", value);
  584. return HWSendWaittimeCMD(temp, strlen(temp));
  585. }
  586. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAPR(const _tAPRArgs& t)
  587. {
  588. FINFO("APR:WS={$},Focus={$},Techmode={$},KV={$},MA={$},MS={$},MAS={$},AECDensity={$},AECFilm={$},AECField={$}",
  589. t.nWS, t.nFocus, t.nTechmode, t.fKV, t.fMA, t.fMS, t.fMAS, t.nAECDensity, t.nAECFilm, t.nAECField);
  590. int tempws = 1;
  591. if (m_arrWSMap.find(cfgWorkStationKey(t.nWS)) != m_arrWSMap.end())
  592. {
  593. m_strCurrentWSName = cfgWorkStationKey(t.nWS);
  594. tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
  595. FDEBUG("Set WS number {$}", tempws);
  596. }
  597. else
  598. {
  599. FDEBUG("Set WS number default 1");
  600. m_strCurrentWSName = cfgWorkStationKey(t.nWS);
  601. tempws = t.nWS;
  602. }
  603. if (!m_RadKV->Verify(t.fKV))
  604. {
  605. FERROR("SetAPR:KV Out of bounds[{$}] \n", t.fKV);
  606. return RET_STATUS::RET_FAILED;
  607. }
  608. else if (!m_RadMA->Verify(t.fMA) && (t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_3P ||
  609. t.nTechmode == CcosAttrKey::TECHMODE_AEC_3P ||
  610. t.nTechmode == CcosAttrKey::TECHMODE_AEC_ReduceMA ||
  611. t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_MAS_MA ||
  612. t.nTechmode == CcosAttrKey::TECHMODE_AEC_MAS_MA))
  613. {
  614. FERROR("SetAPR:MA Out of bounds[{$}] \n", t.fMA);
  615. return RET_STATUS::RET_FAILED;
  616. }
  617. else if (!m_RadMS->Verify(t.fMS) && (t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_3P ||
  618. t.nTechmode == CcosAttrKey::TECHMODE_AEC_3P))
  619. {
  620. FERROR("SetAPR:MS Out of bounds[{$}] \n", t.fMS);
  621. return RET_STATUS::RET_FAILED;
  622. }
  623. else if (!m_RadMAS->Verify(t.fMAS) && (t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_2P ||
  624. t.nTechmode == CcosAttrKey::TECHMODE_AEC_2P ||
  625. t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_MAS_MA ||
  626. t.nTechmode == CcosAttrKey::TECHMODE_AEC_MAS_MA))
  627. {
  628. FERROR("SetAPR:MAS Out of bounds[{$}] \n", t.fMAS);
  629. return RET_STATUS::RET_FAILED;
  630. }
  631. else if (!m_RadFocus->Verify(t.nFocus))
  632. {
  633. FERROR("SetAPR:Focus Out of bounds[{$}] \n", t.nFocus);
  634. return RET_STATUS::RET_FAILED;
  635. }
  636. char temp[50] = { 0 };
  637. switch (t.nTechmode)
  638. {
  639. case CcosAttrKey::TECHMODE_NOAEC_3P:
  640. {
  641. sprintf_s(temp, "RSAWS%1dFO%1dET%1dFI%03dFS%1dFN%+1dKV%04dMA%06dMS%07d",
  642. tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV*10, t.fMA*100, t.fMS*100);
  643. HWSendWaittimeCMD(temp, strlen(temp));
  644. }break;
  645. case CcosAttrKey::TECHMODE_NOAEC_2P:
  646. {
  647. sprintf_s(temp, "RSXWS%1dFO%1dET%1dFI%03dFS%1dFN%+1dKV%04dMX%07d",
  648. tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV * 10, t.fMAS * 1000);
  649. HWSendWaittimeCMD(temp, strlen(temp));
  650. }break;
  651. case CcosAttrKey::TECHMODE_AEC_3P:
  652. {
  653. sprintf_s(temp, "RSAWS%1dFO%1dET%1dFI%03dFS%1dFN%02dKV%04dMA%06dMS%07d",
  654. tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV * 10, t.fMA * 100, t.fMS * 100);
  655. HWSendWaittimeCMD(temp, strlen(temp));
  656. }break;
  657. case CcosAttrKey::TECHMODE_AEC_2P:
  658. {
  659. sprintf_s(temp, "RSXWS%1dFO%1dET%1dFI%03dFS%1dFN%02dKV%04dMX%07d",
  660. tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV * 10, t.fMAS * 1000);
  661. HWSendWaittimeCMD(temp, strlen(temp));
  662. }break;
  663. case CcosAttrKey::TECHMODE_AEC_1P:
  664. {}break;
  665. case CcosAttrKey::TECHMODE_AEC_ReduceMA:
  666. {}break;
  667. case CcosAttrKey::TECHMODE_NOAEC_MAS_MA:
  668. {}break;
  669. case CcosAttrKey::TECHMODE_AEC_MAS_MA:
  670. {}break;
  671. default:
  672. {}break;
  673. }
  674. return RET_STATUS::RET_SUCCEED;
  675. }
  676. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostKV(float& value) //实际为主动上报
  677. {
  678. if (m_PostKV->Get() > 0)
  679. {
  680. value = m_PostKV->Get();
  681. }
  682. return RET_STATUS::RET_SUCCEED;
  683. }
  684. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostMA(float& value) //实际为主动上报
  685. {
  686. if (m_PostMA->Get() > 0)
  687. {
  688. value = m_PostMA->Get();
  689. }
  690. return RET_STATUS::RET_SUCCEED;
  691. }
  692. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostMS(float& value) //实际为主动上报
  693. {
  694. if (m_PostMS->Get() > 0)
  695. {
  696. value = m_PostMS->Get();
  697. }
  698. return RET_STATUS::RET_SUCCEED;
  699. }
  700. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostMAS(float& value) //实际为主动上报
  701. {
  702. if (m_PostMAS->Get() > 0)
  703. {
  704. value = m_PostMAS->Get();
  705. }
  706. return RET_STATUS::RET_SUCCEED;
  707. }
  708. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadFrameRate(FLOAT frameRate) //发生器无此动态设置
  709. {
  710. char temp[50] = { 0 };
  711. sprintf_s(temp, "RPS%03d", (int)(frameRate*10));
  712. return HWSendWaittimeCMD(temp, strlen(temp));
  713. }
  714. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpMode(std::string value) //发生器无此设置
  715. {
  716. FINFO("Enter SetExpMode:[{$}]", value.c_str());
  717. int data = atoi(value.c_str());
  718. char temp[50] = { 0 };
  719. sprintf_s(temp, "RMM%1d", data * 10);
  720. return HWSendWaittimeCMD(temp, strlen(temp));
  721. }
  722. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetEXAMMode(std::string value) //DMOC实际是通过此接口设置是否启用AEC
  723. {
  724. int data = atoi(value.c_str());
  725. char temp[50] = { 0 };
  726. sprintf_s(temp, "EXM%1d", data * 10);
  727. return HWSendWaittimeCMD(temp, strlen(temp));
  728. }
  729. //发生器支持的通用透视命令
  730. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluKV()
  731. {
  732. if (!m_FluKV->CanInc()) return RET_STATUS::RET_FAILED;
  733. //char temp[50] = { 0 };
  734. //sprintf_s(temp, "RKV%04d", value * 10);
  735. return HWSendWaittimeCMD("FLK+", 4);
  736. }
  737. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluKV()
  738. {
  739. if (!m_FluKV->CanDec()) return RET_STATUS::RET_FAILED;
  740. //char temp[50] = { 0 };
  741. //sprintf_s(temp, "RKV%04d", value * 10);
  742. return HWSendWaittimeCMD("FLK-", 4);
  743. }
  744. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluKV(float value)
  745. {
  746. if (!m_FluKV->Verify(value)) return RET_STATUS::RET_FAILED;
  747. char temp[50] = { 0 };
  748. sprintf_s(temp, "FLK%03d", (int)value);
  749. return HWSendWaittimeCMD(temp, strlen(temp));
  750. }
  751. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluMA()
  752. {
  753. if (!m_FluMA->CanInc()) return RET_STATUS::RET_FAILED;
  754. //char temp[50] = { 0 };
  755. //sprintf_s(temp, "RKV%04d", value * 10);
  756. return HWSendWaittimeCMD("FLM+", 4);
  757. }
  758. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluMA()
  759. {
  760. if (!m_FluMA->CanDec()) return RET_STATUS::RET_FAILED;
  761. //char temp[50] = { 0 };
  762. //sprintf_s(temp, "RKV%04d", value * 10);
  763. return HWSendWaittimeCMD("FLM-", 4);
  764. }
  765. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMA(float value)
  766. {
  767. if (!m_FluMA->Verify(value)) return RET_STATUS::RET_FAILED;
  768. char temp[50] = { 0 };
  769. sprintf_s(temp, "FLM%03d", (int)(value * 10));
  770. return HWSendWaittimeCMD(temp, strlen(temp));
  771. }
  772. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluMS()
  773. {
  774. if (!m_FluMS->CanInc()) return RET_STATUS::RET_FAILED;
  775. int value = m_FluMS->Get();
  776. if(m_FluMS->Update(++value))
  777. FireNotify(m_FluMS->GetKey(), m_FluMS->JSGet());
  778. return RET_STATUS::RET_SUCCEED;
  779. }
  780. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluMS()
  781. {
  782. if (!m_FluMS->CanDec()) return RET_STATUS::RET_FAILED;
  783. int value = m_FluMS->Get();
  784. if (m_FluMS->Update(--value))
  785. FireNotify(m_FluMS->GetKey(), m_FluMS->JSGet());
  786. return RET_STATUS::RET_SUCCEED;
  787. }
  788. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMS(float value)
  789. {
  790. if (!m_FluMS->Verify(value)) return RET_STATUS::RET_FAILED;
  791. if (m_FluMS->Update(value))
  792. FireNotify(m_FluMS->GetKey(), m_FluMS->JSGet());
  793. return RET_STATUS::RET_SUCCEED;
  794. }
  795. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluMAS()
  796. {
  797. if (!m_FluMAS->CanInc()) return RET_STATUS::RET_FAILED;
  798. int value = m_FluMAS->Get();
  799. if (m_FluMAS->Update(++value))
  800. FireNotify(m_FluMAS->GetKey(), m_FluMAS->JSGet());
  801. return RET_STATUS::RET_SUCCEED;
  802. }
  803. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluMAS()
  804. {
  805. if (!m_FluMAS->CanDec()) return RET_STATUS::RET_FAILED;
  806. int value = m_FluMAS->Get();
  807. if (m_FluMAS->Update(--value))
  808. FireNotify(m_FluMAS->GetKey(), m_FluMAS->JSGet());
  809. return RET_STATUS::RET_SUCCEED;
  810. }
  811. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMAS(float value)
  812. {
  813. if (!m_FluMAS->Verify(value)) return RET_STATUS::RET_FAILED;
  814. if (m_FluMAS->Update(value))
  815. FireNotify(m_FluMAS->GetKey(), m_FluMAS->JSGet());
  816. return RET_STATUS::RET_SUCCEED;
  817. }
  818. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetPPS(float frameRate)
  819. {
  820. if (!m_FluPPS->CanDec()) return RET_STATUS::RET_FAILED;
  821. char temp[50] = { 0 };
  822. sprintf_s(temp, "FLS%03d", (int)(frameRate * 10));
  823. return HWSendWaittimeCMD(temp, strlen(temp));
  824. }
  825. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetPPS()
  826. {
  827. return HWSendWaittimeCMD("FLS?", 4);
  828. }
  829. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::INCPPS()
  830. {
  831. if (!m_FluPPS->CanInc()) return RET_STATUS::RET_FAILED;
  832. return HWSendWaittimeCMD("FLS+", 4);
  833. }
  834. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DECPPS()
  835. {
  836. if (!m_FluPPS->CanDec()) return RET_STATUS::RET_FAILED;
  837. return HWSendWaittimeCMD("FLS-", 4);
  838. }
  839. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetPluseWidth(float fplusewidth)
  840. {
  841. if (!m_FluMS->Verify(fplusewidth)) return RET_STATUS::RET_FAILED;
  842. char temp[50] = { 0 };
  843. sprintf_s(temp, "FPW%04d", (int)fplusewidth);
  844. return HWSendWaittimeCMD(temp, strlen(temp));
  845. }
  846. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSMode(int nMode)
  847. {
  848. if (!m_FluABSStatus->Verify(nMode)) return RET_STATUS::RET_FAILED;
  849. char temp[50] = { 0 };
  850. sprintf_s(temp, "FLA%1d", nMode);
  851. return HWSendWaittimeCMD(temp, strlen(temp));
  852. }
  853. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSCurve()
  854. {
  855. char temp[50] = { 0 };
  856. sprintf_s(temp, "FLO%1d", 0);
  857. return HWSendWaittimeCMD(temp, strlen(temp));
  858. }
  859. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncABSCurve()
  860. {
  861. return HWSendWaittimeCMD("FLO+", 4);
  862. }
  863. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecABSCurve()
  864. {
  865. return HWSendWaittimeCMD("FLO-", 4);
  866. }
  867. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSValue(float fABSValue)
  868. {
  869. char temp[50] = { 0 };
  870. sprintf_s(temp, "ABS%05d", (int)fABSValue);
  871. return HWSendWaittimeCMD(temp, strlen(temp));
  872. }
  873. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSTargetEXI(float fEXIValue)
  874. {
  875. char temp[50] = { 0 };
  876. sprintf_s(temp, "FAT%05d", (int)fEXIValue);
  877. return HWSendWaittimeCMD(temp, strlen(temp));
  878. }
  879. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAPF(const _tAPFArgs& t)
  880. {
  881. FINFO("APF:WS={$},FluMode={$},ABSMode={$},DoseLever={$},KV={$},MA={$},PPS={$}",
  882. t.nWS, t.nFluMode, t.nABSMode, t.nDoseLever, t.nFLKV, t.fFLMA, t.nPPS);
  883. int tempws = 1;
  884. if (m_arrWSMap.find(cfgWorkStationKey(t.nWS)) != m_arrWSMap.end())
  885. {
  886. m_strCurrentWSName = cfgWorkStationKey(t.nWS);
  887. tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
  888. FDEBUG("Set WS number {$}", tempws);
  889. }
  890. else
  891. {
  892. FDEBUG("Set WS number default 1");
  893. m_strCurrentWSName = cfgWorkStationKey(t.nWS);
  894. tempws = t.nWS;
  895. }
  896. if (!m_RadKV->Verify(t.nFLKV))
  897. {
  898. FERROR("SetAPR:KV Out of bounds[{$}] \n", t.nFLKV);
  899. return RET_STATUS::RET_FAILED;
  900. }
  901. else if (!m_RadMA->Verify(t.fFLMA))
  902. {
  903. FERROR("SetAPR:MA Out of bounds[{$}] \n", t.fFLMA);
  904. return RET_STATUS::RET_FAILED;
  905. }
  906. else if (!m_FluPPS->Verify(t.nPPS) && (t.nFluMode == CcosAttrKey::GENERATOR_FLMODE_PF ||
  907. t.nFluMode == CcosAttrKey::GENERATOR_FLMODE_HPF))
  908. {
  909. FERROR("SetAPR:PPS Out of bounds[{$}] \n", t.nPPS);
  910. return RET_STATUS::RET_FAILED;
  911. }
  912. else if (!m_FluDoseLever->Verify(t.nDoseLever))
  913. {
  914. FERROR("SetAPR:DoseLever Out of bounds[{$}] \n", t.nDoseLever);
  915. return RET_STATUS::RET_FAILED;
  916. }
  917. char temp[50] = { 0 };
  918. switch (t.nFluMode)
  919. {
  920. case CcosAttrKey::GENERATOR_FLMODE_NOTFLU:
  921. {
  922. sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
  923. tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
  924. HWSendWaittimeCMD(temp, strlen(temp));
  925. }break;
  926. case CcosAttrKey::GENERATOR_FLMODE_CF:
  927. {
  928. sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
  929. tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
  930. HWSendWaittimeCMD(temp, strlen(temp));
  931. }break;
  932. case CcosAttrKey::GENERATOR_FLMODE_PF:
  933. {
  934. sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
  935. tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
  936. HWSendWaittimeCMD(temp, strlen(temp));
  937. sprintf_s(temp, "FLS%03d", t.nPPS * 10);
  938. HWSendWaittimeCMD(temp, strlen(temp));
  939. }break;
  940. case CcosAttrKey::GENERATOR_FLMODE_HCF:
  941. {
  942. sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
  943. tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
  944. HWSendWaittimeCMD(temp, strlen(temp));
  945. }break;
  946. case CcosAttrKey::GENERATOR_FLMODE_HPF:
  947. {
  948. sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
  949. tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
  950. HWSendWaittimeCMD(temp, strlen(temp));
  951. sprintf_s(temp, "FLS%03d", t.nPPS * 10);
  952. HWSendWaittimeCMD(temp, strlen(temp));
  953. }break;
  954. default:
  955. {}break;
  956. }
  957. return RET_STATUS::RET_SUCCEED;
  958. }
  959. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetFluIntTimer()
  960. {
  961. return HWSendWaittimeCMD("FLI?", 4);
  962. }
  963. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetFluAccTimer()
  964. {
  965. return HWSendWaittimeCMD("FLT?", 4);
  966. }
  967. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::ResetFluTimer(int ntype)
  968. {
  969. char temp[50] = { 0 };
  970. sprintf_s(temp, "FLR%1d", ntype);
  971. return HWSendWaittimeCMD(temp, strlen(temp));
  972. }
  973. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluPre(int bPrepare)
  974. {
  975. char temp[50] = { 0 };
  976. sprintf_s(temp, "FLP%1d", bPrepare);
  977. return HWSendWaittimeCMD(temp, strlen(temp));
  978. }
  979. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluEXP(int bPrepare)
  980. {
  981. char temp[50] = { 0 };
  982. sprintf_s(temp, "FLX%1d", bPrepare);
  983. return HWSendWaittimeCMD(temp, strlen(temp));
  984. }
  985. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMode(std::string value)
  986. {
  987. int mode = atoi(value.c_str());
  988. char temp[50] = { 0 };
  989. sprintf_s(temp, "FLF%1d", mode);
  990. return HWSendWaittimeCMD(temp, strlen(temp));
  991. }
  992. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMAG(int nsize)
  993. {
  994. char temp[50] = { 0 };
  995. sprintf_s(temp, "FLZ%1d", nsize);
  996. return HWSendWaittimeCMD(temp, strlen(temp));
  997. }
  998. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DisableMAG()
  999. {
  1000. return HWSendWaittimeCMD("FLZ0", 4);
  1001. }
  1002. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluDoseLever(int nlever)
  1003. {
  1004. if (!m_FluDoseLever->Verify(nlever)) return RET_STATUS::RET_FAILED;
  1005. char temp[50] = { 0 };
  1006. sprintf_s(temp, "FLD%1d", nlever);
  1007. return HWSendWaittimeCMD(temp, strlen(temp));
  1008. }
  1009. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetHalfDose(int nlever)
  1010. {
  1011. char temp[50] = { 0 };
  1012. sprintf_s(temp, "FHD%1d", nlever);
  1013. return HWSendWaittimeCMD(temp, strlen(temp));
  1014. }
  1015. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::TransferRadCurve(int ncurve)
  1016. {
  1017. char temp[50] = { 0 };
  1018. sprintf_s(temp, "FLC%1d", ncurve);
  1019. return HWSendWaittimeCMD(temp, strlen(temp));
  1020. }
  1021. //Almax特有指令
  1022. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetPanelField(int value)
  1023. {
  1024. FDEBUG("Enter SetPanelField:[{$}]", value);
  1025. char temp[50] = { 0 };
  1026. sprintf_s(temp, "PZM%02d", value);
  1027. return HWSendWaittimeCMD(temp, strlen(temp));
  1028. }
  1029. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetShutDown(int value)
  1030. {
  1031. FDEBUG("Enter SetShutDown:[{$}]", value);
  1032. char temp[50] = { 0 };
  1033. sprintf_s(temp, "SSD%1d", value);
  1034. return HWSendWaittimeCMD(temp, strlen(temp));
  1035. }
  1036. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExamView(int value)
  1037. {
  1038. FDEBUG("Enter SetExamView:[{$}]", value);
  1039. char temp[50] = { 0 };
  1040. sprintf_s(temp, "VNE%03d", value);
  1041. return HWSendWaittimeCMD(temp, strlen(temp));
  1042. }
  1043. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetDSA(int value)
  1044. {
  1045. FDEBUG("Enter SetDSA:[{$}]", value);
  1046. char temp[50] = { 0 };
  1047. sprintf_s(temp, "DSA%01d", value);
  1048. return HWSendWaittimeCMD(temp, strlen(temp));
  1049. }
  1050. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRoadMap(int value)
  1051. {
  1052. FDEBUG("Enter SetRoadMap:[{$}]", value);
  1053. char temp[50] = { 0 };
  1054. sprintf_s(temp, "IRM%01d", value);
  1055. return HWSendWaittimeCMD(temp, strlen(temp));
  1056. }
  1057. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::EnterExam(int value)
  1058. {
  1059. FDEBUG("Enter EnterExam:[{$}]", value);
  1060. char temp[50] = { 0 };
  1061. sprintf_s(temp, "EXB%01d", value);
  1062. return HWSendWaittimeCMD(temp, strlen(temp));
  1063. }
  1064. //-----------------------------------------------------------------------------
  1065. // ProcessCmd
  1066. //-----------------------------------------------------------------------------
  1067. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSendWaittimeCMD(char* strCommand, int lengh, int headLengh)
  1068. {
  1069. return glo_tDelivermodule.ProcessCommand(strCommand, lengh, glo_nCMDType_WaitTime, headLengh);
  1070. }
  1071. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSendHBCMD(char* strCommand, int lengh, int headLengh)
  1072. {
  1073. return glo_tDelivermodule.ProcessCommand(strCommand, lengh, glo_nCMDType_HB, headLengh);
  1074. }
  1075. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSendWaitACKCMD(char* strCommand, int lengh, int headLengh)
  1076. {
  1077. return glo_tDelivermodule.ProcessCommand(strCommand, lengh, glo_nCMDType_WaitACK, headLengh);
  1078. }
  1079. RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSend(const char* strCommand, int lengh, bool reSend, int nTimeOut)
  1080. {
  1081. if (!m_bConnectFlag)
  1082. {
  1083. FERROR("==OUT==: not Connect,[{$}] send failed \n", strCommand);
  1084. return RET_STATUS::RET_FAILED;
  1085. }
  1086. char strSendCommand[Almax_Com_ReSendLen] = { 0 };
  1087. int len = strlen(strCommand);
  1088. if (len <= 0)
  1089. {
  1090. FERROR("HWSend: cmd is null\n");
  1091. return RET_STATUS::RET_FAILED;
  1092. }
  1093. else if (lengh <= 0)
  1094. {
  1095. FERROR("HWSend: Expected length too small but cmd[{$}] is not null\n", strCommand);
  1096. return RET_STATUS::RET_FAILED;
  1097. }
  1098. else if (len > lengh)
  1099. {
  1100. FERROR("HWSend: Actual length[{$}] > Expected length[{$}] \n", len, lengh);
  1101. return RET_STATUS::RET_FAILED;
  1102. }
  1103. len = lengh;
  1104. ::memcpy(strSendCommand, strCommand, len);
  1105. if (ComputeCheckSum(strSendCommand, len) == 0x00)
  1106. {
  1107. FWARN("HWSend: cmd[{$}] Check Summing failed \n", strCommand);
  1108. }
  1109. //strSendCommand[0] = Almax_STX;
  1110. //strSendCommand[len - 1] = Almax_ETX;
  1111. if (true)
  1112. {
  1113. //char strCommandHead[3] = { 0 };
  1114. //::memcpy(strCommandHead, strCommand, 2);
  1115. //auto find_item = glo_arFrame.find(strCommandHead);
  1116. auto find_item = glo_arFrame.find(strSendCommand);
  1117. if ((find_item != glo_arFrame.end()) && reSend)
  1118. {
  1119. FINFO("==OUT==: [{$}] wait for ACK \n", strSendCommand);
  1120. }
  1121. else
  1122. {
  1123. FINFO("==OUT==: [{$}] \n", strSendCommand);
  1124. }
  1125. }
  1126. int retLength;
  1127. glo_obCommObj.m_SCF.Lock(msTimeOut_Lock)
  1128. .SendPacket(strSendCommand, len, nTimeOut, retLength);
  1129. return RET_STATUS::RET_SUCCEED;
  1130. }
  1131. void nsGEN::CGEN_DEV_IDETEC_Almax::FireNotify(string key, const int context)
  1132. {
  1133. std::string str = std::format("{:d}", context);
  1134. switch (m_nNotifyType)
  1135. {
  1136. case CcosAttrKey::CTRL_PlatformInterface:
  1137. {
  1138. PlatformInterface::CCOSNotifyCallBackEntry(PACKET_CMD::PACKET_CMD_UPDATE, key, str, m_pDevicePath);
  1139. }break;
  1140. case CcosAttrKey::CTRL_Center:
  1141. {
  1142. if (m_EventCenter != nullptr)
  1143. {
  1144. m_EventCenter->OnNotify(1, key, str);
  1145. }
  1146. else
  1147. {
  1148. FERROR("m_EventCenter:[{$}:{$}] is null", key.c_str(), str.c_str());
  1149. }
  1150. }break;
  1151. case CcosAttrKey::CTRL_CallBackFun:
  1152. {
  1153. if (m_funV2DynamicCallBackFun != NULL)
  1154. {
  1155. m_funV2DynamicCallBackFun(key, str);
  1156. }
  1157. else
  1158. {
  1159. FERROR("V2DynamicCallBackFun:[{$}:{$}] is null", key.c_str(), str.c_str());
  1160. }
  1161. }break;
  1162. default:
  1163. FERROR("FireNotify:unknow[{$}]m_nNotifyType", (int)m_nNotifyType);
  1164. break;
  1165. }
  1166. }
  1167. void nsGEN::CGEN_DEV_IDETEC_Almax::FireNotify(string key, const float context)
  1168. {
  1169. std::string str = std::format("{:.2f}", context);
  1170. switch (m_nNotifyType)
  1171. {
  1172. case CcosAttrKey::CTRL_PlatformInterface:
  1173. {
  1174. PlatformInterface::CCOSNotifyCallBackEntry(PACKET_CMD::PACKET_CMD_UPDATE, key, str, m_pDevicePath);
  1175. }break;
  1176. case CcosAttrKey::CTRL_Center:
  1177. {
  1178. if (m_EventCenter != nullptr)
  1179. {
  1180. m_EventCenter->OnNotify(1, key, str);
  1181. }
  1182. else
  1183. {
  1184. FERROR("m_EventCenter:[{$}:{$}] is null", key.c_str(), str.c_str());
  1185. }
  1186. }break;
  1187. case CcosAttrKey::CTRL_CallBackFun:
  1188. {
  1189. if (m_funV2DynamicCallBackFun != NULL)
  1190. {
  1191. m_funV2DynamicCallBackFun(key, str);
  1192. }
  1193. else
  1194. {
  1195. FERROR("V2DynamicCallBackFun:[{$}:{$}] is null", key.c_str(), str.c_str());
  1196. }
  1197. }break;
  1198. default:
  1199. FERROR("FireNotify:unknow[{$}]m_nNotifyType", (int)m_nNotifyType);
  1200. break;
  1201. }
  1202. }
  1203. void nsGEN::CGEN_DEV_IDETEC_Almax::FireNotify(string key, const string context)
  1204. {
  1205. switch (m_nNotifyType)
  1206. {
  1207. case CcosAttrKey::CTRL_PlatformInterface:
  1208. {
  1209. PlatformInterface::CCOSNotifyCallBackEntry(PACKET_CMD::PACKET_CMD_UPDATE, key, context, m_pDevicePath);
  1210. }break;
  1211. case CcosAttrKey::CTRL_Center:
  1212. {
  1213. if (m_EventCenter != nullptr)
  1214. {
  1215. m_EventCenter->OnNotify(1, key, context);
  1216. }
  1217. else
  1218. {
  1219. FERROR("m_EventCenter:[{$}:{$}] is null", key.c_str(), context.c_str());
  1220. }
  1221. }break;
  1222. case CcosAttrKey::CTRL_CallBackFun:
  1223. {
  1224. if (m_funV2DynamicCallBackFun != NULL)
  1225. {
  1226. m_funV2DynamicCallBackFun(key, context);
  1227. }
  1228. else
  1229. {
  1230. FERROR("V2DynamicCallBackFun:[{$}:{$}] is null", key.c_str(), context.c_str());
  1231. }
  1232. }break;
  1233. default:
  1234. FERROR("FireNotify:unknow[{$}]m_nNotifyType", (int)m_nNotifyType);
  1235. break;
  1236. }
  1237. }
  1238. void nsGEN::CGEN_DEV_IDETEC_Almax::FireErrorMessage(const bool Act, const int Code, const char* ResInfo)
  1239. {
  1240. string ErrorCode("Almax_ERR_");
  1241. ErrorCode += std::to_string(Code);
  1242. int level = CcosAttrKey::UNIT_REGULATION_LEVEL::REG_ERRO;
  1243. if (Act)
  1244. {
  1245. FERROR("add {$}:{$}", ErrorCode.c_str(), ResInfo);
  1246. m_MSGUnit->AddErrorMessage(ErrorCode.c_str(), level, ResInfo);
  1247. }
  1248. else
  1249. {
  1250. FERROR("del {$}:{$}", ErrorCode.c_str(), ResInfo);
  1251. m_MSGUnit->DelErrorMessage(ErrorCode.c_str(), level, ResInfo);
  1252. }
  1253. }
  1254. void nsGEN::CGEN_DEV_IDETEC_Almax::FireWarnMessage(const bool Act, const int Code, const char* ResInfo)
  1255. {
  1256. string ErrorCode("Almax_WAR_");
  1257. ErrorCode += std::to_string(Code);
  1258. int level = CcosAttrKey::UNIT_REGULATION_LEVEL::REG_WARN;
  1259. if (Act)
  1260. {
  1261. FERROR("add {$}:{$}", ErrorCode.c_str(), ResInfo);
  1262. m_MSGUnit->AddWarnMessage(ErrorCode.c_str(), level, ResInfo);
  1263. }
  1264. else
  1265. {
  1266. FERROR("del {$}:{$}", ErrorCode.c_str(), ResInfo);
  1267. m_MSGUnit->DelWarnMessage(ErrorCode.c_str(), level, ResInfo);
  1268. }
  1269. }
  1270. void nsGEN::CGEN_DEV_IDETEC_Almax::OnCallBack()
  1271. {
  1272. //无 操作
  1273. auto HWNotProcess = [](const char* value, int length) -> void
  1274. {
  1275. FINFO("This commands[{$}] didn't need to process", value);
  1276. };
  1277. //校验和错误
  1278. auto HWERROR_1 = [this](char* value, int length) -> void
  1279. {
  1280. char* nextTokenPtr = NULL;
  1281. char* tokenPtr = strtok_s(value, ",", &nextTokenPtr);
  1282. if (tokenPtr != NULL)
  1283. {
  1284. FERROR("== HWERROR_1 == : error CheckSum:[{$}]", tokenPtr);
  1285. }
  1286. else
  1287. {
  1288. FERROR("== HWERROR_1 == : error CheckSum:no csum");
  1289. }
  1290. };
  1291. //3.1 RADIOGRAPHIC COMMANDS
  1292. auto HWRKV = [this](char* value, int length) -> void //3.1.1 Sets the KV value (KV value * 10)
  1293. {
  1294. assert(value);
  1295. float tempValue = atof(value) / 10.0;
  1296. FDEBUG("Recv Rad KV[{$}]", tempValue);
  1297. if (m_RadKV->Update(tempValue))
  1298. {
  1299. FireNotify(m_RadKV->GetKey(), tempValue);
  1300. }
  1301. };
  1302. auto HWRMA = [this](char* value, int length) -> void //3.1.2 Sets the MA value (MA * 100)
  1303. {
  1304. assert(value);
  1305. float tempValue = atof(value) / 100.0;
  1306. FDEBUG("Recv Rad MA[{$}]", tempValue);
  1307. if (m_RadMA->Update(tempValue))
  1308. {
  1309. FireNotify(m_RadMA->GetKey(), tempValue);
  1310. }
  1311. };
  1312. auto HWRMS = [this](char* value, int length) -> void //3.1.3 Sets the Exposure Time in milliseconds (MS * 100)
  1313. {
  1314. assert(value);
  1315. float tempValue = atof(value) / 100.0;
  1316. FDEBUG("Recv Rad MS[{$}]", tempValue);
  1317. if (m_RadMS->Update(tempValue))
  1318. {
  1319. FireNotify(m_RadMS->GetKey(), tempValue);
  1320. }
  1321. };
  1322. auto HWRMX = [this](char* value, int length) -> void //3.1.4 Sets the MAS 1/1000 (milliamp * seconds)
  1323. {
  1324. assert(value);
  1325. float tempValue = atof(value) / 1000.0;
  1326. FDEBUG("Recv Rad MAS[{$}]", tempValue);
  1327. if (m_RadMAS->Update(tempValue))
  1328. {
  1329. FireNotify(m_RadMAS->GetKey(), tempValue);
  1330. }
  1331. };
  1332. auto HWRR = [this](char* value, int length) -> void //3.1.5 Refresh Rad Console Data
  1333. {
  1334. //do noting
  1335. };
  1336. auto HWRET = [this](char* value, int length) -> void //3.1.6 Exposure Technique Selection
  1337. {
  1338. assert(value);
  1339. FDEBUG("Recv Rad Technique[{$}]", value);
  1340. if (m_RadTechmode->Update(atoi(value)))
  1341. {
  1342. FireNotify(m_RadTechmode->GetKey(), value);
  1343. }
  1344. };
  1345. auto HWRFO = [this](char* value, int length) -> void //3.1.7 Focus Selection
  1346. {
  1347. assert(value);
  1348. FDEBUG("Recv Rad Focus[{$}]", value);
  1349. if (m_RadFocus->Update(atoi(value)))
  1350. {
  1351. FireNotify(m_RadFocus->GetKey(), value);
  1352. }
  1353. };
  1354. auto HWRFN = [this](char* value, int length) -> void //3.1.8 AEC Density
  1355. {
  1356. assert(value);
  1357. FDEBUG("Recv Rad AEC Field[{$}]", value);
  1358. if (m_RadAECDensity->Update(atoi(value)))
  1359. {
  1360. FireNotify(m_RadAECDensity->GetKey(), value);
  1361. }
  1362. };
  1363. auto HWRFI = [this](char* value, int length) -> void //3.1.9 AEC Field Selection
  1364. {
  1365. assert(value);
  1366. FDEBUG("Recv Rad Focus[{$}]", value);
  1367. if (m_RadAECField->Update(atoi(value)))
  1368. {
  1369. FireNotify(m_RadAECField->GetKey(), value);
  1370. }
  1371. };
  1372. auto HWRFS = [this](char* value, int length) -> void //3.1.10 AEC Film Screen Selection
  1373. {
  1374. assert(value);
  1375. FDEBUG("Recv Rad Film[{$}]", value);
  1376. if (m_RadAECFilm->Update(atoi(value)))
  1377. {
  1378. FireNotify(m_RadAECFilm->GetKey(), value);
  1379. }
  1380. };
  1381. auto HWRAP = [this](char* value, int length) -> void //3.1.11 Post MAS
  1382. {
  1383. assert(value);
  1384. float tempValue = atof(value) / 1000.0;
  1385. FDEBUG("Recv Rad Post MAS[{$}]", tempValue);
  1386. if (m_PostMAS->Update(tempValue))
  1387. {
  1388. FireNotify(m_PostMAS->GetKey(), tempValue);
  1389. }
  1390. };
  1391. auto HWRAT = [this](char* value, int length) -> void //3.1.12 Post TIME(MS * 100)
  1392. {
  1393. assert(value);
  1394. float tempValue = atof(value) / 100.0;
  1395. FDEBUG("Recv Rad Post MS[{$}]", tempValue);
  1396. if (m_PostMS->Update(tempValue))
  1397. {
  1398. FireNotify(m_PostMS->GetKey(), tempValue);
  1399. }
  1400. };
  1401. auto HWRAL = [this](char* value, int length) -> void //3.1.13 AEC Lock
  1402. {
  1403. assert(value);
  1404. FDEBUG("Recv Rad AEC Lock[{$}]", value);
  1405. };
  1406. auto HWPR = [this](char* value, int length) -> void //3.1.14 RAD Preparation
  1407. {
  1408. assert(value);
  1409. int tempValue = atoi(value);
  1410. FDEBUG("Recv Rad PR[{$}]", tempValue);
  1411. switch (tempValue)
  1412. {
  1413. case 0: //RAD Preparation inactive
  1414. {
  1415. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_OFF))
  1416. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1417. }break;
  1418. case 1: //RAD Preparation active
  1419. {
  1420. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_PREPARE))
  1421. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1422. }break;
  1423. case 2: //RAD Generator Ready
  1424. {
  1425. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_READY))
  1426. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1427. }break;
  1428. default:
  1429. {}break;
  1430. }
  1431. };
  1432. auto HWXR = [this](char* value, int length) -> void //3.1.15 RAD X-ray Exposure
  1433. {
  1434. assert(value);
  1435. int tempValue = atoi(value);
  1436. FDEBUG("Recv Rad XR[{$}]", tempValue);
  1437. switch (tempValue)
  1438. {
  1439. case 0: //RAD Exposure inactive
  1440. {
  1441. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_XRAYOFF))
  1442. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1443. }break;
  1444. case 1: //RAD Exposure active
  1445. {
  1446. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_XRAYON))
  1447. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1448. }break;
  1449. default:
  1450. {}break;
  1451. }
  1452. };
  1453. auto HWPS = [this](char* value, int length) -> void //3.1.16 First handswitch
  1454. {
  1455. assert(value);
  1456. int tempValue = atoi(value);
  1457. FDEBUG("Recv Rad First handswitch[{$}]", tempValue);
  1458. switch (tempValue)
  1459. {
  1460. case 0: //Release First HandSwitch
  1461. {
  1462. if (m_Handswitch->Update(CcosAttrKey::HANDSWITCH_STATUS_Release))
  1463. FireNotify(m_Handswitch->GetKey(), m_Handswitch->JSGet());
  1464. }break;
  1465. case 1: //Hold First handswitch
  1466. {
  1467. if (m_GenSynState->Update(CcosAttrKey::HANDSWITCH_STATUS_Hold))
  1468. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1469. }break;
  1470. default:
  1471. {}break;
  1472. }
  1473. };
  1474. auto HWXS = [this](char* value, int length) -> void //3.1.17 Second handSwitch
  1475. {
  1476. assert(value);
  1477. int tempValue = atoi(value);
  1478. FDEBUG("Recv Rad XR[{$}]", tempValue);
  1479. switch (tempValue)
  1480. {
  1481. case 0: //Release Second handswitch
  1482. {
  1483. if (m_Handswitch->Update(CcosAttrKey::HANDSWITCH_STATUS_Release))
  1484. FireNotify(m_Handswitch->GetKey(), m_Handswitch->JSGet());
  1485. }break;
  1486. case 1: //Press Second handswitch
  1487. {
  1488. if (m_GenSynState->Update(CcosAttrKey::FOOTSWITCH_STATUS_Press))
  1489. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1490. }break;
  1491. default:
  1492. {}break;
  1493. }
  1494. };
  1495. auto HWRPS = [this](char* value, int length) -> void //3.1.18 Set Serial Spot Pulses Per Second (PPS)
  1496. {
  1497. assert(value);
  1498. float tempValue = atof(value) / 10.0;
  1499. FDEBUG("Recv Serial Spot Pulses Per Second[{$}]", tempValue);
  1500. if (m_RadFrameRate->Update(tempValue))
  1501. {
  1502. FireNotify(m_RadFrameRate->GetKey(), tempValue);
  1503. }
  1504. };
  1505. auto HWRMM = [this](char* value, int length) -> void //3.1.19 Set Rad Mode
  1506. {
  1507. assert(value);
  1508. FDEBUG("Recv Serial Spot Pulses Per Second[{$}]", value);
  1509. if (m_ExpMode->Update(value))
  1510. {
  1511. FireNotify(m_ExpMode->GetKey(), value);
  1512. }
  1513. };
  1514. //3.2 FLUOROSCOPIC COMMANDS
  1515. auto HWFLK = [this](char* value, int length) -> void //3.2.1 Set Fluoroscopy KV
  1516. {
  1517. assert(value);
  1518. FDEBUG("Recv Fluoroscopy KV[{$}]", value);
  1519. if (m_FluKV->Update(atof(value)))
  1520. {
  1521. FireNotify(m_FluKV->GetKey(), value);
  1522. }
  1523. };
  1524. auto HWFLM = [this](char* value, int length) -> void //3.2.2 Set Fluoroscopy MA
  1525. {
  1526. assert(value);
  1527. float tempValue = atof(value) / 10.0;
  1528. FDEBUG("Recv Fluoroscopy MA[{$}]", tempValue);
  1529. if (m_FluMA->Update(tempValue))
  1530. {
  1531. FireNotify(m_FluMA->GetKey(), tempValue);
  1532. }
  1533. };
  1534. auto HWFLI = [this](char* value, int length) -> void //3.2.3 Fluoroscopy Interval Timer
  1535. {
  1536. assert(value);
  1537. float tempValue = atof(value) / 10.0; //(1 / 10 minutes)
  1538. FDEBUG("Recv Interval Timer[{$}]", tempValue);
  1539. if (m_FluIntTime->Update(tempValue))
  1540. {
  1541. FireNotify(m_FluIntTime->GetKey(), tempValue);
  1542. }
  1543. };
  1544. auto HWFLT = [this](char* value, int length) -> void //3.2.4 Fluoroscopy Accumulative Timer
  1545. {
  1546. assert(value);
  1547. float tempValue = atof(value) / 10.0; //(1 / 10 minutes)
  1548. FDEBUG("Recv Accumulative Timer[{$}]", tempValue);
  1549. if (m_FluAccTime->Update(tempValue))
  1550. {
  1551. FireNotify(m_FluAccTime->GetKey(), tempValue);
  1552. }
  1553. };
  1554. auto HWFLS = [this](char* value, int length) -> void //3.2.5 Set Fluoroscopy Pulses Per Second (PPS)
  1555. {
  1556. assert(value);
  1557. float tempValue = atof(value) / 10.0;
  1558. FDEBUG("Recv Fluoroscopy Pulses Per Second[{$}]", tempValue);
  1559. m_FluPPS->Update(tempValue);
  1560. FireNotify(m_FluPPS->GetKey(), tempValue);
  1561. };
  1562. auto HWFPW = [this](char* value, int length) -> void //3.2.6 Set Fluoroscopy pulse width
  1563. {
  1564. assert(value);
  1565. FDEBUG("Recv Fluoroscopy pulse width[{$}]", value);
  1566. if (m_FluMS->Update(atoi(value)))
  1567. {
  1568. FireNotify(CcosAttrKey::FLUpulseWidth, value);
  1569. }
  1570. };
  1571. auto HWFLF = [this](char* value, int length) -> void //3.2.7 Set Fluoroscopy Mode
  1572. {
  1573. assert(value);
  1574. int tempValue = atoi(value);
  1575. FDEBUG("Recv Fluoroscopy Mode[{$}]", tempValue);
  1576. switch (tempValue)
  1577. {
  1578. case 0: //Fluoro Disabled
  1579. {
  1580. m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_NOTFLU);
  1581. }break;
  1582. case 1: //Continuous Fluoroscopy
  1583. {
  1584. m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_CF);
  1585. }break;
  1586. case 2: //Pulsed Fluoroscopy
  1587. {
  1588. m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_PF);
  1589. }break;
  1590. case 3: //High Level Continuous Fluoroscopy
  1591. {
  1592. m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_HCF);
  1593. }break;
  1594. case 4: //High Level Pulsed Fluoroscopy
  1595. {
  1596. m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_HPF);
  1597. }break;
  1598. default:
  1599. {}break;
  1600. }
  1601. FireNotify(m_FluFMode->GetKey(), m_FluFMode->JSGet());
  1602. };
  1603. auto HWFLP = [this](char* value, int length) -> void //3.2.8 Fluoroscopy Preparation
  1604. {
  1605. assert(value);
  1606. int tempValue = atoi(value);
  1607. FDEBUG("Recv Fluoroscopy Preparation[{$}]", tempValue);
  1608. switch (tempValue)
  1609. {
  1610. case 0: //Fluoroscopy Prep inactive
  1611. {
  1612. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_OFF))
  1613. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1614. }break;
  1615. case 1: //Fluoroscopy Prep active
  1616. {
  1617. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_READY))
  1618. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1619. }break;
  1620. case 2: //Boost Fluoroscopy or Cine Prep active
  1621. {
  1622. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_CINE_READY))
  1623. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1624. }break;
  1625. default:
  1626. {}break;
  1627. }
  1628. };
  1629. auto HWFLX = [this](char* value, int length) -> void //3.2.9 Fluoroscopy Exposure
  1630. {
  1631. assert(value);
  1632. int tempValue = atoi(value);
  1633. FDEBUG("Recv Fluoroscopy Exposure[{$}]", tempValue);
  1634. switch (tempValue)
  1635. {
  1636. case 0: //Fluoroscopy Exposure inactive
  1637. {
  1638. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_XRAYOFF))
  1639. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1640. }break;
  1641. case 1: //Fluoroscopy Exposure active
  1642. {
  1643. if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_XRAYON))
  1644. FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
  1645. }break;
  1646. default:
  1647. {}break;
  1648. }
  1649. };
  1650. auto HWFLA = [this](char* value, int length) -> void //3.2.10 Fluoroscopy Automatic Brightness Stabilization (ABS) Control
  1651. {
  1652. assert(value);
  1653. int tempValue = atoi(value);
  1654. FDEBUG("Recv Fluoroscopy ABS[{$}]", tempValue);
  1655. switch (tempValue)
  1656. {
  1657. case 0: //ABS inactive
  1658. {
  1659. if (m_FluABSStatus->Update(CcosAttrKey::GENERATOR_ABS_OFF))
  1660. FireNotify(m_FluABSStatus->GetKey(), m_FluABSStatus->JSGet());
  1661. }break;
  1662. case 1: //ABS active (KV only)
  1663. {
  1664. if (m_FluABSStatus->Update(CcosAttrKey::GENERATOR_ABS_ON_KV))
  1665. FireNotify(m_FluABSStatus->GetKey(), m_FluABSStatus->JSGet());
  1666. }break;
  1667. case 2: //ABS active (KV / mA)
  1668. {
  1669. if (m_FluABSStatus->Update(CcosAttrKey::GENERATOR_ABS_ON_KVMA))
  1670. FireNotify(m_FluABSStatus->GetKey(), m_FluABSStatus->JSGet());
  1671. }break;
  1672. default:
  1673. {}break;
  1674. }
  1675. };
  1676. auto HWFLZ = [this](char* value, int length) -> void //3.2.11 Fluoroscopy II Magnification Control
  1677. {
  1678. assert(value);
  1679. int tempValue = atoi(value);
  1680. FDEBUG("Recv Fluoroscopy MAG[{$}]", tempValue);
  1681. if (m_FluAccTime->Update(tempValue))
  1682. {
  1683. FireNotify(CcosAttrKey::FLUMag, tempValue);
  1684. }
  1685. };
  1686. auto HWFLR = [this](char* value, int length) -> void //3.2.12 Fluoroscopy Time Reset
  1687. {
  1688. assert(value);
  1689. int tempValue = atoi(value);
  1690. FDEBUG("Recv Fluoroscopy Time Reset[{$}]", tempValue);
  1691. switch (tempValue)
  1692. {
  1693. case 0: //Reset Fluoroscopy Interval Timer
  1694. {
  1695. if (m_FluIntTime->Update(0))
  1696. FireNotify(m_FluIntTime->GetKey(), m_FluIntTime->JSGet());
  1697. }break;
  1698. case 1: //Reset Fluoroscopy Accumulative Timer
  1699. {
  1700. if (m_FluAccTime->Update(0))
  1701. FireNotify(m_FluAccTime->GetKey(), m_FluAccTime->JSGet());
  1702. }break;
  1703. default:
  1704. {}break;
  1705. }
  1706. };
  1707. auto HWFLD = [this](char* value, int length) -> void //3.2.13 Fluoroscopy Dose Level
  1708. {
  1709. assert(value);
  1710. int tempValue = atoi(value);
  1711. FDEBUG("Recv Fluoroscopy Dose Level[{$}]", tempValue);
  1712. if (m_FluDoseLever->Update(tempValue))
  1713. {
  1714. FireNotify(m_FluDoseLever->GetKey(), tempValue);
  1715. }
  1716. };
  1717. auto HWRF = [this](char* value, int length) -> void //3.2.14 Refresh Fluoroscopy Data
  1718. {
  1719. //do noting
  1720. };
  1721. auto HWFLC = [this](char* value, int length) -> void //3.2.15 Fluoroscopy to Rad kV Transfer Curve
  1722. {
  1723. assert(value);
  1724. int tempValue = atoi(value);
  1725. FDEBUG("Recv Rad kV Transfer Curve[{$}]", tempValue);
  1726. };
  1727. auto HWFLO = [this](char* value, int length) -> void //3.2.16 Fluoroscopy ABS Curve
  1728. {
  1729. assert(value);
  1730. int tempValue = atoi(value);
  1731. FDEBUG("Recv Fluoroscopy ABS Curve[{$}]", tempValue);
  1732. };
  1733. auto HWABS = [this](char* value, int length) -> void //3.2.17 Fluoroscopy Automatic Brightness Stabilization (ABS) Brightness
  1734. {
  1735. assert(value);
  1736. int tempValue = atoi(value);
  1737. FDEBUG("Recv Curr ABS value[{$}]", tempValue);
  1738. };
  1739. auto HWFAT = [this](char* value, int length) -> void //3.2.18 Fluoroscopy Automatic Brightness Stabilization (ABS) Target Brightness
  1740. {
  1741. assert(value);
  1742. int tempValue = atoi(value);
  1743. FDEBUG("Recv Target ABS value[{$}]", tempValue);
  1744. };
  1745. auto HWFHD = [this](char* value, int length) -> void //3.2.19 Fluoroscopy Automatic Brightness Stabilization (ABS) Half Dose Control
  1746. {
  1747. assert(value);
  1748. int tempValue = atoi(value);
  1749. FDEBUG("Recv Fluoroscopy Half Dose[{$}]", tempValue);
  1750. };
  1751. //3.3 SYSTEM COMMANDS
  1752. auto HWEWS = [this](char* value, int length) -> void //3.3.1 Work Station Selection
  1753. {
  1754. assert(value);
  1755. int tempValue = atoi(value);
  1756. FDEBUG("Recv Work Station[{$}]", tempValue);
  1757. int tempws = 1;
  1758. if (m_arrWSMap.find(cfgWorkStationKey(tempValue)) != m_arrWSMap.end())
  1759. {
  1760. m_strCurrentWSName = cfgWorkStationKey(tempValue);
  1761. tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
  1762. FDEBUG("Set WS number {$}", tempws);
  1763. SetExpSYN(m_arrWSMap[m_strCurrentWSName].nWSSYN);
  1764. }
  1765. else
  1766. {
  1767. FDEBUG("Set WS number default 1");
  1768. m_strCurrentWSName = cfgWorkStationKey(tempValue);
  1769. }
  1770. FireNotify(CcosAttrKey::WORKSTATION, tempValue);
  1771. };
  1772. auto HWEHE = [this](char* value, int length) -> void //3.3.2 Percentage Anode Tube Heat
  1773. {
  1774. assert(value);
  1775. int tempValue = atoi(value);
  1776. FDEBUG("Recv Tube Heat[{$}]", tempValue);
  1777. if (m_TubeHE->Update(tempValue))
  1778. {
  1779. FireNotify(m_TubeHE->GetKey(), tempValue);
  1780. }
  1781. };
  1782. auto HWEHH = [this](char* value, int length) -> void //3.3.3 Percentage Housing Tube Heat
  1783. {
  1784. assert(value);
  1785. int tempValue = atoi(value);
  1786. FDEBUG("Recv GEN Heat[{$}]", tempValue);
  1787. if (m_GenHE->Update(tempValue))
  1788. {
  1789. FireNotify(m_GenHE->GetKey(), tempValue);
  1790. }
  1791. };
  1792. auto HWERR = [this](char* value, int length) -> void //3.3.4 Generator Error Indicator
  1793. {
  1794. assert(value);
  1795. int tempValue = atoi(value);
  1796. FDEBUG("Recv GEN Error[{$}]", tempValue);
  1797. if (m_nNotifyType == CcosAttrKey::CTRL_CallBackFun)
  1798. {
  1799. FireNotify("ErrorList", tempValue);
  1800. }
  1801. else
  1802. {
  1803. if (tempValue)
  1804. {
  1805. FireErrorMessage(true, tempValue, "nuknow");
  1806. }
  1807. else
  1808. {
  1809. int level = 0;
  1810. m_MSGUnit->DelErrorMessage("0", level, "clear all errors");
  1811. }
  1812. }
  1813. };
  1814. auto HWEWN = [this](char* value, int length) -> void //3.3.5 Generator Warning Indicator
  1815. {
  1816. assert(value);
  1817. int tempValue = atoi(value);
  1818. FDEBUG("Recv GEN Warning[{$}]", tempValue);
  1819. if (m_nNotifyType == CcosAttrKey::CTRL_CallBackFun)
  1820. {
  1821. FireNotify("WarningList", tempValue);
  1822. }
  1823. else
  1824. {
  1825. if (tempValue)
  1826. {
  1827. FireWarnMessage(true, tempValue, "nuknow");
  1828. }
  1829. else
  1830. {
  1831. int level = 0;
  1832. m_MSGUnit->DelWarnMessage("0", level, "clear all Warning");
  1833. }
  1834. }
  1835. };
  1836. auto HWERS = [this](char* value, int length) -> void //3.3.6 Refresh System Data
  1837. {
  1838. //get noting
  1839. };
  1840. auto HWEEC = [this](char* value, int length) -> void //3.3.7 Echo
  1841. {
  1842. m_iHeartBeats = 0;
  1843. };
  1844. auto HWEST = [this](char* value, int length) -> void //3.3.8 Status
  1845. {
  1846. assert(value);
  1847. int tempValue = atoi(value);
  1848. FDEBUG("Recv Generator Status[{$}]", tempValue);
  1849. switch (tempValue)
  1850. {
  1851. case 1: //Initialization Phase
  1852. {
  1853. if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_INIT))
  1854. FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
  1855. }break;
  1856. case 2: //Standby Phase
  1857. {
  1858. if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_STANDBY))
  1859. FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
  1860. }break;
  1861. case 3: //Rad Preparation (Ready) Phase
  1862. {
  1863. }break;
  1864. case 4: //Rad Exposure (X-ray) Phase
  1865. {
  1866. HWSendWaittimeCMD("RAP?", 4);
  1867. HWSendWaittimeCMD("RAT?", 4);
  1868. if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_EXP))
  1869. FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
  1870. }break;
  1871. case 5: //Fluoroscopy Exposure Phase
  1872. {
  1873. if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_EXP))
  1874. FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
  1875. }break;
  1876. case 6: //Calibration Phase
  1877. {
  1878. }break;
  1879. case 7: //Error Phase
  1880. {
  1881. if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_ERROR))
  1882. FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
  1883. }break;
  1884. case 8: //Service Phase
  1885. {
  1886. }break;
  1887. default:
  1888. {}break;
  1889. }
  1890. };
  1891. auto HWRSA = [this](char* value, int length) -> void //3.3.9 Set APR Data
  1892. {
  1893. //do noting
  1894. };
  1895. auto HWRSX = [this](char* value, int length) -> void //3.3.10 Set MX APR Data
  1896. {
  1897. //do noting
  1898. };
  1899. auto HWFAR = [this](char* value, int length) -> void //3.3.11 Set fluoroscopy APR Data
  1900. {
  1901. //do noting
  1902. };
  1903. auto HWEGR = [this](char* value, int length) -> void //3.3.12 Generator Software Revision
  1904. {
  1905. assert(value);
  1906. FDEBUG("Recv Generator Software Revision[{$}]", value);
  1907. };
  1908. auto HWEME = [this](char* value, int length) -> void //3.3.13 Multiple Energy
  1909. {
  1910. //do noting
  1911. };
  1912. auto HWERE = [this](char* value, int length) -> void //3.3.14 Reset device
  1913. {
  1914. int level = 0;
  1915. m_MSGUnit->DelErrorMessage("0", level, "clear all errors");
  1916. };
  1917. auto HWEXB = [this](char* value, int length) -> void //3.3.15 Exposure Enable
  1918. {
  1919. assert(value);
  1920. int tempValue = atoi(value);
  1921. FDEBUG("Recv Exposure Enable[{$}]", tempValue);
  1922. m_bExpEnable = tempValue;
  1923. };
  1924. auto HWEXP = [this](char* value, int length) -> void //3.3.16 Exposure Permit
  1925. {
  1926. assert(value);
  1927. int tempValue = atoi(value);
  1928. FDEBUG("Recv Exposure Permit[{$}]", tempValue);
  1929. m_bSoftExpPermit = tempValue;
  1930. };
  1931. auto HWEXM = [this](char* value, int length) -> void //3.3.17 Exposure mode
  1932. {
  1933. assert(value);
  1934. int tempValue = atoi(value);
  1935. FDEBUG("Recv Exposure mode[{$}]", tempValue);
  1936. EnSYNMode tempSYN = EnSYNMode::EXPOSURE_SYNMODE_HARDWARE_SYNBOX;
  1937. switch (tempValue)
  1938. {
  1939. case 0:
  1940. tempSYN = EnSYNMode::EXPOSURE_SYNMODE_HARDWARE_SYNBOX;
  1941. break;
  1942. case 1:
  1943. tempSYN = EnSYNMode::EXPOSURE_SYNMODE_SOFTWARE_NOSYNBOX;
  1944. break;
  1945. default:
  1946. break;
  1947. }
  1948. m_bSoftExpPermit = tempSYN;
  1949. };
  1950. auto HWTIC = [this](char* value, int length) -> void //3.3.18 Request detector window
  1951. {
  1952. //do noting
  1953. };
  1954. auto HWEXO = [this](char* value, int length) -> void //3.3.19 Exposure Permit
  1955. {
  1956. //do noting
  1957. };
  1958. auto HWIPS = [this](char* value, int length) -> void //3.3.20 Save picture in Last Image Hold
  1959. {
  1960. assert(value);
  1961. FDEBUG("Save picture in Last Image Hold");
  1962. };
  1963. auto HWIPM = [this](char* value, int length) -> void //3.3.21 Image Mirror
  1964. {
  1965. #if 0
  1966. assert(value);
  1967. int tempValue = atoi(value);
  1968. FDEBUG("Image Mirror[{$}]", tempValue);
  1969. FireNotify("ImageMirror", tempValue);
  1970. #else
  1971. if (m_IPM)
  1972. m_IPM = 0;
  1973. else
  1974. m_IPM = 1;
  1975. FDEBUG("Image Mirror[{$}]", m_IPM);
  1976. FireNotify("ImageMirror", m_IPM);
  1977. #endif
  1978. };
  1979. auto HWIPF = [this](char* value, int length) -> void //3.3.22 Image Flip
  1980. {
  1981. #if 0
  1982. assert(value);
  1983. int tempValue = atoi(value);
  1984. FDEBUG("Image Flip[{$}]", tempValue);
  1985. FireNotify("ImageFlip", tempValue);
  1986. #else
  1987. if (m_IPF)
  1988. m_IPF = 0;
  1989. else
  1990. m_IPF = 1;
  1991. FDEBUG("Image Flip[{$}]", m_IPF);
  1992. FireNotify("ImageFlip", m_IPF);
  1993. #endif
  1994. };
  1995. auto HWIPR = [this](char* value, int length) -> void //3.3.23 Image Rotate
  1996. {
  1997. assert(value);
  1998. int tempValue = atoi(value);
  1999. if (tempValue != 0)
  2000. {
  2001. if (value[0] == '0')
  2002. value[0] = '2';//逆时针
  2003. else
  2004. value[0] = '1';//顺时针
  2005. tempValue = atoi(value);
  2006. }
  2007. //else tempValue = 0;//复位
  2008. FDEBUG("Image Rotate[{$}]", tempValue);
  2009. FireNotify("ImageRotate", tempValue);
  2010. };
  2011. auto HWISS = [this](char* value, int length) -> void //3.3.24 Save Single Frame
  2012. {
  2013. assert(value);
  2014. FDEBUG("Save Single Frame");
  2015. };
  2016. auto HWIAS = [this](char* value, int length) -> void //3.3.25 Auto Save
  2017. {
  2018. assert(value);
  2019. int tempValue = atoi(value);
  2020. FDEBUG("Auto Save[{$}]", tempValue);
  2021. FireNotify("AutoSave", tempValue);
  2022. };
  2023. auto HWISC = [this](char* value, int length) -> void //3.3.26 Save Current Image
  2024. {
  2025. assert(value);
  2026. int tempValue = atoi(value);
  2027. FDEBUG("Save Current Image[{$}]", tempValue);
  2028. FireNotify("SaveCurrImage", tempValue);
  2029. };
  2030. auto HWISM = [this](char* value, int length) -> void //3.3.27 Swap Monitors
  2031. {
  2032. assert(value);
  2033. FDEBUG("Swap Monitors");
  2034. };
  2035. auto HWICC = [this](char* value, int length) -> void //3.3.28 Contrast Contorl
  2036. {
  2037. assert(value);
  2038. int tempValue = atoi(value);
  2039. FDEBUG("Contrast Contorl[{$}]", tempValue);
  2040. };
  2041. auto HWIBC = [this](char* value, int length) -> void //3.3.29 Brightness Contorl
  2042. {
  2043. assert(value);
  2044. int tempValue = atoi(value);
  2045. FDEBUG("Brightness Contorl[{$}]", tempValue);
  2046. };
  2047. auto HWSUB = [this](char* value, int length) -> void //3.3.30 Subtraction
  2048. {
  2049. assert(value);
  2050. int tempValue = atoi(value);
  2051. FDEBUG("Subtraction[{$}]", tempValue);
  2052. };
  2053. auto HWIRM = [this](char* value, int length) -> void //3.3.31 Road Map
  2054. {
  2055. assert(value);
  2056. int tempValue = atoi(value);
  2057. FDEBUG("Road Map[{$}]", tempValue);
  2058. FireNotify("RoadMap", tempValue);
  2059. };
  2060. auto HWIRF = [this](char* value, int length) -> void //3.3.32 Recursive Filter
  2061. {
  2062. assert(value);
  2063. int tempValue = atoi(value);
  2064. FDEBUG("Recursive Filter[{$}]", tempValue);
  2065. };
  2066. //3.4 DAP COMMANDS
  2067. auto HWEDA = [this](char* value, int length) -> void //3.4.1 Read DAP Accumulated Value
  2068. {
  2069. assert(value);
  2070. int tempValue = atoi(value);
  2071. FDEBUG("Read DAP Accumulated Value[{$}]", tempValue);
  2072. FireNotify("DAPAccumulated", tempValue);
  2073. };
  2074. auto HWEDR = [this](char* value, int length) -> void //3.4.2 Read DAP Rate Value
  2075. {
  2076. assert(value);
  2077. float tempValue = atof(value) / 10.0;
  2078. FDEBUG("Read DAP Rate Value[{$}]", tempValue);
  2079. };
  2080. auto HWEDZ = [this](char* value, int length) -> void //3.4.3 Zero Accumulated DAP Value
  2081. {
  2082. assert(value);
  2083. FDEBUG("Zero Accumulated DAP Value");
  2084. };
  2085. auto HWEDS = [this](char* value, int length) -> void //3.4.4 DAP Status
  2086. {
  2087. assert(value);
  2088. int tempValue = atoi(value);
  2089. FDEBUG("DAP Status[{$}]", tempValue);
  2090. };
  2091. auto HWEAK = [this](char* value, int length) -> void //3.4.5 Read Air Kerm
  2092. {
  2093. assert(value);
  2094. float tempValue = atof(value) / 10.0;//EAR EAK缩进与协议相反
  2095. FDEBUG("Read Air Kerm[{$}]", tempValue);
  2096. if (m_fAirKerm != tempValue)
  2097. {
  2098. m_fAirKerm = tempValue;
  2099. FireNotify("AirKerm", tempValue);
  2100. }
  2101. };
  2102. auto HWEAR = [this](char* value, int length) -> void //3.4.6 Read Air Kerm Rate
  2103. {
  2104. assert(value);
  2105. float tempValue = atof(value) / 100.0;
  2106. FDEBUG("Read Air Kerm Rate[{$}]", tempValue);
  2107. if (AirKermRate != tempValue)
  2108. {
  2109. AirKermRate = tempValue;
  2110. FireNotify("AirKermRate", tempValue);
  2111. }
  2112. };
  2113. //3.5 MECHNICAL COMMANDS
  2114. auto HWPPN = [this](char* value, int length) -> void //3.5.1 Position Number Value
  2115. {
  2116. assert(value);
  2117. int tempValue = atoi(value);
  2118. FDEBUG("Position Number Value[{$}]", tempValue);
  2119. };
  2120. auto HWPSM = [this](char* value, int length) -> void //3.5.2 Position Status message
  2121. {
  2122. assert(value);
  2123. int tempValue = atoi(value);
  2124. FDEBUG("Position Status message[{$}]", tempValue);
  2125. };
  2126. auto HWPGS = [this](char* value, int length) -> void //3.5.3 Detect Grid Status
  2127. {
  2128. assert(value);
  2129. int tempValue = atoi(value);
  2130. FDEBUG("Detect Grid Status[{$}]", tempValue);
  2131. };
  2132. auto HWSID = [this](char* value, int length) -> void //3.5.4 Set SID
  2133. {
  2134. assert(value);
  2135. int tempValue = atoi(value);
  2136. FDEBUG("Set SID[{$}]", tempValue);
  2137. };
  2138. auto HWGBS = [this](char* value, int length) -> void //3.5.5 Patient Body size
  2139. {
  2140. assert(value);
  2141. int tempValue = atoi(value);
  2142. FDEBUG("Patient Body size[{$}]", tempValue);
  2143. };
  2144. auto HWVID = [this](char* value, int length) -> void //3.5.6 Procedure&View ID
  2145. {
  2146. assert(value);
  2147. int tempValue = atoi(value);
  2148. FDEBUG("Procedure or View ID[{$}]", tempValue);
  2149. };
  2150. //3.6 COLLIMATOR COMMANDS
  2151. auto HWCFS = [this](char* value, int length) -> void //3.6.1 Set Collimator Size
  2152. {
  2153. assert(value);
  2154. char tempData[6]{ 0 };
  2155. strncpy_s(tempData, value, 3);
  2156. float tempValueX = atoi(tempData) / 10.0;
  2157. strncpy_s(tempData, value+3, 3);
  2158. float tempValueY = atoi(tempData) / 10.0;
  2159. FDEBUG("Set Collimator Size[{$},{$}](cm)", tempValueX, tempValueY);
  2160. FireNotify("XSize", tempValueX);
  2161. FireNotify("YSize", tempValueY);
  2162. };
  2163. auto HWCFT = [this](char* value, int length) -> void //3.6.2 Set Collimator Filter
  2164. {
  2165. assert(value);
  2166. int tempValue = atoi(value);
  2167. FDEBUG("Set Collimator Filter[{$}]", tempValue);
  2168. FireNotify("Filter", tempValue);
  2169. };
  2170. auto HWCFN = [this](char* value, int length) -> void //3.6.3 Get Collimator Filter Thickness
  2171. {
  2172. assert(value);
  2173. char tempData[6]{ 0 };
  2174. strncpy_s(tempData, value, 3);
  2175. float tempValueMin = atoi(tempData);
  2176. strncpy_s(tempData, value + 3, 3);
  2177. float tempValueMax = atoi(tempData);
  2178. FDEBUG("Get Collimator Filter Thickness[{$}:{$}](mm)", tempValueMin, tempValueMax);
  2179. };
  2180. auto HWCFL = [this](char* value, int length) -> void //3.6.4 Control Collimator Light
  2181. {
  2182. assert(value);
  2183. int tempValue = atoi(value);
  2184. FDEBUG("Control Collimator Light[{$}]", tempValue);
  2185. };
  2186. auto HWCFR = [this](char* value, int length) -> void //3.6.5 Control Collimator Rotate
  2187. {
  2188. assert(value);
  2189. char tempData[6]{ 0 };
  2190. strncpy_s(tempData, value, 1);
  2191. string strDirection = "clockwise";
  2192. if(atoi(tempData))
  2193. strDirection = "anticlockwise";
  2194. strncpy_s(tempData, value + 1, 3);
  2195. float tempAngle = atoi(tempData);
  2196. strncpy_s(tempData, value + 4, 3);
  2197. float tempPos = atoi(tempData);
  2198. FDEBUG("Control Collimator Rotate[{$}:{$}:{$}]", strDirection.c_str(), tempAngle, tempPos);
  2199. //FireNotify("CollRotateDirection", strDirection);
  2200. sprintf_s(tempData,"%03d%02d", (int)tempAngle, (int)tempPos/10);
  2201. FireNotify("CollRotateAngle", tempData);
  2202. //FireNotify("CollRotatePos", tempPos);
  2203. };
  2204. auto HWCFD = [this](char* value, int length) -> void //3.6.6 Control Collimator Distance
  2205. {
  2206. assert(value);
  2207. float tempValue = atof(value) / 10.0;
  2208. FDEBUG("Control Collimator Distance[{$}]", tempValue);
  2209. };
  2210. //3.7 SERVICE COMMANDS
  2211. auto HWESM = [this](char* value, int length) -> void //3.7.1 Enter Service Mode
  2212. {
  2213. assert(value);
  2214. int tempValue = atoi(value);
  2215. FDEBUG("Enter Service Mode[{$}]", tempValue);
  2216. };
  2217. auto HWSCM = [this](char* value, int length) -> void //3.7.2 Start Calibration Mode
  2218. {
  2219. assert(value);
  2220. char tempData[6]{ 0 };
  2221. strncpy_s(tempData, value, 1);
  2222. float tempValue1 = atoi(tempData);
  2223. strncpy_s(tempData, value + 1, 1);
  2224. float tempValue2 = atoi(tempData);
  2225. FDEBUG("Start Calibration Mode[{$},{$}]", tempValue1, tempValue2);
  2226. };
  2227. auto HWECM = [this](char* value, int length) -> void //3.7.3 End Calibration
  2228. {
  2229. assert(value);
  2230. FDEBUG("End Calibration");
  2231. };
  2232. auto HWQGD = [this](char* value, int length) -> void //3.7.4 Query Generator Data
  2233. {
  2234. assert(value);
  2235. int tempValue = atoi(value);
  2236. FDEBUG("Query Generator Data[{$}]", tempValue);
  2237. };
  2238. auto HWCPD = [this](char* value, int length) -> void //3.7.5 Calibration Parameters Data
  2239. {
  2240. assert(value);
  2241. char tempData[6]{ 0 };
  2242. strncpy_s(tempData, value, 1);
  2243. float tempValue1 = atoi(tempData);
  2244. strncpy_s(tempData, value + 1, 3);
  2245. float tempValue2 = atoi(tempData);
  2246. strncpy_s(tempData, value + 4, 5);
  2247. float tempValue3 = atoi(tempData);
  2248. strncpy_s(tempData, value + 9, 4);
  2249. float tempValue4 = atoi(tempData);
  2250. FDEBUG("Calibration Parameters Data[Focus={$},KV={$},MA={$},FilamentCurData={$}]",
  2251. tempValue1, tempValue2, tempValue3, tempValue4);
  2252. };
  2253. auto HWFCP = [this](char* value, int length) -> void //3.7.6 Fluoro Calibration Parameters
  2254. {
  2255. assert(value);
  2256. char tempData[6]{ 0 };
  2257. strncpy_s(tempData, value, 3);
  2258. float tempValue1 = atoi(tempData) / 10.0;
  2259. strncpy_s(tempData, value + 3, 2);
  2260. float tempValue2 = atoi(tempData);
  2261. strncpy_s(tempData, value + 5, 4);
  2262. float tempValue3 = atoi(tempData);
  2263. strncpy_s(tempData, value + 9, 5);
  2264. float tempValue4 = atoi(tempData) / 100.0;
  2265. strncpy_s(tempData, value + 14, 4);
  2266. float tempValue5 = atoi(tempData);
  2267. FDEBUG("Fluoro Calibration Parameters[KV={$},PPS={$},PulseWidth={$},MA={$},FilamentCurData={$}]",
  2268. tempValue1, tempValue2, tempValue3, tempValue4, tempValue5);
  2269. };
  2270. auto HWFCD = [this](char* value, int length) -> void //3.7.7 Filament Current Data
  2271. {
  2272. assert(value);
  2273. int tempValue = atoi(value);
  2274. FDEBUG("Filament Current Data[{$}]", tempValue);
  2275. };
  2276. auto HWAEM = [this](char* value, int length) -> void //3.7.8 Actual Exposure Current
  2277. {
  2278. assert(value);
  2279. float tempValue = atoi(value) / 100.0;
  2280. FDEBUG("Actual Exposure Current[{$}]", tempValue);
  2281. };
  2282. auto HWCCR = [this](char* value, int length) -> void //3.7.9 Current Calibration Result
  2283. {
  2284. assert(value);
  2285. int tempValue = atoi(value);
  2286. FDEBUG("Current Calibration Result[{$}]", tempValue);
  2287. };
  2288. auto HWWSC = [this](char* value, int length) -> void //3.7.10 Workstation Configration
  2289. {
  2290. assert(value);
  2291. char tempData[6]{ 0 };
  2292. strncpy_s(tempData, value, 1);
  2293. float tempValue1 = atoi(tempData);
  2294. strncpy_s(tempData, value + 3, 1);
  2295. float tempValue2 = atoi(tempData);
  2296. strncpy_s(tempData, value + 6, 1);
  2297. float tempValue3 = atoi(tempData);
  2298. strncpy_s(tempData, value + 9, 1);
  2299. float tempValue4 = atoi(tempData);
  2300. strncpy_s(tempData, value + 13, 1);
  2301. float tempValue5 = atoi(tempData);
  2302. strncpy_s(tempData, value + 17, 3);
  2303. float tempValue6 = atoi(tempData);
  2304. strncpy_s(tempData, value + 23, 3);
  2305. float tempValue7 = atoi(tempData);
  2306. FDEBUG("Fluoro Calibration Parameters[Workstation={$},TubeType={$},SyncMode={$},SignalSource={$},AEC={$},HighSpeedDroptoutTime={$},LowSpeedDroptoutTime={$}]",
  2307. tempValue1, tempValue2, tempValue3, tempValue4, tempValue5, tempValue6, tempValue7);
  2308. };
  2309. auto HWNSD = [this](char* value, int length) -> void //3.7.11 Number of Shot to Dropout
  2310. {
  2311. assert(value);
  2312. int tempValue = atoi(value);
  2313. FDEBUG("Number of Shot to Dropout[{$}]", tempValue);
  2314. };
  2315. auto HWAHS = [this](char* value, int length) -> void //3.7.12 Always In High Speed
  2316. {
  2317. assert(value);
  2318. int tempValue = atoi(value);
  2319. FDEBUG("Always In High Speed[{$}]", tempValue);
  2320. };
  2321. auto HWLSB = [this](char* value, int length) -> void //3.7.13 Low Speed Brake
  2322. {
  2323. assert(value);
  2324. int tempValue = atoi(value);
  2325. FDEBUG("Low Speed Brake[{$}]", tempValue);
  2326. };
  2327. auto HWTBC = [this](char* value, int length) -> void //3.7.14 Tube Configration
  2328. {
  2329. assert(value);
  2330. char tempData[6]{ 0 };
  2331. strncpy_s(tempData, value, 1);
  2332. float tempValue1 = atoi(tempData);
  2333. strncpy_s(tempData, value + 4, 4);
  2334. float tempValue2 = atoi(tempData);
  2335. strncpy_s(tempData, value + 11, 4);
  2336. float tempValue3 = atoi(tempData);
  2337. strncpy_s(tempData, value + 18, 4);
  2338. float tempValue4 = atoi(tempData);
  2339. strncpy_s(tempData, value + 25, 1);
  2340. float tempValue5 = atoi(tempData);
  2341. FDEBUG("Fluoro Calibration Parameters[TubeType={$},highestMA={$},smallestMA={$},minPrepTime={$},EnableBothFilaments={$}]",
  2342. tempValue1, tempValue2, tempValue3, tempValue4, tempValue5);
  2343. };
  2344. auto HWTRP = [this](char* value, int length) -> void //3.7.15 Rating Percentage of Tube
  2345. {
  2346. assert(value);
  2347. int tempValue = atoi(value);
  2348. FDEBUG("Rating Percentage of Tube[{$}]", tempValue);
  2349. };
  2350. auto HWGRP = [this](char* value, int length) -> void //3.7.16 Rating Percentage of Generator
  2351. {
  2352. assert(value);
  2353. int tempValue = atoi(value);
  2354. FDEBUG("Rating Percentage of Generator[{$}](kW)", tempValue);
  2355. };
  2356. auto HWTHL = [this](char* value, int length) -> void //3.7.17 Tube Heat Limitation
  2357. {
  2358. assert(value);
  2359. int tempValue = atoi(value);
  2360. FDEBUG("Tube Heat Limitation[{$}]", tempValue);
  2361. };
  2362. auto HWLKV = [this](char* value, int length) -> void //3.7.18 Limitation of KV
  2363. {
  2364. assert(value);
  2365. char tempData[6]{ 0 };
  2366. strncpy_s(tempData, value, 1);
  2367. string tempValue1 = "DR";
  2368. if(atoi(tempData))
  2369. tempValue1 = "Fluoro";
  2370. strncpy_s(tempData, value + 1, 3);
  2371. float tempValue2 = atoi(tempData);
  2372. strncpy_s(tempData, value + 4, 3);
  2373. float tempValue3 = atoi(tempData);
  2374. FDEBUG("Limitation of KV[mode={$},MaxKV={$},MinKV={$}]",
  2375. tempValue1.c_str(), tempValue2, tempValue3);
  2376. };
  2377. auto HWNEX = [this](char* value, int length) -> void //3.7.19 Number of Exposures
  2378. {
  2379. assert(value);
  2380. int tempValue = atoi(value);
  2381. FDEBUG("Number of Exposures[{$}]", tempValue);
  2382. };
  2383. auto HWGEL = [this](char* value, int length) -> void //3.7.20 Generator Error Log
  2384. {
  2385. assert(value);
  2386. char tempData[6]{ 0 };
  2387. strncpy_s(tempData, value, 4);
  2388. float tempValue1 = atoi(tempData);
  2389. strncpy_s(tempData, value + 4, 2);
  2390. float tempValue2 = atoi(tempData);
  2391. strncpy_s(tempData, value + 6, 2);
  2392. float tempValue3 = atoi(tempData);
  2393. strncpy_s(tempData, value + 9, 2);
  2394. float tempValue4 = atoi(tempData);
  2395. strncpy_s(tempData, value + 11, 2);
  2396. float tempValue5 = atoi(tempData);
  2397. strncpy_s(tempData, value + 13, 2);
  2398. float tempValue6 = atoi(tempData);
  2399. strncpy_s(tempData, value + 16, 4);
  2400. float tempValue7 = atoi(tempData);
  2401. FDEBUG("Fluoro Calibration Parameters[{$-{$}-{$} {$}:{$}:{$} ErrorCode={$}]",
  2402. tempValue1, tempValue2, tempValue3, tempValue4, tempValue5, tempValue6, tempValue7);
  2403. };
  2404. auto HWDGC = [this](char* value, int length) -> void //3.7.21 Detect Grid Config
  2405. {
  2406. assert(value);
  2407. int tempValue = atoi(value);
  2408. FDEBUG("Detect Grid Config[{$}]", tempValue);
  2409. };
  2410. auto HWSPC = [this](char* value, int length) -> void //3.7.22 Serail Port Configration
  2411. {
  2412. assert(value);
  2413. string strValue = "RS232";
  2414. if(atoi(value))
  2415. strValue = "RS422";
  2416. FDEBUG("Serail Port Configration[{$}]", strValue.c_str());
  2417. };
  2418. auto HWPZM = [this](char* value, int length) -> void //Flat Panel Field Selection
  2419. {
  2420. assert(value);
  2421. int tempValue = atoi(value);
  2422. FDEBUG("Flat Panel Field Selection[{$}]", tempValue);
  2423. FireNotify("PanelField", tempValue);
  2424. };
  2425. auto HWSSD = [this](char* value, int length) -> void //System Shut Down
  2426. {
  2427. assert(value);
  2428. int tempValue = atoi(value);
  2429. FDEBUG("System Shut Down[{$}]", tempValue);
  2430. FireNotify("ShutDown", tempValue);
  2431. };
  2432. auto HWVNE = [this](char* value, int length) -> void //Exam Seletcion
  2433. {
  2434. assert(value);
  2435. int tempValue = atoi(value);
  2436. FDEBUG("Exam Seletcion[{$}]", tempValue);
  2437. FireNotify("ExamView", tempValue);
  2438. };
  2439. auto HWDSA = [this](char* value, int length) -> void //DSA status
  2440. {
  2441. assert(value);
  2442. int tempValue = atoi(value);
  2443. FDEBUG("DSA status[{$}]", tempValue);
  2444. FireNotify("DSA", tempValue);
  2445. };
  2446. auto HWIPL = [this](char* value, int length) -> void //Start /stop the cine loop of a sequence
  2447. {
  2448. #if 0
  2449. assert(value);
  2450. int tempValue = atoi(value);
  2451. FDEBUG("Cine Loop of a sequence[{$}]", tempValue);
  2452. FireNotify("CineLoop", tempValue);
  2453. #else
  2454. if (m_IPL)
  2455. m_IPL = 0;
  2456. else
  2457. m_IPL = 1;
  2458. FDEBUG("Cine Loop of a sequence[{$}]", m_IPL);
  2459. FireNotify("CineLoop", m_IPL);
  2460. #endif
  2461. };
  2462. auto HWINT = [this](char* value, int length) -> void //Select the previous or next image in a run
  2463. {
  2464. assert(value);
  2465. int tempValue = atoi(value);
  2466. FDEBUG("previous or next image[{$}]", tempValue);
  2467. FireNotify("NextImage", tempValue);
  2468. };
  2469. auto HWIST = [this](char* value, int length) -> void //Select a previous or subsequent run
  2470. {
  2471. assert(value);
  2472. int tempValue = atoi(value);
  2473. FDEBUG("subsequent run[{$}]", tempValue);
  2474. FireNotify("SubsequentRun", tempValue);
  2475. };
  2476. //初始化指令对照表
  2477. glo_arFrame.clear();
  2478. //glo_arFrame[""] = tFrameMapItem(HWERROR_1);//命令格式:校验和错误
  2479. //3.1 RADIOGRAPHIC COMMANDS
  2480. glo_arFrame["RKV"] = tFrameMapItem(HWRKV); //3.1.1 Sets the KV value (KV value * 10
  2481. glo_arFrame["RMA"] = tFrameMapItem(HWRMA); //3.1.2 Sets the MA value (MA * 100)
  2482. glo_arFrame["RMS"] = tFrameMapItem(HWRMS); //3.1.3 Sets the Exposure Time in milliseconds (MS * 100)
  2483. glo_arFrame["RMX"] = tFrameMapItem(HWRMX); //3.1.4 Sets the MAS 1/1000 (milliamp * seconds)
  2484. glo_arFrame["RR"] = tFrameMapItem(HWRR); //3.1.5 Refresh Rad Console Data
  2485. glo_arFrame["RET"] = tFrameMapItem(HWRET); //3.1.6 Exposure Technique Selection
  2486. glo_arFrame["RFO"] = tFrameMapItem(HWRFO); //3.1.7 Focus Selection
  2487. glo_arFrame["RFN"] = tFrameMapItem(HWRFN); //3.1.8 AEC Density
  2488. glo_arFrame["RFI"] = tFrameMapItem(HWRFI); //3.1.9 AEC Field Selection
  2489. glo_arFrame["RFS"] = tFrameMapItem(HWRFS); //3.1.10 AEC Film Screen Selection
  2490. glo_arFrame["RAP"] = tFrameMapItem(HWRAP); //3.1.11 Post MAS
  2491. glo_arFrame["RAT"] = tFrameMapItem(HWRAT); //3.1.12 Post TIME(MS * 100)
  2492. glo_arFrame["RAL"] = tFrameMapItem(HWRAL); //3.1.13 AEC Lock
  2493. glo_arFrame["PR"] = tFrameMapItem(HWPR); //3.1.14 RAD Preparation
  2494. glo_arFrame["XR"] = tFrameMapItem(HWXR); //3.1.15 RAD X-ray Exposure
  2495. glo_arFrame["PS"] = tFrameMapItem(HWPS); //3.1.16 First handswitch
  2496. glo_arFrame["XS"] = tFrameMapItem(HWXS); //3.1.17 Second handSwitch
  2497. glo_arFrame["RPS"] = tFrameMapItem(HWRPS); //3.1.18 Set Serial Spot Pulses Per Second (PPS)
  2498. glo_arFrame["RMM"] = tFrameMapItem(HWRMM); //3.1.19 Set Rad Mode
  2499. //3.2 FLUOROSCOPIC COMMANDS
  2500. glo_arFrame["FLK"] = tFrameMapItem(HWFLK); //3.2.1 Set Fluoroscopy KV
  2501. glo_arFrame["FLM"] = tFrameMapItem(HWFLM); //3.2.2 Set Fluoroscopy MA
  2502. glo_arFrame["FLI"] = tFrameMapItem(HWFLI); //3.2.3 Fluoroscopy Interval Timer
  2503. glo_arFrame["FLT"] = tFrameMapItem(HWFLT); //3.2.4 Fluoroscopy Accumulative Timer
  2504. glo_arFrame["FLS"] = tFrameMapItem(HWFLS); //3.2.5 Set Fluoroscopy Pulses Per Second (PPS)
  2505. glo_arFrame["FPW"] = tFrameMapItem(HWFPW); //3.2.6 Set Fluoroscopy pulse width
  2506. glo_arFrame["FLF"] = tFrameMapItem(HWFLF); //3.2.7 Set Fluoroscopy Mode
  2507. glo_arFrame["FLP"] = tFrameMapItem(HWFLP); //3.2.8 Fluoroscopy Preparation
  2508. glo_arFrame["FLX"] = tFrameMapItem(HWFLX); //3.2.9 Fluoroscopy Exposure
  2509. glo_arFrame["FLA"] = tFrameMapItem(HWFLA); //3.2.10 Fluoroscopy Automatic Brightness Stabilization (ABS) Control
  2510. glo_arFrame["FLZ"] = tFrameMapItem(HWFLZ); //3.2.11 Fluoroscopy II Magnification Control
  2511. glo_arFrame["FLR"] = tFrameMapItem(HWFLR); //3.2.12 Fluoroscopy Time Reset
  2512. glo_arFrame["FLD"] = tFrameMapItem(HWFLD); //3.2.13 Fluoroscopy Dose Level
  2513. glo_arFrame["RF"] = tFrameMapItem(HWRF); //3.2.14 Refresh Fluoroscopy Data
  2514. glo_arFrame["FLC"] = tFrameMapItem(HWFLC); //3.2.15 Fluoroscopy to Rad kV Transfer Curve
  2515. glo_arFrame["FLO"] = tFrameMapItem(HWFLO); //3.2.16 Fluoroscopy ABS Curve
  2516. glo_arFrame["ABS"] = tFrameMapItem(HWABS); //3.2.17 Fluoroscopy Automatic Brightness Stabilization (ABS) Brightness
  2517. glo_arFrame["FAT"] = tFrameMapItem(HWFAT); //3.2.18 Fluoroscopy Automatic Brightness Stabilization (ABS) Target Brightness
  2518. glo_arFrame["FHD"] = tFrameMapItem(HWFHD); //3.2.19 Fluoroscopy Automatic Brightness Stabilization (ABS) Half Dose Control
  2519. //3.3 SYSTEM COMMANDS
  2520. glo_arFrame["EWS"] = tFrameMapItem(HWEWS); //3.3.1 Work Station Selection
  2521. glo_arFrame["EHE"] = tFrameMapItem(HWEHE); //3.3.2 Percentage Anode Tube Heat
  2522. glo_arFrame["EHH"] = tFrameMapItem(HWEHH); //3.3.3 Percentage Housing Tube Heat
  2523. glo_arFrame["ERR"] = tFrameMapItem(HWERR); //3.3.4 Generator Error Indicator
  2524. glo_arFrame["EWN"] = tFrameMapItem(HWEWN); //3.3.5 Generator Warning Indicator
  2525. glo_arFrame["ERS"] = tFrameMapItem(HWERS); //3.3.6 Refresh System Data
  2526. glo_arFrame["EEC"] = tFrameMapItem(HWEEC); //3.3.7 Echo
  2527. glo_arFrame["EST"] = tFrameMapItem(HWEST); //3.3.8 Status
  2528. glo_arFrame["RSA"] = tFrameMapItem(HWRSA); //3.3.9 Set APR Data
  2529. glo_arFrame["RSX"] = tFrameMapItem(HWRSX); //3.3.10 Set MX APR Data
  2530. glo_arFrame["FAR"] = tFrameMapItem(HWFAR); //3.3.11 Set fluoroscopy APR Data
  2531. glo_arFrame["EGR"] = tFrameMapItem(HWEGR); //3.3.12 Generator Software Revision
  2532. glo_arFrame["EME"] = tFrameMapItem(HWEME); //3.3.13 Multiple Energy
  2533. glo_arFrame["ERE"] = tFrameMapItem(HWERE); //3.3.14 Reset device
  2534. glo_arFrame["EXB"] = tFrameMapItem(HWEXB); //3.3.15 Exposure Enable
  2535. glo_arFrame["EXP"] = tFrameMapItem(HWEXP); //3.3.16 Exposure Permit
  2536. glo_arFrame["EXM"] = tFrameMapItem(HWEXM); //3.3.17 Exposure mode
  2537. glo_arFrame["TIC"] = tFrameMapItem(HWTIC); //3.3.18 Request detector window
  2538. glo_arFrame["EXO"] = tFrameMapItem(HWEXO); //3.3.19 Exposure Permit
  2539. glo_arFrame["IPS"] = tFrameMapItem(HWIPS); //3.3.20 Save picture in Last Image Hold
  2540. glo_arFrame["IPM"] = tFrameMapItem(HWIPM); //3.3.21 Image Mirror
  2541. glo_arFrame["IPF"] = tFrameMapItem(HWIPF); //3.3.22 Image Flip
  2542. glo_arFrame["IPR"] = tFrameMapItem(HWIPR); //3.3.23 Image Rotate
  2543. glo_arFrame["ISS"] = tFrameMapItem(HWISS); //3.3.24 Save Single Frame
  2544. glo_arFrame["IAS"] = tFrameMapItem(HWIAS); //3.3.25 Auto Save
  2545. glo_arFrame["ISC"] = tFrameMapItem(HWISC); //3.3.26 Save Current Image
  2546. glo_arFrame["ISM"] = tFrameMapItem(HWISM); //3.3.27 Swap Monitors
  2547. glo_arFrame["ICC"] = tFrameMapItem(HWICC); //3.3.28 Contrast Contorl
  2548. glo_arFrame["IBC"] = tFrameMapItem(HWIBC); //3.3.29 Brightness Contorl
  2549. glo_arFrame["SUB"] = tFrameMapItem(HWSUB); //3.3.30 Subtraction
  2550. glo_arFrame["IRM"] = tFrameMapItem(HWIRM); //3.3.31 Road Map
  2551. glo_arFrame["IRF"] = tFrameMapItem(HWIRF); //3.3.32 Recursive Filter
  2552. //3.4 DAP COMMANDS
  2553. glo_arFrame["EDA"] = tFrameMapItem(HWEDA); //3.4.1 Read DAP Accumulated Value
  2554. glo_arFrame["EDR"] = tFrameMapItem(HWEDR); //3.4.2 Read DAP Rate Value
  2555. glo_arFrame["EDZ"] = tFrameMapItem(HWEDZ); //3.4.3 Zero Accumulated DAP Value
  2556. glo_arFrame["EDS"] = tFrameMapItem(HWEDS); //3.4.4 DAP Status
  2557. glo_arFrame["EAK"] = tFrameMapItem(HWEAK); //3.4.5 Read Air Kerm
  2558. glo_arFrame["EAR"] = tFrameMapItem(HWEAR); //3.4.6 Read Air Kerm Rate
  2559. //3.5 MECHNICAL COMMANDS
  2560. glo_arFrame["PPN"] = tFrameMapItem(HWPPN); //3.5.1 Position Number Value
  2561. glo_arFrame["PSM"] = tFrameMapItem(HWPSM); //3.5.2 Position Status message
  2562. glo_arFrame["PGS"] = tFrameMapItem(HWPGS); //3.5.3 Detect Grid Status
  2563. glo_arFrame["SID"] = tFrameMapItem(HWSID); //3.5.4 Set SID
  2564. glo_arFrame["GBS"] = tFrameMapItem(HWGBS); //3.5.5 Patient Body size
  2565. glo_arFrame["VID"] = tFrameMapItem(HWVID); //3.5.6 Procedure&View ID
  2566. //3.6 COLLIMATOR COMMANDS
  2567. glo_arFrame["CFS"] = tFrameMapItem(HWCFS); //3.6.1 Set Collimator Size
  2568. glo_arFrame["CFT"] = tFrameMapItem(HWCFT); //3.6.2 Set Collimator Filter
  2569. glo_arFrame["CFN"] = tFrameMapItem(HWCFN); //3.6.3 Get Collimator Filter Thickness
  2570. glo_arFrame["CFL"] = tFrameMapItem(HWCFL); //3.6.4 Control Collimator Light
  2571. glo_arFrame["CFR"] = tFrameMapItem(HWCFR); //3.6.5 Control Collimator Rotate
  2572. glo_arFrame["CFD"] = tFrameMapItem(HWCFD); //3.6.6 Control Collimator Distance
  2573. //3.7 SERVICE COMMANDS
  2574. glo_arFrame["ESM"] = tFrameMapItem(HWESM); //3.7.1 Enter Service Mode
  2575. glo_arFrame["SCM"] = tFrameMapItem(HWSCM); //3.7.2 Start Calibration Mode
  2576. glo_arFrame["ECM"] = tFrameMapItem(HWECM); //3.7.3 End Calibration
  2577. glo_arFrame["QGD"] = tFrameMapItem(HWQGD); //3.7.4 Query Generator Data
  2578. glo_arFrame["CPD"] = tFrameMapItem(HWCPD); //3.7.5 Calibration Parameters Data
  2579. glo_arFrame["FCP"] = tFrameMapItem(HWFCP); //3.7.6 Fluoro Calibration Parameters
  2580. glo_arFrame["FCD"] = tFrameMapItem(HWFCD); //3.7.7 Filament Current Data
  2581. glo_arFrame["AEM"] = tFrameMapItem(HWAEM); //3.7.8 Actual Exposure Current
  2582. glo_arFrame["CCR"] = tFrameMapItem(HWCCR); //3.7.9 Current Calibration Result
  2583. glo_arFrame["WSC"] = tFrameMapItem(HWWSC); //3.7.10 Workstation Configration
  2584. glo_arFrame["NSD"] = tFrameMapItem(HWNSD); //3.7.11 Number of Shot to Dropout
  2585. glo_arFrame["AHS"] = tFrameMapItem(HWAHS); //3.7.12 Always In High Speed
  2586. glo_arFrame["LSB"] = tFrameMapItem(HWLSB); //3.7.13 Low Speed Brake
  2587. glo_arFrame["TBC"] = tFrameMapItem(HWTBC); //3.7.14 Tube Configration
  2588. glo_arFrame["TRP"] = tFrameMapItem(HWTRP); //3.7.15 Rating Percentage of Tube
  2589. glo_arFrame["GRP"] = tFrameMapItem(HWGRP); //3.7.16 Rating Percentage of Generator
  2590. glo_arFrame["THL"] = tFrameMapItem(HWTHL); //3.7.17 Tube Heat Limitation
  2591. glo_arFrame["LKV"] = tFrameMapItem(HWLKV); //3.7.18 Limitation of KV
  2592. glo_arFrame["NEX"] = tFrameMapItem(HWNEX); //3.7.19 Number of Exposures
  2593. glo_arFrame["GEL"] = tFrameMapItem(HWGEL); //3.7.20 Generator Error Log
  2594. glo_arFrame["DGC"] = tFrameMapItem(HWDGC); //3.7.21 Detect Grid Config
  2595. glo_arFrame["SPC"] = tFrameMapItem(HWSPC); //3.7.22 Serail Port Configration
  2596. //Almax特有指令
  2597. glo_arFrame["PZM"] = tFrameMapItem(HWPZM); //Flat Panel Field Selection
  2598. glo_arFrame["SSD"] = tFrameMapItem(HWSSD); //System Shut Down
  2599. glo_arFrame["VNE"] = tFrameMapItem(HWVNE); //Exam Seletcion
  2600. glo_arFrame["DSA"] = tFrameMapItem(HWDSA); //Set DSA
  2601. glo_arFrame["IPL"] = tFrameMapItem(HWIPL); //Start /stop the cine loop of a sequence
  2602. glo_arFrame["INT"] = tFrameMapItem(HWINT); //Select the previous or next image in a run
  2603. glo_arFrame["IST"] = tFrameMapItem(HWIST); //Select a previous or subsequent run
  2604. }
  2605. bool nsGEN::CGEN_DEV_IDETEC_Almax::StartHardwareStatusThread()
  2606. {
  2607. FINFO("enter Start HardwareStatus Thread ");
  2608. if (m_pHardwareStatusThread == NULL)
  2609. {
  2610. DWORD m_HardwareStatusID;
  2611. m_pHardwareStatusThread = CreateThread(0, 0, HardwareStatusThread, this, 0, &m_HardwareStatusID);
  2612. if (m_pHardwareStatusThread == NULL)
  2613. {
  2614. FERROR("Start HardwareStatus Thread Failed");
  2615. return false;
  2616. }
  2617. //DWORD m_HardwareReSendID;
  2618. //m_pHardwareRsSendThread = CreateThread(0, 0, HardwareReSendThread, this, 0, &m_HardwareReSendID);
  2619. //if (m_pHardwareRsSendThread == NULL)
  2620. //{
  2621. // FERROR("Start HardwareReSend Thread Failed");
  2622. // return false;
  2623. //}
  2624. }
  2625. return true;
  2626. }
  2627. DWORD nsGEN::CGEN_DEV_IDETEC_Almax::HardwareStatusThread(LPVOID pParam)
  2628. {
  2629. CGEN_DEV_IDETEC_Almax* pCurGen = (CGEN_DEV_IDETEC_Almax*)pParam;
  2630. if (pCurGen == NULL)
  2631. {
  2632. return false;
  2633. }
  2634. FINFO("HardwareStatusThread start");
  2635. if ((int)pCurGen->m_GenConfig["loopTime"] >= 0)
  2636. {
  2637. pCurGen->m_iLoopTime = (int)pCurGen->m_GenConfig["loopTime"];
  2638. }
  2639. FINFO("loopTime = {$}", pCurGen->m_iLoopTime.load());
  2640. int currtTime = pCurGen->m_iLoopTime;
  2641. while (pCurGen->m_iLoopTime > 0)
  2642. {
  2643. //心跳包统计加1
  2644. pCurGen->m_iHeartBeats++;
  2645. int tempHeartBeat = pCurGen->m_iHeartBeats;
  2646. if (tempHeartBeat > 10) //无返回信息认为连接断开
  2647. {
  2648. pCurGen->m_iHeartBeats = 0;
  2649. FINFO("AlmaxGEN: lost Connect \n");
  2650. pCurGen->m_bConnectFlag = false;
  2651. continue;
  2652. }
  2653. //发送心跳
  2654. //pCurGen->HWSendHBCMD("EEC9", 4);
  2655. //轮询发生器温度信息
  2656. pCurGen->HWSendHBCMD("EHE", 3);
  2657. }
  2658. FINFO("HardwareStatusThread stop");
  2659. return true;
  2660. }