1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737 |
- #include "stdafx.h"
- #include "GEN.DEV.IDETEC_Almax.h"
- namespace nsGEN = CCOS::Dev::Detail::Generator;
- #define Almax_LoopDefHBTime 1000
- //生成命令校验和:cmdData 为 <CMD> [<,> <ARG>]...<,> 其长度要多出3个字符用于存放 STX、CSUM、ETX
- char ComputeCheckSum(char* cmdData, int& size)
- {
- if (size + 3 >= Almax_Com_ReSendLen)
- {
- return 0x00;
- }
- int AsciiSum = Almax_STX + Almax_ETX;
- char TempCMD[Almax_Com_ReSendLen] = { 0 };
- TempCMD[0] = Almax_STX;
- for (int i = 0; i < size; i++) //每字节相加
- {
- AsciiSum += cmdData[i];
- TempCMD[i + 1] = cmdData[i];
- }
- TempCMD[size + 1] = (char)Almax_ETX;
- //if (0x00 <= AsciiSum && AsciiSum <= 0xFF)
- {
- TempCMD[size + 2] = (char)AsciiSum;
- memcpy(cmdData, TempCMD, size + 4);
- size += 3;
- //mLog::Debug("ComputeCheckSum:[0x{$:x}]", AsciiSum);
- return (char)AsciiSum;
- }
- //else
- //{
- // //mLog::Debug("ComputeCheckSum:[0x00]");
- // return 0x00;
- //}
- //return 0xFF;
- }
- //-----------------------------------------------------------------------------
- // CGEN_DEV_IDETEC_Almax
- //-----------------------------------------------------------------------------
- atomic<int> nsGEN::CGEN_DEV_IDETEC_Almax::m_iLoopTime = Almax_LoopDefHBTime;
- CcosAttrKey::UNIT_CTRL_TYPE nsGEN::CGEN_DEV_IDETEC_Almax::m_nNotifyType = CcosAttrKey::CTRL_CallBackFun;
- nsGEN::CGEN_DEV_IDETEC_Almax::CGEN_DEV_IDETEC_Almax(string configfile)
- {
- //其余属性初始化
- ResDataObject temp;
- temp.loadFile(configfile.c_str());
- m_GenConfig = temp["CONFIGURATION"];
- m_pHardwareStatusThread = NULL;
- m_bExpEnable = false;
- m_iHeartBeats = 0;
- m_bConnectFlag = true;
- m_pDevicePath = "UniversalUnit";
- //日志方式
- string version;
- if (GetVersion(version, hMyModule))
- mLog::Info("\n===============log begin : version:{$} ===================\n", version.c_str());
- else
- mLog::Info("\n===============log begin : version:0.0.0.0 ===================\n");
- //设置发生器属性集合各个值的范围及精度
- //硬件参数
- m_TubeInfo.reset(new StringMould(CcosAttrKey::TUBEINFO, "unKnow"));
- m_TubeTargetMaterial.reset(new StringMould(CcosAttrKey::TUBETARGETMATERIAL, CcosAttrKey::TYPE::MO));
- m_TubeAngle.reset(new IntMould(CcosAttrKey::TUBEANGLE,0.0, -180.0, 180.0, 1.0));
- m_TubeHE.reset(new FloatMould(CcosAttrKey::TUBEHEAT, 0.0, 0.0, 100.0, 1.0));
- m_GenHE.reset(new FloatMould(CcosAttrKey::DENHEAT, 0.0, 0.0, 100.0, 1.0));
- m_BatteryChargeState.reset(new IntMould(CcosAttrKey::BATTERYCHARGESTATE, CcosAttrKey::CHARGE_STATUS_OFF, CcosAttrKey::CHARGE_STATUS_OFF, CcosAttrKey::CHARGE_STATUS_MAX, 1));
- m_BatteryPowerState.reset(new IntMould(CcosAttrKey::BATTERYPOWERSTATE, 100, 0, 100, 1));
- m_GenSynState.reset(new IntMould(CcosAttrKey::GENHANDSWITCH, CcosAttrKey::GENERATOR_RAD_OFF, CcosAttrKey::GENERATOR_SYNC_ERR, CcosAttrKey::GENERATOR_SYNC_MAX, 1));
- m_GenState.reset(new IntMould(CcosAttrKey::GENSTATE, CcosAttrKey::GENERATOR_STATUS_STANDBY, CcosAttrKey::GENERATOR_STATUS_SHUTDOWN, CcosAttrKey::GENERATOR_STATUS_MAX, 1.0));
- m_Handswitch.reset(new IntMould(CcosAttrKey::GENHANDSWITCH, CcosAttrKey::HANDSWITCH_STATUS_Release, CcosAttrKey::HANDSWITCH_STATUS_Release, CcosAttrKey::HANDSWITCH_STATUS_MAX, 1.0));
- m_Footswitch.reset(new IntMould(CcosAttrKey::GENFOOTSWITCH, CcosAttrKey::FOOTSWITCH_STATUS_Release, CcosAttrKey::FOOTSWITCH_STATUS_Release, CcosAttrKey::FOOTSWITCH_STATUS_MAX, 1.0));
- //点片参数
- m_RadKV.reset(new FloatMould(CcosAttrKey::RADKV, 40.0, 40.0, 150.0, 1.0)); //接口协议范围:20-49
- m_RadMA.reset(new FloatMould(CcosAttrKey::RADMA, 10.0, 10.0, 1000.0, 1.0));
- m_RadMS.reset(new FloatMould(CcosAttrKey::RADMS, 1.0, 1.0, 6300, 1.0));
- m_RadMAS.reset(new FloatMould(CcosAttrKey::RADMAS, 0.1, 0.1, 1000.0, 1.0));
- m_RadTechmode.reset(new IntMould(CcosAttrKey::RADTECHMODE, CcosAttrKey::TECHMODE_NOAEC_2P, CcosAttrKey::TECHMODE_NOAEC_3P, CcosAttrKey::TECHMODE_MAX, 1));
- m_RadFocus.reset(new IntMould(CcosAttrKey::RADFOCUS, CcosAttrKey::FOCUS_SMALL, CcosAttrKey::FOCUS_SMALL, CcosAttrKey::FOCUS_MAX, 1));
- m_RadAECField.reset(new IntMould(CcosAttrKey::RADAECFIELD, 0, 0, 111, 1));
- m_RadAECFilm.reset(new IntMould(CcosAttrKey::RADAECFILM, 0, 0, 2, 1));
- m_RadAECDensity.reset(new FloatMould(CcosAttrKey::RADAECDENSITY, 0, -4, 4, 1));
- m_RadFrameRate.reset(new IntMould(CcosAttrKey::FRAMERATE, 0, 0, 16, 1));
- m_PostKV.reset(new FloatMould(CcosAttrKey::POSTKV, 0.0, 0.0, 50.0, 1.0));
- m_PostMA.reset(new FloatMould(CcosAttrKey::POSTMA, 0.0, 0.0, 200.0, 0.1));
- m_PostMS.reset(new FloatMould(CcosAttrKey::POSTMS, 0.0, 0.0, 12000.0, 0.01));
- m_PostMAS.reset(new FloatMould(CcosAttrKey::POSTMAS, 0.0, 0.0, 600.0, 0.01));
- m_ExpMode.reset(new StringMould(CcosAttrKey::EXPMODE, CcosAttrKey::TYPE::Single));
- m_EXAMMode.reset(new StringMould(CcosAttrKey::EXAMMODE, CcosAttrKey::TYPE::MANUAL));
- //透视参数
- m_FluKV.reset(new FloatMould(CcosAttrKey::FLUKV, 40.0, 40.0, 125.0, 1.0));
- m_FluMA.reset(new FloatMould(CcosAttrKey::FLUMA, 0.5, 0.5, 20.0, 1.0));
- m_FluMS.reset(new FloatMould(CcosAttrKey::FLUMS, 1.0, 1.0, 1000.0, 1.0));
- m_FluMAS.reset(new FloatMould(CcosAttrKey::FLUMAS, 0.5, 0.5, 1000.0, 1.0));
- m_FluPPS.reset(new IntMould(CcosAttrKey::FLUPPS, 0, 0, 16, 1));
- m_FluABSStatus.reset(new IntMould(CcosAttrKey::FLUABSStatus, 0, 0, 4, 1));
- m_FluDoseLever.reset(new IntMould(CcosAttrKey::FLUDoseLevel, 0, 0, 10, 1));
- m_FluFMode.reset(new IntMould(CcosAttrKey::FLUMode, CcosAttrKey::GENERATOR_FLMODE_NOTFLU, CcosAttrKey::GENERATOR_FLMODE_NOTFLU, CcosAttrKey::GENERATOR_FLMODE_MAX, 1));
- m_FluIntTime.reset(new FloatMould(CcosAttrKey::FLUIntTime, 0.0, 0.0, 300000.0, 1.0));
- m_FluAccTime.reset(new FloatMould(CcosAttrKey::FLUAccTime, 0.0, 0.0, 300000.0, 1.0));
- //发生器告警及错误消息
- m_MSGUnit.reset(new nsDetail::MSGUnit(m_pDevicePath));
- //读取配置固定值
- GetUnitHWValueFromCFG();
- glo_nCMDType_WaitTime = glo_tDelivermodule.SetPriority(true, false, false, true, 100);
- glo_nCMDType_HB = glo_tDelivermodule.SetPriority(false, true, false, true, 50);
- glo_nCMDType_WaitACK = glo_tDelivermodule.SetPriority(true, false, 3, false, 0, true, 1000);
- mLog::Info("m_nCMDType_WaitTime[{$}]m_nCMDType_HB[{$}] m_nCMDType_WaitACK[{$}]", glo_nCMDType_WaitTime, glo_nCMDType_HB, glo_nCMDType_WaitACK);
- //配置响应操作对照表 供发生器回传的数据触发相应的操作
- OnCallBack();
- //重置发生器
- Reset();
- Sleep(500);
- //以下进行默认设置,需要注意默认值是否正确
- RefreshData(); //刷新初始数值
- //启动硬件状态轮询进程
- StartHardwareStatusThread();
- }
- nsGEN::CGEN_DEV_IDETEC_Almax::~CGEN_DEV_IDETEC_Almax()
- {
- mLog::Info("\n===============log GEN end ===================\n");
-
- if (m_pHardwareStatusThread != NULL)
- {
- TerminateThread(m_pHardwareStatusThread, 0);
- m_pHardwareStatusThread = NULL;
- }
- glo_arFrame.clear();
- }
- std::string nsGEN::CGEN_DEV_IDETEC_Almax::GetGUID()
- {
- mLog::Info("===============GetGUID : {$} ===================\n", GeneratorUnitType);
- return GeneratorUnitType;
- }
- std::string nsGEN::CGEN_DEV_IDETEC_Almax::GetResource()
- {
- return "";
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::GetUnitHWValueFromCFG()
- {
- //发生器模块消息上报方式
- if (m_GenConfig.GetKeyCount("NotifyType") > 0)
- {
- int tempValue = (int)m_GenConfig["NotifyType"];
- m_nNotifyType = (CcosAttrKey::UNIT_CTRL_TYPE)tempValue;
- switch (m_nNotifyType)
- {
- case CcosAttrKey::CTRL_PlatformInterface:
- {
- mLog::Debug("NotifyType:PlatformInterface");
- }break;
- case CcosAttrKey::CTRL_Center:
- {
- mLog::Debug("NotifyType:Center");
- m_EventCenter.reset(new IOEventCenter);
- }break;
- case CcosAttrKey::CTRL_CallBackFun:
- {
- mLog::Debug("NotifyType:CallBackFun");
- }break;
- default:
- break;
- }
- }
- //同步模式
- m_arrWSMap.clear();
- if (m_GenConfig.GetKeyCount("WSTable") > 0)
- {
- int WSNamber = (int)m_GenConfig["WSTable"];
- EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNTable"]);
- m_arrWSMap[cfgWorkStationKey("Table", CcosAttrKey::TABLE)] = cfgWorkStationData("Table", WSNamber, WSSYN);
- mLog::Debug("cfg Table WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
- }
- if (m_GenConfig.GetKeyCount("WSWall") > 0)
- {
- int WSNamber = (int)m_GenConfig["WSWall"];
- EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNWall"]);
- m_arrWSMap[cfgWorkStationKey("Wall", CcosAttrKey::WALL)] = cfgWorkStationData("Wall", WSNamber, WSSYN);
- mLog::Debug("cfg Wall WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
- }
- if (m_GenConfig.GetKeyCount("WSFree") > 0)
- {
- int WSNamber = (int)m_GenConfig["WSFree"];
- EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNFree"]);
- m_arrWSMap[cfgWorkStationKey("Free", CcosAttrKey::MOBILE)] = cfgWorkStationData("Free", WSNamber, WSSYN);
- mLog::Debug("cfg Free WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
- }
- if (m_GenConfig.GetKeyCount("WSTomo") > 0)
- {
- int WSNamber = (int)m_GenConfig["WSTomo"];
- EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNTomo"]);
- m_arrWSMap[cfgWorkStationKey("Tomo", CcosAttrKey::TOMO)] = cfgWorkStationData("Tomo", WSNamber, WSSYN);
- mLog::Debug("cfg Tomo WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
- }
- if (m_GenConfig.GetKeyCount("WSConventional") > 0)
- {
- int WSNamber = (int)m_GenConfig["WSConventional"];
- EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNConventional"]);
- m_arrWSMap[cfgWorkStationKey("Direct", CcosAttrKey::CONVENTIONAL)] = cfgWorkStationData("Direct", WSNamber, WSSYN);
- mLog::Debug("cfg Conventional WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
- }
- //球管信息
- if (m_GenConfig.GetKeyCount(CcosConfKey::CcosTubeInfo) > 0)
- {
- string tempValue = m_GenConfig[CcosConfKey::CcosTubeInfo];
- m_TubeInfo->Update(tempValue);
- FireNotify(m_TubeInfo->GetKey(), m_TubeInfo->JSGet());
- }
- if (m_GenConfig.GetKeyCount(CcosConfKey::CcosFocusSmall) > 0)
- {
- float tempValue = (float)m_GenConfig[CcosConfKey::CcosFocusSmall];
- m_FocusSmall = tempValue;
- }
- if (m_GenConfig.GetKeyCount(CcosConfKey::CcosFocusLarge) > 0)
- {
- float tempValue = (float)m_GenConfig[CcosConfKey::CcosFocusLarge];
- m_FocusLarge = tempValue;
- }
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetWS(const string value) //发生器无此设置
- {
- mLog::Debug("Enter SetWS {$}", value.c_str());
- int tempws = 1;
- string strWS = "";
- cfgWorkStationKey trWS = cfgWorkStationKey(value.c_str());
- if (m_arrWSMap.find(trWS) != m_arrWSMap.end())
- {
- m_strCurrentWSName = trWS;
- tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
- strWS = m_arrWSMap[m_strCurrentWSName].strWSNAme;
- mLog::Debug("Set WS number [{$}][{$}]", strWS.c_str(), tempws);
- }
- else
- {
- mLog::Debug("Set WS number default 1");
- m_strCurrentWSName = cfgWorkStationKey(1);
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "WS%1d", tempws);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpSYN(EnSYNMode value)
- {
- mLog::Debug("Enter SetExpSYN {$}", (int)value);
- int tempws = 0;
- switch (value)
- {
- case EnSYNMode::EXPOSURE_SYNMODE_HARDWARE_SYNBOX:
- case EnSYNMode::EXPOSURE_SYNMODE_DIRCETCONNECT_NOSYNBOX:
- tempws = 0;
- break;
- case EnSYNMode::EXPOSURE_SYNMODE_SOFTWARE_NOSYNBOX:
- tempws = 1;
- break;
- default:
- break;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "EXM%1d", tempws);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpEnable() //发生器无此设置
- {
- return HWSendWaittimeCMD("EXB1", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpDisable() //发生器无此设置
- {
- return HWSendWaittimeCMD("EXB0", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::Reset()
- {
- mLog::Debug("Enter Reset");
- //int level = 0;
- //m_MSGUnit->DelErrorMessage("0", level, "clear all errors");
- return HWSendWaittimeCMD("ERE", 1);//仅重置错误状态
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::RefreshData()
- {
- mLog::Debug("Enter RefreshData");
- //HWSendWaittimeCMD("ERS", 3);
- //HWSendWaittimeCMD("RR", 2);
- //HWSendWaittimeCMD("RF", 2);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetGenSynState(int value) //发生器无此设置:AEC二阶段曝光使用
- {
- mLog::Debug("Enter SetGenSynState[{$}]->[{$}]", m_GenSynState->Get(), value);
- switch (value)
- {
- case CcosAttrKey::GENERATOR_RAD_OFF:
- {}break;
- case CcosAttrKey::GENERATOR_RAD_PREPARE:
- {}break;
- case CcosAttrKey::GENERATOR_RAD_READY:
- {
- if (value == 3)
- {
- if (m_arrWSMap.find(m_strCurrentWSName) != m_arrWSMap.end())
- {
- if (m_arrWSMap[m_strCurrentWSName].nWSSYN == EXPOSURE_SYNMODE_SOFTWARE_NOSYNBOX)
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_XRAYON))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- mLog::Debug("SetGenSynState: in softSYN,turn to RAD_XRAYON and send XR1");
- char temp[50] = { 0 };
- sprintf_s(temp, "EXP%01d", 1);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- else
- {
- mLog::Debug("SetGenSynState:WS[{$}:{$}] can't use SOFTWARE_NOSYNBOX", m_arrWSMap[m_strCurrentWSName].strWSNAme.c_str(), (int)m_arrWSMap[m_strCurrentWSName].nWSSYN);
- }
- }
- else
- {
- mLog::Debug("SetGenSynState:WS[{$}] not config", m_strCurrentWSName.nWSID);
- }
- }
- else
- {
- mLog::Debug("SetGenSynState: generator is not in ready status, can't send XR1 command");
- }
- }break;
- case CcosAttrKey::GENERATOR_RAD_XRAYON:
- {}break;
- case CcosAttrKey::GENERATOR_RAD_XRAYOFF:
- {}break;
- case CcosAttrKey::GENERATOR_FLU_OFF:
- {}break;
- case CcosAttrKey::GENERATOR_FLU_READY:
- {}break;
- case CcosAttrKey::GENERATOR_FLU_XRAYON:
- {}break;
- case CcosAttrKey::GENERATOR_FLU_XRAYOFF:
- {}break;
- default:
- break;
- }
- if (m_GenSynState->Update(value))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetGenState(int value) //发生器无此设置
- {
- mLog::Debug("Enter SetGenSynState[{$}]->[{$}]", m_GenState->Get(), value);
- switch (value)
- {
- case CcosAttrKey::GENERATOR_STATUS_SHUTDOWN:
- {}break;
- case CcosAttrKey::GENERATOR_STATUS_INIT:
- {}break;
- case CcosAttrKey::GENERATOR_STATUS_SLEEP:
- {}break;
- case CcosAttrKey::GENERATOR_STATUS_CHARGING:
- {}break;
- case CcosAttrKey::GENERATOR_STATUS_STANDBY:
- {}break;
- case CcosAttrKey::GENERATOR_STATUS_EXP:
- {}break;
- case CcosAttrKey::GENERATOR_STATUS_ERROR:
- {}break;
- default:
- break;
- }
- if (m_GenState->Update(value))
- FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::Clear_DAP()
- {
- //char temp[50] = { 0 };
- //sprintf_s(temp, "EDZ");
- return HWSendWaittimeCMD("EDZ", 3);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetValue_DAP(float& value)
- {
- //char temp[50] = { 0 };
- //sprintf_s(temp, "EDA");
- return HWSendWaittimeCMD("EDA", 3);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetDetectorWindow(bool value)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "TIC%1d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExposurePermit(bool value)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "EXO%1d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::SetNotifyCallBack(callBackFun fun)
- {
- m_funV2DynamicCallBackFun = fun;
- }
- //发生器支持的通用点片命令
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadKV()
- {
- if (!m_RadKV->CanInc()) return RET_STATUS::RET_FAILED;
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RKVI");
- return HWSendWaittimeCMD("RKVI", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadKV()
- {
- if (!m_RadKV->CanDec()) return RET_STATUS::RET_FAILED;
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RKVD");
- return HWSendWaittimeCMD("RKVD", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadKV(float value)
- {
- if (!m_RadKV->Verify(value)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "RKV%04d", (int)(value*10));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadMA()
- {
- if (!m_RadMA->CanInc()) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
- {
- mLog::Info("Techmode is 2Point, Cannot inc MA \n");
- return RET_STATUS::RET_FAILED;
- }
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RMAI");
- return HWSendWaittimeCMD("RMAI", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadMA()
- {
- if (!m_RadMA->CanDec()) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
- {
- mLog::Info("Techmode is 2Point, Cannot dec MA \n");
- return RET_STATUS::RET_FAILED;
- }
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RMAD");
- return HWSendWaittimeCMD("RMAD", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadMA(float value)
- {
- if (!m_RadMA->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
- {
- mLog::Info("Techmode is 2Point, Cannot set MA \n");
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "RMA%06d", (int)(value*100));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadMS()
- {
- if (!m_RadMS->CanInc()) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
- {
- mLog::Info("Techmode is 2Point, Cannot inc MS \n");
- return RET_STATUS::RET_FAILED;
- }
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RMSI");
- return HWSendWaittimeCMD("RMSI", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadMS()
- {
- if (!m_RadMS->CanDec()) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
- {
- mLog::Info("Techmode is 2Point, Cannot dec MS \n");
- return RET_STATUS::RET_FAILED;
- }
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RMSD");
- return HWSendWaittimeCMD("RMSD", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadMS(float value)
- {
- if (!m_RadMS->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_2P)
- {
- mLog::Info("Techmode is 2Point, Cannot set MS \n");
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "RMS%07d", (int)(value*100));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncRadMAS()
- {
- if (!m_RadMAS->CanInc()) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_3P)
- {
- mLog::Info("Techmode is 3Point, Cannot inc MAS \n");
- return RET_STATUS::RET_FAILED;
- }
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RMXI");
- return HWSendWaittimeCMD("RMXI", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecRadMAS()
- {
- if (!m_RadMAS->CanDec()) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_3P)
- {
- mLog::Info("Techmode is 3Point, Cannot dec MAS \n");
- return RET_STATUS::RET_FAILED;
- }
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RMXD");
- return HWSendWaittimeCMD("RMXD", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadMAS(float value)
- {
- if (!m_RadMAS->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_AEC_3P)
- {
- mLog::Info("Techmode is 3Point, Cannot set MAS \n");
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "RMX%07d", (int)(value * 1000));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFocus(int value)
- {
- if (!m_RadFocus->Verify(value)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "RFO%01d", (int)value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetTechmode(int value)
- {
- if (!m_RadTechmode->Verify(value)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "RET%01d", (int)value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAECDensity(int value) //发生器无此设置
- {
- if (!m_RadAECDensity->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P)
- {
- mLog::Info("Techmode is not AEC, Cannot set Density \n");
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "RFN%+1d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAECField(int value) //发生器无此设置
- {
- if (!m_RadAECField->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P)
- {
- mLog::Info("Techmode is not AEC, Cannot set Field \n");
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "RFS%03d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAECFilm(int value) //发生器无此设置
- {
- if (!m_RadAECFilm->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_3P ||
- m_RadTechmode->Get() == CcosAttrKey::TECHMODE_NOAEC_2P)
- {
- mLog::Info("Techmode is not AEC, Cannot set Film \n");
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- sprintf_s(temp, "RFS%1d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAPR(const _tAPRArgs& t)
- {
- mLog::Info("APR:WS={$},Focus={$},Techmode={$},KV={$},MA={$},MS={$},MAS={$},AECDensity={$},AECFilm={$},AECField={$}",
- t.nWS, t.nFocus, t.nTechmode, t.fKV, t.fMA, t.fMS, t.fMAS, t.nAECDensity, t.nAECFilm, t.nAECField);
-
- int tempws = 1;
- if (m_arrWSMap.find(cfgWorkStationKey(t.nWS)) != m_arrWSMap.end())
- {
- m_strCurrentWSName = cfgWorkStationKey(t.nWS);
- tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
- mLog::Debug("Set WS number {$}", tempws);
- }
- else
- {
- mLog::Debug("Set WS number default 1");
- m_strCurrentWSName = cfgWorkStationKey(t.nWS);
- tempws = t.nWS;
- }
- if (!m_RadKV->Verify(t.fKV))
- {
- mLog::Error("SetAPR:KV Out of bounds[{$}] \n", t.fKV);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_RadMA->Verify(t.fMA) && (t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_3P ||
- t.nTechmode == CcosAttrKey::TECHMODE_AEC_3P ||
- t.nTechmode == CcosAttrKey::TECHMODE_AEC_ReduceMA ||
- t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_MAS_MA ||
- t.nTechmode == CcosAttrKey::TECHMODE_AEC_MAS_MA))
- {
- mLog::Error("SetAPR:MA Out of bounds[{$}] \n", t.fMA);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_RadMS->Verify(t.fMS) && (t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_3P ||
- t.nTechmode == CcosAttrKey::TECHMODE_AEC_3P))
- {
- mLog::Error("SetAPR:MS Out of bounds[{$}] \n", t.fMS);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_RadMAS->Verify(t.fMAS) && (t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_2P ||
- t.nTechmode == CcosAttrKey::TECHMODE_AEC_2P ||
- t.nTechmode == CcosAttrKey::TECHMODE_NOAEC_MAS_MA ||
- t.nTechmode == CcosAttrKey::TECHMODE_AEC_MAS_MA))
- {
- mLog::Error("SetAPR:MAS Out of bounds[{$}] \n", t.fMAS);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_RadFocus->Verify(t.nFocus))
- {
- mLog::Error("SetAPR:Focus Out of bounds[{$}] \n", t.nFocus);
- return RET_STATUS::RET_FAILED;
- }
-
- char temp[50] = { 0 };
- switch (t.nTechmode)
- {
- case CcosAttrKey::TECHMODE_NOAEC_3P:
- {
- sprintf_s(temp, "RSAWS%1dFO%1dET%1dFI%03dFS%1dFN%+1dKV%04dMA%06dMS%07d",
- tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV*10, t.fMA*100, t.fMS*100);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::TECHMODE_NOAEC_2P:
- {
- sprintf_s(temp, "RSXWS%1dFO%1dET%1dFI%03dFS%1dFN%+1dKV%04dMX%07d",
- tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV * 10, t.fMAS * 1000);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::TECHMODE_AEC_3P:
- {
- sprintf_s(temp, "RSAWS%1dFO%1dET%1dFI%03dFS%1dFN%02dKV%04dMA%06dMS%07d",
- tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV * 10, t.fMA * 100, t.fMS * 100);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::TECHMODE_AEC_2P:
- {
- sprintf_s(temp, "RSXWS%1dFO%1dET%1dFI%03dFS%1dFN%02dKV%04dMX%07d",
- tempws, t.nFocus, t.nTechmode, t.nAECFilm, t.nAECField, t.nAECDensity, t.fKV * 10, t.fMAS * 1000);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::TECHMODE_AEC_1P:
- {}break;
- case CcosAttrKey::TECHMODE_AEC_ReduceMA:
- {}break;
- case CcosAttrKey::TECHMODE_NOAEC_MAS_MA:
- {}break;
- case CcosAttrKey::TECHMODE_AEC_MAS_MA:
- {}break;
- default:
- {}break;
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostKV(float& value) //实际为主动上报
- {
- if (m_PostKV->Get() > 0)
- {
- value = m_PostKV->Get();
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostMA(float& value) //实际为主动上报
- {
- if (m_PostMA->Get() > 0)
- {
- value = m_PostMA->Get();
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostMS(float& value) //实际为主动上报
- {
- if (m_PostMS->Get() > 0)
- {
- value = m_PostMS->Get();
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::QueryPostMAS(float& value) //实际为主动上报
- {
- if (m_PostMAS->Get() > 0)
- {
- value = m_PostMAS->Get();
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRadFrameRate(FLOAT frameRate) //发生器无此动态设置
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "RPS%03d", (int)(frameRate*10));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExpMode(std::string value) //发生器无此设置
- {
- mLog::Info("Enter SetExpMode:[{$}]", value.c_str());
- int data = atoi(value.c_str());
- char temp[50] = { 0 };
- sprintf_s(temp, "RMM%1d", data * 10);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetEXAMMode(std::string value) //DMOC实际是通过此接口设置是否启用AEC
- {
- int data = atoi(value.c_str());
- char temp[50] = { 0 };
- sprintf_s(temp, "EXM%1d", data * 10);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- //发生器支持的通用透视命令
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluKV()
- {
- if (!m_FluKV->CanInc()) return RET_STATUS::RET_FAILED;
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RKV%04d", value * 10);
- return HWSendWaittimeCMD("FLK+", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluKV()
- {
- if (!m_FluKV->CanDec()) return RET_STATUS::RET_FAILED;
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RKV%04d", value * 10);
- return HWSendWaittimeCMD("FLK-", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluKV(float value)
- {
- if (!m_FluKV->Verify(value)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "FLK%03d", (int)value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluMA()
- {
- if (!m_FluMA->CanInc()) return RET_STATUS::RET_FAILED;
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RKV%04d", value * 10);
- return HWSendWaittimeCMD("FLM+", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluMA()
- {
- if (!m_FluMA->CanDec()) return RET_STATUS::RET_FAILED;
- //char temp[50] = { 0 };
- //sprintf_s(temp, "RKV%04d", value * 10);
- return HWSendWaittimeCMD("FLM-", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMA(float value)
- {
- if (!m_FluMA->Verify(value)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "FLM%03d", (int)(value * 10));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluMS()
- {
- if (!m_FluMS->CanInc()) return RET_STATUS::RET_FAILED;
- int value = m_FluMS->Get();
- if(m_FluMS->Update(++value))
- FireNotify(m_FluMS->GetKey(), m_FluMS->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluMS()
- {
- if (!m_FluMS->CanDec()) return RET_STATUS::RET_FAILED;
- int value = m_FluMS->Get();
- if (m_FluMS->Update(--value))
- FireNotify(m_FluMS->GetKey(), m_FluMS->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMS(float value)
- {
- if (!m_FluMS->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_FluMS->Update(value))
- FireNotify(m_FluMS->GetKey(), m_FluMS->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncFluMAS()
- {
- if (!m_FluMAS->CanInc()) return RET_STATUS::RET_FAILED;
- int value = m_FluMAS->Get();
- if (m_FluMAS->Update(++value))
- FireNotify(m_FluMAS->GetKey(), m_FluMAS->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecFluMAS()
- {
- if (!m_FluMAS->CanDec()) return RET_STATUS::RET_FAILED;
- int value = m_FluMAS->Get();
- if (m_FluMAS->Update(--value))
- FireNotify(m_FluMAS->GetKey(), m_FluMAS->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMAS(float value)
- {
- if (!m_FluMAS->Verify(value)) return RET_STATUS::RET_FAILED;
- if (m_FluMAS->Update(value))
- FireNotify(m_FluMAS->GetKey(), m_FluMAS->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetPPS(float frameRate)
- {
- if (!m_FluPPS->CanDec()) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "FLS%03d", (int)(frameRate * 10));
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetPPS()
- {
- return HWSendWaittimeCMD("FLS?", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::INCPPS()
- {
- if (!m_FluPPS->CanInc()) return RET_STATUS::RET_FAILED;
- return HWSendWaittimeCMD("FLS+", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DECPPS()
- {
- if (!m_FluPPS->CanDec()) return RET_STATUS::RET_FAILED;
- return HWSendWaittimeCMD("FLS-", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetPluseWidth(float fplusewidth)
- {
- if (!m_FluMS->Verify(fplusewidth)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "FPW%04d", (int)fplusewidth);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSMode(int nMode)
- {
- if (!m_FluABSStatus->Verify(nMode)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "FLA%1d", nMode);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSCurve()
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FLO%1d", 0);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::IncABSCurve()
- {
- return HWSendWaittimeCMD("FLO+", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DecABSCurve()
- {
- return HWSendWaittimeCMD("FLO-", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSValue(float fABSValue)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "ABS%05d", (int)fABSValue);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetABSTargetEXI(float fEXIValue)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FAT%05d", (int)fEXIValue);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetAPF(const _tAPFArgs& t)
- {
- mLog::Info("APF:WS={$},FluMode={$},ABSMode={$},DoseLever={$},KV={$},MA={$},PPS={$}",
- t.nWS, t.nFluMode, t.nABSMode, t.nDoseLever, t.nFLKV, t.fFLMA, t.nPPS);
- int tempws = 1;
- if (m_arrWSMap.find(cfgWorkStationKey(t.nWS)) != m_arrWSMap.end())
- {
- m_strCurrentWSName = cfgWorkStationKey(t.nWS);
- tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
- mLog::Debug("Set WS number {$}", tempws);
- }
- else
- {
- mLog::Debug("Set WS number default 1");
- m_strCurrentWSName = cfgWorkStationKey(t.nWS);
- tempws = t.nWS;
- }
- if (!m_RadKV->Verify(t.nFLKV))
- {
- mLog::Error("SetAPR:KV Out of bounds[{$}] \n", t.nFLKV);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_RadMA->Verify(t.fFLMA))
- {
- mLog::Error("SetAPR:MA Out of bounds[{$}] \n", t.fFLMA);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_FluPPS->Verify(t.nPPS) && (t.nFluMode == CcosAttrKey::GENERATOR_FLMODE_PF ||
- t.nFluMode == CcosAttrKey::GENERATOR_FLMODE_HPF))
- {
- mLog::Error("SetAPR:PPS Out of bounds[{$}] \n", t.nPPS);
- return RET_STATUS::RET_FAILED;
- }
- else if (!m_FluDoseLever->Verify(t.nDoseLever))
- {
- mLog::Error("SetAPR:DoseLever Out of bounds[{$}] \n", t.nDoseLever);
- return RET_STATUS::RET_FAILED;
- }
- char temp[50] = { 0 };
- switch (t.nFluMode)
- {
- case CcosAttrKey::GENERATOR_FLMODE_NOTFLU:
- {
- sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
- tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::GENERATOR_FLMODE_CF:
- {
- sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
- tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::GENERATOR_FLMODE_PF:
- {
- sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
- tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- sprintf_s(temp, "FLS%03d", t.nPPS * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::GENERATOR_FLMODE_HCF:
- {
- sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
- tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- case CcosAttrKey::GENERATOR_FLMODE_HPF:
- {
- sprintf_s(temp, "FARWS%1dLA%1dLF%1dLD%1dKV%03dMA%03d",
- tempws, t.nABSMode, t.nFluMode, t.nDoseLever, t.nFLKV, t.fFLMA * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- sprintf_s(temp, "FLS%03d", t.nPPS * 10);
- HWSendWaittimeCMD(temp, strlen(temp));
- }break;
- default:
- {}break;
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetFluIntTimer()
- {
- return HWSendWaittimeCMD("FLI?", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::GetFluAccTimer()
- {
- return HWSendWaittimeCMD("FLT?", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::ResetFluTimer(int ntype)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FLR%1d", ntype);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluPre(int bPrepare)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FLP%1d", bPrepare);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluEXP(int bPrepare)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FLX%1d", bPrepare);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMode(std::string value)
- {
- int mode = atoi(value.c_str());
- char temp[50] = { 0 };
- sprintf_s(temp, "FLF%1d", mode);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluMAG(int nsize)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FLZ%1d", nsize);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::DisableMAG()
- {
- return HWSendWaittimeCMD("FLZ0", 4);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetFluDoseLever(int nlever)
- {
- if (!m_FluDoseLever->Verify(nlever)) return RET_STATUS::RET_FAILED;
- char temp[50] = { 0 };
- sprintf_s(temp, "FLD%1d", nlever);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetHalfDose(int nlever)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FHD%1d", nlever);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::TransferRadCurve(int ncurve)
- {
- char temp[50] = { 0 };
- sprintf_s(temp, "FLC%1d", ncurve);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- //Almax特有指令
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetPanelField(int value)
- {
- mLog::Debug("Enter SetPanelField:[{$}]", value);
- char temp[50] = { 0 };
- sprintf_s(temp, "PZM%02d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetShutDown(int value)
- {
- mLog::Debug("Enter SetShutDown:[{$}]", value);
- char temp[50] = { 0 };
- sprintf_s(temp, "SSD%1d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetExamView(int value)
- {
- mLog::Debug("Enter SetExamView:[{$}]", value);
- char temp[50] = { 0 };
- sprintf_s(temp, "VNE%03d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetDSA(int value)
- {
- mLog::Debug("Enter SetDSA:[{$}]", value);
- char temp[50] = { 0 };
- sprintf_s(temp, "DSA%01d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::SetRoadMap(int value)
- {
- mLog::Debug("Enter SetRoadMap:[{$}]", value);
- char temp[50] = { 0 };
- sprintf_s(temp, "IRM%01d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::EnterExam(int value)
- {
- mLog::Debug("Enter EnterExam:[{$}]", value);
- char temp[50] = { 0 };
- sprintf_s(temp, "EXB%01d", value);
- return HWSendWaittimeCMD(temp, strlen(temp));
- }
- //-----------------------------------------------------------------------------
- // ProcessCmd
- //-----------------------------------------------------------------------------
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSendWaittimeCMD(char* strCommand, int lengh, int headLengh)
- {
- return glo_tDelivermodule.ProcessCommand(strCommand, lengh, glo_nCMDType_WaitTime, headLengh);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSendHBCMD(char* strCommand, int lengh, int headLengh)
- {
- return glo_tDelivermodule.ProcessCommand(strCommand, lengh, glo_nCMDType_HB, headLengh);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSendWaitACKCMD(char* strCommand, int lengh, int headLengh)
- {
- return glo_tDelivermodule.ProcessCommand(strCommand, lengh, glo_nCMDType_WaitACK, headLengh);
- }
- RET_STATUS nsGEN::CGEN_DEV_IDETEC_Almax::HWSend(const char* strCommand, int lengh, bool reSend, int nTimeOut)
- {
- if (!m_bConnectFlag)
- {
- mLog::Error("==OUT==: not Connect,[{$}] send failed \n", strCommand);
- return RET_STATUS::RET_FAILED;
- }
- char strSendCommand[Almax_Com_ReSendLen] = { 0 };
- int len = strlen(strCommand);
- if (len <= 0)
- {
- mLog::Error("HWSend: cmd is null\n");
- return RET_STATUS::RET_FAILED;
- }
- else if (lengh <= 0)
- {
- mLog::Error("HWSend: Expected length too small but cmd[{$}] is not null\n", strCommand);
- return RET_STATUS::RET_FAILED;
- }
- else if (len > lengh)
- {
- mLog::Error("HWSend: Actual length[{$}] > Expected length[{$}] \n", len, lengh);
- return RET_STATUS::RET_FAILED;
- }
- len = lengh;
- ::memcpy(strSendCommand, strCommand, len);
- if (ComputeCheckSum(strSendCommand, len) == 0x00)
- {
- mLog::Warn("HWSend: cmd[{$}] Check Summing failed \n", strCommand);
- }
- //strSendCommand[0] = Almax_STX;
- //strSendCommand[len - 1] = Almax_ETX;
- if (true)
- {
- //char strCommandHead[3] = { 0 };
- //::memcpy(strCommandHead, strCommand, 2);
- //auto find_item = glo_arFrame.find(strCommandHead);
- auto find_item = glo_arFrame.find(strSendCommand);
- if ((find_item != glo_arFrame.end()) && reSend)
- {
- mLog::Info("==OUT==: [{$}] wait for ACK \n", strSendCommand);
- }
- else
- {
- mLog::Info("==OUT==: [{$}] \n", strSendCommand);
- }
- }
- int retLength;
- glo_obCommObj.m_SCF.Lock(msTimeOut_Lock)
- .SendPacket(strSendCommand, len, nTimeOut, retLength);
- return RET_STATUS::RET_SUCCEED;
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::FireNotify(string key, const int context)
- {
- std::string str = std::format("{:d}", context);
- switch (m_nNotifyType)
- {
- case CcosAttrKey::CTRL_PlatformInterface:
- {
- PlatformInterface::CCOSNotifyCallBackEntry(PACKET_CMD::PACKET_CMD_UPDATE, key, str, m_pDevicePath);
- }break;
- case CcosAttrKey::CTRL_Center:
- {
- if (m_EventCenter != nullptr)
- {
- m_EventCenter->OnNotify(1, key, str);
- }
- else
- {
- mLog::Error("m_EventCenter:[{$}:{$}] is null", key.c_str(), str.c_str());
- }
- }break;
- case CcosAttrKey::CTRL_CallBackFun:
- {
- if (m_funV2DynamicCallBackFun != NULL)
- {
- m_funV2DynamicCallBackFun(key, str);
- }
- else
- {
- mLog::Error("V2DynamicCallBackFun:[{$}:{$}] is null", key.c_str(), str.c_str());
- }
- }break;
- default:
- mLog::Error("FireNotify:unknow[{$}]m_nNotifyType", (int)m_nNotifyType);
- break;
- }
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::FireNotify(string key, const float context)
- {
- std::string str = std::format("{:.2f}", context);
- switch (m_nNotifyType)
- {
- case CcosAttrKey::CTRL_PlatformInterface:
- {
- PlatformInterface::CCOSNotifyCallBackEntry(PACKET_CMD::PACKET_CMD_UPDATE, key, str, m_pDevicePath);
- }break;
- case CcosAttrKey::CTRL_Center:
- {
- if (m_EventCenter != nullptr)
- {
- m_EventCenter->OnNotify(1, key, str);
- }
- else
- {
- mLog::Error("m_EventCenter:[{$}:{$}] is null", key.c_str(), str.c_str());
- }
- }break;
- case CcosAttrKey::CTRL_CallBackFun:
- {
- if (m_funV2DynamicCallBackFun != NULL)
- {
- m_funV2DynamicCallBackFun(key, str);
- }
- else
- {
- mLog::Error("V2DynamicCallBackFun:[{$}:{$}] is null", key.c_str(), str.c_str());
- }
- }break;
- default:
- mLog::Error("FireNotify:unknow[{$}]m_nNotifyType", (int)m_nNotifyType);
- break;
- }
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::FireNotify(string key, const string context)
- {
- switch (m_nNotifyType)
- {
- case CcosAttrKey::CTRL_PlatformInterface:
- {
- PlatformInterface::CCOSNotifyCallBackEntry(PACKET_CMD::PACKET_CMD_UPDATE, key, context, m_pDevicePath);
- }break;
- case CcosAttrKey::CTRL_Center:
- {
- if (m_EventCenter != nullptr)
- {
- m_EventCenter->OnNotify(1, key, context);
- }
- else
- {
- mLog::Error("m_EventCenter:[{$}:{$}] is null", key.c_str(), context.c_str());
- }
- }break;
- case CcosAttrKey::CTRL_CallBackFun:
- {
- if (m_funV2DynamicCallBackFun != NULL)
- {
- m_funV2DynamicCallBackFun(key, context);
- }
- else
- {
- mLog::Error("V2DynamicCallBackFun:[{$}:{$}] is null", key.c_str(), context.c_str());
- }
- }break;
- default:
- mLog::Error("FireNotify:unknow[{$}]m_nNotifyType", (int)m_nNotifyType);
- break;
- }
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::FireErrorMessage(const bool Act, const int Code, const char* ResInfo)
- {
- string ErrorCode("Almax_ERR_");
- ErrorCode += std::to_string(Code);
- int level = CcosAttrKey::UNIT_REGULATION_LEVEL::REG_ERRO;
- if (Act)
- {
- mLog::Error("add {$}:{$}", ErrorCode.c_str(), ResInfo);
- m_MSGUnit->AddErrorMessage(ErrorCode.c_str(), level, ResInfo);
- }
- else
- {
- mLog::Error("del {$}:{$}", ErrorCode.c_str(), ResInfo);
- m_MSGUnit->DelErrorMessage(ErrorCode.c_str(), level, ResInfo);
- }
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::FireWarnMessage(const bool Act, const int Code, const char* ResInfo)
- {
- string ErrorCode("Almax_WAR_");
- ErrorCode += std::to_string(Code);
- int level = CcosAttrKey::UNIT_REGULATION_LEVEL::REG_WARN;
- if (Act)
- {
- mLog::Error("add {$}:{$}", ErrorCode.c_str(), ResInfo);
- m_MSGUnit->AddWarnMessage(ErrorCode.c_str(), level, ResInfo);
- }
- else
- {
- mLog::Error("del {$}:{$}", ErrorCode.c_str(), ResInfo);
- m_MSGUnit->DelWarnMessage(ErrorCode.c_str(), level, ResInfo);
- }
- }
- void nsGEN::CGEN_DEV_IDETEC_Almax::OnCallBack()
- {
- //无 操作
- auto HWNotProcess = [](const char* value, int length) -> void
- {
- mLog::Info("This commands[{$}] didn't need to process", value);
- };
- //校验和错误
- auto HWERROR_1 = [this](char* value, int length) -> void
- {
- char* nextTokenPtr = NULL;
- char* tokenPtr = strtok_s(value, ",", &nextTokenPtr);
- if (tokenPtr != NULL)
- {
- mLog::Error("== HWERROR_1 == : error CheckSum:[{$}]", tokenPtr);
- }
- else
- {
- mLog::Error("== HWERROR_1 == : error CheckSum:no csum");
- }
- };
- //3.1 RADIOGRAPHIC COMMANDS
- auto HWRKV = [this](char* value, int length) -> void //3.1.1 Sets the KV value (KV value * 10)
- {
- assert(value);
- float tempValue = atof(value) / 10.0;
- mLog::Debug("Recv Rad KV[{$}]", tempValue);
- if (m_RadKV->Update(tempValue))
- {
- FireNotify(m_RadKV->GetKey(), tempValue);
- }
- };
- auto HWRMA = [this](char* value, int length) -> void //3.1.2 Sets the MA value (MA * 100)
- {
- assert(value);
- float tempValue = atof(value) / 100.0;
- mLog::Debug("Recv Rad MA[{$}]", tempValue);
- if (m_RadMA->Update(tempValue))
- {
- FireNotify(m_RadMA->GetKey(), tempValue);
- }
- };
- auto HWRMS = [this](char* value, int length) -> void //3.1.3 Sets the Exposure Time in milliseconds (MS * 100)
- {
- assert(value);
- float tempValue = atof(value) / 100.0;
- mLog::Debug("Recv Rad MS[{$}]", tempValue);
- if (m_RadMS->Update(tempValue))
- {
- FireNotify(m_RadMS->GetKey(), tempValue);
- }
- };
- auto HWRMX = [this](char* value, int length) -> void //3.1.4 Sets the MAS 1/1000 (milliamp * seconds)
- {
- assert(value);
- float tempValue = atof(value) / 1000.0;
- mLog::Debug("Recv Rad MAS[{$}]", tempValue);
- if (m_RadMAS->Update(tempValue))
- {
- FireNotify(m_RadMAS->GetKey(), tempValue);
- }
- };
- auto HWRR = [this](char* value, int length) -> void //3.1.5 Refresh Rad Console Data
- {
- //do noting
- };
- auto HWRET = [this](char* value, int length) -> void //3.1.6 Exposure Technique Selection
- {
- assert(value);
- mLog::Debug("Recv Rad Technique[{$}]", value);
- if (m_RadTechmode->Update(atoi(value)))
- {
- FireNotify(m_RadTechmode->GetKey(), value);
- }
- };
- auto HWRFO = [this](char* value, int length) -> void //3.1.7 Focus Selection
- {
- assert(value);
- mLog::Debug("Recv Rad Focus[{$}]", value);
- if (m_RadFocus->Update(atoi(value)))
- {
- FireNotify(m_RadFocus->GetKey(), value);
- }
- };
- auto HWRFN = [this](char* value, int length) -> void //3.1.8 AEC Density
- {
- assert(value);
- mLog::Debug("Recv Rad AEC Field[{$}]", value);
- if (m_RadAECDensity->Update(atoi(value)))
- {
- FireNotify(m_RadAECDensity->GetKey(), value);
- }
- };
- auto HWRFI = [this](char* value, int length) -> void //3.1.9 AEC Field Selection
- {
- assert(value);
- mLog::Debug("Recv Rad Focus[{$}]", value);
- if (m_RadAECField->Update(atoi(value)))
- {
- FireNotify(m_RadAECField->GetKey(), value);
- }
- };
- auto HWRFS = [this](char* value, int length) -> void //3.1.10 AEC Film Screen Selection
- {
- assert(value);
- mLog::Debug("Recv Rad Film[{$}]", value);
- if (m_RadAECFilm->Update(atoi(value)))
- {
- FireNotify(m_RadAECFilm->GetKey(), value);
- }
- };
- auto HWRAP = [this](char* value, int length) -> void //3.1.11 Post MAS
- {
- assert(value);
- float tempValue = atof(value) / 1000.0;
- mLog::Debug("Recv Rad Post MAS[{$}]", tempValue);
- if (m_PostMAS->Update(tempValue))
- {
- FireNotify(m_PostMAS->GetKey(), tempValue);
- }
- };
- auto HWRAT = [this](char* value, int length) -> void //3.1.12 Post TIME(MS * 100)
- {
- assert(value);
- float tempValue = atof(value) / 100.0;
- mLog::Debug("Recv Rad Post MS[{$}]", tempValue);
- if (m_PostMS->Update(tempValue))
- {
- FireNotify(m_PostMS->GetKey(), tempValue);
- }
- };
- auto HWRAL = [this](char* value, int length) -> void //3.1.13 AEC Lock
- {
- assert(value);
- mLog::Debug("Recv Rad AEC Lock[{$}]", value);
- };
- auto HWPR = [this](char* value, int length) -> void //3.1.14 RAD Preparation
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Rad PR[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //RAD Preparation inactive
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_OFF))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- case 1: //RAD Preparation active
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_PREPARE))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- case 2: //RAD Generator Ready
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_READY))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWXR = [this](char* value, int length) -> void //3.1.15 RAD X-ray Exposure
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Rad XR[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //RAD Exposure inactive
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_XRAYOFF))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- case 1: //RAD Exposure active
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_RAD_XRAYON))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWPS = [this](char* value, int length) -> void //3.1.16 First handswitch
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Rad First handswitch[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //Release First HandSwitch
- {
- if (m_Handswitch->Update(CcosAttrKey::HANDSWITCH_STATUS_Release))
- FireNotify(m_Handswitch->GetKey(), m_Handswitch->JSGet());
- }break;
- case 1: //Hold First handswitch
- {
- if (m_GenSynState->Update(CcosAttrKey::HANDSWITCH_STATUS_Hold))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWXS = [this](char* value, int length) -> void //3.1.17 Second handSwitch
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Rad XR[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //Release Second handswitch
- {
- if (m_Handswitch->Update(CcosAttrKey::HANDSWITCH_STATUS_Release))
- FireNotify(m_Handswitch->GetKey(), m_Handswitch->JSGet());
- }break;
- case 1: //Press Second handswitch
- {
- if (m_GenSynState->Update(CcosAttrKey::FOOTSWITCH_STATUS_Press))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWRPS = [this](char* value, int length) -> void //3.1.18 Set Serial Spot Pulses Per Second (PPS)
- {
- assert(value);
- float tempValue = atof(value) / 10.0;
- mLog::Debug("Recv Serial Spot Pulses Per Second[{$}]", tempValue);
- if (m_RadFrameRate->Update(tempValue))
- {
- FireNotify(m_RadFrameRate->GetKey(), tempValue);
- }
- };
- auto HWRMM = [this](char* value, int length) -> void //3.1.19 Set Rad Mode
- {
- assert(value);
- mLog::Debug("Recv Serial Spot Pulses Per Second[{$}]", value);
- if (m_ExpMode->Update(value))
- {
- FireNotify(m_ExpMode->GetKey(), value);
- }
- };
- //3.2 FLUOROSCOPIC COMMANDS
- auto HWFLK = [this](char* value, int length) -> void //3.2.1 Set Fluoroscopy KV
- {
- assert(value);
- mLog::Debug("Recv Fluoroscopy KV[{$}]", value);
- if (m_FluKV->Update(atof(value)))
- {
- FireNotify(m_FluKV->GetKey(), value);
- }
- };
- auto HWFLM = [this](char* value, int length) -> void //3.2.2 Set Fluoroscopy MA
- {
- assert(value);
- float tempValue = atof(value) / 10.0;
- mLog::Debug("Recv Fluoroscopy MA[{$}]", tempValue);
- if (m_FluMA->Update(tempValue))
- {
- FireNotify(m_FluMA->GetKey(), tempValue);
- }
- };
- auto HWFLI = [this](char* value, int length) -> void //3.2.3 Fluoroscopy Interval Timer
- {
- assert(value);
- float tempValue = atof(value) / 10.0; //(1 / 10 minutes)
- mLog::Debug("Recv Interval Timer[{$}]", tempValue);
- if (m_FluIntTime->Update(tempValue))
- {
- FireNotify(m_FluIntTime->GetKey(), tempValue);
- }
- };
- auto HWFLT = [this](char* value, int length) -> void //3.2.4 Fluoroscopy Accumulative Timer
- {
- assert(value);
- float tempValue = atof(value) / 10.0; //(1 / 10 minutes)
- mLog::Debug("Recv Accumulative Timer[{$}]", tempValue);
- if (m_FluAccTime->Update(tempValue))
- {
- FireNotify(m_FluAccTime->GetKey(), tempValue);
- }
- };
- auto HWFLS = [this](char* value, int length) -> void //3.2.5 Set Fluoroscopy Pulses Per Second (PPS)
- {
- assert(value);
- float tempValue = atof(value) / 10.0;
- mLog::Debug("Recv Fluoroscopy Pulses Per Second[{$}]", tempValue);
- m_FluPPS->Update(tempValue);
- FireNotify(m_FluPPS->GetKey(), tempValue);
- };
- auto HWFPW = [this](char* value, int length) -> void //3.2.6 Set Fluoroscopy pulse width
- {
- assert(value);
- mLog::Debug("Recv Fluoroscopy pulse width[{$}]", value);
- if (m_FluMS->Update(atoi(value)))
- {
- FireNotify(CcosAttrKey::FLUpulseWidth, value);
- }
- };
- auto HWFLF = [this](char* value, int length) -> void //3.2.7 Set Fluoroscopy Mode
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy Mode[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //Fluoro Disabled
- {
- m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_NOTFLU);
- }break;
- case 1: //Continuous Fluoroscopy
- {
- m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_CF);
- }break;
- case 2: //Pulsed Fluoroscopy
- {
- m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_PF);
- }break;
- case 3: //High Level Continuous Fluoroscopy
- {
- m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_HCF);
- }break;
- case 4: //High Level Pulsed Fluoroscopy
- {
- m_FluFMode->Update(CcosAttrKey::GENERATOR_FLMODE_HPF);
- }break;
- default:
- {}break;
- }
- FireNotify(m_FluFMode->GetKey(), m_FluFMode->JSGet());
- };
- auto HWFLP = [this](char* value, int length) -> void //3.2.8 Fluoroscopy Preparation
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy Preparation[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //Fluoroscopy Prep inactive
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_OFF))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- case 1: //Fluoroscopy Prep active
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_READY))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- case 2: //Boost Fluoroscopy or Cine Prep active
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_CINE_READY))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWFLX = [this](char* value, int length) -> void //3.2.9 Fluoroscopy Exposure
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy Exposure[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //Fluoroscopy Exposure inactive
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_XRAYOFF))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- case 1: //Fluoroscopy Exposure active
- {
- if (m_GenSynState->Update(CcosAttrKey::GENERATOR_FLU_XRAYON))
- FireNotify(m_GenSynState->GetKey(), m_GenSynState->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWFLA = [this](char* value, int length) -> void //3.2.10 Fluoroscopy Automatic Brightness Stabilization (ABS) Control
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy ABS[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //ABS inactive
- {
- if (m_FluABSStatus->Update(CcosAttrKey::GENERATOR_ABS_OFF))
- FireNotify(m_FluABSStatus->GetKey(), m_FluABSStatus->JSGet());
- }break;
- case 1: //ABS active (KV only)
- {
- if (m_FluABSStatus->Update(CcosAttrKey::GENERATOR_ABS_ON_KV))
- FireNotify(m_FluABSStatus->GetKey(), m_FluABSStatus->JSGet());
- }break;
- case 2: //ABS active (KV / mA)
- {
- if (m_FluABSStatus->Update(CcosAttrKey::GENERATOR_ABS_ON_KVMA))
- FireNotify(m_FluABSStatus->GetKey(), m_FluABSStatus->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWFLZ = [this](char* value, int length) -> void //3.2.11 Fluoroscopy II Magnification Control
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy MAG[{$}]", tempValue);
- if (m_FluAccTime->Update(tempValue))
- {
- FireNotify(CcosAttrKey::FLUMag, tempValue);
- }
- };
- auto HWFLR = [this](char* value, int length) -> void //3.2.12 Fluoroscopy Time Reset
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy Time Reset[{$}]", tempValue);
- switch (tempValue)
- {
- case 0: //Reset Fluoroscopy Interval Timer
- {
- if (m_FluIntTime->Update(0))
- FireNotify(m_FluIntTime->GetKey(), m_FluIntTime->JSGet());
- }break;
- case 1: //Reset Fluoroscopy Accumulative Timer
- {
- if (m_FluAccTime->Update(0))
- FireNotify(m_FluAccTime->GetKey(), m_FluAccTime->JSGet());
- }break;
- default:
- {}break;
- }
- };
- auto HWFLD = [this](char* value, int length) -> void //3.2.13 Fluoroscopy Dose Level
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy Dose Level[{$}]", tempValue);
- if (m_FluDoseLever->Update(tempValue))
- {
- FireNotify(m_FluDoseLever->GetKey(), tempValue);
- }
- };
- auto HWRF = [this](char* value, int length) -> void //3.2.14 Refresh Fluoroscopy Data
- {
- //do noting
- };
- auto HWFLC = [this](char* value, int length) -> void //3.2.15 Fluoroscopy to Rad kV Transfer Curve
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Rad kV Transfer Curve[{$}]", tempValue);
- };
- auto HWFLO = [this](char* value, int length) -> void //3.2.16 Fluoroscopy ABS Curve
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy ABS Curve[{$}]", tempValue);
- };
- auto HWABS = [this](char* value, int length) -> void //3.2.17 Fluoroscopy Automatic Brightness Stabilization (ABS) Brightness
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Curr ABS value[{$}]", tempValue);
- };
- auto HWFAT = [this](char* value, int length) -> void //3.2.18 Fluoroscopy Automatic Brightness Stabilization (ABS) Target Brightness
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Target ABS value[{$}]", tempValue);
- };
- auto HWFHD = [this](char* value, int length) -> void //3.2.19 Fluoroscopy Automatic Brightness Stabilization (ABS) Half Dose Control
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Fluoroscopy Half Dose[{$}]", tempValue);
- };
- //3.3 SYSTEM COMMANDS
- auto HWEWS = [this](char* value, int length) -> void //3.3.1 Work Station Selection
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Work Station[{$}]", tempValue);
- int tempws = 1;
- if (m_arrWSMap.find(cfgWorkStationKey(tempValue)) != m_arrWSMap.end())
- {
- m_strCurrentWSName = cfgWorkStationKey(tempValue);
- tempws = m_arrWSMap[m_strCurrentWSName].nWSNamber;
- mLog::Debug("Set WS number {$}", tempws);
- SetExpSYN(m_arrWSMap[m_strCurrentWSName].nWSSYN);
- }
- else
- {
- mLog::Debug("Set WS number default 1");
- m_strCurrentWSName = cfgWorkStationKey(tempValue);
- }
- FireNotify(CcosAttrKey::WORKSTATION, tempValue);
- };
- auto HWEHE = [this](char* value, int length) -> void //3.3.2 Percentage Anode Tube Heat
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Tube Heat[{$}]", tempValue);
- if (m_TubeHE->Update(tempValue))
- {
- FireNotify(m_TubeHE->GetKey(), tempValue);
- }
- };
- auto HWEHH = [this](char* value, int length) -> void //3.3.3 Percentage Housing Tube Heat
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv GEN Heat[{$}]", tempValue);
- if (m_GenHE->Update(tempValue))
- {
- FireNotify(m_GenHE->GetKey(), tempValue);
- }
- };
- auto HWERR = [this](char* value, int length) -> void //3.3.4 Generator Error Indicator
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv GEN Error[{$}]", tempValue);
- if (m_nNotifyType == CcosAttrKey::CTRL_CallBackFun)
- {
- FireNotify("ErrorList", tempValue);
- }
- else
- {
- if (tempValue)
- {
- FireErrorMessage(true, tempValue, "nuknow");
- }
- else
- {
- int level = 0;
- m_MSGUnit->DelErrorMessage("0", level, "clear all errors");
- }
- }
- };
- auto HWEWN = [this](char* value, int length) -> void //3.3.5 Generator Warning Indicator
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv GEN Warning[{$}]", tempValue);
- if (m_nNotifyType == CcosAttrKey::CTRL_CallBackFun)
- {
- FireNotify("WarningList", tempValue);
- }
- else
- {
- if (tempValue)
- {
- FireWarnMessage(true, tempValue, "nuknow");
- }
- else
- {
- int level = 0;
- m_MSGUnit->DelWarnMessage("0", level, "clear all Warning");
- }
- }
- };
- auto HWERS = [this](char* value, int length) -> void //3.3.6 Refresh System Data
- {
- //get noting
- };
- auto HWEEC = [this](char* value, int length) -> void //3.3.7 Echo
- {
- m_iHeartBeats = 0;
- };
- auto HWEST = [this](char* value, int length) -> void //3.3.8 Status
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Generator Status[{$}]", tempValue);
- switch (tempValue)
- {
- case 1: //Initialization Phase
- {
- if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_INIT))
- FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
- }break;
- case 2: //Standby Phase
- {
- if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_STANDBY))
- FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
- }break;
- case 3: //Rad Preparation (Ready) Phase
- {
- }break;
- case 4: //Rad Exposure (X-ray) Phase
- {
- HWSendWaittimeCMD("RAP?", 4);
- HWSendWaittimeCMD("RAT?", 4);
- if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_EXP))
- FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
- }break;
- case 5: //Fluoroscopy Exposure Phase
- {
- if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_EXP))
- FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
- }break;
- case 6: //Calibration Phase
- {
- }break;
- case 7: //Error Phase
- {
- if (m_GenState->Update(CcosAttrKey::GENERATOR_STATUS_ERROR))
- FireNotify(m_GenState->GetKey(), m_GenState->JSGet());
- }break;
- case 8: //Service Phase
- {
- }break;
- default:
- {}break;
- }
- };
- auto HWRSA = [this](char* value, int length) -> void //3.3.9 Set APR Data
- {
- //do noting
- };
- auto HWRSX = [this](char* value, int length) -> void //3.3.10 Set MX APR Data
- {
- //do noting
- };
- auto HWFAR = [this](char* value, int length) -> void //3.3.11 Set fluoroscopy APR Data
- {
- //do noting
- };
- auto HWEGR = [this](char* value, int length) -> void //3.3.12 Generator Software Revision
- {
- assert(value);
- mLog::Debug("Recv Generator Software Revision[{$}]", value);
- };
- auto HWEME = [this](char* value, int length) -> void //3.3.13 Multiple Energy
- {
- //do noting
- };
- auto HWERE = [this](char* value, int length) -> void //3.3.14 Reset device
- {
- int level = 0;
- m_MSGUnit->DelErrorMessage("0", level, "clear all errors");
- };
- auto HWEXB = [this](char* value, int length) -> void //3.3.15 Exposure Enable
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Exposure Enable[{$}]", tempValue);
- m_bExpEnable = tempValue;
- };
- auto HWEXP = [this](char* value, int length) -> void //3.3.16 Exposure Permit
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Exposure Permit[{$}]", tempValue);
- m_bSoftExpPermit = tempValue;
- };
- auto HWEXM = [this](char* value, int length) -> void //3.3.17 Exposure mode
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recv Exposure mode[{$}]", tempValue);
- EnSYNMode tempSYN = EnSYNMode::EXPOSURE_SYNMODE_HARDWARE_SYNBOX;
- switch (tempValue)
- {
- case 0:
- tempSYN = EnSYNMode::EXPOSURE_SYNMODE_HARDWARE_SYNBOX;
- break;
- case 1:
- tempSYN = EnSYNMode::EXPOSURE_SYNMODE_SOFTWARE_NOSYNBOX;
- break;
- default:
- break;
- }
- m_bSoftExpPermit = tempSYN;
- };
- auto HWTIC = [this](char* value, int length) -> void //3.3.18 Request detector window
- {
- //do noting
- };
- auto HWEXO = [this](char* value, int length) -> void //3.3.19 Exposure Permit
- {
- //do noting
- };
- auto HWIPS = [this](char* value, int length) -> void //3.3.20 Save picture in Last Image Hold
- {
- assert(value);
- mLog::Debug("Save picture in Last Image Hold");
- };
- auto HWIPM = [this](char* value, int length) -> void //3.3.21 Image Mirror
- {
- #if 0
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Image Mirror[{$}]", tempValue);
- FireNotify("ImageMirror", tempValue);
- #else
- if (m_IPM)
- m_IPM = 0;
- else
- m_IPM = 1;
- mLog::Debug("Image Mirror[{$}]", m_IPM);
- FireNotify("ImageMirror", m_IPM);
- #endif
- };
- auto HWIPF = [this](char* value, int length) -> void //3.3.22 Image Flip
- {
- #if 0
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Image Flip[{$}]", tempValue);
- FireNotify("ImageFlip", tempValue);
- #else
- if (m_IPF)
- m_IPF = 0;
- else
- m_IPF = 1;
- mLog::Debug("Image Flip[{$}]", m_IPF);
- FireNotify("ImageFlip", m_IPF);
- #endif
- };
- auto HWIPR = [this](char* value, int length) -> void //3.3.23 Image Rotate
- {
- assert(value);
- int tempValue = atoi(value);
- if (tempValue != 0)
- {
- if (value[0] == '0')
- value[0] = '2';//逆时针
- else
- value[0] = '1';//顺时针
- tempValue = atoi(value);
- }
- //else tempValue = 0;//复位
-
- mLog::Debug("Image Rotate[{$}]", tempValue);
- FireNotify("ImageRotate", tempValue);
- };
- auto HWISS = [this](char* value, int length) -> void //3.3.24 Save Single Frame
- {
- assert(value);
- mLog::Debug("Save Single Frame");
- };
- auto HWIAS = [this](char* value, int length) -> void //3.3.25 Auto Save
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Auto Save[{$}]", tempValue);
- FireNotify("AutoSave", tempValue);
- };
- auto HWISC = [this](char* value, int length) -> void //3.3.26 Save Current Image
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Save Current Image[{$}]", tempValue);
- FireNotify("SaveCurrImage", tempValue);
- };
- auto HWISM = [this](char* value, int length) -> void //3.3.27 Swap Monitors
- {
- assert(value);
- mLog::Debug("Swap Monitors");
- };
- auto HWICC = [this](char* value, int length) -> void //3.3.28 Contrast Contorl
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Contrast Contorl[{$}]", tempValue);
- };
- auto HWIBC = [this](char* value, int length) -> void //3.3.29 Brightness Contorl
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Brightness Contorl[{$}]", tempValue);
- };
- auto HWSUB = [this](char* value, int length) -> void //3.3.30 Subtraction
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Subtraction[{$}]", tempValue);
- };
- auto HWIRM = [this](char* value, int length) -> void //3.3.31 Road Map
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Road Map[{$}]", tempValue);
- FireNotify("RoadMap", tempValue);
- };
- auto HWIRF = [this](char* value, int length) -> void //3.3.32 Recursive Filter
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Recursive Filter[{$}]", tempValue);
- };
- //3.4 DAP COMMANDS
- auto HWEDA = [this](char* value, int length) -> void //3.4.1 Read DAP Accumulated Value
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Read DAP Accumulated Value[{$}]", tempValue);
- FireNotify("DAPAccumulated", tempValue);
- };
- auto HWEDR = [this](char* value, int length) -> void //3.4.2 Read DAP Rate Value
- {
- assert(value);
- float tempValue = atof(value) / 10.0;
- mLog::Debug("Read DAP Rate Value[{$}]", tempValue);
- };
- auto HWEDZ = [this](char* value, int length) -> void //3.4.3 Zero Accumulated DAP Value
- {
- assert(value);
- mLog::Debug("Zero Accumulated DAP Value");
- };
- auto HWEDS = [this](char* value, int length) -> void //3.4.4 DAP Status
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("DAP Status[{$}]", tempValue);
- };
- auto HWEAK = [this](char* value, int length) -> void //3.4.5 Read Air Kerm
- {
- assert(value);
- float tempValue = atof(value) / 10.0;//EAR EAK缩进与协议相反
- mLog::Debug("Read Air Kerm[{$}]", tempValue);
- if (m_fAirKerm != tempValue)
- {
- m_fAirKerm = tempValue;
- FireNotify("AirKerm", tempValue);
- }
- };
- auto HWEAR = [this](char* value, int length) -> void //3.4.6 Read Air Kerm Rate
- {
- assert(value);
- float tempValue = atof(value) / 100.0;
- mLog::Debug("Read Air Kerm Rate[{$}]", tempValue);
- if (AirKermRate != tempValue)
- {
- AirKermRate = tempValue;
- FireNotify("AirKermRate", tempValue);
- }
- };
- //3.5 MECHNICAL COMMANDS
- auto HWPPN = [this](char* value, int length) -> void //3.5.1 Position Number Value
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Position Number Value[{$}]", tempValue);
- };
- auto HWPSM = [this](char* value, int length) -> void //3.5.2 Position Status message
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Position Status message[{$}]", tempValue);
- };
- auto HWPGS = [this](char* value, int length) -> void //3.5.3 Detect Grid Status
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Detect Grid Status[{$}]", tempValue);
- };
- auto HWSID = [this](char* value, int length) -> void //3.5.4 Set SID
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Set SID[{$}]", tempValue);
- };
- auto HWGBS = [this](char* value, int length) -> void //3.5.5 Patient Body size
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Patient Body size[{$}]", tempValue);
- };
- auto HWVID = [this](char* value, int length) -> void //3.5.6 Procedure&View ID
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Procedure or View ID[{$}]", tempValue);
- };
- //3.6 COLLIMATOR COMMANDS
- auto HWCFS = [this](char* value, int length) -> void //3.6.1 Set Collimator Size
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 3);
- float tempValueX = atoi(tempData) / 10.0;
- strncpy_s(tempData, value+3, 3);
- float tempValueY = atoi(tempData) / 10.0;
- mLog::Debug("Set Collimator Size[{$},{$}](cm)", tempValueX, tempValueY);
- FireNotify("XSize", tempValueX);
- FireNotify("YSize", tempValueY);
- };
- auto HWCFT = [this](char* value, int length) -> void //3.6.2 Set Collimator Filter
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Set Collimator Filter[{$}]", tempValue);
- FireNotify("Filter", tempValue);
- };
- auto HWCFN = [this](char* value, int length) -> void //3.6.3 Get Collimator Filter Thickness
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 3);
- float tempValueMin = atoi(tempData);
- strncpy_s(tempData, value + 3, 3);
- float tempValueMax = atoi(tempData);
- mLog::Debug("Get Collimator Filter Thickness[{$}:{$}](mm)", tempValueMin, tempValueMax);
- };
- auto HWCFL = [this](char* value, int length) -> void //3.6.4 Control Collimator Light
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Control Collimator Light[{$}]", tempValue);
- };
- auto HWCFR = [this](char* value, int length) -> void //3.6.5 Control Collimator Rotate
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 1);
- string strDirection = "clockwise";
- if(atoi(tempData))
- strDirection = "anticlockwise";
- strncpy_s(tempData, value + 1, 3);
- float tempAngle = atoi(tempData);
- strncpy_s(tempData, value + 4, 3);
- float tempPos = atoi(tempData);
- mLog::Debug("Control Collimator Rotate[{$}:{$}:{$}]", strDirection.c_str(), tempAngle, tempPos);
- //FireNotify("CollRotateDirection", strDirection);
- sprintf_s(tempData,"%03d%02d", (int)tempAngle, (int)tempPos/10);
- FireNotify("CollRotateAngle", tempData);
- //FireNotify("CollRotatePos", tempPos);
- };
- auto HWCFD = [this](char* value, int length) -> void //3.6.6 Control Collimator Distance
- {
- assert(value);
- float tempValue = atof(value) / 10.0;
- mLog::Debug("Control Collimator Distance[{$}]", tempValue);
- };
- //3.7 SERVICE COMMANDS
- auto HWESM = [this](char* value, int length) -> void //3.7.1 Enter Service Mode
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Enter Service Mode[{$}]", tempValue);
- };
- auto HWSCM = [this](char* value, int length) -> void //3.7.2 Start Calibration Mode
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 1);
- float tempValue1 = atoi(tempData);
- strncpy_s(tempData, value + 1, 1);
- float tempValue2 = atoi(tempData);
- mLog::Debug("Start Calibration Mode[{$},{$}]", tempValue1, tempValue2);
- };
- auto HWECM = [this](char* value, int length) -> void //3.7.3 End Calibration
- {
- assert(value);
- mLog::Debug("End Calibration");
- };
- auto HWQGD = [this](char* value, int length) -> void //3.7.4 Query Generator Data
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Query Generator Data[{$}]", tempValue);
- };
- auto HWCPD = [this](char* value, int length) -> void //3.7.5 Calibration Parameters Data
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 1);
- float tempValue1 = atoi(tempData);
- strncpy_s(tempData, value + 1, 3);
- float tempValue2 = atoi(tempData);
- strncpy_s(tempData, value + 4, 5);
- float tempValue3 = atoi(tempData);
- strncpy_s(tempData, value + 9, 4);
- float tempValue4 = atoi(tempData);
- mLog::Debug("Calibration Parameters Data[Focus={$},KV={$},MA={$},FilamentCurData={$}]",
- tempValue1, tempValue2, tempValue3, tempValue4);
- };
- auto HWFCP = [this](char* value, int length) -> void //3.7.6 Fluoro Calibration Parameters
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 3);
- float tempValue1 = atoi(tempData) / 10.0;
- strncpy_s(tempData, value + 3, 2);
- float tempValue2 = atoi(tempData);
- strncpy_s(tempData, value + 5, 4);
- float tempValue3 = atoi(tempData);
- strncpy_s(tempData, value + 9, 5);
- float tempValue4 = atoi(tempData) / 100.0;
- strncpy_s(tempData, value + 14, 4);
- float tempValue5 = atoi(tempData);
- mLog::Debug("Fluoro Calibration Parameters[KV={$},PPS={$},PulseWidth={$},MA={$},FilamentCurData={$}]",
- tempValue1, tempValue2, tempValue3, tempValue4, tempValue5);
- };
- auto HWFCD = [this](char* value, int length) -> void //3.7.7 Filament Current Data
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Filament Current Data[{$}]", tempValue);
- };
- auto HWAEM = [this](char* value, int length) -> void //3.7.8 Actual Exposure Current
- {
- assert(value);
- float tempValue = atoi(value) / 100.0;
- mLog::Debug("Actual Exposure Current[{$}]", tempValue);
- };
- auto HWCCR = [this](char* value, int length) -> void //3.7.9 Current Calibration Result
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Current Calibration Result[{$}]", tempValue);
- };
- auto HWWSC = [this](char* value, int length) -> void //3.7.10 Workstation Configration
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 1);
- float tempValue1 = atoi(tempData);
- strncpy_s(tempData, value + 3, 1);
- float tempValue2 = atoi(tempData);
- strncpy_s(tempData, value + 6, 1);
- float tempValue3 = atoi(tempData);
- strncpy_s(tempData, value + 9, 1);
- float tempValue4 = atoi(tempData);
- strncpy_s(tempData, value + 13, 1);
- float tempValue5 = atoi(tempData);
- strncpy_s(tempData, value + 17, 3);
- float tempValue6 = atoi(tempData);
- strncpy_s(tempData, value + 23, 3);
- float tempValue7 = atoi(tempData);
- mLog::Debug("Fluoro Calibration Parameters[Workstation={$},TubeType={$},SyncMode={$},SignalSource={$},AEC={$},HighSpeedDroptoutTime={$},LowSpeedDroptoutTime={$}]",
- tempValue1, tempValue2, tempValue3, tempValue4, tempValue5, tempValue6, tempValue7);
- };
- auto HWNSD = [this](char* value, int length) -> void //3.7.11 Number of Shot to Dropout
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Number of Shot to Dropout[{$}]", tempValue);
- };
- auto HWAHS = [this](char* value, int length) -> void //3.7.12 Always In High Speed
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Always In High Speed[{$}]", tempValue);
- };
- auto HWLSB = [this](char* value, int length) -> void //3.7.13 Low Speed Brake
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Low Speed Brake[{$}]", tempValue);
- };
- auto HWTBC = [this](char* value, int length) -> void //3.7.14 Tube Configration
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 1);
- float tempValue1 = atoi(tempData);
- strncpy_s(tempData, value + 4, 4);
- float tempValue2 = atoi(tempData);
- strncpy_s(tempData, value + 11, 4);
- float tempValue3 = atoi(tempData);
- strncpy_s(tempData, value + 18, 4);
- float tempValue4 = atoi(tempData);
- strncpy_s(tempData, value + 25, 1);
- float tempValue5 = atoi(tempData);
- mLog::Debug("Fluoro Calibration Parameters[TubeType={$},highestMA={$},smallestMA={$},minPrepTime={$},EnableBothFilaments={$}]",
- tempValue1, tempValue2, tempValue3, tempValue4, tempValue5);
- };
- auto HWTRP = [this](char* value, int length) -> void //3.7.15 Rating Percentage of Tube
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Rating Percentage of Tube[{$}]", tempValue);
- };
- auto HWGRP = [this](char* value, int length) -> void //3.7.16 Rating Percentage of Generator
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Rating Percentage of Generator[{$}](kW)", tempValue);
- };
- auto HWTHL = [this](char* value, int length) -> void //3.7.17 Tube Heat Limitation
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Tube Heat Limitation[{$}]", tempValue);
- };
- auto HWLKV = [this](char* value, int length) -> void //3.7.18 Limitation of KV
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 1);
- string tempValue1 = "DR";
- if(atoi(tempData))
- tempValue1 = "Fluoro";
- strncpy_s(tempData, value + 1, 3);
- float tempValue2 = atoi(tempData);
- strncpy_s(tempData, value + 4, 3);
- float tempValue3 = atoi(tempData);
- mLog::Debug("Limitation of KV[mode={$},MaxKV={$},MinKV={$}]",
- tempValue1.c_str(), tempValue2, tempValue3);
- };
- auto HWNEX = [this](char* value, int length) -> void //3.7.19 Number of Exposures
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Number of Exposures[{$}]", tempValue);
- };
- auto HWGEL = [this](char* value, int length) -> void //3.7.20 Generator Error Log
- {
- assert(value);
- char tempData[6]{ 0 };
- strncpy_s(tempData, value, 4);
- float tempValue1 = atoi(tempData);
- strncpy_s(tempData, value + 4, 2);
- float tempValue2 = atoi(tempData);
- strncpy_s(tempData, value + 6, 2);
- float tempValue3 = atoi(tempData);
- strncpy_s(tempData, value + 9, 2);
- float tempValue4 = atoi(tempData);
- strncpy_s(tempData, value + 11, 2);
- float tempValue5 = atoi(tempData);
- strncpy_s(tempData, value + 13, 2);
- float tempValue6 = atoi(tempData);
- strncpy_s(tempData, value + 16, 4);
- float tempValue7 = atoi(tempData);
- mLog::Debug("Fluoro Calibration Parameters[{$-{$}-{$} {$}:{$}:{$} ErrorCode={$}]",
- tempValue1, tempValue2, tempValue3, tempValue4, tempValue5, tempValue6, tempValue7);
- };
- auto HWDGC = [this](char* value, int length) -> void //3.7.21 Detect Grid Config
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Detect Grid Config[{$}]", tempValue);
- };
- auto HWSPC = [this](char* value, int length) -> void //3.7.22 Serail Port Configration
- {
- assert(value);
- string strValue = "RS232";
- if(atoi(value))
- strValue = "RS422";
- mLog::Debug("Serail Port Configration[{$}]", strValue.c_str());
- };
- auto HWPZM = [this](char* value, int length) -> void //Flat Panel Field Selection
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Flat Panel Field Selection[{$}]", tempValue);
- FireNotify("PanelField", tempValue);
- };
- auto HWSSD = [this](char* value, int length) -> void //System Shut Down
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("System Shut Down[{$}]", tempValue);
- FireNotify("ShutDown", tempValue);
- };
- auto HWVNE = [this](char* value, int length) -> void //Exam Seletcion
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Exam Seletcion[{$}]", tempValue);
- FireNotify("ExamView", tempValue);
- };
- auto HWDSA = [this](char* value, int length) -> void //DSA status
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("DSA status[{$}]", tempValue);
- FireNotify("DSA", tempValue);
- };
- auto HWIPL = [this](char* value, int length) -> void //Start /stop the cine loop of a sequence
- {
- #if 0
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("Cine Loop of a sequence[{$}]", tempValue);
- FireNotify("CineLoop", tempValue);
- #else
- if (m_IPL)
- m_IPL = 0;
- else
- m_IPL = 1;
- mLog::Debug("Cine Loop of a sequence[{$}]", m_IPL);
- FireNotify("CineLoop", m_IPL);
- #endif
- };
- auto HWINT = [this](char* value, int length) -> void //Select the previous or next image in a run
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("previous or next image[{$}]", tempValue);
- FireNotify("NextImage", tempValue);
- };
- auto HWIST = [this](char* value, int length) -> void //Select a previous or subsequent run
- {
- assert(value);
- int tempValue = atoi(value);
- mLog::Debug("subsequent run[{$}]", tempValue);
- FireNotify("SubsequentRun", tempValue);
- };
- //初始化指令对照表
- glo_arFrame.clear();
- //glo_arFrame[""] = tFrameMapItem(HWERROR_1);//命令格式:校验和错误
- //3.1 RADIOGRAPHIC COMMANDS
- glo_arFrame["RKV"] = tFrameMapItem(HWRKV); //3.1.1 Sets the KV value (KV value * 10
- glo_arFrame["RMA"] = tFrameMapItem(HWRMA); //3.1.2 Sets the MA value (MA * 100)
- glo_arFrame["RMS"] = tFrameMapItem(HWRMS); //3.1.3 Sets the Exposure Time in milliseconds (MS * 100)
- glo_arFrame["RMX"] = tFrameMapItem(HWRMX); //3.1.4 Sets the MAS 1/1000 (milliamp * seconds)
- glo_arFrame["RR"] = tFrameMapItem(HWRR); //3.1.5 Refresh Rad Console Data
- glo_arFrame["RET"] = tFrameMapItem(HWRET); //3.1.6 Exposure Technique Selection
- glo_arFrame["RFO"] = tFrameMapItem(HWRFO); //3.1.7 Focus Selection
- glo_arFrame["RFN"] = tFrameMapItem(HWRFN); //3.1.8 AEC Density
- glo_arFrame["RFI"] = tFrameMapItem(HWRFI); //3.1.9 AEC Field Selection
- glo_arFrame["RFS"] = tFrameMapItem(HWRFS); //3.1.10 AEC Film Screen Selection
- glo_arFrame["RAP"] = tFrameMapItem(HWRAP); //3.1.11 Post MAS
- glo_arFrame["RAT"] = tFrameMapItem(HWRAT); //3.1.12 Post TIME(MS * 100)
- glo_arFrame["RAL"] = tFrameMapItem(HWRAL); //3.1.13 AEC Lock
- glo_arFrame["PR"] = tFrameMapItem(HWPR); //3.1.14 RAD Preparation
- glo_arFrame["XR"] = tFrameMapItem(HWXR); //3.1.15 RAD X-ray Exposure
- glo_arFrame["PS"] = tFrameMapItem(HWPS); //3.1.16 First handswitch
- glo_arFrame["XS"] = tFrameMapItem(HWXS); //3.1.17 Second handSwitch
- glo_arFrame["RPS"] = tFrameMapItem(HWRPS); //3.1.18 Set Serial Spot Pulses Per Second (PPS)
- glo_arFrame["RMM"] = tFrameMapItem(HWRMM); //3.1.19 Set Rad Mode
- //3.2 FLUOROSCOPIC COMMANDS
- glo_arFrame["FLK"] = tFrameMapItem(HWFLK); //3.2.1 Set Fluoroscopy KV
- glo_arFrame["FLM"] = tFrameMapItem(HWFLM); //3.2.2 Set Fluoroscopy MA
- glo_arFrame["FLI"] = tFrameMapItem(HWFLI); //3.2.3 Fluoroscopy Interval Timer
- glo_arFrame["FLT"] = tFrameMapItem(HWFLT); //3.2.4 Fluoroscopy Accumulative Timer
- glo_arFrame["FLS"] = tFrameMapItem(HWFLS); //3.2.5 Set Fluoroscopy Pulses Per Second (PPS)
- glo_arFrame["FPW"] = tFrameMapItem(HWFPW); //3.2.6 Set Fluoroscopy pulse width
- glo_arFrame["FLF"] = tFrameMapItem(HWFLF); //3.2.7 Set Fluoroscopy Mode
- glo_arFrame["FLP"] = tFrameMapItem(HWFLP); //3.2.8 Fluoroscopy Preparation
- glo_arFrame["FLX"] = tFrameMapItem(HWFLX); //3.2.9 Fluoroscopy Exposure
- glo_arFrame["FLA"] = tFrameMapItem(HWFLA); //3.2.10 Fluoroscopy Automatic Brightness Stabilization (ABS) Control
- glo_arFrame["FLZ"] = tFrameMapItem(HWFLZ); //3.2.11 Fluoroscopy II Magnification Control
- glo_arFrame["FLR"] = tFrameMapItem(HWFLR); //3.2.12 Fluoroscopy Time Reset
- glo_arFrame["FLD"] = tFrameMapItem(HWFLD); //3.2.13 Fluoroscopy Dose Level
- glo_arFrame["RF"] = tFrameMapItem(HWRF); //3.2.14 Refresh Fluoroscopy Data
- glo_arFrame["FLC"] = tFrameMapItem(HWFLC); //3.2.15 Fluoroscopy to Rad kV Transfer Curve
- glo_arFrame["FLO"] = tFrameMapItem(HWFLO); //3.2.16 Fluoroscopy ABS Curve
- glo_arFrame["ABS"] = tFrameMapItem(HWABS); //3.2.17 Fluoroscopy Automatic Brightness Stabilization (ABS) Brightness
- glo_arFrame["FAT"] = tFrameMapItem(HWFAT); //3.2.18 Fluoroscopy Automatic Brightness Stabilization (ABS) Target Brightness
- glo_arFrame["FHD"] = tFrameMapItem(HWFHD); //3.2.19 Fluoroscopy Automatic Brightness Stabilization (ABS) Half Dose Control
- //3.3 SYSTEM COMMANDS
- glo_arFrame["EWS"] = tFrameMapItem(HWEWS); //3.3.1 Work Station Selection
- glo_arFrame["EHE"] = tFrameMapItem(HWEHE); //3.3.2 Percentage Anode Tube Heat
- glo_arFrame["EHH"] = tFrameMapItem(HWEHH); //3.3.3 Percentage Housing Tube Heat
- glo_arFrame["ERR"] = tFrameMapItem(HWERR); //3.3.4 Generator Error Indicator
- glo_arFrame["EWN"] = tFrameMapItem(HWEWN); //3.3.5 Generator Warning Indicator
- glo_arFrame["ERS"] = tFrameMapItem(HWERS); //3.3.6 Refresh System Data
- glo_arFrame["EEC"] = tFrameMapItem(HWEEC); //3.3.7 Echo
- glo_arFrame["EST"] = tFrameMapItem(HWEST); //3.3.8 Status
- glo_arFrame["RSA"] = tFrameMapItem(HWRSA); //3.3.9 Set APR Data
- glo_arFrame["RSX"] = tFrameMapItem(HWRSX); //3.3.10 Set MX APR Data
- glo_arFrame["FAR"] = tFrameMapItem(HWFAR); //3.3.11 Set fluoroscopy APR Data
- glo_arFrame["EGR"] = tFrameMapItem(HWEGR); //3.3.12 Generator Software Revision
- glo_arFrame["EME"] = tFrameMapItem(HWEME); //3.3.13 Multiple Energy
- glo_arFrame["ERE"] = tFrameMapItem(HWERE); //3.3.14 Reset device
- glo_arFrame["EXB"] = tFrameMapItem(HWEXB); //3.3.15 Exposure Enable
- glo_arFrame["EXP"] = tFrameMapItem(HWEXP); //3.3.16 Exposure Permit
- glo_arFrame["EXM"] = tFrameMapItem(HWEXM); //3.3.17 Exposure mode
- glo_arFrame["TIC"] = tFrameMapItem(HWTIC); //3.3.18 Request detector window
- glo_arFrame["EXO"] = tFrameMapItem(HWEXO); //3.3.19 Exposure Permit
- glo_arFrame["IPS"] = tFrameMapItem(HWIPS); //3.3.20 Save picture in Last Image Hold
- glo_arFrame["IPM"] = tFrameMapItem(HWIPM); //3.3.21 Image Mirror
- glo_arFrame["IPF"] = tFrameMapItem(HWIPF); //3.3.22 Image Flip
- glo_arFrame["IPR"] = tFrameMapItem(HWIPR); //3.3.23 Image Rotate
- glo_arFrame["ISS"] = tFrameMapItem(HWISS); //3.3.24 Save Single Frame
- glo_arFrame["IAS"] = tFrameMapItem(HWIAS); //3.3.25 Auto Save
- glo_arFrame["ISC"] = tFrameMapItem(HWISC); //3.3.26 Save Current Image
- glo_arFrame["ISM"] = tFrameMapItem(HWISM); //3.3.27 Swap Monitors
- glo_arFrame["ICC"] = tFrameMapItem(HWICC); //3.3.28 Contrast Contorl
- glo_arFrame["IBC"] = tFrameMapItem(HWIBC); //3.3.29 Brightness Contorl
- glo_arFrame["SUB"] = tFrameMapItem(HWSUB); //3.3.30 Subtraction
- glo_arFrame["IRM"] = tFrameMapItem(HWIRM); //3.3.31 Road Map
- glo_arFrame["IRF"] = tFrameMapItem(HWIRF); //3.3.32 Recursive Filter
- //3.4 DAP COMMANDS
- glo_arFrame["EDA"] = tFrameMapItem(HWEDA); //3.4.1 Read DAP Accumulated Value
- glo_arFrame["EDR"] = tFrameMapItem(HWEDR); //3.4.2 Read DAP Rate Value
- glo_arFrame["EDZ"] = tFrameMapItem(HWEDZ); //3.4.3 Zero Accumulated DAP Value
- glo_arFrame["EDS"] = tFrameMapItem(HWEDS); //3.4.4 DAP Status
- glo_arFrame["EAK"] = tFrameMapItem(HWEAK); //3.4.5 Read Air Kerm
- glo_arFrame["EAR"] = tFrameMapItem(HWEAR); //3.4.6 Read Air Kerm Rate
- //3.5 MECHNICAL COMMANDS
- glo_arFrame["PPN"] = tFrameMapItem(HWPPN); //3.5.1 Position Number Value
- glo_arFrame["PSM"] = tFrameMapItem(HWPSM); //3.5.2 Position Status message
- glo_arFrame["PGS"] = tFrameMapItem(HWPGS); //3.5.3 Detect Grid Status
- glo_arFrame["SID"] = tFrameMapItem(HWSID); //3.5.4 Set SID
- glo_arFrame["GBS"] = tFrameMapItem(HWGBS); //3.5.5 Patient Body size
- glo_arFrame["VID"] = tFrameMapItem(HWVID); //3.5.6 Procedure&View ID
- //3.6 COLLIMATOR COMMANDS
- glo_arFrame["CFS"] = tFrameMapItem(HWCFS); //3.6.1 Set Collimator Size
- glo_arFrame["CFT"] = tFrameMapItem(HWCFT); //3.6.2 Set Collimator Filter
- glo_arFrame["CFN"] = tFrameMapItem(HWCFN); //3.6.3 Get Collimator Filter Thickness
- glo_arFrame["CFL"] = tFrameMapItem(HWCFL); //3.6.4 Control Collimator Light
- glo_arFrame["CFR"] = tFrameMapItem(HWCFR); //3.6.5 Control Collimator Rotate
- glo_arFrame["CFD"] = tFrameMapItem(HWCFD); //3.6.6 Control Collimator Distance
- //3.7 SERVICE COMMANDS
- glo_arFrame["ESM"] = tFrameMapItem(HWESM); //3.7.1 Enter Service Mode
- glo_arFrame["SCM"] = tFrameMapItem(HWSCM); //3.7.2 Start Calibration Mode
- glo_arFrame["ECM"] = tFrameMapItem(HWECM); //3.7.3 End Calibration
- glo_arFrame["QGD"] = tFrameMapItem(HWQGD); //3.7.4 Query Generator Data
- glo_arFrame["CPD"] = tFrameMapItem(HWCPD); //3.7.5 Calibration Parameters Data
- glo_arFrame["FCP"] = tFrameMapItem(HWFCP); //3.7.6 Fluoro Calibration Parameters
- glo_arFrame["FCD"] = tFrameMapItem(HWFCD); //3.7.7 Filament Current Data
- glo_arFrame["AEM"] = tFrameMapItem(HWAEM); //3.7.8 Actual Exposure Current
- glo_arFrame["CCR"] = tFrameMapItem(HWCCR); //3.7.9 Current Calibration Result
- glo_arFrame["WSC"] = tFrameMapItem(HWWSC); //3.7.10 Workstation Configration
- glo_arFrame["NSD"] = tFrameMapItem(HWNSD); //3.7.11 Number of Shot to Dropout
- glo_arFrame["AHS"] = tFrameMapItem(HWAHS); //3.7.12 Always In High Speed
- glo_arFrame["LSB"] = tFrameMapItem(HWLSB); //3.7.13 Low Speed Brake
- glo_arFrame["TBC"] = tFrameMapItem(HWTBC); //3.7.14 Tube Configration
- glo_arFrame["TRP"] = tFrameMapItem(HWTRP); //3.7.15 Rating Percentage of Tube
- glo_arFrame["GRP"] = tFrameMapItem(HWGRP); //3.7.16 Rating Percentage of Generator
- glo_arFrame["THL"] = tFrameMapItem(HWTHL); //3.7.17 Tube Heat Limitation
- glo_arFrame["LKV"] = tFrameMapItem(HWLKV); //3.7.18 Limitation of KV
- glo_arFrame["NEX"] = tFrameMapItem(HWNEX); //3.7.19 Number of Exposures
- glo_arFrame["GEL"] = tFrameMapItem(HWGEL); //3.7.20 Generator Error Log
- glo_arFrame["DGC"] = tFrameMapItem(HWDGC); //3.7.21 Detect Grid Config
- glo_arFrame["SPC"] = tFrameMapItem(HWSPC); //3.7.22 Serail Port Configration
- //Almax特有指令
- glo_arFrame["PZM"] = tFrameMapItem(HWPZM); //Flat Panel Field Selection
- glo_arFrame["SSD"] = tFrameMapItem(HWSSD); //System Shut Down
- glo_arFrame["VNE"] = tFrameMapItem(HWVNE); //Exam Seletcion
- glo_arFrame["DSA"] = tFrameMapItem(HWDSA); //Set DSA
- glo_arFrame["IPL"] = tFrameMapItem(HWIPL); //Start /stop the cine loop of a sequence
- glo_arFrame["INT"] = tFrameMapItem(HWINT); //Select the previous or next image in a run
- glo_arFrame["IST"] = tFrameMapItem(HWIST); //Select a previous or subsequent run
- }
- bool nsGEN::CGEN_DEV_IDETEC_Almax::StartHardwareStatusThread()
- {
- mLog::Info("enter Start HardwareStatus Thread ");
- if (m_pHardwareStatusThread == NULL)
- {
- DWORD m_HardwareStatusID;
- m_pHardwareStatusThread = CreateThread(0, 0, HardwareStatusThread, this, 0, &m_HardwareStatusID);
- if (m_pHardwareStatusThread == NULL)
- {
- mLog::Error("Start HardwareStatus Thread Failed");
- return false;
- }
- //DWORD m_HardwareReSendID;
- //m_pHardwareRsSendThread = CreateThread(0, 0, HardwareReSendThread, this, 0, &m_HardwareReSendID);
- //if (m_pHardwareRsSendThread == NULL)
- //{
- // mLog::Error("Start HardwareReSend Thread Failed");
- // return false;
- //}
- }
- return true;
- }
- DWORD nsGEN::CGEN_DEV_IDETEC_Almax::HardwareStatusThread(LPVOID pParam)
- {
- CGEN_DEV_IDETEC_Almax* pCurGen = (CGEN_DEV_IDETEC_Almax*)pParam;
- if (pCurGen == NULL)
- {
- return false;
- }
- mLog::Info("HardwareStatusThread start");
- if ((int)pCurGen->m_GenConfig["loopTime"] >= 0)
- {
- pCurGen->m_iLoopTime = (int)pCurGen->m_GenConfig["loopTime"];
- }
- mLog::Info("loopTime = {$}", pCurGen->m_iLoopTime.load());
- int currtTime = pCurGen->m_iLoopTime;
- while (pCurGen->m_iLoopTime > 0)
- {
- //心跳包统计加1
- pCurGen->m_iHeartBeats++;
- int tempHeartBeat = pCurGen->m_iHeartBeats;
- if (tempHeartBeat > 10) //无返回信息认为连接断开
- {
- pCurGen->m_iHeartBeats = 0;
- mLog::Info("AlmaxGEN: lost Connect \n");
- pCurGen->m_bConnectFlag = false;
- continue;
- }
- //发送心跳
- //pCurGen->HWSendHBCMD("EEC9", 4);
- //轮询发生器温度信息
- pCurGen->HWSendHBCMD("EHE", 3);
- }
- mLog::Info("HardwareStatusThread stop");
- return true;
- }
|