1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966 |
- // CCOS.Dev.Generator.EMD_EPS45_80.cpp : 定义 DLL 应用程序的导出函数。
- //
- #include "stdafx.h"
- #include <bitset>
- #include <assert.h>
- #include "Base64.h"
- using namespace std::placeholders;
- #include "Helper.JSON.hpp"
- #include "CCOS.Dev.Generator.SimensRF80.h"
- using namespace CCOS::Dev::Detail::Generator;
- namespace nsGEN = CCOS::Dev::Detail::Generator;
- #pragma warning (disable:4244) // warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
- #pragma warning (disable:4305) // warning C4305: “参数”: 从“double”到“float”截断
- #pragma warning (disable:4267) // warning C4267 : “初始化”: 从“size_t”转换到“int”,可能丢失数据
- static const int msTimeOut_Lock = 500;
- #define RF80_WaitACKTimer 2000
- #define RF80_Flag_COMCtrl 1
- Log4CPP::Logger* mLog::gLogger = nullptr;
- //指令操作关联结构
- nsGEN::tFrameMapItem::tFrameMapItem()
- {
- m_fFun = NULL;
- }
- nsGEN::tFrameMapItem::tFrameMapItem(cbFun f)
- {
- m_fFun = f;
- }
- nsGEN::tFrameMapItem& nsGEN::tFrameMapItem::operator =(const tFrameMapItem& value)
- {
- m_fFun = value.m_fFun;
- return *this;
- }
- static map <string, tFrameMapItem> arFrame;
- //-----------------------------------------------------------------------------
- // 特殊方法
- //-----------------------------------------------------------------------------
- //以指定分隔符截断字符串
- void StrSubstrData(const char* strData, char delimiter, std::vector<string>& array, int endAct = 1)
- {
- string strtemp = strData;
- string strItem = strtemp;
- std::size_t oldPos = 0;
- std::size_t findPos = strtemp.find(delimiter);
- while (findPos != string::npos)
- {
- strItem = strtemp.substr(oldPos, findPos - oldPos);
- if(!strItem.empty())
- {
- array.push_back(strItem);
- }
- if (findPos != strtemp.length())
- {
- oldPos = findPos + 1;
- findPos = strtemp.find(delimiter, oldPos);
- if (findPos == string::npos)
- {
- strItem = strtemp.substr(oldPos, strtemp.length() - oldPos);
- break;
- }
- }
- else
- {
- break;
- }
- }
- switch (endAct)
- {
- case 0:
- {}break;
- case 1:
- {
- if (strItem.length() >= 3)
- {
- strItem.pop_back();
- strItem.pop_back();
- }
- }break;
- default:
- break;
- }
- array.push_back(strItem);
- }
- void InitSendRecvCMDMap()
- {
- //send
- {
- //正在将发电机组设置为安全状态.发电机组状态变为SERIAL_ERROR
- glo_Send_RF80Fun["ABT"] = stru_EDS_SMG{ "<ABT", "11111" };
- //此命令用于获取2点暗盒或DR曝光的参数:Max ms
- glo_Send_RF80Fun["DQ2"] = stru_EDS_SMG{ "<DQ2 %.1f", "11111" };
- //此命令用于获取3点盒式磁带或DR曝光的参数
- glo_Send_RF80Fun["DQ3"] = stru_EDS_SMG{ "<DQ3", "11111" };
- //此命令用于检查2点暗盒或DR曝光的参数:UT, Tube Load, Focus
- glo_Send_RF80Fun["CP2"] = stru_EDS_SMG{ "<CP2 %.1f %u %c", "00101" };
- //此命令用于检查3点盒式磁带或DR曝光的参数:UT, mAs, Focus
- glo_Send_RF80Fun["CP3"] = stru_EDS_SMG{ "<CP3 %.1f %.2f %c", "00101" };
- //此命令用于检查两点序列的参数:UT, FPS, Xray Time, Focus
- glo_Send_RF80Fun["CS2"] = stru_EDS_SMG{ "<CS2 %.1f %.1f %u %c", "00101" };
- //此命令用于检查3点序列的参数:UT, FPS, Xray Time, Focus
- glo_Send_RF80Fun["CS3"] = stru_EDS_SMG{ "<CS3 %.1f %.1f %u %c", "00101" };
- //此命令用于发送0点DR曝光(单个或系列)的参数:Curve, Switch, Focus, Dose, Dominant, Max.time, Fps, Scene Length
- glo_Send_RF80Fun["ED0"] = stru_EDS_SMG{ "<ED0 %u %x %c %u %u %u %.1f %u", "00100" };
- //此命令用于发送1点DR曝光的参数:WS, UT, Tube load, Current red, Switch, Focus, Dose, Density, Dominant, Max.time
- glo_Send_RF80Fun["ED1"] = stru_EDS_SMG{ "<ED1 %u %.1f %u %u %x %c %u %.1f %u %u", "00100" };
- //此命令用于发送2点DR曝光的参数(使用kV和mAs进行曝光,无AEC,发生器将计算mA,以获得尽可能短的时间):WS, UT, mAs, Tube Load, Switch, Focus
- glo_Send_RF80Fun["ED2"] = stru_EDS_SMG{ "<ED2 %u %.1f %.2f %u %x %c", "00100" };
- //此命令用于发送三点曝光的参数:WS, UT, mAs, IT, Switch, Focus
- glo_Send_RF80Fun["ED3"] = stru_EDS_SMG{ "<ED3 %u %.1f %.2f %.3f %x %c", "00100" };
- //此命令用于发送1点DR曝光系列的参数:WS, UT, Tube load, Current red, Switch, Focus, Dose, Density, Dominant, Max.time, Frame per second
- glo_Send_RF80Fun["ES1"] = stru_EDS_SMG{ "<ES1 %u %.1f %u %u %x %c %u %.1f %u %u %.1f", "00100" };
- //此命令用于发送2点DR曝光的参数(使用kV和mAs进行曝光,无AEC,发生器将计算mA,以获得尽可能短的时间):WS, UT, mAs, Tube Load, Switch, Focus, Frame per second
- glo_Send_RF80Fun["ES2"] = stru_EDS_SMG{ "<ES2 %u %.1f %.2f %u %x %c %.1f", "00100" };
- //此命令用于发送三点曝光的参数:WS, UT, mAs, IT, Switch, Focus, Frame per second
- glo_Send_RF80Fun["ES3"] = stru_EDS_SMG{ "<ES3 %u %.1f %.2f %.3f %x %c %.1f", "00100" };
- //这是发送三点曝光参数的备用命令:WS, UT, mAs, ms, Tube load, Switch, Focus
- glo_Send_RF80Fun["EA3"] = stru_EDS_SMG{ "<EA3 %u %.1f %.2f %.0f %u %x %c", "00100" };
- //此命令用于发送1点曝光(使用kV和AEC进行曝光)的参数:WS, UT, Tube load, Current red, Switch, Focus, Sensitivity, Dominant, Density
- glo_Send_RF80Fun["EP1"] = stru_EDS_SMG{ "<EP1 %u %.1f %u %u %x %c %c %u %.1f", "00100" };
- //此命令用于发送2点曝光的参数(使用kV和mAs进行曝光,无AEC,发生器将计算mA,以获得尽可能短的时间):WS, UT, mAs, Tube Load, Switch, Focus
- glo_Send_RF80Fun["EP2"] = stru_EDS_SMG{ "<EP2 %u %.1f %.2f %u %x %c", "00100" };
- //此命令用于发送三点曝光的参数:WS, UT, mAs, IT, Switch, Focus
- glo_Send_RF80Fun["EP3"] = stru_EDS_SMG{ "<EP3 %u %.1f %.2f %.1f %x %c", "00100" };
- //HOST命令发电机组从 SERIAL_ERROR 返回至 SERIAL_STANDBY
- glo_Send_RF80Fun["ERQ"] = stru_EDS_SMG{ "<ERQ", "00101" };
- //生命防护由主机初始化.生命防护不是强制性的:Time out Receive count
- glo_Send_RF80Fun["GRD"] = stru_EDS_SMG{ "<GRD %u %u", "11111" };
- //此命令请求发生器的状态
- glo_Send_RF80Fun["GST"] = stru_EDS_SMG{ "<GST", "11111" };
- //从现在起,Generator将使用指定的版本.如果版本未知,Generator将报告并使用实现的最新版本:Version
- glo_Send_RF80Fun["IFV"] = stru_EDS_SMG{ "<IFV %u", "11111" };
- //此命令请求卡套管载荷计算器的状态
- glo_Send_RF80Fun["GHU"] = stru_EDS_SMG{ "<GHU", "11111" };
- //该命令用于重置DAP和荧光数据kV、mA、蜂鸣器时间和总时间的实际和汇总数据,以及荧光ABC控制的实际曝光点值:[DAP] [future use]
- glo_Send_RF80Fun["RAD"] = stru_EDS_SMG{ "<RAD %u %u", "00100" };
- //发生器报告其准备执行曝光,即阻塞条件
- glo_Send_RF80Fun["RDY"] = stru_EDS_SMG{ "<RDY", "11111" };
- //发电机应设置为未就绪状态.仅适用于Polydoros RFX:Not Ready Condition
- glo_Send_RF80Fun["SNRDY"] = stru_EDS_SMG{ "<SNRDY %x", "11111" };
- //此命令用于设置房间灯光输出的开/关:D800/D880.X23
- glo_Send_RF80Fun["RLC"] = stru_EDS_SMG{ "<RLC %u", "01111" };
- //主机请求发送CAN电报:Address Length Data Data
- glo_Send_RF80Fun["CS"] = stru_EDS_SMG{ "<CS %x %d %x %x", "01111" };
- //主机请求在D801.X4或X5上发送串行电报:string
- glo_Send_RF80Fun["KKS"] = stru_EDS_SMG{ "<KKS %s", "01111" };
- //主机向发生器发送可能的剂量设定点值,以显示在SCU上.该命令必须在任何探测器曝光参数之前发送:Setpoint 1 Setpoint 2 .. Setpoint n
- glo_Send_RF80Fun["DOSP"] = stru_EDS_SMG{ "<DOSP %2.2f %2.2f %2.2f %2.2f", "01111" };
- //主机向发生器发送带有DR的1点暴露的剂量校正系数.发生器将ED1命令的设定值与该值相乘.该值应在0.7…1.3的范围内:WS 1 WS 2 WS 3
- glo_Send_RF80Fun["DOCF"] = stru_EDS_SMG{ "<DOCF %1.4f %1.4f %1.4f", "01111" };
- //主机向SCU发送探测器就绪状态
- glo_Send_RF80Fun["RDR"] = stru_EDS_SMG{ "<RDR", "00011" };
- //该命令用于通过类似D800/D880上S5的SW电报禁用X射线:on/off
- glo_Send_RF80Fun["SSWSS"] = stru_EDS_SMG{ "<SSWSS %u", "01111" };
- //此命令用于在平面探测器校准期间禁用X射线生成:on/off
- glo_Send_RF80Fun["DECEX"] = stru_EDS_SMG{ "<DECEX %u", "11111" };
- //该命令在准备过程中激活D800/D880 X142上的X射线开启指示:on/off
- glo_Send_RF80Fun["RIP"] = stru_EDS_SMG{ "<RIP %u", "11111" };
- //此命令用于启动曝光循环:Pre contact, Main contact, Mode
- glo_Send_RF80Fun["SXP"] = stru_EDS_SMG{ "<SXP %u %u %u", "00110" };
- //此命令用于停止和恢复DR系列曝光的调节剂量:Stop
- glo_Send_RF80Fun["DRS"] = stru_EDS_SMG{ "<DRS %u", "00010" };
- //此命令用于通知ABC控件实际荧光亮度值.此命令对于没有B信号的系统体系结构是必需的.电报和延迟之间的时间应该是恒定的,以实现稳定的亮度控制.超时待澄清:Brightness actual Brightness nominal
- glo_Send_RF80Fun["FBA"] = stru_EDS_SMG{ "<FBA %u %u", "00010" };
- //此命令用于发送连续荧光(使用荧光曲线的连续荧光)的参数:Curve type Stop Doserate Focus
- glo_Send_RF80Fun["FPC"] = stru_EDS_SMG{ "<FPC %u %u %u %c", "00110" };
- //此命令用于发送手动透视:UT, IT, Focus
- glo_Send_RF80Fun["FPM"] = stru_EDS_SMG{ "<FPM %.1f %.2f %c", "00110" };
- //该命令用于发送脉冲透视:Curve type, Stop, UT, IT, X-ray time, max.time, fps, Dose/pulse, Focus
- glo_Send_RF80Fun["FPP"] = stru_EDS_SMG{ "<FPP %u %u %.1f %.1f %.1f %u %.1f %u %c", "00110" };
- //此命令用于重置荧光蜂鸣器并将计时器设置为0
- glo_Send_RF80Fun["RFB"] = stru_EDS_SMG{ "<RFB", "00111" };
- //此命令用于启动和停止透视.只有当发电机组能够运行Fluoro时,才接受Fluoro:Start / Stop
- glo_Send_RF80Fun["SFL"] = stru_EDS_SMG{ "<SFL %u", "00110" };
- //此命令可用于测试串行端口:Count String
- glo_Send_RF80Fun["COMTEST"] = stru_EDS_SMG{ "<COMTEST %u %s", "11111" };
- }
- //recv
- {
- //DQ2 Format 1:UT Allowed min.mAs Allowed max.mAs-Generator Thermal lim.max.mAs-Large Thermal lim.max.mAs-Small Current lim.mAs-Large Current lim.mAs-Small
- glo_Recv_RF80Fun["AD2"] = stru_EDS_SMG{ ">AD2 %.1f %u %u %u %u %u %u", "11111" };
- //DQ2 Format 2:Maximal exposure time in sec
- glo_Recv_RF80Fun["AD2Timemax"] = stru_EDS_SMG{ ">AD2Timemax %u", "11111" };
- //DQ2 Format 3:Minimal exposure time in sec
- glo_Recv_RF80Fun["AD2Timemin"] = stru_EDS_SMG{ ">AD2Timemin %u", "11111" };
- //DQ2 Format 4:End:指令 DQ2 发送成功, 所有数据发送完毕
- glo_Recv_RF80Fun["AD2End"] = stru_EDS_SMG{ ">AD2End", "11111" };
- //DQ3 Format 1:index 1st Tube voltage UT index 2nd Tube voltage UT ..
- glo_Recv_RF80Fun["AD3kV"] = stru_EDS_SMG{ ">AD3kV %d %.2f %d %.2f %d", "11111" };
- //DQ3 Format 2:ms Allowed min mAs
- glo_Recv_RF80Fun["AD3ms"] = stru_EDS_SMG{ ">AD3ms %3.2f %d", "11111" };
- //DQ3 Format 3:1st Allowed max.mAs-Generator 1st Allowed max.mAs-Large 1st Allowed max.mAs-Small 2nd Allowed max.mAs-Generator …
- glo_Recv_RF80Fun["AD3mAs"] = stru_EDS_SMG{ ">AD3mAs %u %u %u %u %u", "11111" };
- //DQ3 Format 4:DP3电报的最后一行
- glo_Recv_RF80Fun["AD3End"] = stru_EDS_SMG{ ">AD3End", "11111" };
- //CP2:Allowed min.mAs Allowed max.mAs
- glo_Recv_RF80Fun["AC2"] = stru_EDS_SMG{ ">AC2 %.2f %.2f", "00101" };
- //CP3:mAs valid Allowed min.IT Allowed max.IT
- glo_Recv_RF80Fun["AC3"] = stru_EDS_SMG{ ">AC3 %u %.1f %.1f", "00101" };
- //CS2:Ut FPS Xray Time Focus mAs
- glo_Recv_RF80Fun["AS2"] = stru_EDS_SMG{ ">AS2 %.1f %.1f %u %c %.1f", "00101" };
- //CP3:Ut FPS Xray Time Focus mA
- glo_Recv_RF80Fun["AS3"] = stru_EDS_SMG{ ">AS3 %.1f %.1f %u %c %.1f", "00101" };
- //该命令由发电机组发出,用于发送DAP值:Sum Actual
- glo_Recv_RF80Fun["DAP"] = stru_EDS_SMG{ ">DAP %.2f %.2f", "00110" };
- //在曝光系列期间,发生器单元报告最后一个X射线脉冲的实际曝光数据:UT IT mAs ms End DAP Pulse
- glo_Recv_RF80Fun["EPA"] = stru_EDS_SMG{ ">EPA %.1f %.2f %.2f %.1f %x %.2f %u", "00110" };
- //发电机组检测到错误,并更改为状态 SERIAL_ERROR ,报告错误原因:Delimiter Num System ErrNum Para Prio Delimiter Num Reaction Prio Delimiter Extended
- glo_Recv_RF80Fun["ERR"] = stru_EDS_SMG{ ">ERR IT %04d %02x %02x %04x %1x F80 %d %04x %1x TXT %s %s %s", "01111" };
- //发生器报告曝光或荧光的准备状态已完成.状态从 SERIAL_STANDBY 更改为 SERIAL_EXPOSURE
- glo_Recv_RF80Fun["EXP"] = stru_EDS_SMG{ ">EXP", "00010" };
- //发生器报告用户按下关闭按钮,发生器将关闭.状态变为 SERIAL_SHUTDOWN
- glo_Recv_RF80Fun["SDN"] = stru_EDS_SMG{ ">SDN", "01111" };
- //生命防护由主机初始化.生命防护不是强制性的:Transmit count
- glo_Recv_RF80Fun["GRD"] = stru_EDS_SMG{ ">GRD %u", "11111" };
- //此命令请求发生器的状态:State Signals
- glo_Recv_RF80Fun["GST"] = stru_EDS_SMG{ ">GST %u %x", "11111" };
- //此命令用于告诉发生器单元Host将使用哪个版本的接口命令.如果未发送此命令,发生器将使用最新版本:Version
- glo_Recv_RF80Fun["IFV"] = stru_EDS_SMG{ ">IFV %u", "11111" };
- //发生器报告初始化状态已完成.状态从 SERIAL_START 更改为 SERIAL_INIT
- glo_Recv_RF80Fun["INI"] = stru_EDS_SMG{ ">INI", "01000" };
- //在曝光期间,已达到允许的最大mAs值.如果发电机的最大mAs不高于600mA,这可能是600mA,也可能是56kWs除以标称管电压的结果
- glo_Recv_RF80Fun["LIM"] = stru_EDS_SMG{ ">LIM", "00010" };
- //在曝光期间,已达到允许的最大曝光时间.从1点到3点的所有曝光类型都可能出现限制时间.在信号流中省略了硬件信号
- glo_Recv_RF80Fun["LIT"] = stru_EDS_SMG{ ">LIT", "00010" };
- //此命令取决于计算器的类型:%HU PT
- glo_Recv_RF80Fun["PHU"] = stru_EDS_SMG{ ">PHU %u %u", "00111" };
- //发生器报告其准备执行曝光,即阻塞条件:Ready Condition1 Ready Condition2
- glo_Recv_RF80Fun["RDY"] = stru_EDS_SMG{ ">RDY %x %x", "11111" };
- //发电机通知主机收到CAN电报:Address Length Data Data
- glo_Recv_RF80Fun["CR"] = stru_EDS_SMG{ ">CR %x %d %x %x", "01111" };
- //此命令用于通知主机曝光释放输入的变化(pre-contact or main-contact).如果满足所有要求,主机可以使用此命令使用“<SXP”触发曝光,或者发送KK-Tomo时间输入的更改:Pre contact Main contact KK
- glo_Recv_RF80Fun["RXP"] = stru_EDS_SMG{ ">RXP %u %u %u", "11111" };
- //发生器报告其处于备用状态并准备输入,状态从 SERIAL_INIT/SERIAL_EXPOSURE/SERIAL_ERROR 更改为 SERIAL_STANDBY
- glo_Recv_RF80Fun["SBY"] = stru_EDS_SMG{ ">SBY", "11111" };
- //发生器报告单个储罐温度高于或低于极限的变化
- glo_Recv_RF80Fun["TWS"] = stru_EDS_SMG{ ">TWS %x", "00100" };
- //发生器收到未知或错误的命令
- glo_Recv_RF80Fun["UNK"] = stru_EDS_SMG{ ">UNK", "11111" };
- //发生器收到一条校验和错误的消息
- glo_Recv_RF80Fun["CRC"] = stru_EDS_SMG{ ">CRC", "11111" };
- //此命令用于验证0点DR曝光的接收参数:请参阅ED0命令
- glo_Recv_RF80Fun["VD0"] = stru_EDS_SMG{ ">VD0 %u %x %c %u %u %u %.1f %u", "00100" };
- //此命令用于验证1点DR曝光的接收参数:请参阅ED1命令
- glo_Recv_RF80Fun["VD1"] = stru_EDS_SMG{ ">VD1 %u %.1f %u %u %x %c %u %.1f %u %u", "00100" };
- //此命令用于验证2点DR曝光的接收参数:请参阅ED2命令
- glo_Recv_RF80Fun["VD2"] = stru_EDS_SMG{ ">VD2 %u %.1f %.2f %u %x %c", "00100" };
- //此命令用于验证3点DR曝光的接收参数:请参阅ED3命令
- glo_Recv_RF80Fun["VD3"] = stru_EDS_SMG{ ">VD3 %u %.1f %.2f %.3f %x %c", "00100" };
- //此命令用于验证3点DR曝光的接收参数:请参阅EA3命令
- glo_Recv_RF80Fun["VA3"] = stru_EDS_SMG{ ">VA3 %u %.1f %.2f %.0f %u %x %c", "00100" };
- //此命令用于验证1点曝光的接收参数:请参阅EP1命令
- glo_Recv_RF80Fun["VP1"] = stru_EDS_SMG{ ">VP1 %u %.1f %u %u %x %c %c %u %.1f", "00100" };
- //此命令用于验证2点曝光的接收参数:请参阅EP2命令
- glo_Recv_RF80Fun["VP2"] = stru_EDS_SMG{ ">VP2 %u %.1f %.2f %u %x %c", "00100" };
- //此命令用于验证3点曝光的接收参数:请参阅EP3命令
- glo_Recv_RF80Fun["VP3"] = stru_EDS_SMG{ ">VP3 %u %.1f %.2f %.1f %x %c", "00100" };
- //此命令用于验证1点DR曝光的接收参数:请参阅ES1命令
- glo_Recv_RF80Fun["VS1"] = stru_EDS_SMG{ ">VS1 %u %.1f %u %u %x %c %u %.1f %u %u %.1f", "00100" };
- //此命令用于验证2点DR曝光的接收参数:请参阅ES2命令
- glo_Recv_RF80Fun["VS2"] = stru_EDS_SMG{ ">VS2 %u %.1f %.2f %u %x %c %.1f", "00100" };
- //此命令用于验证3点DR曝光的接收参数:请参阅ES3命令
- glo_Recv_RF80Fun["VS3"] = stru_EDS_SMG{ ">VS3 %u %.1f %.2f %.3f %x %c %.1f", "00100" };
- //该命令用于验证收到的剂量调节停止命令<DRS:Stop
- glo_Recv_RF80Fun["VRS"] = stru_EDS_SMG{ ">VRS %u", "00010" };
- //此命令用于指示荧光蜂鸣器已激活,因为指定的荧光计时器已过期
- glo_Recv_RF80Fun["FBS"] = stru_EDS_SMG{ ">FBS %u", "00010" };
- //该命令由发生器单元提供,用于指示实际的荧光参数:kV mA Time State Deviation
- glo_Recv_RF80Fun["FPA"] = stru_EDS_SMG{ ">FPA %.1f %.2f %.2f %u %d", "00110" };
- //该命令由发生器单元给出,用于指示实际的脉冲荧光参数:UT IT x-ray time Tube current time product Timer State Deviation
- glo_Recv_RF80Fun["PPA"] = stru_EDS_SMG{ ">PPA %.1f %.1f %.1f %.2f %.2f %u %d", "00110" };
- //使用此命令时,系统控制单元可以通知主机曝光释放输入(脚踏开关)的变化.如果满足所有要求,主机可以使用此命令使用“<SFL”触发曝光:Handswitch Footswitch
- glo_Recv_RF80Fun["RFL"] = stru_EDS_SMG{ ">RFL %u %u", "00110" };
- //此命令用于验证连续荧光的接收参数:参见FPC命令:Curve type Stop Doserate Focus
- glo_Recv_RF80Fun["VPC"] = stru_EDS_SMG{ ">VPC %u %u %u %c", "00110" };
- //此命令用于验证手动荧光检测的接收参数:参见FPM命令
- glo_Recv_RF80Fun["VPM"] = stru_EDS_SMG{ ">VPM %.1f %.2f %c", "00110" };
- //该命令用于验证脉冲荧光的接收参数:参见FPP命令
- glo_Recv_RF80Fun["VPP"] = stru_EDS_SMG{ ">VPP %u %u %.1f %.1f %.1f %u %.1f %u %c", "00110" };
- //此命令可用于测试串行端口:String
- glo_Recv_RF80Fun["COMTEST"] = stru_EDS_SMG{ ">COMTEST %s", "11111" };
- }
- }
- //-----------------------------------------------------------------------------
- // GenDevice
- //-----------------------------------------------------------------------------
- vector <float> g_MA_List = { 10, 12.5, 16, 20, 25, 32, 40, 50, 63, 80, 100, 125,160, 200, 250, 320, 400, 500, 630, 800, 1000 };
- vector <float> g_MAS_List = { 0.5, 0.63, 0.8, 1, 1.25, 1.6, 2, 2.5, 3.2, 4, 5, 6.3, 8, 10, 12.5, 16, 20, 25, 32, 40, 50, 63, 80, 100, 125, 160, 200, 250, 320, 400, 500, 630,800, 1000 };
- vector <float> g_MS_List = { 1,1.25,1.6,2,2.5,3.2,4, 5, 6.3, 8, 10, 12.5, 16, 20, 25, 32, 40,50, 63, 80, 100, 125, 160, 200, 250, 320, 400, 500, 630, 800, 1000,1250, 1600, 2000, 2500, 3200, 4000, 5000 };
- nsSerialGPM::CDeliverModule nsGEN::RF80Device::m_tDelivermodule;
- nsGEN::RF80Device::RF80Device(std::shared_ptr <IOEventCenter> center, nsSCF::SCF SCF,std::string configPath) : super(center, SCF)
- {
- assert(EventCenter);
- 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_DoseUnit.m_GenSynState.reset(new GENSYNSTATEMould(AttrKey::GENERATOR_RAD_OFF, AttrKey::GENERATOR_SYNC_ERR, AttrKey::GENERATOR_SYNC_MAX, 1));
- m_DoseUnit.m_GenState.reset(new GENSTATEMould(0, AttrKey::GENERATOR_STATUS_SHUTDOWN, AttrKey::GENERATOR_STATUS_MAX, 1));
- m_DoseUnit.m_WS.reset(new WORKSTATIONMould(1, 0, 5, 1));
- m_DoseUnit.m_Handswitch.reset(new GENHANDSWITCHMould(0, 0, 9999, 1));
- m_DoseUnit.m_GenTotalExpNumber.reset(new TOTALEXPNUMMould(0, 0, 9999, 1));
- m_DoseUnit.m_GenTotalAcqTimes.reset(new TOTALACQTIMESMould(0, 0, 9999, 1));
- m_DoseUnit.m_GenTubeCoolWaitTimes.reset(new TUBECOOLTIMEMould(0, 0, 9999, 1));
- m_DoseUnit.m_GenTubeOverLoadNumber.reset(new TUBEOVERLOADNUMMould(0, 0, 9999, 1));
- m_DoseUnit.m_GenCurrentExpNumber.reset(new CUREXPNUMMould(0, 0, 9999, 1));
- m_DoseUnit.m_KV.reset(new KVMould(0.0, 40.0, 150.0, 1.0));
- m_DoseUnit.m_MA.reset(new MAMould(0.0, 0.5, 800.0, 0.1));
- m_DoseUnit.m_MS.reset(new MSMould(0.0, 1.0, 10000.0, 0.01));
- m_DoseUnit.m_MAS.reset(new MASMould(0.0, 0.5, 800.0, 0.01));
- m_DoseUnit.m_Techmode.reset(new TECHMODEMould(AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_2P, AttrKey::TECHMODE_NOAEC_3P, AttrKey::TECHMODE_AEC_MAS_MA, 1));
- m_DoseUnit.m_Focus.reset(new FOCUSMould(AttrKey::FOCUS_TYPE::FOCUS_LARGE, AttrKey::FOCUS_SMALL, AttrKey::FOCUS_LARGE, 1));
- m_DoseUnit.m_AECField.reset(new AECFIELDMould(0, 0, 111, 1));
- m_DoseUnit.m_AECFilm.reset(new AECFILMMould(0, 0, 2, 1));
- m_DoseUnit.m_AECDensity.reset(new AECDENSITYMould(0, -4, 4, 1));
- m_DoseUnit.m_HE.reset(new TUBEHEATMould(0, 0, 100, 1));
- m_DoseUnit.m_PostKV.reset(new POSTKVMould(0.0, 40.0, 150.0, 1.0));
- m_DoseUnit.m_PostMA.reset(new POSTMAMould(0.0, 0.5, 800.0, 0.1));
- m_DoseUnit.m_PostMS.reset(new POSTMSMould(0.0, 1.0, 10000.0, 0.01));
- m_DoseUnit.m_PostMAS.reset(new POSTMASMould(0.0, 0.5, 800.0, 0.01));
- m_DoseUnit.m_ExpMode.reset(new EXPMODEMould(AttrKey::EXPMODE_TYPE::Single));
- m_DoseUnit.m_FrameRate.reset(new FRAMERATEMould(5, 0, 16, 1));
- m_DoseUnit.m_FLKV.reset(new FLUKVMould(0.0, 40.0, 150.0, 1));
- m_DoseUnit.m_FLMA.reset(new FLUMAMould(0.0, 0.5, 800.0, 0.1));
- m_DoseUnit.m_FLMS.reset(new FLUMSMould(0.0, 1.0, 10000.0, 0.01));
- m_DoseUnit.m_FLAccTime.reset(new FLAccTimeMould(0.0, 0.0, 300.0, 1));
- m_DoseUnit.m_FLIntTime.reset(new FLUIntTimeMould(0.0, 0.0, 1000.0, 1));
- m_DoseUnit.m_PPS.reset(new PPSMould(5.0, 0.0, 60.0, 1));
- m_DoseUnit.m_FLMode.reset(new FLUModeMould(AttrKey::GENERATOR_FLUMode::GENERATOR_FLMODE_NOTFLU));
- m_DoseUnit.m_ABSStatus.reset(new FLUABSStatusMould(AttrKey::GENERATOR_ABSStatus::GENERATOR_ABS_OFF));
- m_DoseUnit.m_MagSize.reset(new FLUMagMould(0, 0, 3, 1));
- m_DoseUnit.m_DoseLevel.reset(new FLUDoseLevelMould(AttrKey::GENERATOR_DoseLevel::GENERATOR_DOSE_LOW));
- m_DoseUnit.m_Curve.reset(new FLUCurveMould(0, 1, 3, 1));
- m_MSGUnit.reset(new nsDetail::MSGUnit(center, GeneratorUnitType));
- //串口处理层
- m_tDelivermodule.InitSendModle(this, &ProcessClientData, WriteLog);
- m_nCMDType_FirstSend = m_tDelivermodule.SetPriority(false, true);
- m_nCMDType_WaitTime = m_tDelivermodule.SetPriority(false, false, 0, true, 100);
- m_nCMDType_WaitSelf = m_tDelivermodule.SetPriority(false, false, 0, false, 0, true, 2000);
- mLog::Info("m_nCMDType_FirstSend[{$}] m_nCMDType_WaitTime[{$}] m_nCMDType_WaitSelf[{$}]",
- m_nCMDType_FirstSend,m_nCMDType_WaitTime, m_nCMDType_WaitSelf);
- {
- map<string, string> cmdHeadmap;
- cmdHeadmap["<IFV"] = ">IFV";
- cmdHeadmap["<GST"] = ">GST";
- cmdHeadmap["<ERQ"] = ">SBY";
- cmdHeadmap["<GHU"] = ">PHU";
- cmdHeadmap["<ED1"] = ">VD1";
- cmdHeadmap["<ES1"] = ">VS1";
- cmdHeadmap["<ED2"] = ">VD2";
- cmdHeadmap["<ES2"] = ">VS2";
- cmdHeadmap["<ED3"] = ">VD3";
- cmdHeadmap["<ES3"] = ">VS3";
- cmdHeadmap["<RFB"] = ">FBS";
- cmdHeadmap["<FPP"] = ">VPP";
- cmdHeadmap["<FPC"] = ">VPC";
- cmdHeadmap["<FPM"] = ">VPM";
- m_tDelivermodule.SetSpeSelfHead(cmdHeadmap);
- }
- //状态参数初始化
- m_GenStatus.changeState(GS_INIT);
- m_hRadLimitMASEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_hRadLimitMAEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_hExitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_hLoopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- m_hArrayEvent[0] = m_hExitEvent;
- m_hArrayEvent[1] = m_hLoopEvent;
- //加载配制文件
- m_strConfigPath = configPath;
- ResDataObject temp;
- temp.loadFile(m_strConfigPath.c_str());
- m_GenConfig = temp["CONFIGURATION"];
- TransJsonText(m_GenConfig);
-
- //公布方法
- Register();
- InitSendRecvCMDMap();
- OnCallBack();
- //初始化参数
- GetConfData();
- GetState();
- //Reset();
- StartHardwareStatusThread();
- }
- nsGEN::RF80Device::~RF80Device ()
- {
- SetEvent(m_hExitEvent);
- Sleep(1000);
- #if Ccos_V3
- if (m_pGenClient)
- {
- if (!m_pGenClient->IsClosed())
- {
- m_pGenClient->Close();
- }
- delete m_pGenClient;
- m_pGenClient = NULL;
- }
- #endif
- }
- std::string nsGEN::RF80Device::GetGUID() const
- {
- mLog::Debug("\n===============GetGUID : {$} ===================\n", GeneratorUnitType);
- return GeneratorUnitType;
- }
- void nsGEN::RF80Device::Register()
- {
- auto Disp = &Dispatch;
- superGen::Register (Disp);
- superGen::RegisterRAD (Disp);
- superGen::RegisterAEC (Disp);
- superGen::RegisterExpEnable (Disp);
- superGen::RegisterGeneratortoSyncStatus(Disp);
- superGen::RegisterFluoro(Disp);
- Disp->Get.Push(m_MSGUnit->GetKey().c_str(), [this](std::string& out) { out = m_MSGUnit->JSGet(); return RET_STATUS::RET_SUCCEED; });
- auto fun_Clear_DAP = [this](auto a, auto&)
- {
- return Clear_DAP();
- };
- Disp->Action.Push("Clear_DAP", fun_Clear_DAP);
- auto fun_GetValue_DAP = [this](auto a, auto& b)
- {
- float value = 0;
- RET_STATUS ret = GetValue_DAP(value);
- b = ToJSON(value);
- return ret;
- };
- Disp->Action.Push("GetValue_DAP", fun_GetValue_DAP);
- }
- int nsGEN::RF80Device::GetConfData()
- {
- //是否由RXP发送SXP
- if (m_GenConfig.GetKeyCount("IsSendSXPByRxp") > 0)
- {
- string value = (string)m_GenConfig["IsSendSXPByRxp"];
- if (value.length() == 2 &&
- (value.at(0) == '1' || value.at(0) == '0') &&
- (value.at(1) == '1' || value.at(1) == '0'))
- {
- m_bIsSendSXPByRxpFlag = value;
- mLog::Debug("cfg IsSendSXPByRxp [{$}]", m_bIsSendSXPByRxpFlag.c_str());
- }
- else
- {
- mLog::Warn("cfg IsSendSXPByRxp not right");
- }
- }
- //是否由RXP发送SFL
- if (m_GenConfig.GetKeyCount("IsSendSFLByRxp") > 0)
- {
- string value = (string)m_GenConfig["IsSendSFLByRxp"];
- if (value.length() == 1 &&
- (value.at(0) == '1' || value.at(0) == '0'))
- {
- m_bIsSendSFLByRxpFlag = value;
- mLog::Debug("cfg IsSendSFLByRxp [{$}]", m_bIsSendSFLByRxpFlag.c_str());
- }
- else
- {
- mLog::Warn("cfg IsSendSFLByRxp not right");
- }
- }
- //是否发送RDR
- if (m_GenConfig.GetKeyCount("IsSendSCUFPDReady") > 0)
- {
- m_bIsSendSCUFPDReady = (int)m_GenConfig["IsSendSCUFPDReady"];
- mLog::Debug("cfg IsSendSCUFPDReady [{$}]", m_bIsSendSCUFPDReady);
- }
- //与FullUCB通信
- #if Ccos_V3
- if (m_GenConfig.GetKeyCount("IsSendToFullUCB") > 0)
- {
- m_SignalArray = (string)m_GenConfig["IsSendToFullUCB"];
- m_pGenClient = new LogicClient("DV3_FullUCB", "","NSQ", false);
- if (m_pGenClient->Open("ccosChannel", ALL_ACCESS))
- {
- mLog::Debug("Ccos_V3 Create DV3_FullUCB Client success");
- }
- }
- #endif
- //同步模式
- if (m_GenConfig.GetKeyCount("WSTable") > 0)
- {
- int WSNamber = (int)m_GenConfig["WSTable"];
- EnSYNMode WSSYN = (EnSYNMode)((int)m_GenConfig["SYNTable"]);
- m_arrWSMap[cfgWorkStationKey("Table", AttrKey::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", AttrKey::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", AttrKey::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", AttrKey::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", AttrKey::CONVENTIONAL)] = cfgWorkStationData("Direct", WSNamber, WSSYN);
- mLog::Debug("cfg Conventional WS[{$}],SYN[{$}]", WSNamber, (int)WSSYN);
- }
- //参数默认值
- if (m_GenConfig.GetKeyCount("TubeLoad") > 0)
- {
- m_nCfgTubeLoad = (int)m_GenConfig["TubeLoad"];
- mLog::Debug("cfg TubeLoad [{$}]", m_nCfgTubeLoad);
- }
- if (m_GenConfig.GetKeyCount("CurrentReduction") > 0)
- {
- m_nCfdCurrentRed = (int)m_GenConfig["CurrentReduction"];
- mLog::Debug("cfg CurrentReduction [{$}]", m_nCfdCurrentRed);
- }
- if (m_GenConfig.GetKeyCount("Switch") > 0)
- {
- m_nCfdSwitch = (int)m_GenConfig["Switch"];
- mLog::Debug("cfg Switch [{$}]", m_nCfdSwitch);
- }
- if (m_GenConfig.GetKeyCount("AECDose") > 0)
- {
- m_nCfdDose = (int)m_GenConfig["AECDose"];
- mLog::Debug("cfg AECDose [{$}]", m_nCfdDose);
- }
- if (m_GenConfig.GetKeyCount("AECDRMaxTime") > 0)
- {
- m_nCfdMaxTime = (int)m_GenConfig["AECDRMaxTime"];
- mLog::Debug("cfg AECDRMaxTime [{$}]", m_nCfdMaxTime);
- }
- if (m_GenConfig.GetKeyCount("DoseRate") > 0)
- {
- m_nCfdDoseRate = (int)m_GenConfig["DoseRate"];
- mLog::Debug("cfg DoseRate [{$}]", m_nCfdDoseRate);
- }
- if (m_GenConfig.GetKeyCount("PFMS") > 0)
- {
- m_nCfdPFMS = (int)m_GenConfig["PFMS"];
- mLog::Debug("cfg PFMS [{$}]", m_nCfdPFMS);
- }
- if (m_GenConfig.GetKeyCount("PFMSMax") > 0)
- {
- m_nCfdPFMSMax = (int)m_GenConfig["PFMSMax"];
- mLog::Debug("cfg PFMSMax [{$}]", m_nCfdPFMSMax);
- }
- //获取参数值合集
- m_ResParametersList = m_GenConfig["ParameterList"];
- //load FPS ans MAX KW map
- m_mapFPSMaxKW.clear();
- m_mapFPSMaxKW.insert(std::pair<float, int>(0.5, 8000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(1.0, 8000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(2.0, 8000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(3.0, 8000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(4.0, 4000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(6.0, 4000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(7.5, 4000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(15, 2000));
- m_mapFPSMaxKW.insert(std::pair<float, int>(30, 2000));
- return 0;
- }
- RET_STATUS nsGEN::RF80Device::SetGenSynState(int value)
- {
- mLog::Debug("Enter SetGenSynState:[{$}]", value);
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- if (value >= AttrKey::GENERATOR_RAD_OFF && value <= AttrKey::GENERATOR_RAD_XRAYOFF)
- {
- if (m_ExpReady[0] != '1')
- {
- mLog::Warn("SetGenSynState:not in RAD ready");
- return RET_STATUS::RET_SUCCEED;
- }
- }
- else if (value >= AttrKey::GENERATOR_FLU_OFF && value <= AttrKey::GENERATOR_FLU_XRAYOFF)
- {
- if (m_ExpReady[1] != '1')
- {
- mLog::Warn("SetGenSynState:not in Flu ready");
- return RET_STATUS::RET_SUCCEED;
- }
- }
- switch (value)
- {
- case AttrKey::GENERATOR_RAD_OFF:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SXP"].strParamArry.c_str(),
- 0, 0, 0);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- }break;
- case AttrKey::GENERATOR_RAD_PREPARE:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SXP"].strParamArry.c_str(),
- m_nSYNMode, 0, m_RadMode);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- if (m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::Single ||
- m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::TOMO)
- {
- DetectorReady();
- }
- }break;
- case AttrKey::GENERATOR_RAD_READY:
- {
- if (m_LastTechMode != RF80Tech_RAD)
- {
- m_bNeedSendToSynBox = true;
- m_LastTechMode = RF80Tech_RAD;
- HWSendWaitSelfCMD(m_LastParamArry[RF80Tech_RAD].strParamCMD, strlen(m_LastParamArry[RF80Tech_RAD].strParamCMD), glo_Send_RF80Fun[m_LastParamArry[RF80Tech_RAD].strCMDID].struStatus);
- }
- }break;
- case AttrKey::GENERATOR_RAD_XRAYON:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SXP"].strParamArry.c_str(),
- m_nSYNMode, m_nSYNMode, m_RadMode);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- }break;
- case AttrKey::GENERATOR_RAD_XRAYOFF:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SXP"].strParamArry.c_str(),
- 0, 0, 0);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- }break;
- case AttrKey::GENERATOR_FLU_OFF:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SFL"].strParamArry.c_str(),
- 0);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SFL"].struStatus);
- }break;
- case AttrKey::GENERATOR_FLU_READY:
- {
- if (m_LastTechMode != RF80Tech_FLU)
- {
- m_bNeedSendToSynBox = true;
- m_LastTechMode = RF80Tech_FLU;
- HWSendWaitSelfCMD(m_LastParamArry[RF80Tech_FLU].strParamCMD, strlen(m_LastParamArry[RF80Tech_FLU].strParamCMD), glo_Send_RF80Fun[m_LastParamArry[RF80Tech_FLU].strCMDID].struStatus);
- }
- }break;
- case AttrKey::GENERATOR_FLU_XRAYON:
- {
- int fluMode = m_DoseUnit.m_FLMode->Get();
- mLog::Debug("SetGenSynState: current FluMode[{$}]", fluMode);
- switch (fluMode)
- {
- case AttrKey::GENERATOR_FLMODE_NOTFLU:
- break;
- case AttrKey::GENERATOR_FLMODE_CF:
- case AttrKey::GENERATOR_FLMODE_HCF:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SFL"].strParamArry.c_str(),
- m_nSYNMode);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SFL"].struStatus);
- }break;
- case AttrKey::GENERATOR_FLMODE_PF:
- case AttrKey::GENERATOR_FLMODE_HPF:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SFL"].strParamArry.c_str(),
- 1);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SFL"].struStatus);
- }break;
- break;
- case AttrKey::GENERATOR_FLMODE_MAX:
- break;
- default:
- break;
- }
- }break;
- case AttrKey::GENERATOR_FLU_XRAYOFF:
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SFL"].strParamArry.c_str(),
- 0);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SFL"].struStatus);
- }break;
- default:
- break;
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::Reset()
- {
- mLog::Debug("Enter Reset");
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- if (m_DoseUnit.m_FLMode->Get() != AttrKey::GENERATOR_FLMODE_NOTFLU)
- {
- sprintf(strSendCMD, glo_Send_RF80Fun["RAD"].strParamArry.c_str(), 1, 0);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["RAD"].struStatus);
- memset(strSendCMD, 0x00, GEN_CF80_SEND_LEN_max);
- }
- if (m_DoseUnit.m_GenState->Get() != nsGEN::AttrKey::GENERATOR_STATUS_ERROR)
- {
- GetState();
- }
- else
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ERQ"].strParamArry.c_str());
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ERQ"].struStatus);
- }
- Sleep(1000);
- mLog::Debug("End Reset");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetExpMode(std::string value)
- {
- mLog::Debug("Enter SetExpMode:[{$}]", value.c_str());
- if (!value.empty())
- {
- if (m_DoseUnit.m_ExpMode->Update(value))
- {
- FireNotify(AttrKey::EXPMODE, m_DoseUnit.m_ExpMode->JSGet());
- }
- if (m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::TOMO)
- {
- if (0 == m_DoseUnit.m_KV->Get())
- {
- SetAPRLocal(m_APRParam.nWS, m_APRParam.nTechmode, m_APRParam.nFocus,
- m_APRParam.fKV, m_APRParam.fMA, m_APRParam.fMS, m_APRParam.fMAS,
- m_APRParam.nAECField, m_APRParam.nAECFilm, m_APRParam.nAECDensity);
- }
- else
- {
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- m_DoseUnit.m_KV->Get(), m_DoseUnit.m_MA->Get(), m_DoseUnit.m_MS->Get(), m_DoseUnit.m_MAS->Get(),
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- }
- }
- else if (m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::Stitch)
- {
- int aprnum = m_DoseUnit.m_GenCurrentExpNumber->Get();
- if (!m_APRarray.empty() && aprnum < m_APRarray.size())
- {
- SetAPR(m_APRarray[aprnum]);
- m_DoseUnit.m_GenCurrentExpNumber->Update(++aprnum);
- mLog::Debug("SetAPRArray:[totalEXP:{$}, currentEXP:{$}]", m_APRarray.size(), m_DoseUnit.m_GenCurrentExpNumber->Get());
- }
- else
- {
- mLog::Warn("APRarray is empty");
- }
- }
- }
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFrameRate(FLOAT frameRate)
- {
- mLog::Debug("Enter SetFrameRate[{$}]", frameRate);
- if (m_DoseUnit.m_FrameRate->Update(frameRate))
- {
- FireNotify(AttrKey::FRAMERATE, m_DoseUnit.m_FrameRate->Get());
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::ActiveSyncMode(_tSyncModeArgs value)
- {
- mLog::Debug("Enter ActiveSyncMode:[SynMode:{$},SynValue:{$},WS:{$}],currentMode[{$}]",
- value.strSyncMode.c_str(), value.strSyncValue.c_str(), value.strWS.c_str(), m_DoseUnit.m_ExpMode->JSGet().c_str());
- int tempSynNUm = atoi(value.strSyncValue.c_str());
- if (value.strSyncMode == AttrKey::SYNC_TYPE::SYNC_HWS)
- {
- m_nSYNMode = 1;
- }
- else if (value.strSyncMode == AttrKey::SYNC_TYPE::SYNC_CMD)
- {
- m_nSYNMode = 2;
- }
- else if (value.strSyncMode == AttrKey::SYNC_TYPE::SYNC_FRE)
- {
- m_bIsSendSXPByRxpFlag[1] = '1';
- m_nSYNMode = 2;
- }
- else if (value.strSyncMode == AttrKey::SYNC_TYPE::SYNC_DEMO)
- {
- m_nSYNMode = tempSynNUm;
- }
- mLog::Debug("ActiveSyncMode:not support [{$}:{$}] in [{$}]", value.strSyncMode.c_str(), value.strSyncValue.c_str(), m_DoseUnit.m_ExpMode->JSGet().c_str());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::Clear_DAP()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::GetValue_DAP(float& value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::QueryHE(int& value)
- {
- char strSendCMD[GEN_CF80_SEND_LEN_min] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["GHU"].strParamArry.c_str());
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["GHU"].struStatus);
- return RET_STATUS::RET_SUCCEED;
- }
- //点片
- RET_STATUS nsGEN::RF80Device::IncKV ()
- {
- mLog::Debug("Enter IncKV");
- if (!m_DoseUnit.m_KV->CanInc ()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_KV->Get();
- return SetKV(++value);
- }
- RET_STATUS nsGEN::RF80Device::DecKV ()
- {
- mLog::Debug("Enter DecKV");
- if (!m_DoseUnit.m_KV->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_KV->Get();
- return SetKV(--value);
- }
- RET_STATUS nsGEN::RF80Device::SetKV (float value)
- {
- mLog::Debug("Enter SetKV:[{$}]", value);
- if (!m_DoseUnit.m_KV->Verify(value)) return RET_STATUS::RET_SUCCEED;
- m_RadLimitFlag = false;
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- value, m_DoseUnit.m_MA->Get(), m_DoseUnit.m_MS->Get(), m_DoseUnit.m_MAS->Get(),
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- m_RadLimitFlag = true;
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::IncMA ()
- {
- mLog::Debug("Enter IncMA");
- if (!m_DoseUnit.m_MA->CanInc()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_MA->Get();
- {
- mLog::Debug("IncMA:small curr MA={$}", value);
- if (m_DoseUnit.m_MA->CanToNext(value, g_MA_List))
- {
- SetMA(value);
- }
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DecMA ()
- {
- mLog::Debug("Enter DecMA");
- if (!m_DoseUnit.m_MA->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_MA->Get();
- {
- mLog::Debug("DecMA:small curr MA={$}", value);
- if (m_DoseUnit.m_MA->CanToPrev(value, g_MA_List))
- {
- SetMA(value);
- }
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetMA (float value)
- {
- mLog::Debug("Enter SetMA:[{$}]", value);
- if (!m_DoseUnit.m_MA->Verify(value)) return RET_STATUS::RET_SUCCEED;
- float tempMAS = value * m_DoseUnit.m_MS->Get() / 1000.0f;
- Search3PointRange(m_DoseUnit.m_KV->Get(), tempMAS, m_DoseUnit.m_Focus->Get());
- if (WaitForSingleObject(m_hRadLimitMAEvent, 2000) == WAIT_OBJECT_0)
- {
- mLog::Debug("m_hRadLimitMAEvent = true");
- if (m_fCurMinMA < m_fCurMaxMA)
- {
- if (value < m_fCurMinMA)
- {
- mLog::Warn("set MA[{$}] too small[{$}]", value, m_fCurMinMA);
- value = m_fCurMinMA;
- }
- if (value > m_fCurMaxMA)
- {
- mLog::Warn("set MA[{$}] too big[{$}]", value, m_fCurMaxMA);
- value = m_fCurMaxMA;
- }
- }
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- m_DoseUnit.m_KV->Get(), value, m_DoseUnit.m_MS->Get(), tempMAS,
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- }
- else
- {
- mLog::Warn("m_hRadLimitMAEvent timeout");
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::IncMS ()
- {
- mLog::Debug("Enter IncMS");
- if (!m_DoseUnit.m_MS->CanInc()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_MS->Get();
- if (m_DoseUnit.m_MS->CanToNext(value, g_MS_List))
- {
- SetMS(value);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DecMS ()
- {
- mLog::Debug("Enter DecMS");
- if (!m_DoseUnit.m_MS->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_MS->Get();
- if (m_DoseUnit.m_MS->CanToPrev(value, g_MS_List))
- {
- SetMS(value);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetMS (float value)
- {
- mLog::Debug("Enter SetMS:[{$}]", value);
- if (!m_DoseUnit.m_MS->Verify(value)) return RET_STATUS::RET_SUCCEED;
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- m_DoseUnit.m_KV->Get(), m_DoseUnit.m_MA->Get(), value, m_DoseUnit.m_MAS->Get(),
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::IncMAS ()
- {
- mLog::Debug("Enter IncMAS");
- if (!m_DoseUnit.m_MAS->CanInc()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_MAS->Get();
- if (m_DoseUnit.m_MAS->CanToNext(value, g_MAS_List))
- {
- SetMAS(++value);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DecMAS ()
- {
- mLog::Debug("Enter DecMAS");
- if (!m_DoseUnit.m_MAS->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_MAS->Get();
- if (m_DoseUnit.m_MAS->CanToPrev(value, g_MAS_List))
- {
- SetMAS(--value);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetMAS (float value)
- {
- mLog::Debug("Enter SetMAS:[{$}]", value);
- if (!m_DoseUnit.m_MA->Verify(value)) return RET_STATUS::RET_SUCCEED;
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- m_DoseUnit.m_KV->Get(), m_DoseUnit.m_MA->Get(), m_DoseUnit.m_MS->Get(), value,
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFocus(int value)
- {
- mLog::Debug("Enter SetFocus:[{$}]", value);
- if (!m_DoseUnit.m_Focus->Verify(value)) return RET_STATUS::RET_SUCCEED;
- if (m_DoseUnit.m_Focus->Get() != value)
- {
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), value,
- m_DoseUnit.m_KV->Get(), m_DoseUnit.m_MA->Get(), m_DoseUnit.m_MS->Get(), m_DoseUnit.m_MAS->Get(),
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- m_RadLimitFlag = true;
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetWS(const string value)
- {
- mLog::Debug("Enter SetWS:[{$}]", value);
- 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);
- }
- m_DoseUnit.m_WS->Update(tempws);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetTechmode (int value)
- {
- mLog::Debug("Enter SetTechmode:[{$}]", value);
- if (!m_DoseUnit.m_Techmode->Verify(value)) return RET_STATUS::RET_SUCCEED;
- if (m_DoseUnit.m_Techmode->Update(value))
- {
- float fKV = m_DoseUnit.m_KV->Get();
- float fMA = m_DoseUnit.m_MA->Get();
- float fMS = m_DoseUnit.m_MS->Get();
- float fMAS = m_DoseUnit.m_MAS->Get();
- int nAECDensity = m_DoseUnit.m_AECField->Get();
- int nAECFilm = m_DoseUnit.m_AECFilm->Get();
- int nAECField = m_DoseUnit.m_AECDensity->Get();
- //TechMode
- switch (value)
- {
- case AttrKey::TECHMODE_TYPE::TECHMODE_AEC_2P:
- case AttrKey::TECHMODE_TYPE::TECHMODE_AEC_3P:
- {
- if (m_APRParam.nAECDensity != 0)
- {
- nAECDensity = m_APRParam.nAECDensity;
- m_APRParam.nAECDensity = 0;
- }
- if (m_APRParam.nAECFilm != 0)
- {
- nAECFilm = m_APRParam.nAECFilm;
- m_APRParam.nAECFilm = 0;
- }
- if (m_APRParam.nAECField != 0)
- {
- nAECField = m_APRParam.nAECField;
- m_APRParam.nAECField = 0;
- }
- }break;
- case AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_2P:
- {
- if (m_APRParam.fMAS != 0)
- {
- fMAS = m_APRParam.fMAS;
- m_APRParam.fMAS = 0;
- }
- }break;
- case AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_3P:
- {
- if (m_APRParam.fMA != 0)
- {
- fMA = m_APRParam.fMA;
- m_APRParam.fMA = 0;
- }
- if (m_APRParam.fMS != 0)
- {
- fMS = m_APRParam.fMS;
- m_APRParam.fMS = 0;
- }
- }break;
- }
- SetAPRLocal(m_DoseUnit.m_WS->Get(), value, m_DoseUnit.m_Focus->Get(),
- fKV, fMA, fMS, fMAS,
- nAECDensity, nAECFilm, nAECField);
- }
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetAECDensity (int value)
- {
- mLog::Debug("Enter SetAECDensity = {$}", value);
- if (!m_DoseUnit.m_AECDensity->Verify (value)) return RET_STATUS::RET_SUCCEED;
- if (m_DoseUnit.m_AECDensity->Get() != value)
- {
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- m_DoseUnit.m_KV->Get(), m_DoseUnit.m_MA->Get(), m_DoseUnit.m_MS->Get(), m_DoseUnit.m_MAS->Get(),
- m_DoseUnit.m_AECField->Get(), m_DoseUnit.m_AECFilm->Get(), value);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetAECField (int value)
- {
- mLog::Debug("Enter SetAECField = {$}", value);
- if (!m_DoseUnit.m_AECField->Verify (value)) return RET_STATUS::RET_SUCCEED;
- if (m_DoseUnit.m_AECDensity->Get() != value)
- {
- SetAPRLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_Techmode->Get(), m_DoseUnit.m_Focus->Get(),
- m_DoseUnit.m_KV->Get(), m_DoseUnit.m_MA->Get(), m_DoseUnit.m_MS->Get(), m_DoseUnit.m_MAS->Get(),
- value, m_DoseUnit.m_AECFilm->Get(), m_DoseUnit.m_AECDensity->Get());
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetAECFilm (int value)
- {
- mLog::Debug("Enter SetAECFilm = {$}", value);
- if (!m_DoseUnit.m_AECFilm->Verify (value)) return RET_STATUS::RET_SUCCEED;
- if (m_DoseUnit.m_Techmode->Get() == AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_3P ||
- m_DoseUnit.m_Techmode->Get() == AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_2P)
- {
- if (m_DoseUnit.m_AECFilm->Update(value))
- {
- FireNotify(AttrKey::AECFILM, value);
- }
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetAPR (const _tAPRArgs& t)
- {
- m_RadLimitFlag = true;
- m_APRParam = t;
- mLog::Debug("SetAPR:KV={$},MA={$},MS={$},MAS={$},Focus={$},Techmode={$},WS={$},AECDensity={$},AECField={$},AECFilm={$}",
- t.fKV, t.fMA, t.fMS, t.fMAS, t.nFocus, t.nTechmode, t.nWS, t.nAECDensity, t.nAECField, t.nAECFilm);
- SetAPRLocal(t.nWS, t.nTechmode, t.nFocus,
- t.fKV, t.fMA, t.fMS, t.fMAS,
- t.nAECField, t.nAECFilm, t.nAECDensity);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetAPRArray(vector<_tAPRArgs>& APRarray)
- {
- mLog::Debug("SetAPRArray:size[{$}]", APRarray.size());
- m_DoseUnit.m_GenCurrentExpNumber->Update(0);
- m_APRarray = APRarray;
- return RET_STATUS::RET_SUCCEED;
- }
- bool nsGEN::RF80Device::SetAPRLocal(int nWS, int nET, int nFO, int nKV, float fMA, float fMS, float fMAS, int nAECFieldSel, int nAECFilmSel, int nAECDensity)
- {
- mLog::Debug("SetAPRLocal: RadLimitFlag[{$}],TechMode[{$}],Focus[{$}],KV[{$}],MA[{$}],MS[{$}],MAS[{$}],AECField[{$}],AECFilm[{$}],AECDensity[{$}],FrameRate[{$}]",
- m_RadLimitFlag,nET, nFO, nKV, fMA, fMS, fMAS, nAECFieldSel, nAECFilmSel, nAECDensity, m_DoseUnit.m_FrameRate->Get());
- //wxx_test
- if(nET == AttrKey::TECHMODE_TYPE::TECHMODE_AEC_2P)
- nET = AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_2P;
- if(nET == AttrKey::TECHMODE_TYPE::TECHMODE_AEC_3P)
- nET = AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_3P;
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- //工作位
- int tempWS = 1;
- if (m_arrWSMap.find(cfgWorkStationKey(nWS)) != m_arrWSMap.end())
- {
- m_strCurrentWSName = cfgWorkStationKey(nWS);
- mLog::Debug("Set WS number {$}", m_arrWSMap[m_strCurrentWSName].nWSNamber);
- tempWS = m_arrWSMap[m_strCurrentWSName].nWSNamber;
- }
- else
- {
- m_strCurrentWSName = cfgWorkStationKey(1);
- mLog::Debug("Set WS number default 1");
- }
- //焦点
- char tempFocus = 'S';
- if (AttrKey::FOCUS_SMALL == nFO)
- {
- tempFocus = 'S';
- }
- else if (AttrKey::FOCUS_LARGE == nFO)
- {
- tempFocus = 'L';
- }
- //KV
- float tempKV = nKV;
- //TechMode
- switch (nET)
- {
- case AttrKey::TECHMODE_TYPE::TECHMODE_AEC_2P:
- case AttrKey::TECHMODE_TYPE::TECHMODE_AEC_3P:
- {
- int nfield = TurnAECFieldSel(true, nAECFieldSel);
- if (m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::TOMO)
- {
- float tempPPS = m_DoseUnit.m_FrameRate->Get();
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ES1"].strParamArry.c_str(),
- tempWS, tempKV, m_nCfgTubeLoad, m_nCfdCurrentRed, m_nCfdSwitch, tempFocus, m_nCfdDose, (float)nAECDensity, nfield, m_nCfdMaxTime, tempPPS);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ES1"].struStatus);
- SetLastParambeforeEXP(RF80Tech_RAD,"ES1", strSendCMD);
- }
- else
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ED1"].strParamArry.c_str(),
- tempWS, tempKV, m_nCfgTubeLoad, m_nCfdCurrentRed, m_nCfdSwitch, tempFocus, m_nCfdDose, (float)nAECDensity, nfield, m_nCfdMaxTime);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ED1"].struStatus);
- SetLastParambeforeEXP(RF80Tech_RAD, "ED1", strSendCMD);
- }
- }break;
- case AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_2P:
- {
- float tempMA{ 0 };
- float tempMAS = fMAS;
- if (!CheckRadLimitValue(nET, nFO, tempKV, tempMAS, tempMA))
- {
- if (tempMAS < m_fCurMinMAS)
- {
- mLog::Warn("set MAS[{$}] too small[{$}]", tempMAS, m_fCurMinMAS);
- tempMAS = m_fCurMinMAS;
- }
- if (tempMAS > m_fCurMaxMAS)
- {
- mLog::Warn("set MAS[{$}] too big[{$}]", tempMAS, m_fCurMaxMAS);
- tempMAS = m_fCurMaxMAS;
- }
- }
- if (m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::TOMO)
- {
- float tempPPS = m_DoseUnit.m_FrameRate->Get();
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ES2"].strParamArry.c_str(),
- tempWS, tempKV, tempMAS, m_nCfgTubeLoad, m_nCfdSwitch, tempFocus, tempPPS);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ES2"].struStatus);
- SetLastParambeforeEXP(RF80Tech_RAD,"ES2", strSendCMD);
- }
- else
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ED2"].strParamArry.c_str(),
- tempWS, tempKV, tempMAS, m_nCfgTubeLoad, m_nCfdSwitch, tempFocus);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ED2"].struStatus);
- SetLastParambeforeEXP(RF80Tech_RAD, "ED2", strSendCMD);
- }
- }break;
- case AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_3P:
- {
- float tempMA = fMA;
- float tempMAS = fMA * fMS / 1000.0f;
- if (!CheckRadLimitValue(nET, nFO, tempKV, tempMAS, tempMA))
- {
- if (tempMAS < m_fCurMinMAS)
- {
- mLog::Warn("set MAS[{$}] too small[{$}]", tempMAS, m_fCurMinMAS);
- tempMAS = m_fCurMinMAS;
- }
- if (tempMAS > m_fCurMaxMAS)
- {
- mLog::Warn("set MAS[{$}] too big[{$}]", tempMAS, m_fCurMaxMAS);
- tempMAS = m_fCurMaxMAS;
- }
- if (tempMA < m_fCurMinMA)
- {
- mLog::Warn("set MA[{$}] too small[{$}]", tempMA, m_fCurMinMA);
- tempMA = m_fCurMinMA;
- }
- if (tempMA > m_fCurMaxMA)
- {
- mLog::Warn("set MA[{$}] too big[{$}]", tempMA, m_fCurMaxMA);
- tempMA = m_fCurMaxMA;
- }
- }
- if(m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::TOMO)
- {
- float tempPPS = m_DoseUnit.m_FrameRate->Get();
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ES3"].strParamArry.c_str(),
- tempWS, tempKV, tempMAS, tempMA, m_nCfdSwitch, tempFocus, tempPPS);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ES3"].struStatus);
- SetLastParambeforeEXP(RF80Tech_RAD,"ES3", strSendCMD);
- }
- else
- {
- sprintf_s(strSendCMD, glo_Send_RF80Fun["ED3"].strParamArry.c_str(),
- tempWS, tempKV, tempMAS, tempMA, m_nCfdSwitch, tempFocus);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["ED3"].struStatus);
- SetLastParambeforeEXP(RF80Tech_RAD, "ED3", strSendCMD);
- }
- }break;
- }
- if (m_DoseUnit.m_Techmode->Update(nET))
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- return true;
- }
- //未使用
- RET_STATUS nsGEN::RF80Device::QueryPostKV(float& value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::QueryPostMA(float& value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::QueryPostMS(float& value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::QueryPostMAS(float& value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetGenState(int value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetExpEnable()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetExpDisable()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetEXAMMode(std::string value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- //透视
- RET_STATUS nsGEN::RF80Device::IncFluKV()
- {
- mLog::Debug("Enter IncFluKV");
- if (!m_DoseUnit.m_FLKV->CanInc()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_FLKV->Get();
- return SetFluKV(++value);
- }
- RET_STATUS nsGEN::RF80Device::DecFluKV()
- {
- mLog::Debug("Enter DecFluKV");
- if (!m_DoseUnit.m_FLKV->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_FLKV->Get();
- return SetFluKV(--value);
- }
- RET_STATUS nsGEN::RF80Device::SetFluKV(float value)
- {
- mLog::Debug("Enter SetFluKV:[{$}]", value);
- if (!m_DoseUnit.m_FLKV->Verify(value)) return RET_STATUS::RET_SUCCEED;
- SetAPFLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_FLMode->Get(), m_DoseUnit.m_ABSStatus->Get(),
- m_DoseUnit.m_DoseLevel->Get(), value, m_DoseUnit.m_FLMA->Get(), m_DoseUnit.m_PPS->Get());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::IncFluMA()
- {
- mLog::Debug("Enter IncFluKV");
- if (!m_DoseUnit.m_FLMA->CanInc()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_FLMA->Get();
- SetFluKV(++value);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DecFluMA()
- {
- mLog::Debug("Enter DecFluKV");
- if (!m_DoseUnit.m_FLKV->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_FLKV->Get();
- SetFluKV(--value);
- if (!m_DoseUnit.m_FLMA->CanDec()) return RET_STATUS::RET_SUCCEED;
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFluMA(float value)
- {
- mLog::Debug("Enter SetFluMA:[{$}]", value);
- if (!m_DoseUnit.m_FLMA->Verify(value)) return RET_STATUS::RET_SUCCEED;
- SetAPFLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_FLMode->Get(), m_DoseUnit.m_ABSStatus->Get(),
- m_DoseUnit.m_DoseLevel->Get(), m_DoseUnit.m_FLKV->Get(), value, m_DoseUnit.m_PPS->Get());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::IncFluMS()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DecFluMS()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFluMS(float value)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetPPS(float frameRate)
- {
- mLog::Debug("Enter SetPPS:[{$}]", frameRate);
- if (!m_DoseUnit.m_PPS->Verify(frameRate)) return RET_STATUS::RET_SUCCEED;
- SetAPFLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_FLMode->Get(), m_DoseUnit.m_ABSStatus->Get(),
- m_DoseUnit.m_DoseLevel->Get(), m_DoseUnit.m_FLKV->Get(), m_DoseUnit.m_FLMA->Get(), frameRate);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::INCPPS()
- {
- mLog::Debug("Enter INCPPS");
- if (!m_DoseUnit.m_PPS->CanInc()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_PPS->Get();
- SetPPS(++value);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DECPPS()
- {
- mLog::Debug("Enter DECPPS");
- if (!m_DoseUnit.m_PPS->CanDec()) return RET_STATUS::RET_SUCCEED;
- float value = m_DoseUnit.m_PPS->Get();
- SetPPS(--value);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetPluseWidth(float fplusewidth)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetABSMode(int nMode)
- {
- mLog::Debug("Enter SetABSMode:[{$}]", nMode);
- if (!m_DoseUnit.m_ABSStatus->Verify(nMode)) return RET_STATUS::RET_SUCCEED;
- SetAPFLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_FLMode->Get(), nMode,
- m_DoseUnit.m_DoseLevel->Get(), m_DoseUnit.m_FLKV->Get(), m_DoseUnit.m_FLMA->Get(), m_DoseUnit.m_PPS->Get());
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetABSCurve(int curveNum)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::IncABSCurve()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DecABSCurve()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetABSValue(float fABSValue)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetABSTargetEXI(float fEXIValue)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- float nsGEN::RF80Device::GetFluIntTimer()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- float nsGEN::RF80Device::GetFluAccTimer()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::ResetFluTimer(int ntype)
- {
- mLog::Debug("ReSetFluAccTimer:[{$}]", ntype);
- char strSendCMD[GEN_CF80_SEND_LEN_min] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["RFB"].strParamArry.c_str());
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["RFB"].struStatus);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFluPre(int bPrepare)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFluEXP(int bPrepare)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFLFMode(std::string value)
- {
- mLog::Debug("Enter SetFLFMode:[{$}]", value.c_str());
- float fKV = m_DoseUnit.m_FLKV->Get();
- float fMA = m_DoseUnit.m_FLMA->Get();
- int nABS = m_DoseUnit.m_ABSStatus->Get();
- int nDose = m_DoseUnit.m_DoseLevel->Get();
- float fPPS = m_DoseUnit.m_PPS->Get();
- if (0.1 > fKV)
- {
- fKV = m_APFParam.nFLKV;
- }
- if (0.1 > fMA)
- {
- fMA = m_APFParam.fFLMA;
- }
- if (0.1 > fPPS)
- {
- fPPS = m_APFParam.nPPS;
- }
- if (value == "CF")
- {
- SetAPFLocal(m_DoseUnit.m_WS->Get(), AttrKey::GENERATOR_FLMODE_CF, nABS,
- nDose, fKV, fMA, fPPS);
- }
- else if (value == "PF")
- {
- SetAPFLocal(m_DoseUnit.m_WS->Get(), AttrKey::GENERATOR_FLMODE_PF, nABS,
- nDose, fKV, fMA, fPPS);
- }
- else
- {
- mLog::Info("other FluMode {$}", value.c_str());
- return RET_STATUS::RET_SUCCEED;
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFluMAG(int nsize)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::DisableMAG()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetFluDoseLever(int nlever)
- {
- mLog::Debug("Enter SetFluDoseLever:[{$}]", nlever);
- if (!m_DoseUnit.m_DoseLevel->Verify(nlever)) return RET_STATUS::RET_SUCCEED;
- SetAPFLocal(m_DoseUnit.m_WS->Get(), m_DoseUnit.m_FLMode->Get(), m_DoseUnit.m_ABSStatus->Get(),
- nlever, m_DoseUnit.m_FLKV->Get(), m_DoseUnit.m_FLMA->Get(), m_DoseUnit.m_PPS->Get());
- }
- RET_STATUS nsGEN::RF80Device::SetHalfDose(int nlever)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::TransferRadCurve(int ncurve)
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::SetAPF(const _tAPFArgs& t)
- {
- mLog::Debug("SetAPF: nWS={$}, Flu mode={$}, ABS mode={$}, DoseLever={$}, nFlkv={$}, FlMA={$}",
- t.nWS, t.nFluMode, t.nABSMode, t.nDoseLever, t.nFLKV, t.fFLMA, t.nPPS);
- m_APFParam = t;
- SetAPFLocal(t.nWS, t.nFluMode, t.nABSMode, t.nDoseLever, t.nFLKV, t.fFLMA, t.nPPS);
- return RET_STATUS::RET_SUCCEED;
- }
- bool nsGEN::RF80Device::SetAPFLocal(int nWS, int nFluType, int nABSMode, int nDoseLevel, int nFKVP, float fFMA, float fPPS)
- {
- mLog::Debug("SetAPFLocal: nWS={$}, Flu mode={$}, ABS mode={$}, DoseLever={$}, FlKV={$}, FlMA={$}, PPS={$}",
- nWS, nFluType, nABSMode, nDoseLevel, nFKVP, fFMA, fPPS);
- switch (nFluType)
- {
- case AttrKey::GENERATOR_FLMODE_NOTFLU:
- break;
- case AttrKey::GENERATOR_FLMODE_CF:
- {
- if (nABSMode == AttrKey::GENERATOR_ABS_OFF)
- {
- SetManualFlourParameter(nFKVP, fFMA);
- }
- else
- {
- if (nDoseLevel == 0)
- nDoseLevel = 1;
- SetContinulFlourParameter(nDoseLevel, 0);
- }
- }break;
- case AttrKey::GENERATOR_FLMODE_PF:
- {
- if (nABSMode == AttrKey::GENERATOR_ABS_OFF)
- {
- nDoseLevel = 0;
- SetPlusFlouroParameter(nDoseLevel, 1, nFKVP, fFMA, fPPS);
- }
- else
- {
- if (nDoseLevel == 0)
- {
- nDoseLevel = 1;
- }
- SetPlusFlouroParameter(nDoseLevel, 0, nFKVP, fFMA, fPPS);
- }
- }break;
- case AttrKey::GENERATOR_FLMODE_HCF:
- break;
- case AttrKey::GENERATOR_FLMODE_HPF:
- break;
- case AttrKey::GENERATOR_FLMODE_MAX:
- break;
- default:
- break;
- }
- return true;
- }
- bool nsGEN::RF80Device::SetPlusFlouroParameter(int curve, int abs, float kv, float ma, float fps)
- {
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["FPP"].strParamArry.c_str(),
- curve, abs, kv, ma, (float)m_nCfdPFMS, m_nCfdPFMSMax, fps, m_nCfdDoseRate,'S');
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["FPP"].struStatus);
- SetLastParambeforeEXP(RF80Tech_FLU,"FPP",strSendCMD);
- return true;
- }
- bool nsGEN::RF80Device::SetContinulFlourParameter(int curve, int abs)
- {
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["FPC"].strParamArry.c_str(),
- curve, abs, m_nCfdDoseRate, 'S');
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["FPC"].struStatus);
- SetLastParambeforeEXP(RF80Tech_FLU,"FPC", strSendCMD);
- return true;
- }
- bool nsGEN::RF80Device::SetManualFlourParameter(int kv, float ma)
- {
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["FPM"].strParamArry.c_str(),
- (float)kv, ma, 'S');
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["FPM"].struStatus);
- SetLastParambeforeEXP(RF80Tech_FLU, "FPM", strSendCMD);
- return true;
- }
- //V3新方法
- void nsGEN::RF80Device::SubscribeSelf(ccos_mqtt_connection* conn)
- {
- //订阅GEN所有Action
- //SubscribeTopic(conn, "CCOS/DEVICE/Generator/Action/#"); Moduld层默认订阅了这个Action,如果这边也订阅的话就会执行两遍Action,可能会出问题
- }
- //消息上报
- RET_STATUS nsGEN::RF80Device::ProcessMsg(char* strCMD, int nCMDLengh, stru_EDS_Status& state)
- {
- if (!state.compare(m_GenStatus))
- {
- mLog::Debug("==OUT failed==: [{$}][{$}], current[{$}]state not in[{$}] \n", strCMD, nCMDLengh, m_GenStatus.status, state.status);
- return RET_STATUS::RET_SUCCEED;
- }
- if (FormatCMD(strCMD, nCMDLengh))
- {
- string strLog(strCMD);
- strLog.at(strLog.length() - 1) = 0x03;
- strLog.at(strLog.length() - 2) = 0x04;
- mLog::Debug("==OUT==: [{$}],lengh[{$}] \n", strLog.c_str(), nCMDLengh);
- int ret = 0;
- int nTimeOut = 100;
- m_SCF.Lock(msTimeOut_Lock)
- .SendPacket(strCMD, nCMDLengh, nTimeOut, ret);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsGEN::RF80Device::HWSend(char* strCMD, int nCMDLengh)
- {
- if (FormatCMD(strCMD, nCMDLengh))
- {
- string strLog(strCMD);
- strLog.at(strLog.length() - 1) = 0x03;
- strLog.at(strLog.length() - 2) = 0x04;
- mLog::Debug("==OUT==: [{$}],lengh[{$}] \n", strLog.c_str(), nCMDLengh);
- int ret = 0;
- int nTimeOut = 100;
- m_SCF.Lock(msTimeOut_Lock)
- .SendPacket(strCMD, nCMDLengh, nTimeOut, ret);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- void nsGEN::RF80Device::FireNotify(string key, const int context)
- {
- char szInfo[64] = { 0 };
- sprintf_s(szInfo, "%d", context);
- std::string str = szInfo;
- EventCenter->OnNotify(1, key, str);//(int)ATTRACTION_SET 2
- }
- void nsGEN::RF80Device::FireNotify(std::string key, const float context)
- {
- char szInfo[64] = { 0 };
- sprintf_s(szInfo, "%.2f", context);
- std::string str = szInfo;
- EventCenter->OnNotify(1, key, str);//(int)ATTRACTION_SET 2
- }
- void nsGEN::RF80Device::FireNotify(std::string key, const std::string context)
- {
- EventCenter->OnNotify(1, key, context);
- }
- void nsGEN::RF80Device::FireErrorMessage(const bool Act, const int Code, const char* ResInfo)
- {
- string ErrorCode("RF80_ERR_");
- int level = RF80_REGULATION_LEVEL::REG_ERRO;
- if (Code != 0)
- {
- ErrorCode += std::to_string(Code);
- }
- else
- {
- ErrorCode = "";
- }
- 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);
- if (Code == 0)
- m_MSGUnit->DelErrorMessage("0", level, ResInfo);
- else
- m_MSGUnit->DelErrorMessage(ErrorCode.c_str(), level, ResInfo);
- }
- }
- void nsGEN::RF80Device::FireWarnMessage(const bool Act, const int Code, const char* ResInfo)
- {
- string ErrorCode("PSGMG_WAR_");
- int level = RF80_REGULATION_LEVEL::REG_WARN;
- if (Code != 0)
- {
- ErrorCode += std::to_string(Code);
- }
- else
- {
- ErrorCode = "";
- }
- 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);
- }
- }
- //-----------------------------------------------------------------------------
- // ProcessCmd
- //-----------------------------------------------------------------------------
- void nsGEN::RF80Device::ProcessClientData(const char* pData, unsigned long nDataLength, void* lparam)
- {
- RF80Device* pCurGen = (RF80Device*)lparam;
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- memcpy(strSendCMD, pData, nDataLength);
- pCurGen->HWSend(strSendCMD, nDataLength);
- }
- void nsGEN::RF80Device::WriteLog(const char* pData, nsSerialGPM::LOG_V2_LEVEL level)
- {
- switch (level)
- {
- case nsSerialGPM::LOG_V2_FATAL:
- case nsSerialGPM::LOG_V2_ERROR:
- mLog::Error(pData);
- break;
- case nsSerialGPM::LOG_V2_WARNING:
- mLog::Warn(pData);
- break;
- case nsSerialGPM::LOG_V2_DEBUG:
- mLog::Debug(pData);
- break;
- case nsSerialGPM::LOG_V2_INFO:
- mLog::Info(pData);
- break;
- default:
- break;
- }
- }
- RET_STATUS nsGEN::RF80Device::HWSendFirst(char* strCommand, int lengh, stru_EDS_Status& state, int headLengh)
- {
- if (!state.compare(m_GenStatus))
- {
- mLog::Debug("==OUT failed==: [{$}][{$}], current[{$}]state not in[{$}] \n", strCommand, lengh, m_GenStatus.status, state.status);
- return RET_STATUS::RET_SUCCEED;
- }
- return m_tDelivermodule.ProcessCommand(strCommand, lengh, m_nCMDType_FirstSend, headLengh);
- }
- RET_STATUS nsGEN::RF80Device::HWSendWaittimeCMD(char* strCommand, int lengh, stru_EDS_Status& state, int headLengh)
- {
- if (!state.compare(m_GenStatus))
- {
- mLog::Debug("==OUT failed==: [{$}][{$}], current[{$}]state not in[{$}] \n", strCommand, lengh, m_GenStatus.status, state.status);
- return RET_STATUS::RET_SUCCEED;
- }
- return m_tDelivermodule.ProcessCommand(strCommand, lengh, m_nCMDType_WaitTime, headLengh);
- }
- RET_STATUS nsGEN::RF80Device::HWSendWaitSelfCMD(char* strCommand, int lengh, stru_EDS_Status& state, int headLengh)
- {
- if (!state.compare(m_GenStatus))
- {
- mLog::Debug("==OUT failed==: [{$}][{$}], current[{$}]state not in[{$}] \n", strCommand, lengh, m_GenStatus.status, state.status);
- return RET_STATUS::RET_SUCCEED;
- }
- return m_tDelivermodule.ProcessCommand(strCommand, lengh, m_nCMDType_WaitSelf, headLengh);
- }
- //OnCallBack
- bool nsGEN::RF80Device::OnCallBack()
- {
- //无 操作
- auto HWNotProcess = [](const char* value, int length) -> void
- {
- mLog::Debug("This commands[{$}] didn't need to process", value);
- };
- //DQ2 Format 1:UT Allowed min.mAs Allowed max.mAs-Generator Thermal lim.max.mAs-Large Thermal lim.max.mAs-Small Current lim.mAs-Large Current lim.mAs-Small
- auto HW_AD2 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 8)
- {
- //%.1f %u %u %u %u %u %u
- mLog::Debug("HW_AD2: UT[{$}], Allowed min.mAs[{$}], Allowed max.mAs-Generator[{$}], Thermal lim.max.mAs-Large[{$}], Thermal lim.max.mAs-Small[{$}], Current lim.mAs-Large[{$}], Current lim.mAs-Small[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str());
- m_fCurMinMAS = atof(paramList[1].c_str());
- m_fCurMaxMAS = atof(paramList[2].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //DQ2 Format 2:Maximal exposure time in sec
- auto HW_AD2Timemax = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%u
- mLog::Debug("HW_AD2Timemax: Maximal exposure time in sec[{$}]",
- paramList[1].c_str());
- m_fCurMinMS = atof(paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //DQ2 Format 3:Minimal exposure time in sec
- auto HW_AD2Timemin = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%u
- mLog::Debug("HW_AD2Timemin: Minimal exposure time in sec[{$}]",
- paramList[1].c_str());
- m_fCurMaxMS = atof(paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //DQ2 Format 4:End:指令 DQ2 发送成功, 所有数据发送完毕
- auto HW_AD2End = [this](vector <string>& paramList) -> void
- {
- mLog::Debug("HW_AD2End: AD2End");
- };
- //DQ3 Format 1:index 1st Tube voltage UT index 2nd Tube voltage UT ..
- auto HW_AD3kV = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 5)
- {
- //%d %.2f %d %.2f %d
- mLog::Debug("HW_AD3kV: index[{$}], 1st Tube voltage UT[{$}], index[{$}], 2nd Tube voltage UT[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //DQ3 Format 2:ms Allowed min mAs
- auto HW_AD3ms = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 3)
- {
- //%3.2f %d
- mLog::Debug("HW_AD3ms: ms[{$}], Allowed min mAs[{$}]",
- paramList[1].c_str(), paramList[2].c_str());
- m_fCurMinMAS = atof(paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //DQ3 Format 3:1st Allowed max.mAs-Generator 1st Allowed max.mAs-Large 1st Allowed max.mAs-Small 2nd Allowed max.mAs-Generator …
- auto HW_AD3mAs = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 6)
- {
- //%u %u %u %u %u
- mLog::Debug("HW_AD3mAs: 1st Allowed max.mAs-Generator[{$}], 1st Allowed max.mAs-Large[{$}], 1st Allowed max.mAs-Small[{$}], 2nd Allowed max.mAs-Generator[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str());
- m_fCurMaxMAS = atof(paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //DQ3 Format 4:DP3电报的最后一行
- auto HW_AD3End = [this](vector <string>& paramList) -> void
- {
- mLog::Debug("HW_AD3End: AD3End");
- };
- //CP2:Allowed min.mAs Allowed max.mAs
- auto HW_AC2 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 3)
- {
- //%.2f %.2f
- mLog::Debug("HW_AC2: Allowed min.mAs[{$}], Allowed max.mAs[{$}]",
- paramList[1].c_str(), paramList[2].c_str());
- m_fCurMinMAS = atof(paramList[1].c_str());
- m_fCurMaxMAS = atof(paramList[2].c_str());
- SetEvent(m_hRadLimitMASEvent);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //CP3:mAs valid Allowed min.IT Allowed max.IT
- auto HW_AC3 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 4)
- {
- //%u %.1f %.1f
- mLog::Debug("HW_AC3: mAs valid[{$}], Allowed min.IT[{$}], Allowed max.IT[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str());
- if ("0" == paramList[1].c_str())
- {
- mLog::Warn("HW_AC3: valid range should be checked in advance using <CP2");
- }
- else
- {
- mLog::Debug("HW_AC3: allowed tube currents are valid");
- }
- m_fCurMinMA = atof(paramList[2].c_str());
- m_fCurMaxMA = atof(paramList[3].c_str());
- SetEvent(m_hRadLimitMAEvent);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //CS2:Ut FPS Xray Time Focus mAs
- auto HW_AS2 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 6)
- {
- //%.1f %.1f %u %c %.1f
- mLog::Debug("HW_AS2: Ut[{$}], FPS[{$}], Xray Time[{$}], Focus[{$}], mAs[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str());
- m_fCurMaxMAS = atof(paramList[5].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //CP3:Ut FPS Xray Time Focus mA
- auto HW_AS3 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 6)
- {
- //%.1f %.1f %u %c %.1f mA
- mLog::Debug("HW_AS3: Ut[{$}], FPS[{$}], Xray Time[{$}], Focus[{$}], mA[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str());
- m_fCurMaxMA = atof(paramList[5].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //该命令由发电机组发出,用于发送DAP值:Sum Actual
- auto HW_DAP = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 3)
- {
- //%.2f %.2f
- mLog::Debug("HW_DAP: Sum[{$}], Actual[{$}]",
- paramList[1].c_str(), paramList[2].c_str());
- float DAPvalue = atof(paramList[2].c_str());
- FireNotify("DAP", DAPvalue);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //在曝光系列期间,发生器单元报告最后一个X射线脉冲的实际曝光数据:UT IT mAs ms End DAP Pulse
- auto HW_EPA = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 8)
- {
- //%.1f %.2f %.2f %.1f %x %.2f %u
- mLog::Debug("HW_EPA: UT[{$}], IT[{$}], mAs[{$}], ms[{$}], End[{$}], DAP[{$}], Pulse[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str());
- if (m_DoseUnit.m_GenSynState->Get() == AttrKey::GENERATOR_RAD_READY)
- {
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_RAD_XRAYON))
- {
- mLog::Debug("EXPSTATE: [{$}] -> XR1", m_DoseUnit.m_GenSynState->Get());
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- }
- else if(m_DoseUnit.m_GenSynState->Get() != AttrKey::GENERATOR_RAD_XRAYON)
- {
- mLog::Warn("EXPSTATE: [{$}] not in ready", m_DoseUnit.m_GenSynState->Get());
- }
- m_DoseUnit.m_PostKV->Update(atof(paramList[1].c_str()));
- FireNotify(m_DoseUnit.m_PostKV->GetKey(), m_DoseUnit.m_PostKV->Get());
- m_DoseUnit.m_PostMA->Update(atof(paramList[2].c_str()));
- FireNotify(m_DoseUnit.m_PostMA->GetKey(), m_DoseUnit.m_PostMA->Get());
- m_DoseUnit.m_PostMS->Update(atof(paramList[4].c_str()));
- FireNotify(m_DoseUnit.m_PostMS->GetKey(), m_DoseUnit.m_PostMS->Get());
- m_DoseUnit.m_PostMAS->Update(atof(paramList[3].c_str()));
- FireNotify(m_DoseUnit.m_PostMAS->GetKey(), m_DoseUnit.m_PostMAS->Get());
- float DAPvalue = atof(paramList[6].c_str());
- FireNotify("DAP", DAPvalue);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发电机组检测到错误,并更改为状态 SERIAL_ERROR ,报告错误原因:Delimiter Num System ErrNum Para Prio Delimiter Num Reaction Prio Delimiter Extended
- auto HW_ERR = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 15)
- {
- //IT %04d %02x %02x %04x %1x F80 %d %04x %1x TXT %s %s %s
- mLog::Debug("HW_ERR: Delimiter[{$}], Num[{$}], System[{$}], ErrNum[{$}], Para[{$}], Prio[{$}], Delimiter[{$}], Num[{$}], Reaction[{$}], Prio[{$}], Delimiter[{$}], Extended[{$}]",
- paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(), paramList[6].c_str(),
- paramList[8].c_str(), paramList[9].c_str(), paramList[10].c_str(), paramList[12].c_str(), paramList[13].c_str(),
- paramList[14].c_str());
- mLog::Debug("GENSTATE: {$} -> SERIAL_ERROR", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_ERROR);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_ERROR))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- int ErrorCode = atoi(paramList[2].c_str());
- string info = "Generator has error,please reset it";
- FireErrorMessage(true, ErrorCode, info.c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器报告曝光或荧光的准备状态已完成.状态从 SERIAL_STANDBY 更改为 SERIAL_EXPOSURE
- auto HW_EXP = [this](vector <string>& paramList) -> void
- {//实际在">EXP"之后才是真正的Ready
- if (paramList.size() >= 1)
- {
- m_XrayReady[1] = '1';
- mLog::Debug("current XrayReady: [{$}]", m_XrayReady.c_str());
- if (m_XrayReady == "11")
- {
- m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_RAD_READY);
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- else
- {
- mLog::Warn("GENEXPSTATE: {$} not in EXP_Ready", m_DoseUnit.m_GenSynState->Get());
- }
- mLog::Debug("EXPSTATE: [{$}] -> PR2", m_DoseUnit.m_GenSynState->Get());
-
- mLog::Debug("GENSTATE: {$} -> SERIAL_EXPOSURE", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_EXPOSURE);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_EXP))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器报告用户按下关闭按钮,发生器将关闭.状态变为 SERIAL_SHUTDOWN
- auto HW_SDN = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 1)
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_SHUTDOWN", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_SHUTDOWN);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_SHUTDOWN))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //生命防护由主机初始化.生命防护不是强制性的:Transmit count
- auto HW_GRD = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%u
- mLog::Debug("HW_GRD: Transmit count[{$}]",
- paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令请求发生器的状态:State Signals
- auto HW_GST = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 3)
- {
- //%u %x
- mLog::Debug("HW_GST: State[{$}], Signals[{$}]",
- paramList[1].c_str(), paramList[2].c_str());
- int state = atoi(paramList[1].c_str());
- switch (state)
- {
- case 0: //undefined
- {
-
- }break;
- case 1: //SERIAL_INIT
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_INIT", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_INIT);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_INIT))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- }break;
- case 2: //SERIAL_STANDBY
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_STANDBY", m_GenStatus.GetState());
- if (m_DoseUnit.m_GenState->Get() == nsGEN::AttrKey::GENERATOR_STATUS_ERROR)
- {
- int ErrorCode = 0;
- string info = "";
- FireErrorMessage(false, ErrorCode, info.c_str());
- }
- m_GenStatus.changeState(GS_STANDBY);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_STANDBY))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- }break;
- case 3: //SERIAL_EXPOSURE
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_EXPOSURE", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_EXPOSURE);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_EXP))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- }break;
- case 4: //SERIAL_ERROR
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_ERROR", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_ERROR);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_ERROR))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- }break;
- default:
- break;
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于告诉发生器单元Host将使用哪个版本的接口命令.如果未发送此命令,发生器将使用最新版本:Version
- auto HW_IFV = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%u
- mLog::Debug("HW_IFV: Version[{$}]",
- paramList[1].c_str());
- m_nVersion = atoi(paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器报告初始化状态已完成.状态从 SERIAL_START 更改为 SERIAL_INIT
- auto HW_INI = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 1)
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_INIT", m_GenStatus.GetState());
- m_GenStatus.changeState(GS_INIT);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_INIT))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenSynState->JSGet());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //在曝光期间,已达到允许的最大mAs值.如果发电机的最大mAs不高于600mA,这可能是600mA,也可能是56kWs除以标称管电压的结果
- auto HW_LIM = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 1)
- {
- mLog::Debug("HW_LIM: exposure was ended by mAs limit");
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //在曝光期间,已达到允许的最大曝光时间.从1点到3点的所有曝光类型都可能出现限制时间.在信号流中省略了硬件信号
- auto HW_LIT = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- mLog::Debug("HW_LIT: exposure was ended by time limit");
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令取决于计算器的类型:%HU PT
- auto HW_PHU = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 3)
- {
- //%u %u
- mLog::Debug("HW_PHU: %HU[{$}], PT[{$}]",
- paramList[1].c_str(), paramList[2].c_str());
- if (m_DoseUnit.m_HE->Update(atoi(paramList[1].c_str())))
- FireNotify(m_DoseUnit.m_HE->GetKey(), m_DoseUnit.m_HE->Get());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器报告其准备执行曝光,即阻塞条件:Ready Condition1 Ready Condition2
- auto HW_RDY = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 3)
- {
- //%x %x
- std::bitset<16> binary1(std::stoi(paramList[1], 0, 16)); // 将16进制转为32位的二进制数
- string Condition1 = binary1.to_string(); // 输出二进制字符串
- std::bitset<16> binary2(std::stoi(paramList[2], 0, 16)); // 将16进制转为32位的二进制数
- string Condition2 = binary2.to_string(); // 输出二进制字符串
- mLog::Debug("HW_RDY: Ready Condition1[{$}]->[{$}], Ready Condition2[{$}]->[{$}]",
- paramList[1].c_str(), Condition1.c_str(), paramList[2].c_str(), Condition2.c_str());
- //条件1
- string readyFlag = m_ExpReady;
- if ("0000000000000000" == Condition1 || //0x0000
- "0000000100000000" == Condition1 || //0x0100
- "0000001000000000" == Condition1 || //0x0200
- "0000100000000000" == Condition1) //0x0800
- {
- mLog::Debug("Ready Condition1[ready for exposure and fluoroscopy]");
- readyFlag = "11";
- }
- else
- {
- if ('1' == Condition1.at(15)) //0x0001
- {
- mLog::Error("Ready Condition1[not ready because of heat unit or pause time]");
- readyFlag = "00";
- }
- if ('1' == Condition1.at(14)) //0x0002
- {
- mLog::Error("Ready Condition1[not ready because door is open]");
- readyFlag = "00";
- }
- if ('1' == Condition1.at(13)) //0x0004
- {
- mLog::Error("Ready Condition1[not ready because over temperature of the tube]");
- readyFlag = "00";
- }
- if ('1' == Condition1.at(12)) //0x0008
- {
- mLog::Error("Ready Condition1[not ready because error state is active]");
- readyFlag = "00";
- }
- if ('1' == Condition1.at(11)) //0x0010
- {
- mLog::Error("Ready Condition1[not ready because energy storage unit is not ready]");
- readyFlag = "00";
- }
- if ('1' == Condition1.at(10)) //0x0020
- {
- mLog::Error("Ready Condition1[not ready for exposure because no valid exposure parameters are given]");
- readyFlag.at(0) = '0';
- }
- else
- {
- readyFlag.at(0) = '1';
- }
- if ('1' == Condition1.at(9)) //0x0040
- {
- mLog::Error("Ready Condition1[not ready for fluoroscopy because no valid fluoroscopy parameters are given]");
- readyFlag.at(1) = '0';
- }
- else
- {
- readyFlag.at(1) = '1';
- }
- if ('1' == Condition1.at(8)) //0x0080
- {
- mLog::Error("Ready Condition1[not ready because no exposure disable switch (room switch)]");
- readyFlag = "00";
- }
- if ('1' == Condition1.at(7)) //0x0100
- {
- mLog::Error("Ready Condition1[state of S3 (service switch) on]");
- }
- else
- {
- mLog::Error("Ready Condition1[state of S3 (service switch) off]");
- }
- if ('1' == Condition1.at(6)) //0x0200
- {
- mLog::Error("Ready Condition1[state of S4 (mAs measure switch) on]");
- }
- else
- {
- mLog::Error("Ready Condition1[state of S4 (mAs measure switch) off]");
- }
- if ('1' == Condition1.at(5)) //0x0400
- {
- mLog::Error("Ready Condition1[state of S5 (X-ray disable switch) on]");
- readyFlag = "00";
- }
- else
- {
- mLog::Error("Ready Condition1[state of S5 (X-ray disable switch) off]");
- }
- if ('1' == Condition1.at(4)) //0x0800
- {
- mLog::Error("Ready Condition1[state of S7 (just for internal use) on]");
- }
- else
- {
- mLog::Error("Ready Condition1[state of S7 (just for internal use) off]");
- }
- if ('1' == Condition1.at(3)) //0x1000
- {
- mLog::Error("Ready Condition1[reserved for internal use]");
- }
- if ('1' == Condition1.at(2)) //0x2000
- {
- mLog::Error("Ready Condition1[state of tube pressure switch (X143) on]");
- }
- else
- {
- mLog::Error("Ready Condition1[state of tube pressure switch (X143) off]");
- }
- if ('1' == Condition1.at(1)) //0x4000
- {
- mLog::Error("Ready Condition1[state of software safety switch X-ray disabled]");
- readyFlag = "00";
- }
- else
- {
- mLog::Error("Ready Condition1[state of software safety switch X-ray enable]");
- }
- if ('1' == Condition1.at(0)) //0x8000
- {
- mLog::Error("Ready Condition1[state of calibration switch, input of X19.8]");
- }
- }
- mLog::Debug("HW_RDY: current ExpReady[{$}]->[{$}]", m_ExpReady.c_str(), readyFlag.c_str());
- if (readyFlag != m_ExpReady)
- {
- m_ExpReady = readyFlag;
- SetEvent(m_hLoopEvent);
- }
-
- //条件2
- if ("0000000000000000" == Condition2)
- {
- mLog::Debug("Ready Condition2[ready]");
- }
- else
- {
- if ('1' == Condition2.at(15))
- {
- mLog::Error("Ready Condition2[state of command <RIP]");
- }
- if ('1' == Condition2.at(14))
- {
- mLog::Error("Ready Condition2[state of command <DECEX]");
- }
- if ('1' == Condition2.at(13))
- {
- mLog::Error("Ready Condition2[state of communication with SCU]");
- }
- if ('1' == Condition2.at(12))
- {
- mLog::Error("Ready Condition2[not ready because of changed configuration, restart necessary]");
- }
- if ('1' == Condition2.at(11))
- {
- mLog::Error("Ready Condition2[not ready because generator time hasn’t been set by system]");
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发电机通知主机收到CAN电报:Address Length Data Data
- auto HW_CR = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 5)
- {
- //%x %d %x %x
- mLog::Debug("recv CAN data: Address[{$}], Length[{$}], Data[{$}], Data[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于通知主机曝光释放输入的变化(pre-contact or main-contact).如果满足所有要求,主机可以使用此命令使用“<SXP”触发曝光,或者发送KK-Tomo时间输入的更改:Pre contact Main contact KK
- auto HW_RXP = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 4)
- {
- //%u %u %u
- mLog::Debug("HW_RXP: Pre contact[{$}], Main contact[{$}], KK[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str());
- int PreContact = atoi(paramList[1].c_str());
- int MainContact = atoi(paramList[2].c_str());
- switch (m_LastTechMode)
- {
- case CCOS::Dev::Detail::Generator::RF80Tech_RAD:
- {
- SetRadStatus(PreContact, MainContact);
- }break;
- case CCOS::Dev::Detail::Generator::RF80Tech_FLU:
- {
- SetFluStatus(PreContact, MainContact);
- }break;
- case CCOS::Dev::Detail::Generator::RF80Tech_FLU_MAX:
- {}break;
- default:
- break;
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器报告其处于备用状态并准备输入,状态从 SERIAL_INIT/SERIAL_EXPOSURE/SERIAL_ERROR 更改为 SERIAL_STANDBY
- auto HW_SBY = [this](vector <string>& paramList) -> void
- {
- mLog::Debug("GENSTATE: {$} -> SERIAL_STANDBY", m_GenStatus.GetState());
- if (m_DoseUnit.m_GenState->Get() == nsGEN::AttrKey::GENERATOR_STATUS_ERROR)
- {
- int ErrorCode = 0;
- string info = "";
- FireErrorMessage(false, ErrorCode, info.c_str());
- }
- m_GenStatus.changeState(GS_STANDBY);
- if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_STANDBY))
- FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());
- //拼接参数自动下发
- if (m_DoseUnit.m_ExpMode->JSGet() == AttrKey::EXPMODE_TYPE::Stitch)
- {
- int aprnum = m_DoseUnit.m_GenCurrentExpNumber->Get();
- if (!m_APRarray.empty() && aprnum < m_APRarray.size())
- {
- SetAPR(m_APRarray[aprnum]);
- m_DoseUnit.m_GenCurrentExpNumber->Update(++aprnum);
- mLog::Debug("SetAPRArray:[totalEXP:{$}, currentEXP:{$}]", m_APRarray.size(), m_DoseUnit.m_GenCurrentExpNumber->Get());
- }
- else
- {
- mLog::Warn("APRarray is empty");
- }
- }
- };
- //发生器报告单个储罐温度高于或低于极限的变化
- auto HW_TWS = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- int state = atoi(paramList[1].c_str());
- if(0 == state)
- mLog::Debug("HW_TWS: single tank temperature below 60C");
- else if(1 == state)
- mLog::Debug("HW_TWS: single tank temperature above 60C");
- else
- mLog::Debug("HW_TWS: State[{$}]", paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器收到未知或错误的命令
- auto HW_UNK = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 1)
- {
- mLog::Debug("HW_UNK: received an unknown or erroneous command");
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //发生器收到一条校验和错误的消息
- auto HW_CRC = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 1)
- {
- mLog::Debug("HW_CRC: received a message with wrong checksum");
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证0点DR曝光的接收参数:请参阅ED0命令
- auto HW_VD0 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 9)
- {
- //%u %x %c %u %u %u %.1f %u
- mLog::Debug("HW_VD0: Curve[{$}], Switch[{$}], Focus[{$}], Dose[{$}], Dominant[{$}], Max.time[{$}], Fps[{$}], Scene Length[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str(), paramList[8].c_str());
- //Focus
- if ("S" == paramList[3])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VD0: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[3])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VD0: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- //Dose
- m_nCfdDose = atoi(paramList[4].c_str());
- //AECField
- int nField = TurnAECFieldSel(false, atoi(paramList[5].c_str()));
- if (m_DoseUnit.m_AECField->Update(nField))
- {
- mLog::Debug("HW_VD0: AECField update to [{$}]", nField);
- FireNotify(AttrKey::AECFIELD, m_DoseUnit.m_AECField->Get());
- }
- //Frames per second
- float frameRate = atof(paramList[7].c_str());
- if (m_DoseUnit.m_FrameRate->Update(frameRate))
- {
- mLog::Debug("HW_VD0: FrameRate update to [{$}]", frameRate);
- FireNotify(AttrKey::FRAMERATE, m_DoseUnit.m_FrameRate->Get());
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证1点DR曝光的接收参数:请参阅ED1命令
- auto HW_VD1 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 11)
- {
- //%u %.1f %u %u %x %c %u %.1f %u %u
- mLog::Debug("HW_VD1: WS[{$}], UT[{$}], Tube load[{$}], Current red[{$}], Switch[{$}], Focus[{$}], Dose[{$}], Density[{$}], Dominant[{$}], Max.time[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str(), paramList[8].c_str(), paramList[9].c_str(), paramList[10].c_str());
- //TechMode
- //if(m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_AEC_1P))
- // {
- //mLog::Debug("HW_VD1: Techmode update to [{$}] -> TECHMODE_AEC_1P", m_DoseUnit.m_Techmode->Get());
- // FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- // }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VD1: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VD1: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VD1: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VD1: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- //Dose
- m_nCfdDose = atoi(paramList[7].c_str());
- //AECDensity
- int nDensity = atoi(paramList[8].c_str());
- if (m_DoseUnit.m_AECDensity->Update(nDensity))
- {
- mLog::Debug("HW_VD1: AECDensity update to [{$}]", nDensity);
- FireNotify(AttrKey::AECDENSITY, m_DoseUnit.m_AECDensity->Get());
- }
- //AECField
- int nField = TurnAECFieldSel(false, atoi(paramList[9].c_str()));
- if (m_DoseUnit.m_AECField->Update(nField))
- {
- mLog::Debug("HW_VD1: AECField update to [{$}]", nField);
- FireNotify(AttrKey::AECFIELD, m_DoseUnit.m_AECField->Get());
- }
- SetSynBoxSwitchStatus(m_bNeedSendToSynBox);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证2点DR曝光的接收参数:请参阅ED2命令
- auto HW_VD2 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 7)
- {
- //%u %.1f %.2f %u %x %c
- mLog::Debug("HW_VD2: WS[{$}], UT[{$}], mAs[{$}], Tube Load[{$}], Switch[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str());
- //TechMode
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_2P))
- {
- mLog::Debug("HW_VD2: Techmode update to [{$}] -> TECHMODE_NOAEC_2P", m_DoseUnit.m_Techmode->Get());
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VD2: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VD2: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //MAS
- float MAS = atof(paramList[3].c_str());
- if (m_DoseUnit.m_MAS->Update(MAS))
- {
- mLog::Debug("HW_VD2: MAS update to [{$}]", MAS);
- FireNotify(m_DoseUnit.m_MAS->GetKey(), m_DoseUnit.m_MAS->Get());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VD2: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VD2: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- SetSynBoxSwitchStatus(m_bNeedSendToSynBox);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证3点DR曝光的接收参数:请参阅ED3命令
- auto HW_VD3 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 7)
- {
- //%u %.1f %.2f %.3f %x %c
- mLog::Debug("HW_VD3: WS[{$}], UT[{$}], mAs[{$}], IT[{$}], Switch[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str());
- //TechMode
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_3P))
- {
- mLog::Debug("HW_VD3: Techmode update to [{$}] -> TECHMODE_NOAEC_3P", m_DoseUnit.m_Techmode->Get());
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VD3: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VD3: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //MAS
- float MAS = atof(paramList[3].c_str());
- if(m_DoseUnit.m_MAS->Update(MAS))
- {
- mLog::Debug("HW_VD3: MAS update to [{$}]", MAS);
- }
- //MA
- float MA = atof(paramList[4].c_str());
- if (m_DoseUnit.m_MA->Update(MA))
- {
- mLog::Debug("HW_VD3: MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_MA->GetKey(), m_DoseUnit.m_MA->Get());
- }
- //MS
- float MS = MAS * 1000.0f / MA;
- if (m_DoseUnit.m_MS->Update(MS))
- {
- mLog::Debug("HW_VD3: MS update to [{$}]", MS);
- FireNotify(m_DoseUnit.m_MS->GetKey(), m_DoseUnit.m_MS->Get());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VD3: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VD3: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- SetSynBoxSwitchStatus(m_bNeedSendToSynBox);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证3点DR曝光的接收参数:请参阅EA3命令
- auto HW_VA3 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 8)
- {
- //%u %.1f %.2f %.0f %u %x %c
- mLog::Debug("HW_VA3: WS[{$}], UT[{$}], mAs[{$}], ms[{$}], Tube load[{$}], Switch[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str());
- //TechMode
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_3P))
- {
- mLog::Debug("HW_VA3: Techmode update to [{$}] -> TECHMODE_NOAEC_3P", m_DoseUnit.m_Techmode->Get());
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VA3: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VA3: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //MAS
- float MAS = atof(paramList[3].c_str());
- if (m_DoseUnit.m_MAS->Update(MAS))
- {
- mLog::Debug("HW_VA3: MAS update to [{$}]", MAS);
- }
- //MS
- float MS = atof(paramList[4].c_str());
- if (m_DoseUnit.m_MS->Update(MS))
- {
- mLog::Debug("HW_VA3: MS update to [{$}]", MS);
- FireNotify(m_DoseUnit.m_MS->GetKey(), m_DoseUnit.m_MS->Get());
- }
- //MA
- float MA = MAS * 1000.0f / MS;
- if (m_DoseUnit.m_MA->Update(MA))
- {
- mLog::Debug("HW_VA3: MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_MA->GetKey(), m_DoseUnit.m_MA->Get());
- }
- //Focus
- if ("S" == paramList[7])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VA3: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[7])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VA3: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证1点曝光的接收参数:请参阅EP1命令
- auto HW_VP1 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 10)
- {
- //%u %.1f %u %u %x %c %c %u %.1f
- mLog::Debug("HW_VP1: WS[{$}], UT[{$}], Tube load[{$}], Current red[{$}], Switch[{$}], Focus[{$}], Sensitivity[{$}], Dominant[{$}], Density[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str(), paramList[8].c_str(), paramList[9].c_str());
- //TechMode
- //mLog::Debug("HW_VP1: Techmode update to [{$}] -> TECHMODE_AEC_1P", m_DoseUnit.m_Techmode->Get());
- //if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_AEC_1P))
- // FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VP1: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VP1: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VP1: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VP1: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- //AECFilm
- int nFilm = TurnAECFilmSel(false, atoi(paramList[7].c_str()));
- if (m_DoseUnit.m_AECFilm->Update(nFilm))
- {
- mLog::Debug("HW_VP1: AECFilm update to [{$}]", nFilm);
- FireNotify(AttrKey::AECFILM, m_DoseUnit.m_AECFilm->Get());
- }
- //AECField
- int nField = TurnAECFieldSel(false, atoi(paramList[8].c_str()));
- if (m_DoseUnit.m_AECField->Update(nField))
- {
- mLog::Debug("HW_VP1: AECField update to [{$}]", nField);
- FireNotify(AttrKey::AECFIELD, m_DoseUnit.m_AECField->Get());
- }
- //AECDensity
- int nDensity = atoi(paramList[9].c_str());
- if (m_DoseUnit.m_AECDensity->Update(nDensity))
- {
- mLog::Debug("HW_VP1: AECDensity update to [{$}]", nDensity);
- FireNotify(AttrKey::AECDENSITY, m_DoseUnit.m_AECDensity->Get());
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证2点曝光的接收参数:请参阅EP2命令
- auto HW_VP2 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 7)
- {
- //%u %.1f %.2f %u %x %c
- mLog::Debug("HW_VP2: WS[{$}], UT[{$}], mAs[{$}], Tube Load[{$}], Switch[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str());
- //TechMode
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_2P))
- {
- mLog::Debug("HW_VP2: Techmode update to [{$}] -> TECHMODE_NOAEC_2P", m_DoseUnit.m_Techmode->Get());
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VP2: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VP2: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->JSGet());
- }
- //MAS
- float MAS = atof(paramList[3].c_str());
- if (m_DoseUnit.m_MAS->Update(MAS))
- {
- mLog::Debug("HW_VP2: MAS update to [{$}]", MAS);
- FireNotify(m_DoseUnit.m_MAS->GetKey(), m_DoseUnit.m_MAS->JSGet());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VP2: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VP2: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证3点曝光的接收参数:请参阅EP3命令
- auto HW_VP3 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 7)
- {
- //%u %.1f %.2f %.1f %x %c
- mLog::Debug("HW_VP3: WS[{$}], UT[{$}], mAs[{$}], IT[{$}], Switch[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str());
- //TechMode
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_3P))
- {
- mLog::Debug("HW_VP3: Techmode update to [{$}] -> TECHMODE_NOAEC_3P", m_DoseUnit.m_Techmode->Get());
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VP3: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VP3: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //MAS
- float MAS = atof(paramList[3].c_str());
- if (m_DoseUnit.m_MAS->Update(MAS))
- {
- mLog::Debug("HW_VP3: MAS update to [{$}]", MAS);
- }
- //MA
- float MA = atof(paramList[4].c_str());
- if (m_DoseUnit.m_MA->Update(MA))
- {
- mLog::Debug("HW_VP3: MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_MA->GetKey(), m_DoseUnit.m_MA->Get());
- }
- //MS
- float MS = MAS * 1000.0f / MA;
- if (m_DoseUnit.m_MS->Update(MS))
- {
- mLog::Debug("HW_VP3: MS update to [{$}]", MS);
- FireNotify(m_DoseUnit.m_MS->GetKey(), m_DoseUnit.m_MS->Get());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VP3: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VP3: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证1点DR曝光的接收参数:请参阅ES1命令
- auto HW_VS1 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 12)
- {
- //%u %.1f %u %u %x %c %u %.1f %u %u %.1f
- mLog::Debug("HW_VS1: WS[{$}], UT[{$}], Tube load[{$}], Current red[{$}], Switch[{$}], Focus[{$}], Dose[{$}], Density[{$}], Dominant[{$}], Max.time[{$}], Frame per second[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str(), paramList[8].c_str(), paramList[9].c_str(), paramList[10].c_str(),
- paramList[11].c_str());
- //TechMode
- //mLog::Debug("HW_VS1: Techmode update to [{$}] -> TECHMODE_AEC_1P", m_DoseUnit.m_Techmode->Get());
- //if(m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_AEC_1P))
- // FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- //WS
- int WS = atoi(paramList[1].c_str());
- mLog::Debug("HW_VS1: WS update to [{$}]", WS);
- if (m_DoseUnit.m_WS->Update(WS))
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- //KV
- float KV = atof(paramList[2].c_str());
- mLog::Debug("HW_VS1: KV update to [{$}]", KV);
- if (m_DoseUnit.m_KV->Update(KV))
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- //Focus
- if ("S" == paramList[6])
- {
- mLog::Debug("HW_VS1: Focus update to [SMALL]");
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- else if ("L" == paramList[6])
- {
- mLog::Debug("HW_VS1: Focus update to [LARGE]");
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- //Dose
- m_nCfdDose = atoi(paramList[7].c_str());
- //AECDensity
- int nDensity = atoi(paramList[8].c_str());
- mLog::Debug("HW_VS1: AECDensity update to [{$}]", nDensity);
- if (m_DoseUnit.m_AECDensity->Update(nDensity))
- FireNotify(AttrKey::AECDENSITY, m_DoseUnit.m_AECDensity->Get());
- //AECField
- int nField = TurnAECFieldSel(false, atoi(paramList[9].c_str()));
- mLog::Debug("HW_VS1: AECField update to [{$}]", nField);
- if (m_DoseUnit.m_AECField->Update(nField))
- FireNotify(AttrKey::AECFIELD, m_DoseUnit.m_AECField->Get());
- //Frames per second
- float frameRate = atof(paramList[11].c_str());
- mLog::Debug("HW_VS1: FrameRate update to [{$}]", frameRate);
- if (m_DoseUnit.m_FrameRate->Update(frameRate))
- FireNotify(AttrKey::FRAMERATE, m_DoseUnit.m_FrameRate->Get());
- SetSynBoxSwitchStatus(m_bNeedSendToSynBox);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证2点DR曝光的接收参数:请参阅ES2命令
- auto HW_VS2 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 8)
- {
- //%u %.1f %.2f %u %x %c %.1f
- mLog::Debug("HW_VS2: WS[{$}], UT[{$}], mAs[{$}], Tube Load[{$}], Switch[{$}], Focus[{$}], Frame per second[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str());
- //TechMode
- mLog::Debug("HW_VS2: Techmode update to [{$}] -> TECHMODE_NOAEC_2P", m_DoseUnit.m_Techmode->Get());
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_2P))
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- //WS
- int WS = atoi(paramList[1].c_str());
- mLog::Debug("HW_VS2: WS update to [{$}]", WS);
- if (m_DoseUnit.m_WS->Update(WS))
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- //KV
- float KV = atof(paramList[2].c_str());
- mLog::Debug("HW_VS2: KV update to [{$}]", KV);
- if (m_DoseUnit.m_KV->Update(KV))
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- //MAS
- float MAS = atof(paramList[3].c_str());
- mLog::Debug("HW_VS2: MAS update to [{$}]", MAS);
- if (m_DoseUnit.m_MAS->Update(MAS))
- FireNotify(m_DoseUnit.m_MAS->GetKey(), m_DoseUnit.m_MAS->Get());
- //Focus
- if ("S" == paramList[6])
- {
- mLog::Debug("HW_VS2: Focus update to [SMALL]");
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- else if ("L" == paramList[6])
- {
- mLog::Debug("HW_VS2: Focus update to [LARGE]");
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- //Frames per second
- float frameRate = atof(paramList[7].c_str());
- mLog::Debug("HW_VS1: FrameRate update to [{$}]", frameRate);
- if (m_DoseUnit.m_FrameRate->Update(frameRate))
- FireNotify(AttrKey::FRAMERATE, m_DoseUnit.m_FrameRate->Get());
- SetSynBoxSwitchStatus(m_bNeedSendToSynBox);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证3点DR曝光的接收参数:请参阅ES3命令
- auto HW_VS3 = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 8)
- {
- //%u %.1f %.2f %.3f %x %c %.1f
- mLog::Debug("HW_VS3: WS[{$}], UT[{$}], mAs[{$}], IT[{$}], Switch[{$}], Focus[{$}], Frame per second[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str());
- //TechMode
- if (m_DoseUnit.m_Techmode->Update(AttrKey::TECHMODE_NOAEC_3P))
- {
- mLog::Debug("HW_VS3: Techmode update to [{$}] -> TECHMODE_NOAEC_3P", m_DoseUnit.m_Techmode->Get());
- FireNotify(AttrKey::TECHMODE, m_DoseUnit.m_Techmode->JSGet());
- }
- //WS
- int WS = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_WS->Update(WS))
- {
- mLog::Debug("HW_VS3: WS update to [{$}]", WS);
- FireNotify(AttrKey::WORKSTATION, m_DoseUnit.m_WS->JSGet());
- }
- //KV
- float KV = atof(paramList[2].c_str());
- if (m_DoseUnit.m_KV->Update(KV))
- {
- mLog::Debug("HW_VS3: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_KV->GetKey(), m_DoseUnit.m_KV->Get());
- }
- //MAS
- float MAS = atof(paramList[3].c_str());
- if (m_DoseUnit.m_MAS->Update(MAS))
- {
- mLog::Debug("HW_VS3: MAS update to [{$}]", MAS);
- }
- //MA
- float MA = atof(paramList[4].c_str());
- if (m_DoseUnit.m_MA->Update(MA))
- {
- mLog::Debug("HW_VS3: MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_MA->GetKey(), m_DoseUnit.m_MA->Get());
- }
- //MS
- float MS = MAS * 1000.0f / MA;
- if (m_DoseUnit.m_MS->Update(MS))
- {
- mLog::Debug("HW_VS3: MS update to [{$}]", MS);
- FireNotify(m_DoseUnit.m_MS->GetKey(), m_DoseUnit.m_MS->Get());
- }
- //Focus
- if ("S" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VS3: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[6])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VS3: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- //Frames per second
- float frameRate = atof(paramList[7].c_str());
- if (m_DoseUnit.m_FrameRate->Update(frameRate))
- {
- mLog::Debug("HW_VS1: FrameRate update to [{$}]", frameRate);
- FireNotify(AttrKey::FRAMERATE, m_DoseUnit.m_FrameRate->Get());
- }
- SetSynBoxSwitchStatus(m_bNeedSendToSynBox);
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //该命令用于验证收到的剂量调节停止命令<DRS:Stop
- auto HW_VRS = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%u
- int State = atoi(paramList[1].c_str());
- switch (State)
- {
- case 0:
- {
- mLog::Debug("HW_VRS: Dose regulation on");
- }break;
- case 1:
- {
- mLog::Debug("HW_VRS: Dose regulation stop");
- }break;
- default:
- {
- mLog::Debug("HW_VRS: Stop[{$}]",
- paramList[1].c_str());
- }break;
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于指示荧光蜂鸣器已激活,因为指定的荧光计时器已过期
- auto HW_FBS = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%u
- int State = atoi(paramList[1].c_str());
- switch (State)
- {
- case 0:
- {
- mLog::Debug("HW_FBS: Fluoro Beeper is not activate");
- }break;
- case 1:
- {
- mLog::Debug("HW_FBS: Fluoro Beeper is active");
- }break;
- case 2:
- {
- mLog::Debug("HW_FBS: Xray blocked because of fluoro beeper timeout; Fluoro beeper is not active");
- }break;
- case 3:
- {
- mLog::Debug("HW_FBS: Xray blocked because of 60 minutes fluoro scene without interruption");
- }break;
- default:
- {
- mLog::Debug("HW_FBS: State[{$}]",
- paramList[1].c_str());
- }break;
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //该命令由发生器单元提供,用于指示实际的荧光参数:kV mA Time State Deviation
- auto HW_FPA = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 6)
- {
- //%.1f %.2f %.2f %u %d
- mLog::Debug("HW_FPA: kV[{$}], mA[{$}], Time[{$}], State[{$}], Deviation[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str());
- if (m_DoseUnit.m_GenSynState->Get() == AttrKey::GENERATOR_FLU_READY)
- {
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_FLU_XRAYON))
- {
- mLog::Debug("EXPSTATE: [{$}] -> FLX1", m_DoseUnit.m_GenSynState->Get());
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- }
- else if (m_DoseUnit.m_GenSynState->Get() != AttrKey::GENERATOR_FLU_XRAYON)
- {
- mLog::Warn("EXPSTATE: [{$}] not in ready", m_DoseUnit.m_GenSynState->Get());
- }
- //KV
- float KV = atof(paramList[1].c_str());
- if (m_DoseUnit.m_PostKV->Update(KV))
- {
- mLog::Debug("HW_FPA: Post KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_PostKV->GetKey(), m_DoseUnit.m_PostKV->Get());
- }
- //MA
- float MA = atof(paramList[2].c_str());
- if (m_DoseUnit.m_PostMA->Update(MA))
- {
- mLog::Debug("HW_FPA: Post MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_PostMA->GetKey(), m_DoseUnit.m_PostMA->Get());
- }
- //time
- float time = atof(paramList[3].c_str());
- if (m_DoseUnit.m_FLAccTime->Update(time))
- {
- mLog::Debug("HW_FPA: time update to [{$}]", time);
- FireNotify(m_DoseUnit.m_FLAccTime->GetKey(), m_DoseUnit.m_FLAccTime->Get());
- }
- //ABS mode
- int abs = atoi(paramList[4].c_str());
- switch (abs)
- {
- case 0:
- {
- mLog::Debug("HW_FPA: ABC control active");
- }break;
- case 1:
- {
- mLog::Debug("HW_FPA: ABC control active, but upper control limits reached");
- }break;
- case 2:
- {
- mLog::Debug("HW_FPA: ABC control active, but lower control limits reached");
- }break;
- case 3:
- {
- mLog::Debug("HW_FPA: ABC control stopped");
- }break;
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //该命令由发生器单元给出,用于指示实际的脉冲荧光参数:UT IT x-ray time Tube current time product Timer State Deviation
- auto HW_PPA = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 8)
- {
- //%.1f %.1f %.1f %.2f %.2f %u %d
- mLog::Debug("HW_PPA: UT[{$}], IT[{$}], x-ray time[{$}], Tube current time product[{$}], Timer[{$}], State[{$}], Deviation[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str());
- if (m_DoseUnit.m_GenSynState->Get() == AttrKey::GENERATOR_FLU_READY)
- {
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_FLU_XRAYON))
- {
- mLog::Debug("EXPSTATE: [{$}] -> FLX1", m_DoseUnit.m_GenSynState->Get());
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- }
- else if (m_DoseUnit.m_GenSynState->Get() != AttrKey::GENERATOR_FLU_XRAYON)
- {
- mLog::Warn("EXPSTATE: [{$}] not in ready", m_DoseUnit.m_GenSynState->Get());
- }
- //KV
- float KV = atof(paramList[1].c_str());
- if (m_DoseUnit.m_PostKV->Update(KV))
- {
- mLog::Debug("HW_PPA: Post KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_PostKV->GetKey(), m_DoseUnit.m_PostKV->Get());
- }
- //MA
- float MA = atof(paramList[2].c_str());
- if (m_DoseUnit.m_PostMA->Update(MA))
- {
- mLog::Debug("HW_PPA: Post MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_PostMA->GetKey(), m_DoseUnit.m_PostMA->Get());
- }
- //MS
- float MS = atof(paramList[3].c_str());
- if (m_DoseUnit.m_FLMS->Update(MS))
- {
- mLog::Debug("HW_PPA: Post pulse length ms update to [{$}]", MS);
- FireNotify(m_DoseUnit.m_FLMS->GetKey(), m_DoseUnit.m_FLMS->Get());
- }
- //time
- float time = atof(paramList[5].c_str());
- if (m_DoseUnit.m_FLAccTime->Update(time))
- {
- mLog::Debug("HW_PPA: time update to [{$}]", time);
- FireNotify(m_DoseUnit.m_FLAccTime->GetKey(), m_DoseUnit.m_FLAccTime->Get());
- }
- //ABS mode
- int abs = atoi(paramList[6].c_str());
- switch (abs)
- {
- case 0:
- {
- mLog::Debug("HW_PPA: ABC control active");
- }break;
- case 1:
- {
- mLog::Debug("HW_PPA: ABC control active, but upper control limits reached");
- }break;
- case 2:
- {
- mLog::Debug("HW_PPA: ABC control active, but lower control limits reached");
- }break;
- case 3:
- {
- mLog::Debug("HW_PPA: ABC control stopped");
- }break;
- case 4:
- {
- mLog::Debug("HW_PPA: ABC control stopped, but upper control limits reached");
- }break;
- case 5:
- {
- mLog::Debug("HW_PPA: ABC control stopped, but lower control limits reached");
- }break;
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //使用此命令时,系统控制单元可以通知主机曝光释放输入(脚踏开关)的变化.如果满足所有要求,主机可以使用此命令使用“<SFL”触发曝光:Handswitch Footswitch
- auto HW_RFL = [this](vector <string>& paramList) -> void
- {
- //%u %u
- if (paramList.size() >= 3)
- {
- mLog::Debug("HW_RFL: Handswitch[{$}], Footswitch[{$}]",
- paramList[1].c_str(), paramList[2].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证连续荧光的接收参数:参见FPC命令:Curve type Stop Doserate Focus
- auto HW_VPC = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 5)
- {
- //%u %u %u %c
- mLog::Debug("HW_VPC: Curve type[{$}], Stop[{$}], Doserate[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str());
- //FluMode
- if (m_DoseUnit.m_FLMode->Update(AttrKey::GENERATOR_FLMODE_CF))
- {
- mLog::Debug("HW_VPC: FluMode update to [{$}] -> GENERATOR_FLMODE_CF", m_DoseUnit.m_FLMode->Get());
- FireNotify(AttrKey::FLUMode, m_DoseUnit.m_FLMode->JSGet());
- }
- //DoseLevel
- int DoseLevel = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_DoseLevel->Update(DoseLevel))
- {
- mLog::Debug("HW_VPC: DoseLevel update to [{$}]", DoseLevel);
- FireNotify(AttrKey::FLUDoseLevel, m_DoseUnit.m_DoseLevel->Get());
- }
- //ABS
- int abs = atoi(paramList[3].c_str());
- switch (abs)
- {
- case 0:
- {
- if (m_DoseUnit.m_ABSStatus->Update(AttrKey::GENERATOR_ABS_ON_KV))
- {
- mLog::Debug("HW_VPC: abs update to [on]");
- FireNotify(m_DoseUnit.m_ABSStatus->GetKey(), m_DoseUnit.m_ABSStatus->JSGet());
- }
- }break;
- case 1:
- {
- if (m_DoseUnit.m_ABSStatus->Update(AttrKey::GENERATOR_ABS_OFF))
- {
- mLog::Debug("HW_VPC: abs update to [off]");
- FireNotify(m_DoseUnit.m_ABSStatus->GetKey(), m_DoseUnit.m_ABSStatus->JSGet());
- }
- }break;
- }
- //Focus
- if ("S" == paramList[4])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VPC: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[4])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VPC: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令用于验证手动荧光检测的接收参数:参见FPM命令
- auto HW_VPM = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 4)
- {
- //%.1f %.2f %c
- mLog::Debug("HW_VPM: UT[{$}], IT[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str());
- //FluMode
- if (m_DoseUnit.m_FLMode->Update(AttrKey::GENERATOR_FLMODE_CF))
- {
- mLog::Debug("HW_VPM: FluMode update to [{$}] -> GENERATOR_FLMODE_CF", m_DoseUnit.m_FLMode->Get());
- FireNotify(AttrKey::FLUMode, m_DoseUnit.m_FLMode->JSGet());
- }
- //KV
- float KV = atof(paramList[1].c_str());
- if (m_DoseUnit.m_FLKV->Update(KV))
- {
- mLog::Debug("HW_VPM: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_FLKV->GetKey(), m_DoseUnit.m_FLKV->Get());
- }
- //MA
- float MA = atof(paramList[2].c_str());
- if (m_DoseUnit.m_FLMA->Update(MA))
- {
- mLog::Debug("HW_VPM: MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_FLMA->GetKey(), m_DoseUnit.m_FLMA->Get());
- }
- //Focus
- if ("S" == paramList[3])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VPM: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[3])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VPM: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //该命令用于验证脉冲荧光的接收参数:参见FPP命令
- auto HW_VPP = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 10)
- {
- //%u %u %.1f %.1f %.1f %u %.1f %u %c
- mLog::Debug("HW_VPP: Curve type[{$}], Stop[{$}], UT[{$}], IT[{$}], X-ray time[{$}], max.time[{$}], fps[{$}], Dose/pulse[{$}], Focus[{$}]",
- paramList[1].c_str(), paramList[2].c_str(), paramList[3].c_str(), paramList[4].c_str(), paramList[5].c_str(),
- paramList[6].c_str(), paramList[7].c_str(), paramList[8].c_str(), paramList[9].c_str());
- //FluMode
- if (m_DoseUnit.m_FLMode->Update(AttrKey::GENERATOR_FLMODE_PF))
- {
- mLog::Debug("HW_VPP: FluMode update to [{$}] -> GENERATOR_FLMODE_PF", m_DoseUnit.m_FLMode->Get());
- FireNotify(AttrKey::FLUMode, m_DoseUnit.m_FLMode->JSGet());
- }
- //DoseLevel
- int DoseLevel = atoi(paramList[1].c_str());
- if (m_DoseUnit.m_DoseLevel->Update(DoseLevel))
- {
- mLog::Debug("HW_VPP: DoseLevel update to [{$}]", DoseLevel);
- FireNotify(AttrKey::FLUDoseLevel, m_DoseUnit.m_DoseLevel->Get());
- }
- //ABS
- int abs = atoi(paramList[2].c_str());
- switch (abs)
- {
- case 0:
- {
- if (m_DoseUnit.m_ABSStatus->Update(AttrKey::GENERATOR_ABS_ON_KV))
- {
- mLog::Debug("HW_VPP: abs update to [on]");
- FireNotify(m_DoseUnit.m_ABSStatus->GetKey(), m_DoseUnit.m_ABSStatus->JSGet());
- }
- }break;
- case 1:
- {
- if (m_DoseUnit.m_ABSStatus->Update(AttrKey::GENERATOR_ABS_OFF))
- {
- mLog::Debug("HW_VPP: abs update to [off]");
- FireNotify(m_DoseUnit.m_ABSStatus->GetKey(), m_DoseUnit.m_ABSStatus->JSGet());
- }
- }break;
- }
- //KV
- float KV = atof(paramList[3].c_str());
- if (m_DoseUnit.m_FLKV->Update(KV))
- {
- mLog::Debug("HW_VPP: KV update to [{$}]", KV);
- FireNotify(m_DoseUnit.m_FLKV->GetKey(), m_DoseUnit.m_FLKV->Get());
- }
- //MA
- float MA = atof(paramList[4].c_str());
- if (m_DoseUnit.m_FLMA->Update(MA))
- {
- mLog::Debug("HW_VPP: MA update to [{$}]", MA);
- FireNotify(m_DoseUnit.m_FLMA->GetKey(), m_DoseUnit.m_FLMA->Get());
- }
- //MS
- float MS = atof(paramList[5].c_str());
- if (m_DoseUnit.m_FLMS->Update(MS))
- {
- mLog::Debug("HW_VPP: Post pulse length ms update to [{$}]", MS);
- FireNotify(m_DoseUnit.m_FLMS->GetKey(), m_DoseUnit.m_FLMS->Get());
- }
- //PPS
- float PPS = atof(paramList[7].c_str());
- if (m_DoseUnit.m_PPS->Update(PPS))
- {
- mLog::Debug("HW_VPP: PPS update to [{$}]", PPS);
- FireNotify(AttrKey::FLUPPS, m_DoseUnit.m_PPS->Get());
- }
- //Focus
- if ("S" == paramList[9])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_SMALL))
- {
- mLog::Debug("HW_VPP: Focus update to [SMALL]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- else if ("L" == paramList[9])
- {
- if (m_DoseUnit.m_Focus->Update(AttrKey::FOCUS_LARGE))
- {
- mLog::Debug("HW_VPP: Focus update to [LARGE]");
- FireNotify(AttrKey::FOCUS, m_DoseUnit.m_Focus->JSGet());
- }
- }
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- //此命令可用于测试串行端口:String
- auto HW_COMTEST = [this](vector <string>& paramList) -> void
- {
- if (paramList.size() >= 2)
- {
- //%s
- mLog::Debug("HW_COMTEST: test serial port [{$}]",
- paramList[1].c_str());
- }
- else
- {
- mLog::Warn("commands[{$}] item count[{$}] not right", paramList[0].c_str(), paramList.size());
- }
- };
- arFrame.clear();
- arFrame[">AD2"] = tFrameMapItem(HW_AD2);
- arFrame[">AD2Timemax"] = tFrameMapItem(HW_AD2Timemax);
- arFrame[">AD2Timemin"] = tFrameMapItem(HW_AD2Timemin);
- arFrame[">AD2End"] = tFrameMapItem(HW_AD2End);
- arFrame[">AD3kV"] = tFrameMapItem(HW_AD3kV);
- arFrame[">AD3ms"] = tFrameMapItem(HW_AD3ms);
- arFrame[">AD3mAs"] = tFrameMapItem(HW_AD3mAs);
- arFrame[">AD3End"] = tFrameMapItem(HW_AD3End);
- arFrame[">AC2"] = tFrameMapItem(HW_AC2);
- arFrame[">AC3"] = tFrameMapItem(HW_AC3);
- arFrame[">AS2"] = tFrameMapItem(HW_AS2);
- arFrame[">AS3"] = tFrameMapItem(HW_AS3);
- arFrame[">DAP"] = tFrameMapItem(HW_DAP);
- arFrame[">EPA"] = tFrameMapItem(HW_EPA);
- arFrame[">ERR"] = tFrameMapItem(HW_ERR);
- arFrame[">EXP"] = tFrameMapItem(HW_EXP);
- arFrame[">SDN"] = tFrameMapItem(HW_SDN);
- arFrame[">GRD"] = tFrameMapItem(HW_GRD);
- arFrame[">GST"] = tFrameMapItem(HW_GST);
- arFrame[">IFV"] = tFrameMapItem(HW_IFV);
- arFrame[">INI"] = tFrameMapItem(HW_INI);
- arFrame[">LIM"] = tFrameMapItem(HW_LIM);
- arFrame[">LIT"] = tFrameMapItem(HW_LIT);
- arFrame[">PHU"] = tFrameMapItem(HW_PHU);
- arFrame[">RDY"] = tFrameMapItem(HW_RDY);
- arFrame[">CR"] = tFrameMapItem(HW_CR);
- arFrame[">RXP"] = tFrameMapItem(HW_RXP);
- arFrame[">SBY"] = tFrameMapItem(HW_SBY);
- arFrame[">TWS"] = tFrameMapItem(HW_TWS);
- arFrame[">UNK"] = tFrameMapItem(HW_UNK);
- arFrame[">CRC"] = tFrameMapItem(HW_CRC);
- arFrame[">VD0"] = tFrameMapItem(HW_VD0);
- arFrame[">VD1"] = tFrameMapItem(HW_VD1);
- arFrame[">VD2"] = tFrameMapItem(HW_VD2);
- arFrame[">VD3"] = tFrameMapItem(HW_VD3);
- arFrame[">VA3"] = tFrameMapItem(HW_VA3);
- arFrame[">VP1"] = tFrameMapItem(HW_VP1);
- arFrame[">VP2"] = tFrameMapItem(HW_VP2);
- arFrame[">VP3"] = tFrameMapItem(HW_VP3);
- arFrame[">VS1"] = tFrameMapItem(HW_VS1);
- arFrame[">VS2"] = tFrameMapItem(HW_VS2);
- arFrame[">VS3"] = tFrameMapItem(HW_VS3);
- arFrame[">VRS"] = tFrameMapItem(HW_VRS);
- arFrame[">FBS"] = tFrameMapItem(HW_FBS);
- arFrame[">FPA"] = tFrameMapItem(HW_FPA);
- arFrame[">PPA"] = tFrameMapItem(HW_PPA);
- arFrame[">RFL"] = tFrameMapItem(HW_RFL);
- arFrame[">VPC"] = tFrameMapItem(HW_VPC);
- arFrame[">VPM"] = tFrameMapItem(HW_VPM);
- arFrame[">VPP"] = tFrameMapItem(HW_VPP);
- arFrame[">COMTEST"] = tFrameMapItem(HW_COMTEST);
- return true;
- }
- //获取当前设备状态,固件版本
- void nsGEN::RF80Device::GetState()
- {
- char strSendCMD[GEN_CF80_SEND_LEN_min] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["GST"].strParamArry.c_str());
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["GST"].struStatus);
- memset(strSendCMD,0,GEN_CF80_SEND_LEN_min);
- sprintf_s(strSendCMD, glo_Send_RF80Fun["RDY"].strParamArry.c_str());
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["RDY"].struStatus);
- }
- void nsGEN::RF80Device::SetVersion(int ver)
- {
- mLog::Debug("Enter SetVersion:[{$}]", ver);
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["IFV"].strParamArry.c_str(),
- ver);
- HWSendWaitSelfCMD(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["IFV"].struStatus);
- }
- //添加指令尾
- //接口版本1: 每个命令都是一个字符串,必须以回车符'r\'和换行符'\n'终止。
- //接口版本2; 每个命令都是一个字符串,并且只能以换行符'\n'(Unix样式)终止。最后一个字符是校验和。使用以下函数
- bool nsGEN::RF80Device::FormatCMD(char* pCmd, int& nSize)
- {
- if (nSize > GEN_CF80_SEND_LEN_max)
- {
- mLog::Debug("FormatCMD: lengh[{$}] is too big \n", nSize);
- return false;
- }
- if (m_nVersion = 1)
- {
- pCmd[nSize] = CR;
- nSize++;
- }
- else if (m_nVersion = 2)
- {
- char checksum = 0;
- for (int i = 0; i < nSize; i++)
- checksum += pCmd[i];
- if (checksum < 16)
- checksum += 16;
- pCmd[nSize] = checksum;
- nSize++;
- }
- else
- {
- mLog::Debug("FormatCMD: unknow[{$}] version \n", m_nVersion);
- return false;
- }
- pCmd[nSize] = LF;
- nSize++;
- return true;
- }
- //参数处理
- void nsGEN::RF80Device::Search3PointRange(float kv, float mas, int focus)
- {
- char tempFocus = 'S';
- if (AttrKey::FOCUS_SMALL == focus)
- {
- tempFocus = 'S';
- }
- else if (AttrKey::FOCUS_LARGE == focus)
- {
- tempFocus = 'L';
- }
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["CP3"].strParamArry.c_str(),
- kv, mas, tempFocus);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["CP3"].struStatus);
- }
- void nsGEN::RF80Device::Search2PointRange(float kv, int focus)
- {
- char tempFocus = 'S';
- if (AttrKey::FOCUS_SMALL == focus)
- {
- tempFocus = 'S';
- }
- else if (AttrKey::FOCUS_LARGE == focus)
- {
- tempFocus = 'L';
- }
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["CP2"].strParamArry.c_str(),
- kv, m_nCfgTubeLoad, tempFocus);
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["CP2"].struStatus);
- }
- bool nsGEN::RF80Device::CheckRadLimitValue(int techMode, int focus, float kv, float & mas, float& ma) //mode
- {
- if (m_RadLimitFlag)
- {
- m_RadLimitFlag = false;
- mLog::Debug("CheckLimitValue:[{$}]", techMode);
- switch (techMode)
- {
- case AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_2P:
- case AttrKey::TECHMODE_TYPE::TECHMODE_AEC_2P:
- {
- Search2PointRange(kv, focus);
- if (WaitForSingleObject(m_hRadLimitMASEvent, 2000) == WAIT_OBJECT_0)
- {
- mLog::Debug("m_hRadLimitMASEvent = true");
- if (m_fCurMinMAS < m_fCurMaxMAS)
- {
- if (mas < m_fCurMinMAS)
- {
- mLog::Warn("set MAS[{$}] too small[{$}]", mas, m_fCurMinMAS);
- mas = m_fCurMinMAS;
- }
- if (mas > m_fCurMaxMAS)
- {
- mLog::Warn("set MAS[{$}] too big[{$}]", mas, m_fCurMaxMAS);
- mas = m_fCurMaxMAS;
- }
- }
- return true;
- }
- else
- {
- mLog::Warn("m_hRadLimitMASEvent timeout");
- return false;
- }
- }break;
- case AttrKey::TECHMODE_TYPE::TECHMODE_NOAEC_3P:
- case AttrKey::TECHMODE_TYPE::TECHMODE_AEC_3P:
- {
- Search2PointRange(kv, focus);
- if (WaitForSingleObject(m_hRadLimitMASEvent, 2000) == WAIT_OBJECT_0)
- {
- mLog::Debug("m_hRadLimitMASEvent = true");
- if (m_fCurMinMAS < m_fCurMaxMAS)
- {
- if (mas < m_fCurMinMAS)
- {
- mLog::Warn("set MAS[{$}] too small[{$}]", mas, m_fCurMinMAS);
- mas = m_fCurMinMAS;
- }
- if (mas > m_fCurMaxMAS)
- {
- mLog::Warn("set MAS[{$}] too big[{$}]", mas, m_fCurMaxMAS);
- mas = m_fCurMaxMAS;
- }
- }
- Search3PointRange(kv, mas, focus);
- if (WaitForSingleObject(m_hRadLimitMAEvent, 2000) == WAIT_OBJECT_0)
- {
- mLog::Debug("m_hRadLimitMAEvent = true");
- if (m_fCurMinMA < m_fCurMaxMA)
- {
- if (ma < m_fCurMinMA)
- {
- mLog::Warn("set MA[{$}] too small[{$}]", ma, m_fCurMinMA);
- ma = m_fCurMinMA;
- }
- if (ma > m_fCurMaxMA)
- {
- mLog::Warn("set MA[{$}] too big[{$}]", ma, m_fCurMaxMA);
- ma = m_fCurMaxMA;
- }
- }
- return true;
- }
- else
- {
- mLog::Warn("m_hRadLimitMAEvent timeout");
- return false;
- }
- }
- else
- {
- mLog::Warn("m_hRadLimitMASEvent timeout");
- return false;
- }
- }break;
- }
- }
- return false;
- }
- bool nsGEN::RF80Device::CheckFluFPSMaxKW(float kv, float ma)
- {
- for (auto p : m_mapFPSMaxKW)
- {
- float tempPPS = m_DoseUnit.m_PPS->Get();
- if (abs(p.first - tempPPS) < 0.1)//find
- {
- if (kv * ma > p.second)
- {
- return false;//over max kw.do nothing.
- }
- else
- {
- return true;
- }
- }
- }
- return false;
- }
- int nsGEN::RF80Device::TurnAECFieldSel(bool isToGen, const int value)
- {
- int AECFieldSel = -1;
- if (isToGen)
- {
- switch (value)
- {
- case 100:
- AECFieldSel = 1;
- break;
- case 10:
- AECFieldSel = 2;
- break;
- case 110:
- AECFieldSel = 3;
- break;
- case 1:
- AECFieldSel = 4;
- break;
- case 101:
- AECFieldSel = 5;
- break;
- case 11:
- AECFieldSel = 6;
- break;
- case 111:
- AECFieldSel = 7;
- break;
- default:
- AECFieldSel = 2;
- break;
- }
- }
- else
- {
- switch (value)
- {
- case 1:
- AECFieldSel = 100;
- break;
- case 2:
- AECFieldSel = 10;
- break;
- case 3:
- AECFieldSel = 110;
- break;
- case 4:
- AECFieldSel = 1;
- break;
- case 5:
- AECFieldSel = 101;
- break;
- case 6:
- AECFieldSel = 11;
- break;
- case 7:
- AECFieldSel = 111;
- break;
- default:
- AECFieldSel = 10;
- break;
- }
- }
- return AECFieldSel;
- }
- int nsGEN::RF80Device::TurnAECFilmSel(bool isToGen, int value)
- {
- int AECFilmSel = -1;
- if (isToGen)
- {
- if (value == 1)
- {
- AECFilmSel = 'D'; //Low sensitivity
- }
- else if (value == 10)
- {
- AECFilmSel = 'U'; //medium sensitivity
- }
- else if (value == 100)
- {
- AECFilmSel = 'H'; //high sensitivity
- }
- else
- {
- AECFilmSel = 'D';
- }
- }
- else
- {
- switch (value)
- {
- case 'H':
- AECFilmSel = 100;
- break;
- case 'U':
- AECFilmSel = 10;
- break;
- case 'D':
- AECFilmSel = 1;
- break;
- default:
- AECFilmSel = 10;
- break;
- }
- }
- return AECFilmSel;
- }
- void nsGEN::RF80Device::DetectorReady()
- {
- mLog::Debug("Enter DetectorReady[{$}]", m_bIsSendSCUFPDReady);
- if (m_bIsSendSCUFPDReady)
- {
- char strSendCMD[GEN_CF80_SEND_LEN_min] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["RDR"].strParamArry.c_str());
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["RDR"].struStatus);
- }
- }
- void nsGEN::RF80Device::SetLastParambeforeEXP(RF80_TechMode lastTech, string CMDid, const char* CMDdata)
- {
- mLog::Debug("Enter SetLastParambeforeEXP[{$}]", (int)lastTech);
- switch (lastTech)
- {
- case RF80Tech_RAD:
- {
- m_LastTechMode = RF80Tech_RAD;
- m_LastParamArry[RF80Tech_RAD].SetData(CMDid, CMDdata);
- }break;
- case RF80Tech_FLU:
- {
- m_LastTechMode = RF80Tech_FLU;
- m_LastParamArry[RF80Tech_FLU].SetData(CMDid, CMDdata);
- }break;
- case RF80Tech_FLU_MAX:
- break;
- default:
- break;
- }
- }
- //设置曝光状态
- void nsGEN::RF80Device::SetRadStatus(int PreContact, int MainContact)
- {
- mLog::Debug("Enter SetRadStatus[{$},{$}]", PreContact, MainContact);
- if (m_ExpReady[0] != '1')
- {
- mLog::Warn("SetRadStatus:not in RAD ready");
- return;
- }
- if (0 == PreContact && 0 == MainContact)
- {
- mLog::Debug("EXPSTATE: [{$}] -> PR0", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_RAD_OFF))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- m_XrayReady = "00";
- mLog::Debug("current XrayReady: [{$}]", m_XrayReady.c_str());
- }
- else if (0 != PreContact && 0 == MainContact)
- {
- m_XrayReady[0] = '1';
- mLog::Debug("current XrayReady: [{$}]", m_XrayReady.c_str());
- if (m_DoseUnit.m_GenSynState->Get() == AttrKey::GENERATOR_RAD_XRAYON)
- {
- mLog::Debug("EXPSTATE: [{$}] -> XR0", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_RAD_XRAYOFF))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- else
- {
- mLog::Debug("EXPSTATE: [{$}] -> PR1", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_RAD_PREPARE))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- }
- else if (0 != PreContact && 0 != MainContact)
- {
- //只用于触发"<SXP 1/2 1/2 0/1"自动发送
- }
- mLog::Debug("currSYNmode:WS[{$}:{$}]", m_arrWSMap[m_strCurrentWSName].strWSNAme.c_str(), (int)m_nSYNMode);
- if (PreContact)
- {
- PreContact = m_nSYNMode;
- }
- if (MainContact)
- {
- MainContact = m_nSYNMode;
- }
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SXP"].strParamArry.c_str(),
- PreContact, MainContact, m_RadMode);
- if (("00" == m_bIsSendSXPByRxpFlag) && (0 == PreContact && 0 == MainContact))
- {
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- }
- else if (("10" == m_bIsSendSXPByRxpFlag) && (0 == MainContact))
- {
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- }
- else if ("11" == m_bIsSendSXPByRxpFlag)
- {
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SXP"].struStatus);
- if (0 != PreContact && 0 != MainContact)
- {
- DetectorReady();
- }
- }
- }
- void nsGEN::RF80Device::SetFluStatus(int PreContact, int MainContact)
- {
- mLog::Debug("Enter SetFluStatus[{$},{$}]", PreContact, MainContact);
- if (m_ExpReady[1] != '1')
- {
- mLog::Warn("SetFluStatus:not in Flu ready");
- return;
- }
-
- if (0 == PreContact && 0 == MainContact)
- {
- mLog::Debug("EXPSTATE: [{$}] -> FLU0", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_FLU_OFF))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- else if (0 != PreContact && 0 == MainContact)
- {
- if (m_DoseUnit.m_GenSynState->Get() == AttrKey::GENERATOR_FLU_XRAYON)
- {
- mLog::Debug("EXPSTATE: [{$}] -> FLX0", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_FLU_XRAYOFF))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- else
- {
- mLog::Debug("EXPSTATE: [{$}] -> FLU1", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_FLU_READY))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- }
- else if (0 != PreContact && 0 != MainContact)
- {
- if (m_DoseUnit.m_GenSynState->Get() != AttrKey::GENERATOR_FLU_READY)
- {
- mLog::Debug("EXPSTATE: [{$}] -> FLU1", m_DoseUnit.m_GenSynState->Get());
- if (m_DoseUnit.m_GenSynState->Update(AttrKey::GENERATOR_FLU_READY))
- FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());
- }
- }
- mLog::Debug("currSYNmode:WS[{$}:{$}]", m_arrWSMap[m_strCurrentWSName].strWSNAme.c_str(), (int)m_nSYNMode);
- bool softSyn = false;
- if (m_DoseUnit.m_FLMode->Get() == AttrKey::GENERATOR_FLMODE_CF ||
- m_DoseUnit.m_FLMode->Get() == AttrKey::GENERATOR_FLMODE_HCF)
- {
- if (PreContact)
- {
- PreContact = m_nSYNMode;
- }
- if (MainContact)
- {
- MainContact = m_nSYNMode;
- }
- }
- if((0 != PreContact && 0 != MainContact) || (0 == PreContact && 0 == MainContact))
- {
- char strSendCMD[GEN_CF80_SEND_LEN_max] = { 0 };
- sprintf_s(strSendCMD, glo_Send_RF80Fun["SFL"].strParamArry.c_str(),
- PreContact);
- if (("0" == m_bIsSendSFLByRxpFlag) && (0 == PreContact))
- {
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SFL"].struStatus);
- }
- else if ("1" == m_bIsSendSFLByRxpFlag)
- {
- HWSendFirst(strSendCMD, strlen(strSendCMD), glo_Send_RF80Fun["SFL"].struStatus);
- }
- }
- }
- void nsGEN::RF80Device::SetSynBoxSwitchStatus(bool flag)
- {
- mLog::Debug("Enter SetSynBoxSwitchStatus[{$}]", m_bNeedSendToSynBox);
- if (m_bNeedSendToSynBox)
- {
- m_bNeedSendToSynBox = false;
- #if Ccos_V3
- if (m_pGenClient != NULL)
- {
- if (!m_pGenClient->IsClosed())
- {
- std::vector <string> paramList;
- StrSubstrData(m_SignalArray.c_str(), (char)TAB, paramList,0);
- ResDataObject Request, Response;
- for (auto item : paramList)
- {
- mLog::Debug("DV3_FullUCB Client execute [SimulateSwitchSignal][{$}]", item.c_str());
- Request.add("P0", item.c_str());
- }
- m_pGenClient->Action("SimulateSwitchSignal", Request, Response, 4993, "CCOS/DEVICE/SynBox");
- }
- else
- {
- mLog::Debug("DV3_FullUCB Client is Close");
- }
- }
- else
- {
- mLog::Debug("DV3_FullUCB Client is NULL");
- }
- #endif
- }
- }
- /*下面的线程函数,其实用来充当定时器功能。*/
- bool nsGEN::RF80Device::StartHardwareStatusThread()
- {
- mLog::Debug("Enter StartHardwareStatusThread");
- 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;
- }
- }
- return true;
- }
- DWORD nsGEN::RF80Device::HardwareStatusThread(LPVOID pParam)
- {
- mLog::Debug("Enter HardwareStatusThread");
- RF80Device* pCurGen = (RF80Device*)pParam;
- if (pCurGen == NULL)
- {
- return 0;
- }
- if (pCurGen->m_GenConfig.GetFirstOf("loopTime") >= 0)
- {
- if ((int)pCurGen->m_GenConfig["loopTime"] >= 100)
- {
- pCurGen->m_iLoopTime = (int)pCurGen->m_GenConfig["loopTime"];
- }
- }
- mLog::Debug("loopTime = {$}", pCurGen->m_iLoopTime);
- int currtTime = pCurGen->m_iLoopTime;
- if (0 == currtTime)
- {
- return 0;
- }
- int waitTime = INFINITE;
- DWORD event = 0;
- bool bExit = false;
- while (!bExit)
- {
- event = WaitForMultipleObjects(2, pCurGen->m_hArrayEvent, FALSE, waitTime);
- switch (event)
- {
- case WAIT_OBJECT_0:
- {
- mLog::Debug("HardwareStatusThread: exited");
- bExit = TRUE;
- return 0;
- }break;
- case (WAIT_TIMEOUT):
- {
- mLog::Warn("HardwareStatusThread: Get loop EVENT timeout");
- }break;
- case (WAIT_OBJECT_0 + 1):
- {
- //曝光允许
- int expReady = false;
- {
- if (pCurGen->m_ExpReady == "11")
- {
- expReady = true;
- }
- else if (pCurGen->m_ExpReady == "10")
- {
- if (pCurGen->m_DoseUnit.m_FLMode->Get() == AttrKey::GENERATOR_FLMODE_NOTFLU)
- {
- expReady = true;
- }
- }
- else if (pCurGen->m_ExpReady == "01")
- {
- if (pCurGen->m_DoseUnit.m_FLMode->Get() == AttrKey::GENERATOR_FLMODE_NOTFLU)
- {
- expReady = true;
- }
- }
- }
- //等待
- Sleep(currtTime);
- //发送状态查询
- if (!expReady)
- {
- pCurGen->GetState();
- }
- //判断是否停止轮询
- if (expReady)
- {
- ResetEvent(pCurGen->m_hLoopEvent);
- }
- }break;
- default:
- {
- mLog::Debug("HardwareStatusThread: unknown event");
- }break;
- }
- }
- return 0;
- }
- //查找响应操作对照表执行对应操作
- static bool DecodeFrame(const char* strFrame, int length)
- {
- std::vector <string> paramList;
- StrSubstrData(strFrame, (char)TAB, paramList);
- //if (!paramList.empty())
- {
- auto found = arFrame.find(paramList[0]);//此处pr用来在arFrame中找到对于的包头
- if (found == arFrame.end())
- {
- return false;
- }
- found->second.m_fFun(paramList);
- }
- return true;
- }
- //-----------------------------------------------------------------------------
- // GenDriver
- //-----------------------------------------------------------------------------
- nsGEN::RF80Driver::RF80Driver ()
- {
- m_pAttribute.reset(new ResDataObject());
- m_pDescription.reset(new ResDataObject());
- }
- nsGEN::RF80Driver::~RF80Driver ()
- {
- }
- auto nsGEN::RF80Driver::CreateDevice (int index) -> std::unique_ptr <IODevice>
- {
- if (!m_SCF.isConnected())
- return nullptr;
- auto dev = std::unique_ptr <IODevice>(new IODevice(new RF80Device(EventCenter, m_SCF,m_ConfigFileName)));
- return dev;
- }
- void nsGEN::RF80Driver::FireNotify (int code, std::string key, std::string content)
- {
- EventCenter->OnNotify (code, key, content);
- }
- void nsGEN::RF80Driver::Prepare ()
- {
- string strLogPath = GetProcessDirectory();
- string::size_type PlatformFlag = strLogPath.find("\\PlatformModule");
- if (PlatformFlag != string::npos)
- {
- strLogPath.resize(PlatformFlag);
- }
- strLogPath += R"(\OEMDrivers\Generator\Conf\Log4CPP.Config.GEN.xml)";
- Log4CPP::GlobalContext::Map::Set(ECOM::Utility::Hash("LogFileName"), "GEN.Simens");
- auto rc = Log4CPP::LogManager::LoadConfigFile(strLogPath.c_str());
- mLog::gLogger = Log4CPP::LogManager::GetLogger("GEN.Simens");
- m_SCFDllName = GetConnectDLL(m_ConfigFileName);
- super::Prepare ();
- }
- bool DATA_ACTION nsGEN::RF80Driver::Connect ()
- {
- ResDataObject Connection = GetConnectParam(m_ConfigFileName);
- mLog::Info("connections:{$} \n", Connection.encode());
- auto erCode = m_SCF.Connect(Connection.encode(), &nsGEN::RF80Driver::callbackPackageProcess, SCF_PACKET_TRANSFER, 3000);
- if (erCode != SCF_ERR::SCF_SUCCEED)
- return false;
- auto rc = super::Connect();
- if (!rc)
- return false;
- return true;
- }
- void nsGEN::RF80Driver::Disconnect()
- {
- super::Disconnect();
- m_SCF.Disconnect();
- }
- bool nsGEN::RF80Driver::isConnected() const
- {
- return super::isConnected();
- }
- std::string nsGEN::RF80Driver::DriverProbe ()
- {
- ResDataObject r_config, HardwareInfo;
- if (r_config.loadFile (m_ConfigFileName.c_str ()))
- {
- HardwareInfo.add ("MajorID", r_config ["CONFIGURATION"] ["MajorID"]);
- HardwareInfo.add ("MinorID", r_config ["CONFIGURATION"] ["MinorID"]);
- HardwareInfo.add ("VendorID", r_config ["CONFIGURATION"] ["VendorID"]);
- HardwareInfo.add ("ProductID", r_config ["CONFIGURATION"] ["ProductID"]);
- HardwareInfo.add ("SerialID", r_config ["CONFIGURATION"] ["SerialID"]);
- }
- else
- {
- HardwareInfo.add ("MajorID", "Generator");
- HardwareInfo.add ("MinorID", "Dr");
- HardwareInfo.add("VendorID", "ECOM");
- HardwareInfo.add("ProductID", "Template");
- HardwareInfo.add ("SerialID", "Drv");
- }
- string ret = HardwareInfo.encode ();
- return ret;
- }
- bool nsGEN::RF80Driver::GetDeviceConfig(std::string& Cfg)
- {
- Cfg = m_DeviceConfigSend.encode();
- return true;
- }
- bool nsGEN::RF80Driver::SetDeviceConfig(std::string Cfg)
- {
- mLog::Info("--Func-- SetDeviceConfig {$}\n", Cfg.c_str());
- ResDataObject DeviceConfig;
- DeviceConfig.decode(Cfg.c_str());
- ResDataObject DescriptionTempEx;
- DescriptionTempEx = DeviceConfig["DeviceConfig"]["Attribute"];
- mLog::Debug("Attribute:{$}", DescriptionTempEx.encode());
- bool bSaveFile = false; //true:重新保存配置文件
- string strAccess = "";
- for (int i = 0; i < DescriptionTempEx.size(); i++)
- {
- string strKey = DescriptionTempEx.GetKey(i);
- mLog::Info("{$}", strKey.c_str());
- try
- {
- if (m_pAttribute->GetFirstOf(strKey.c_str()) >= 0)
- {
- strAccess = (string)(*m_pDescription)[strKey.c_str()]["Access"];
- if ("RW" == strAccess)
- {
- //修改对应配置,在其他单元的配置项要同时调用其修改函数修改真实值
- //1. 修改内存中的值,用于给上层发消息
- (*m_pAttribute)[strKey.c_str()] = DescriptionTempEx[i];
- //2. 拿到Innerkey
- int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
- mLog::Info("nConfigInfoCount {$}", nConfigInfoCount);
- string strTemp = ""; //存储AttributeKey
- for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
- {
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
- if (strTemp == strKey)
- {
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
- break;
- }
- }
- //3. 修改配置文件中的值
- if (SetDeviceConfigValue(m_Configurations, strTemp.c_str(), 1, DescriptionTempEx[i]))
- {
- mLog::Debug("SetDeviceConfigValue over");
- bSaveFile = true;
- }
- }
- else
- {
- mLog::Info("{$} is not a RW configuration item", strKey.c_str());
- }
- }
- else
- {
- mLog::Info("without this attribute {$}", strKey.c_str());
- }
- }
- catch (ResDataObjectExption& e)
- {
- mLog::Error("SetDriverConfig crashed: {$}", e.what());
- return false;
- }
- }
- if (bSaveFile)
- {
- //3. 重新保存配置文件
- SaveConfigFile(true);
- }
- return true;
- }
- bool nsGEN::RF80Driver::SaveConfigFile(bool bSendNotify)
- {
- m_ConfigAll["CONFIGURATION"] = m_Configurations;
- bool bRt = m_ConfigAll.SaveFile(m_ConfigFileName.c_str());
- mLog::Info("SaveConfigFile over {$}", bRt);
- return true;
- }
- bool nsGEN::RF80Driver::GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue)
- {
- strValue = "";
- string strTemp = pInnerKey;
- if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
- {
- size_t pos = 0;
- ResDataObject resTemp = config;
- while ((pos = strTemp.find_first_of(',')) != string::npos)
- {
- string Key = strTemp.substr(0, pos);
- string TempValue = resTemp[Key.c_str()].encode();
- resTemp.clear();
- resTemp.decode(TempValue.c_str());
- strTemp = strTemp.substr(pos + 1, strTemp.length() - pos - 1);
- }
- if (strTemp != "")
- {
- strValue = (string)resTemp[strTemp.c_str()];
- }
- else
- {
- strValue = (string)resTemp;
- }
- }
- return true;
- }
- bool nsGEN::RF80Driver::SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue)
- {
- string strTemp = pInnerKey;
- mLog::Debug("Begin to change {$} item value to {$}", pInnerKey, szValue);
- if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
- {
- try {
- int pos = 0;
- ResDataObject* resTemp = &config;
- while ((pos = strTemp.find_first_of(',')) != string::npos)
- {
- string Key = strTemp.substr(0, pos);
- resTemp = &(*resTemp)[Key.c_str()];
- strTemp = strTemp.substr(pos + 1, strTemp.length() - pos - 1);
- }
- if (strTemp != "")
- {
- (*resTemp)[strTemp.c_str()] = szValue;
- }
- else
- {
- *resTemp = szValue;
- }
- }
- catch (ResDataObjectExption& e)
- {
- mLog::Error("SetDriverConfigvalue crashed: {$}", e.what());
- return false;
- }
- }
- return true;
- }
- std::string nsGEN::RF80Driver::GetResource()
- {
- ResDataObject r_config, temp;
- if (!temp.loadFile(m_ConfigFileName.c_str()))
- {
- return "";
- }
- m_ConfigAll = temp;
- r_config = temp["CONFIGURATION"];
- m_Configurations = r_config;
- ResDataObject DescriptionTemp;
- ResDataObject DescriptionSend;
- ResDataObject m_DescriptionSend;
- ResDataObject ListTemp;
- string strTemp = ""; //用于读取字符串配置信息
- string strIndex = ""; //用于读取配置信息中的List项
- int nTemp = -1; //用于读取整型配置信息
- char sstream[10] = { 0 }; //用于转换值
- string strValue = ""; //用于存储配置的值
- string strType = ""; //用于存储配置的类型 int/float/string...
- /***
- * 1. 通过循环,将所有配置项写到pDeviceConfig
- * 2. 记录配置项的内部key以及配置类型,类型对应了不同配置文件路径,用于读写真实值
- ***/
- try
- {
- //便利ConfigToolInfo 中 所有的AttributeInfo 属性段
- int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
- m_pAttribute->clear();
- m_pDescription->clear();
- for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
- {
- DescriptionTemp.clear();
- DescriptionSend.clear();
- ListTemp.clear();
- //AttributeType
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Type"];
- DescriptionTemp.add(ConfKey::CcosGeneratorType, strTemp.c_str());//CcosGeneratorAttribute
- DescriptionSend.add(ConfKey::CcosGeneratorType, strTemp.c_str());//CcosGeneratorAttribute
- strType = strTemp; //记录配置项的类型
- //AttributeKey
- //1. 根据AttributeType,内部key和配置路径,拿到当前的真实值
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
- nTemp = (int)m_Configurations["ConfigToolInfo"][nInfoIndex]["PathID"];
- GetDeviceConfigValue(r_config, strTemp.c_str(), nTemp, strValue); //得到strValue的值
- //2. 赋值
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
- if ("int" == strType)
- {
- (*m_pAttribute).add(strTemp.c_str(), atoi(strValue.c_str()));
- }
- else if ("float" == strType)
- {
- (*m_pAttribute).add(strTemp.c_str(), atoi(strValue.c_str()));
- }
- else //其它先按string类型处理
- {
- (*m_pAttribute).add(strTemp.c_str(), strValue.c_str());
- }
- //AttributeAccess
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Access"];
- DescriptionTemp.add(ConfKey::CcosAccess, strTemp.c_str());
- DescriptionSend.add(ConfKey::CcosAccess, strTemp.c_str());
- //AttributeList
- nTemp = m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListNum"];
- if (nTemp > 0) //ListNum不大于0时说明不需要list配置
- {
- for (int nListIndex = 0; nListIndex < nTemp; nListIndex++)
- {
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListInfo"][nListIndex];
- auto temKey = std::to_string(nListIndex);
- ListTemp.add(temKey.c_str(), strTemp.c_str());
- }
- DescriptionTemp.add(ConfKey::CcosList, ListTemp);
- DescriptionSend.add(ConfKey::CcosList, ListTemp.encode());
- }
- //AttributeRequired
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Required"];
- DescriptionTemp.add(ConfKey::CcosRequired, strTemp.c_str());
- DescriptionSend.add(ConfKey::CcosRequired, strTemp.c_str());
- //AttributeDefaultValue
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["DefaultValue"];
- if (strTemp != "") //不需要的配置项为空
- {
- DescriptionTemp.add(ConfKey::CcosDefaultValue, strTemp.c_str());
- DescriptionSend.add(ConfKey::CcosDefaultValue, strTemp.c_str());
- }
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
- (*m_pDescription).add(strTemp.c_str(), DescriptionTemp);
- m_DescriptionSend.add(strTemp.c_str(), DescriptionSend.encode());
- }
- }
- catch (ResDataObjectExption& e)
- {
- mLog::Error("Get config error: {$}", e.what());
- return "";
- }
- ResDataObject resDeviceResource;
- resDeviceResource.add(ConfKey::CcosGeneratorAttribute, (*m_pAttribute));
- resDeviceResource.add(ConfKey::CcosGeneratorDescription, (*m_pDescription));
- ResDataObject DescriptionTempEx;
- DescriptionTempEx.add(ConfKey::CcosGeneratorConfig, resDeviceResource);
- m_DeviceConfig.clear();
- m_DeviceConfig = DescriptionTempEx;
- //mLog::Debug("local ************* get resource over {$}", DescriptionTempEx.encode());
- resDeviceResource.clear();
- resDeviceResource.add(ConfKey::CcosGeneratorAttribute, (*m_pAttribute));
- resDeviceResource.add(ConfKey::CcosGeneratorDescription, m_DescriptionSend);
- DescriptionTempEx.clear();
- DescriptionTempEx.add(ConfKey::CcosGeneratorConfig, resDeviceResource);
- m_DeviceConfigSend.clear();
- m_DeviceConfigSend = DescriptionTempEx;
- string res = m_DeviceConfigSend.encode();
- //mLog::Debug("get resource over {$}", DescriptionTempEx.encode());
- return res;
- }
- std::string nsGEN::RF80Driver::DeviceProbe ()
- {
- ResDataObject r_config, HardwareInfo;
- if (r_config.loadFile (m_ConfigFileName.c_str ()))
- {
- HardwareInfo.add ("MajorID", r_config ["CONFIGURATION"] ["MajorID"]);
- HardwareInfo.add ("MinorID", r_config ["CONFIGURATION"] ["MinorID"]);
- HardwareInfo.add ("VendorID", r_config ["CONFIGURATION"] ["VendorID"]);
- HardwareInfo.add ("ProductID", r_config ["CONFIGURATION"] ["ProductID"]);
- HardwareInfo.add ("SerialID", r_config ["CONFIGURATION"] ["SerialID"]);
- }
- else
- {
- HardwareInfo.add ("MajorID", "Generator");
- HardwareInfo.add ("MinorID", "Dr");
- HardwareInfo.add ("VendorID", "ECOM");
- HardwareInfo.add ("ProductID", "Template");
- HardwareInfo.add ("SerialID", "1234");
- }
- string ret = HardwareInfo.encode ();
- return ret;
- }
- void nsGEN::RF80Driver::Dequeue (const char * Packet, DWORD Length)
- {
- DecodeFrame (Packet, Length);
- }
- PACKET_RET nsGEN::RF80Driver::callbackPackageProcess (const char * RecData, DWORD nLength, DWORD& PacketLength)
- {
- //判断是否是整包
- /*
- 这个是回调函数,我收到的数据会需要这个回调函数帮我判断是否是整个的包;
- 如果有整个的包,返回值为true,在PacketLength处返回给我整个包的长度,我再截取后放入缓存供上层使用;
- 如果缓存中的数据没有整个的数据包,那么返回false
- */
- #if 0 //测试专用
- if (nLength > 1)
- {
- mLog::Error("receive data_len[{$}]", nLength);
- for (int i = 0; i < nLength; i++)
- {
- if (i != nLength - 1)
- {
- mLog::Error("receive data[{$}][{$}]", i, RecData[i]);
- }
- else
- {
- mLog::Error("receive data[{$}][{$}]", i, RecData[i]);
- }
- }
- }
- #endif
- bool bHasHead = false;
- if (nLength < 1)
- {
- PacketLength = 0;
- mLog::Error("nLength too small, nLength=={$}", nLength);
- return PACKET_USELESS;
- }
- else if (nLength > GEN_CF80_RECV_LEN)
- {
- PacketLength = nLength;
- mLog::Error("nLength too big, nLength=={$}", nLength);
- return PACKET_USELESS;
- }
- char strtemp[GEN_CF80_RECV_LEN] = { 0 };
- for (DWORD i = 0; i < nLength; i++)
- {
- //寻找包头
- if (RecData[i] == RECV_HEAD)
- {
- if (i != 0) //包头之前的数据格式不对,全部扔掉
- {
- PacketLength = i;
- memcpy(strtemp, RecData, PacketLength);
- mLog::Error("==IN unknown format data ==: [{$}],UselessDataLength={$};TotalLength={$} \n", strtemp, PacketLength, nLength);
- return PACKET_USELESS;
- }
- else
- {
- bHasHead = true;
- }
- }
- //寻找包尾
- if (RecData[i] == LF)
- {
- if (bHasHead)
- {
- if (i >= 4) //正常指令
- {
- PacketLength = i + 1; //+1 because \n
- memcpy(strtemp, RecData, i - 1); //只有>+数据,-1 排除 checkSum or \r
- if (true)
- {
- mLog::Info("==IN==: [{$}]", strtemp);
- }
- RF80Device::m_tDelivermodule.CheckReceive(strtemp, 4);
- return PACKET_ISPACKET;
- }
- else //空指令
- {
- PacketLength = i + 1;
- memcpy(strtemp, RecData, PacketLength); //空数据,格式正确但无有效命令
- mLog::Error("==IN uselss data==: [{$}] \n", strtemp);
- return PACKET_USELESS;
- }
- }
- else //有包尾但无包头
- {
- PacketLength = i + 1;
- memcpy(strtemp, RecData, PacketLength);
- mLog::Error("==IN no head data ==: [{$}],NoHeadDataLength={$};TotalLength={$} \n", strtemp, PacketLength, nLength);
- return PACKET_USELESS;
- }
- }
- }
- if (bHasHead)
- {
- PacketLength = 0;
- }
- return PACKET_NOPACKET;
- }
- //-----------------------------------------------------------------------------
- // GetIODriver & CreateIODriver
- //-----------------------------------------------------------------------------
- static nsGEN::RF80Driver gIODriver;
- extern "C" CCOS::Dev::IODriver * __cdecl GetIODriver () // 返回静态对象的引用, 调用者不能删除 !
- {
- return &gIODriver;
- }
- extern "C" CCOS::Dev::IODriver * __cdecl CreateIODriver () // 返回新对象, 调用者必须自行删除此对象 !
- {
- return new nsGEN::RF80Driver ();
- }
|