1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271 |
- #include "stdafx.h"
- #include "CCOS.Dev.FPD.TrixellDR.h"
- #include "TrixellCtrl.h"
- #include "common_api.h"
- #include "FileVersion.hpp"
- #include "GridSuppression.h"
- #include "DICOMImageHeadKey.h"
- #pragma comment(lib, "Version.lib")
- namespace nsFPD = CCOS::Dev::Detail::Detector;
- static nsFPD::TrixellDriver gIODriver;
- Log4CPP::Logger* gLogger = nullptr;
- extern const char* g_szMouldPath;
- extern "C" CCOS::Dev::IODriver * __cdecl GetIODriver() // 返回静态对象的引用, 调用者不能删除 !
- {
- return &gIODriver;
- }
- extern "C" CCOS::Dev::IODriver * __cdecl CreateIODriver() // 返回新对象, 调用者必须自行删除此对象 !
- {
- return new nsFPD::TrixellDriver();
- }
- nsFPD::TrixellDriver::TrixellDriver()
- {
- pObjDev = nullptr;
- m_bConnect = false; //缺省为false
- m_pAttribute.reset(new ResDataObject());
- m_pDescription.reset(new ResDataObject());
- }
- nsFPD::TrixellDriver::~TrixellDriver()
- {
- if (nullptr != pObjDev)
- {
- delete pObjDev;
- pObjDev = nullptr;
- }
- }
- /***
- ** 类似于重构前的DriverEntry(),多板时会顺序调用每个平板dpc的这个接口
- ** 之后的接口调用上层是多线程执行的,不能保证先后顺序
- ***/
- void nsFPD::TrixellDriver::Prepare()
- {
- /*string strLogPath = GetProcessDirectory() + R"(\OEMDrivers\Detector\Conf\Log4CPP.Config.FPD.xml)";
- Log4CPP::GlobalContext::Map::Set(ZSKK::Utility::Hash("LogFileName"), "FPD.TrixellDR");
- auto rc = Log4CPP::LogManager::LoadConfigFile(strLogPath.c_str());
- gLogger = Log4CPP::LogManager::GetLogger("FPD.TrixellDR");*/
- string strLogPath = GetProcessDirectory() + R"(\Conf\Log4CPP.Config.xml)";
- auto rc = Log4CPP::LogManager::LoadConfigFile(strLogPath.c_str());
- gLogger = Log4CPP::LogManager::GetLogger("Module");
- #ifdef _WIN64
- Force("=============================Version: {$} (64-bit)==================================", FileVersion(g_szMouldPath).GetVersionString());
- #else
- Force("=============================Version: {$} (32-bit)==================================", FileVersion(g_szMouldPath).GetVersionString());
- #endif
- pObjDev = new FPDDeviceTrixell(EventCenter, m_ConfigFileName);
- pObjDev->CreateDevice();
- pObjDev->Register();
- Info("driver prepare over");
- }
- bool nsFPD::TrixellDriver::Connect()
- {
- Info("--Func-- driver connect");
- m_bConnect = pObjDev->m_stDeviceConfig.bConnectStatus;
- return m_bConnect;
- }
- void nsFPD::TrixellDriver::Disconnect()
- {
- Info("--Func-- driver disconnect");
- m_bConnect = false;
- }
- bool nsFPD::TrixellDriver::isConnected() const
- {
- return m_bConnect;
- }
- auto nsFPD::TrixellDriver::CreateDevice(int index)->std::unique_ptr <IODevice>
- {
- Info("--Func-- driver createdevice");
- auto Device = std::unique_ptr<IODevice>(new IODevice(pObjDev));
- return Device;
- }
- std::string nsFPD::TrixellDriver::DriverProbe()
- {
- Trace("--Func-- Driver Probe");
- 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", "Detector");
- HardwareInfo.add("MinorID", "DR");
- HardwareInfo.add("VendorID", "Trixell");
- HardwareInfo.add("ProductID", "Trixell");
- HardwareInfo.add("SerialID", "Driver");
- }
- string str = HardwareInfo.encode();
- return str;
- }
- /***
- ** 获取ID和配置
- ***/
- std::string nsFPD::TrixellDriver::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 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
- {
- int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
- //Info(g_pFPDCtrlLog, "ConfigInfo Count: {$}", nConfigInfoCount);
- m_pAttribute->clear();
- m_pDescription->clear();
- for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
- {
- DescriptionTemp.clear();
- ListTemp.clear();
- //AttributeType
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Type"];
- DescriptionTemp.add(AttributeType, strTemp.c_str());
- //Info(g_pFPDCtrlLog, "--> {$}: {$}", AttributeType, strTemp.c_str());
- 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);
- //2. 赋值
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
- if ("int" == strType)
- {
- (*m_pAttribute).add(strTemp.c_str(), atoi(strValue.c_str()));
- //Info(g_pFPDCtrlLog, "Key {$}: {$}", strTemp.c_str(), atoi(strValue.c_str()));
- }
- else if ("float" == strType)
- {
- (*m_pAttribute).add(strTemp.c_str(), atof(strValue.c_str()));
- //Info(g_pFPDCtrlLog, "Key {$}: {$}", strTemp.c_str(), atof(strValue.c_str()));
- }
- else //其它先按string类型处理
- {
- (*m_pAttribute).add(strTemp.c_str(), strValue.c_str());
- //Info(g_pFPDCtrlLog, "Key {$}: {$}", strTemp.c_str(), strValue.c_str());
- }
- //AttributeAccess
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Access"];
- DescriptionTemp.add(AttributeAccess, strTemp.c_str());
- //Info(g_pFPDCtrlLog, "{$}: {$}", AttributeAccess, strTemp.c_str());
- //AttributeRangeMin
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["RangeMin"];
- if (strTemp != "") //不需要的配置项为空
- {
- DescriptionTemp.add(AttributeRangeMin, strTemp.c_str());
- //Info(g_pFPDCtrlLog, "{$}: {$}", AttributeRangeMin, strTemp.c_str());
- }
- //AttributeRangeMax
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["RangeMax"];
- if (strTemp != "") //不需要的配置项为空
- {
- DescriptionTemp.add(AttributeRangeMax, strTemp.c_str());
- //Info(g_pFPDCtrlLog, "{$}: {$}", AttributeRangeMax, 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];
- //sprintf_s(sstream, "{$}", nListIndex);
- auto temKey = std::to_string(nListIndex);
- ListTemp.add(temKey.c_str(), strTemp.c_str());
- //Info(g_pFPDCtrlLog, "list {$}: {$}", nListIndex, strTemp.c_str());
- }
- DescriptionTemp.add(AttributeList, ListTemp);
- }
- //AttributeRequired
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Required"];
- DescriptionTemp.add(AttributeRequired, strTemp.c_str());
- //Info(g_pFPDCtrlLog, "{$}: {$}", AttributeRequired, strTemp.c_str());
- //AttributeDefaultValue
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["DefaultValue"];
- if (strTemp != "") //不需要的配置项为空
- {
- DescriptionTemp.add(AttributeDefaultValue, strTemp.c_str());
- //Info(g_pFPDCtrlLog, "{$}: {$}", AttributeDefaultValue, strTemp.c_str());
- }
- strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
- (*m_pDescription).add(strTemp.c_str(), DescriptionTemp);
- }
- }
- catch (ResDataObjectExption& e)
- {
- Error("Get config error: {$}", e.what());
- return "";
- }
- ResDataObject resDeviceResource;
- resDeviceResource.add(ConfKey::CcosDetectorAttribute, (*m_pAttribute));
- resDeviceResource.add(ConfKey::CcosDetectorDescription, (*m_pDescription));
- ResDataObject DescriptionTempEx;
- DescriptionTempEx.add(ConfKey::CcosDetectorConfig, resDeviceResource);
- m_DeviceConfig.clear();
- m_DeviceConfig = DescriptionTempEx;
- string res = DescriptionTempEx.encode();
- Trace("get resource over {$}", DescriptionTempEx.encode());
- return res;
- }
- std::string nsFPD::TrixellDriver::DeviceProbe()
- {
- Trace("--Func-- Device Probe");
- ResDataObject r_config, HardwareInfo;
- if (r_config.loadFile(m_ConfigFileName.c_str()))
- {
- HardwareInfo.add("MajorID", r_config["CONFIGURATION"]["MajorID"]);
- HardwareInfo.add("MinorID", "Device");
- 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", "Detector");
- HardwareInfo.add("MinorID", "Device");
- HardwareInfo.add("VendorID", "Trixell");
- HardwareInfo.add("ProductID", "Trixell");
- HardwareInfo.add("SerialID", "1234");
- }
- string str = HardwareInfo.encode();
- return str;
- }
- bool nsFPD::TrixellDriver::GetDeviceConfig(std::string& Cfg)
- {
- Cfg = m_DeviceConfig.encode();
- Info("GetDeviceConfig over");
- return true;
- }
- bool nsFPD::TrixellDriver::SetDeviceConfig(std::string Cfg)
- {
- Info("--Func-- SetDeviceConfig {$}\n", Cfg.c_str());
- ResDataObject DeviceConfig;
- DeviceConfig.decode(Cfg.c_str());
- ResDataObject DescriptionTempEx;
- DescriptionTempEx = DeviceConfig["DeviceConfig"]["Attribute"];
- Trace("Attribute:{$}", DescriptionTempEx.encode());
- bool bSaveFile = false; //true:重新保存配置文件
- string strAccess = "";
- for (int i = 0; i < DescriptionTempEx.size(); i++)
- {
- string strKey = DescriptionTempEx.GetKey(i);
- 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");
- 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]))
- {
- Trace("SetDeviceConfigValue over");
- bSaveFile = true;
- }
- }
- else
- {
- Info("{$} is not a RW configuration item", strKey.c_str());
- }
- }
- else
- {
- Info("without this attribute {$}", strKey.c_str());
- }
- }
- catch (ResDataObjectExption& e)
- {
- Error("SetDriverConfig crashed: {$}", e.what());
- return false;
- }
- }
- if (bSaveFile)
- {
- //3. 重新保存配置文件
- SaveConfigFile(true);
- }
- return true;
- }
- bool nsFPD::TrixellDriver::SaveConfigFile(bool bSendNotify)
- {
- m_ConfigAll["CONFIGURATION"] = m_Configurations;
- bool bRt = m_ConfigAll.SaveFile(m_ConfigFileName.c_str());
- Info("SaveConfigFile over {$}", bRt);
- return true;
- }
- bool nsFPD::TrixellDriver::GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue)
- {
- strValue = "";
- string strTemp = pInnerKey;
- if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
- {
- if (WiredIP == strTemp || WirelessIP == strTemp || LocalIP == strTemp)
- {
- strValue = (string)config["connections"][pInnerKey];
- }
- else if (DetectorVender == strTemp || DetectorModel == strTemp ||
- DetectorDescription == strTemp || DetectorSerialNumber == strTemp)
- {
- strValue = (string)config[pInnerKey];
- }
- else if (SyncType == strTemp || FPDWorkStation == strTemp ||
- ImageWidth == strTemp || ImageHeight == strTemp)
- {
- strValue = (string)config["ModeTable"]["DetectorMode"][pInnerKey];
- }
- else if (TempMaxLimit == strTemp || ReConnect == strTemp ||
- TempUpperLimit == strTemp || TempLowerLimit == strTemp || TempMinLimit == strTemp ||
- BatLowerLimit == strTemp || BatMiniLimit == strTemp ||
- BatLowerLimitInCali == strTemp || WifiLowerLimit == strTemp ||
- WifiMiniLimit == strTemp || HighPowerTimeout == strTemp ||
- ShowTemperature == strTemp || ShowWifi == strTemp ||
- ShowBattery == strTemp || ShowBluetooth == strTemp ||
- FPDExamMode == strTemp || FPDAcqMode == strTemp || FPDModeMatch == strTemp || CcosDetectorAttachedFlag == strTemp)
- {
- strValue = (string)config[pInnerKey];
- }
- else
- {
- strValue = "";
- Warn("Error Configuration item: {$}", pInnerKey);
- }
- }
- return true;
- }
- bool nsFPD::TrixellDriver::SetDeviceConfigValue(ResDataObject & config, const char* pInnerKey, int nPathID, const char* szValue)
- {
- string strTemp = pInnerKey;
- Trace("Begin to change {$} item value to {$}", pInnerKey, szValue);
- if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
- {
- try {
- if (WiredIP == strTemp || WirelessIP == strTemp || LocalIP == strTemp)
- {
- config["connections"][pInnerKey] = szValue;
- }
- else if (DetectorVender == strTemp || DetectorModel == strTemp ||
- DetectorDescription == strTemp || DetectorSerialNumber == strTemp)
- {
- config[pInnerKey] = szValue;
- }
- else if (SyncType == strTemp || FPDWorkStation == strTemp ||
- ImageWidth == strTemp || ImageHeight == strTemp)
- {
- config["ModeTable"]["DetectorMode"][pInnerKey] = szValue;
- }
- else if (TempMaxLimit == strTemp || ReConnect == strTemp ||
- TempUpperLimit == strTemp || TempLowerLimit == strTemp ||
- BatLowerLimit == strTemp || BatMiniLimit == strTemp ||
- BatLowerLimitInCali == strTemp || WifiLowerLimit == strTemp ||
- WifiMiniLimit == strTemp || HighPowerTimeout == strTemp ||
- ShowTemperature == strTemp || ShowWifi == strTemp ||
- ShowBattery == strTemp || ShowBluetooth == strTemp ||
- FPDExamMode == strTemp || FPDAcqMode == strTemp || FPDModeMatch == strTemp)
- {
- config[pInnerKey] = szValue;
- }
- else
- {
- Warn("Error Configuration item: {$}", pInnerKey);
- return false;
- }
- }
- catch (ResDataObjectExption& e)
- {
- Error("SetDriverConfigvalue crashed: {$}", e.what());
- return false;
- }
- }
- return true;
- }
- //-----------------------------------------------------------------------------
- // FPDDeviceTrixell
- //-----------------------------------------------------------------------------
- extern TrixellCtrl* g_pDetector;
- nsFPD::FPDDeviceTrixell::FPDDeviceTrixell(std::shared_ptr<IOEventCenter> center, std::string strConfigPath)
- : m_hNotifyThread(nullptr)
- , m_NotifyThreadID(0)
- , m_nDeviceIndex(-1)
- , m_eAppStatus(APP_STATUS_IDLE)
- , m_strLastError("")
- , m_bBatteryCharging(false)
- , m_bImagePendingOrNot(false)
- , m_bResetDetector(false)
- , m_nCalibTotalExposureNum(0)
- , m_nCalibCurrentCalibrationRound(0)
- , m_nCalibCurrentExposureIndex(0)
- , m_nCalibCurrentExposureNum(0)
- , m_bNotifyCalWarn(true)
- {
- m_pDetectors = nullptr;
- m_strWorkPath = GetProcessDirectory();
- m_AcqUnit.reset(new OemAcq(center, this));
- m_SyncUnit.reset(new OemSync(center, this));
- m_CalibUnit.reset(new OemCalib(center, this));
- m_DetectorCtrlUnit.reset(new OemCtrl(center, this));
- m_DetectorConfiguration.reset(new DetectorConfiguration(strConfigPath));
- m_WarnAndError.reset(new FPDErrorWarning(center, DetectorUnitType, m_strWorkPath + "\\OEMDrivers\\Detector\\Trixell\\TrixellDRDetector"));
- //m_CalibProcess.reset(new CalibrationProcess());
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_SHUTDOWN));
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_WaitCalibDoseEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_PauseCalibrationEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_ExitEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_ConnectEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
- EventCenter = center;
- }
- nsFPD::FPDDeviceTrixell::~FPDDeviceTrixell()
- {
- SetEvent(m_ExitEvt);
- if (m_PauseCalibrationEvt)
- {
- CloseHandle(m_PauseCalibrationEvt);
- m_PauseCalibrationEvt = nullptr;
- }
- if (m_ExitEvt)
- {
- CloseHandle(m_ExitEvt);
- m_ExitEvt = nullptr;
- }
- if (m_ConnectEvt)
- {
- CloseHandle(m_ConnectEvt);
- m_ConnectEvt = nullptr;
- }
- if (m_WaitCalibDoseEvt)
- {
- CloseHandle(m_WaitCalibDoseEvt);
- m_WaitCalibDoseEvt = nullptr;
- }
- }
- std::string nsFPD::FPDDeviceTrixell::GetGUID() const
- {
- return DetectorUnitType;
- }
- bool nsFPD::FPDDeviceTrixell::Prepare()
- {
- Info("--Func-- device prepare \n");
- EventCenter->OnMaxBlockSize("DrQue",m_stDeviceConfig.nFullImageWidth * m_stDeviceConfig.nFullImageHeight * 2, 3,
- m_stDeviceConfig.nPreviewWidth * m_stDeviceConfig.nPreviewHeight * 2, 1);
- m_hNotifyThread = CreateThread(0, 0, OnNotify, this, 0, &m_NotifyThreadID);
- if (m_hNotifyThread == NULL)
- {
- Info("Start Process Thread Failed!");
- }
- else
- {
- Info("Start Process Thread End");
- }
- SetEvent(m_ConnectEvt); //Connect();
- return true;
- }
- void nsFPD::FPDDeviceTrixell::RegisterCtrl(nsDetail::Dispatch* Dispatch)
- {
- Dispatch->Get.Push("DetectorConnectStatus", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetConnectStatus);
- Dispatch->Get.Push("DetectorInitialStatus", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetInitialStatus);
- Dispatch->Get.Push("DetectorUpdateFWStatus", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetUpdateFWStatus);
- Dispatch->Get.Push("FPDShockSensorInfo", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetShockSensorInfo);
- Dispatch->Get.Push("DetectorStatus", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetFPDStatus);
- Dispatch->Get.Push("FPDAttached", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetAttachStatus);
- Dispatch->Get.Push("DetectorAttach", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetAttachResult);//event
- Dispatch->Get.Push("RecoverImageState", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetRecoverImageState);//event
- Dispatch->Get.Push("RecoverImageEvent", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetRecoverImageEvent);//event
- Dispatch->Get.Push("FieldofViewShape", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetFieldofViewShape);
- Dispatch->Get.Push("FieldofViewDimension", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetFieldofViewDimension);
- Dispatch->Get.Push("DetectorType", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetDetectorType);
- Dispatch->Get.Push("Description", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetDescription);
- Dispatch->Get.Push("DetectorID", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetDetectorID);
- Dispatch->Get.Push("DateofLastDetectorCalibration", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetDateofLastDetectorCalibration);
- Dispatch->Get.Push("TimeofLastDetectorCalibration", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetTimeofLastDetectorCalibration);
- Dispatch->Get.Push("DetectorConditionsNominalFlag", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetDetectorConditionsNominalFlag);
- Dispatch->Get.Push("FPDSensitivity", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetFPDSensitivity);
- Dispatch->Get.Push("PixelData", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetPixelData);
- Dispatch->Get.Push("TargetEXI", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetTargetEXI);
- //Dispatch->Action.Push("SetFilterType", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::);
- Dispatch->Action.Push("ActiveDetector", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSActiveDetector);
- //Dispatch->Action.Push("SleepDetector", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::);
- //Dispatch->Action.Push("WakeupDetector", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::);
- Dispatch->Action.Push("AttachConnect", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSAttachConnect);
- Dispatch->Action.Push("CancelAttach", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSCancelAttach);
- Dispatch->Action.Push("ResetConnect", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSResetConnect);
- Dispatch->Action.Push("DisConnectFPD", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSDisConnectFPD);
- Dispatch->Action.Push("UpdateFirmware", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSUpdateFirmware);
- Dispatch->Action.Push(ActionKey::GetDetectorInfo, m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetDetectorInfo);
- Dispatch->Action.Push("EnterExam", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSEnterExam);
- Dispatch->Action.Push("RecoverImage", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSRecoverImage);
- Dispatch->Action.Push("GetRecoverImageState", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSGetRecoverImageState);
- Dispatch->Action.Push("SaveSensitivity", m_DetectorCtrlUnit.get (), &DetectorCtrlUnit::JSSaveSensitivity);
- Dispatch->Action.Push("RESET", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSRESET);
- Dispatch->Action.Push("SaveRawDataMode", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSSaveRawDataMode);
- }
- void nsFPD::FPDDeviceTrixell::RegisterAcq(nsDetail::Dispatch* Dispatch)
- {
- Dispatch->Action.Push("SetAcqMode", m_AcqUnit.get(), &AcqUnit::JSSetAcqMode);
- Dispatch->Get.Push("ZskkFPDState", m_AcqUnit.get(), &AcqUnit::JSGetZskkFPDState);
- Dispatch->Get.Push("NoNeedWaitImage", m_AcqUnit.get(), &AcqUnit::JSGetNoNeedWaitImage);
- Dispatch->Get.Push("ImgDataInfo", m_AcqUnit.get(), &AcqUnit::JSGetLastImage);
- Dispatch->Get.Push("AutonumousMapFinish", m_AcqUnit.get(), &AcqUnit::JSAutonumousMapFinish);
- }
- void nsFPD::FPDDeviceTrixell::RegisterSync(nsDetail::Dispatch* Dispatch)
- {
- Dispatch->Action.Push("SetSyncMode", m_SyncUnit.get(), &SyncUnit::JSSetSyncMode);
- Dispatch->Action.Push("SetXwindowSize", m_SyncUnit.get(), &SyncUnit::JSSetXwindowSize);
- Dispatch->Action.Push("PrepareAcquisition", m_SyncUnit.get(), &SyncUnit::JSPrepareAcquisition);
- Dispatch->Action.Push("StartAcquisition", m_SyncUnit.get(), &SyncUnit::JSStartAcquisition);
- Dispatch->Action.Push("StopAcquisition", m_SyncUnit.get(), &SyncUnit::JSStopAcquisition);
- Dispatch->Action.Push("ActiveSyncMode", m_SyncUnit.get(), &SyncUnit::JSActiveSyncMode);
- Dispatch->Get.Push(CcosFPDReadyStatus, m_SyncUnit.get(), &SyncUnit::JSGetFPDReady);
- Dispatch->Get.Push(CcosXwindowStatus, m_SyncUnit.get(), &SyncUnit::JSGetXWindowStatus);
- Dispatch->Get.Push(CcosImageReadingStatus, m_SyncUnit.get(), &SyncUnit::JSGetImageReadingStatus);
- Dispatch->Get.Push("SupportSyncMode", m_SyncUnit.get(), &SyncUnit::JSGetSupportSyncMode);
- }
- void nsFPD::FPDDeviceTrixell::RegisterCalib(nsDetail::Dispatch* Dispatch)
- {
- //Dispatch->Action.Push("UploadCalibrationFiles", m_CalibUnit.get(), &CalibUnit::JSUploadCalibrationFiles);
- //Dispatch->Action.Push("SetSID", m_CalibUnit.get(), &CalibUnit::JSSetSID);
- Dispatch->Action.Push("ActiveCalibration", m_CalibUnit.get(), &CalibUnit::JSActiveCalibration);
- Dispatch->Action.Push("GetRequestedDose", m_CalibUnit.get(), &CalibUnit::JSGetRequestedDose);
- Dispatch->Action.Push("SetRequestedDose", m_CalibUnit.get(), &CalibUnit::JSSetRequestedDose);
- Dispatch->Action.Push("PrepareCalibration", m_CalibUnit.get(), &CalibUnit::JSPrepareCalibration);
- Dispatch->Action.Push("StartCalibration", m_CalibUnit.get(), &CalibUnit::JSStartCalibration);
- Dispatch->Action.Push("StopCalibration", m_CalibUnit.get(), &CalibUnit::JSStopCalibration);
- Dispatch->Action.Push("SetCorrectionType", m_CalibUnit.get(), &CalibUnit::JSSetCorrectionType);
- Dispatch->Action.Push("GetCalibrationStep", m_CalibUnit.get(), &CalibUnit::JSGetCalibrationStep);
- Dispatch->Action.Push("SaveCalibrationFile", m_CalibUnit.get(), &CalibUnit::JSSaveCalibrationFile);
- Dispatch->Action.Push("AcceptCalibration", m_CalibUnit.get(), &CalibUnit::JSAcceptCalibration);
- Dispatch->Action.Push("RejectCalibration", m_CalibUnit.get(), &CalibUnit::JSRejectCalibration);
-
- Dispatch->Get.Push("HaveImgCalibration", m_CalibUnit.get(), &CalibUnit::JSGetHaveImgCalibration);
- Dispatch->Get.Push(AttrKey::CalibrationStatus, m_CalibUnit.get(), &CalibUnit::JSGetCalibStatus);
- Dispatch->Get.Push(AttrKey::CalibrationProgress, m_CalibUnit.get(), &CalibUnit::JSGetCalibProgress);
- Dispatch->Get.Push("SaveCalibrationFileFinish", m_CalibUnit.get(), &CalibUnit::JSGetSaveCalibrationFileFinish);
- Dispatch->Get.Push(AttrKey::CalibMode, m_CalibUnit.get(), &CalibUnit::JSGetCalibMode);
- Dispatch->Get.Push(AttrKey::LastCalibrationDate, m_CalibUnit.get(), &CalibUnit::JSGetLastCalibrationDate);
- Dispatch->Get.Push(AttrKey::CalibrationFileExpireTime, m_CalibUnit.get(), &CalibUnit::JSGetCalibrationFileExpireTime);
- Dispatch->Set.Push(AttrKey::LastCalibrationDate, m_CalibUnit.get(), &CalibUnit::SetLastCalibrationDate);
- Dispatch->Set.Push(AttrKey::CalibrationFileExpireTime, m_CalibUnit.get(), &CalibUnit::SetCalibrationFileExpireTime);
- Dispatch->Update.Push(AttrKey::CalibMode, m_CalibUnit.get(), &CalibUnit::JSUpdateCalibMode);
- Dispatch->Update.Push(AttrKey::LastCalibrationDate, m_CalibUnit.get(), &CalibUnit::JSUpdateLastCalibrationDate);
- Dispatch->Update.Push(AttrKey::CalibrationFileExpireTime, m_CalibUnit.get(), &CalibUnit::JSUpdateCalibrationFileExpireTime);
- Dispatch->Update.Push(AttrKey::CalibrationFileExpirationReminder,
- [this](std::string in, std::string& out) {out = in; this->m_bNotifyCalWarn = (in == "1") ? true : false; return RET_STATUS::RET_SUCCEED; });
- }
- void nsFPD::FPDDeviceTrixell::RegisterOthers(nsDetail::Dispatch* Dispatch)
- {
- Dispatch->Get.Push(AttrKey::Temperature_Value, m_Temperature.get(), &DeviceTemperatureMould::JSGetCurrentTemperatureValue);
- Dispatch->Get.Push(AttrKey::Remain_Power_Value, m_Battery.get(), &DeviceBatteryMould::JSGetCurrentBatteryValue);
- Dispatch->Get.Push(AttrKey::Wifi_Strength_Value, m_Wifi.get(), &DeviceWifiMould::JSGetCurrentSignalValue);
- //Dispatch->Get.Push(m_WarnAndError->m_MSGUnit->GetKey().c_str(), [this](std::string& out) { out = m_WarnAndError->m_MSGUnit->JSGet(); return RET_STATUS::RET_SUCCEED; });
- Dispatch->Get.Push(nDetail::AttrKey::ErrorList, m_WarnAndError.get(), &FPDErrorWarning::JSGetErrorList);
- Dispatch->Get.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureErrorMax);
- Dispatch->Get.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureErrorMin);
- Dispatch->Get.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureWarningMax);
- Dispatch->Get.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureWarningMin);
- Dispatch->Get.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::JSGetBatteryErrorMin);
- Dispatch->Get.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::JSGetBatteryWarningMin);
- Dispatch->Get.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::JSGetSignalErrorMin);
- Dispatch->Get.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::JSGetSignalWarningMin);
- Dispatch->Set.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureErrorMax);
- Dispatch->Set.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureErrorMin);
- Dispatch->Set.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureWarningMax);
- Dispatch->Set.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureWarningMin);
- Dispatch->Set.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::SetBatteryErrorMin);
- Dispatch->Set.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::SetBatteryWarningMin);
- Dispatch->Set.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::SetSignalErrorMin);
- Dispatch->Set.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::SetSignalWarningMin);
-
- Dispatch->Update.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureErrorMax);
- Dispatch->Update.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureErrorMin);
- Dispatch->Update.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureWarningMax);
- Dispatch->Update.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureWarningMin);
- Dispatch->Update.Push(TemperatureCalibUpWarn, [](std::string in, std::string& out) {out = in; return RET_STATUS::RET_SUCCEED; });
- Dispatch->Update.Push(TemperatureCalibLowWarn, [](std::string in, std::string& out) {out = in; return RET_STATUS::RET_SUCCEED; });
- Dispatch->Update.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::JSUpdateBatteryErrorMin);
- Dispatch->Update.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::JSUpdateBatteryWarningMin);
- Dispatch->Update.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::JSUpdateSignalErrorMin);
- Dispatch->Update.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::JSUpdateSignalWarningMin);
- }
- //离线采集接口
- void nsFPD::FPDDeviceTrixell::RegisterAutonumous(nsDetail::Dispatch* Dispatch)
- {
- Dispatch->Action.Push("OfflineFPD", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSOfflineFPD);
- Dispatch->Action.Push("OnlineFPD", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSOnlineFPD);
- Dispatch->Action.Push("GetAutonumousImageList", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetAutonumousImageList);
- Dispatch->Action.Push("RemoveAutonumousImageList", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSRemoveAutonumousImageList);
- Dispatch->Action.Push("RemoveAutonumousAll", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSRemoveAutonumousAll);
- Dispatch->Action.Push("GetImageMetaData", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetImageMetaData);
- Dispatch->Action.Push("ExportAutonumousAll", m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSExportAutonumousAll);
- }
- void nsFPD::FPDDeviceTrixell::Register()
- {
- auto Disp = &Dispatch;
- RegisterCtrl(Disp);
- RegisterAcq(Disp);
- RegisterSync(Disp);
- RegisterCalib(Disp);
- RegisterOthers(Disp);
- RegisterAutonumous(Disp);
- }
- bool nsFPD::FPDDeviceTrixell::LoadConfig()
- {
- if (!m_DetectorConfiguration->LoadConfigurations(m_stDeviceConfig))
- {
- Error("Load configuration file failed!!!");
- return false;
- }
- try
- {
- m_nFullImgWidth = m_stDeviceConfig.nFullImageWidth;
- m_nFullImgHeight = m_stDeviceConfig.nFullImageHeight;
- m_nLeftOffset = m_stDeviceConfig.nImageLeftOffset;
- m_nTopOffset = m_stDeviceConfig.nImageTopffset;
- m_bPreviewEnable = m_stDeviceConfig.bPreviewEnable;
- if (m_stDeviceConfig.nForceGridSuppress > 0)
- {
- m_bForceGridSuppress = true;
- }
- else
- {
- m_bForceGridSuppress = false;
- }
- int nAttached = (int)m_DetectorConfiguration->m_Configurations[CcosDetectorAttachedFlag];
- if (nAttached == 1)
- {
- m_bAttached = true;
- m_DetectorCtrlUnit->SetAttachStatus("1");
- }
- else
- {
- m_bAttached = false;
- m_stDeviceConfig.bConnectStatus = false;
- }
- string strFPDinfo;
- strFPDinfo = (string)m_DetectorConfiguration->m_Configurations["FieldofViewShape"];
- m_DetectorCtrlUnit->SetFieldofViewShape(strFPDinfo);
- strFPDinfo = (string)m_DetectorConfiguration->m_Configurations["FieldofViewDimension"];
- m_DetectorCtrlUnit->SetFieldofViewDimension(strFPDinfo);
- m_DetectorCtrlUnit->SetDetectorType("SCINTILLATOR");
- strFPDinfo = (string)m_DetectorConfiguration->m_Configurations["Description"];
- m_DetectorCtrlUnit->SetDescription(strFPDinfo);
- m_DetectorCtrlUnit->SetDetectorConditionsNominalFlag("YES");
- auto strFinfo = std::to_string(m_stDeviceConfig.nDoseOfEXI);
- m_DetectorCtrlUnit->SetFPDSensitivity(strFinfo);
- m_fFactorEXI2UGY = 100.0f / (float)atof(strFinfo.c_str()) * 1.0f;//子系统将UI的TargetEXI 乘以FPDSensitivity再传给imagesave,用作计算EXI和DI并填写ecm头。
- Info("FactorEXI2UGY = {$}", m_fFactorEXI2UGY);
- m_DetectorCtrlUnit->SetPixelData("");
- m_DetectorCtrlUnit->SetTargetEXI("5000");
- m_Battery.reset(new DeviceBatteryMould("DetectorTrixellBattery", 0, m_stDeviceConfig.nBatteryLimit,
- m_stDeviceConfig.nBatteryWarning, 100, 30, 100, 100, 0, EventCenter));
- m_Temperature.reset(new DeviceTemperatureMould("DetectorTrixellTemperature", 0.0f, m_stDeviceConfig.fTemperMinLimit,
- m_stDeviceConfig.fTemperLowLimit, m_stDeviceConfig.fTemperUpperLimit, 50.0f, 100.0f, m_stDeviceConfig.fTemperMaxLimit, 0.0f, EventCenter));
- m_Wifi.reset(new DeviceWifiMould("DetectorTrixellWifi", 0, m_stDeviceConfig.nWifiLimit, m_stDeviceConfig.nWifiWarning,
- 100, 50, 100, 100, 0, EventCenter));
- //------------------------------------可支持的同步模式
- ResDataObject jsonSupportSyncType;
- jsonSupportSyncType = m_DetectorConfiguration->m_Configurations["SupportSyncMode"];
- Debug("SupportSyncMode: {$}", jsonSupportSyncType.encode());
- m_SyncUnit->JSSetSupportSyncMode(jsonSupportSyncType.encode());
- //校正日期
- m_CalibUnit->SetLastCalibrationDate(m_stDeviceConfig.strLastCalibrationDate);
- m_CalibUnit->SetCalibrationFileExpireTime(m_stDeviceConfig.strCalibrationFileExpireTime);
- m_bNotifyCalWarn = ((int)m_DetectorConfiguration->m_Configurations["CalibrationFileExpirationReminder"] == 1) ? true : false;
- //校正参数
- ResDataObject CalibDoseList;
- string strCalibDose = m_strWorkPath + R"(\OEMDrivers\Detector\Trixell\TrixellDRDetector\CalibrationDose_Trixell.xml)";
- Info("start load calibDose file: {$}", strCalibDose.c_str());
- struct stat buffer;
- if (stat(strCalibDose.c_str(), &buffer) == 0)
- {
- CalibDoseList.loadFile(strCalibDose.c_str());
- m_CalibDoseList = CalibDoseList["List"];
- Info("m_CalibDoseList: {$} ", m_CalibDoseList.encode());
- for (int i = 0; i < m_CalibDoseList.size(); i++)
- {
- ResDataObject temp = m_CalibDoseList[i];
- int nExpNum = temp["ExpNum"];
- m_nCalibTotalExposureNum += nExpNum;
- //Info("temp: {$} ", temp.encode());
- }
- Info("CalibTotalExposureNum: {$}", m_nCalibTotalExposureNum);
- }
- else
- {
- Error("{$} file not exist!", strCalibDose);
- }
- }
- catch (exception e)
- {
- Error("Get calibDose error: {$}", e.what());
- }
- return true;
- }
- bool nsFPD::FPDDeviceTrixell::CreateDevice()
- {
- if (!LoadConfig())
- {
- return false;
- }
- if (nullptr == g_pDetector)
- {
- if (nullptr == m_pDetectors)
- {
- m_pDetectors = new TrixellCtrl();
- Info("Create SDK ctrl ok\n");
- g_pDetector = (TrixellCtrl*)m_pDetectors;
- }
- }
- else
- {
- m_pDetectors = g_pDetector;
- Info("SDK ctrl Already exit\n");
- }
- return ((TrixellCtrl*)m_pDetectors)->AddDPCs(this, m_DetectorConfiguration->m_Configurations, m_stDeviceConfig);
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::Connect()
- {
- Info("------------------------ FPD {$} Start running ------------------------", m_stDeviceConfig.strDeviceName.c_str());
- bool bRet = m_pDetectors->Connect(m_strWorkPath.c_str(), this);
- if (!bRet)
- {
- Error("Connect detector failed!!!");
- return RET_STATUS::RET_FAILED;
- }
- Info("Connect detector success");
- return RET_STATUS::RET_SUCCEED;
- }
- DWORD nsFPD::FPDDeviceTrixell::OnNotify(LPVOID pParam)
- {
- Info("OnNotify Loop Entry-----------");
- FPDDeviceTrixell* pNotifyOpr = (FPDDeviceTrixell*)pParam;
- int nHandlesNum = 3;
- HANDLE* pHandles = new HANDLE[nHandlesNum];
- pHandles[0] = pNotifyOpr->m_PauseCalibrationEvt;
- pHandles[1] = pNotifyOpr->m_ExitEvt;
- pHandles[2] = pNotifyOpr->m_ConnectEvt;
- while (1)
- {
- DWORD dwResult = WaitForMultipleObjects(nHandlesNum, pHandles, FALSE, INFINITE);
- if (dwResult == WAIT_OBJECT_0) //m_PauseCalibrationEvt
- {
- Info("OnNotify get PauseCalibration evt");
- pNotifyOpr->PauseCalibration();
- }
- else if (dwResult == WAIT_OBJECT_0 + 1) //m_ExitEvt
- {
- Info("Exit OnNotify Thread");
- break;
- }
- else if (dwResult == WAIT_OBJECT_0 + 2) //m_ConnectEvt
- {
- Info("Get ConnectEVT");
- pNotifyOpr->Connect();
- ResetEvent(pNotifyOpr->m_ConnectEvt);
- }
- }
- delete[] pHandles;
- Info("Exit OnNotify Thread over");
- return 0;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::ActiveDetector(bool bActive)
- {
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- if (bActive)
- {
- bool bRet = ((TrixellCtrl*)m_pDetectors)->ActivePanel(this);
- if (!bRet)
- {
- return RET_STATUS::RET_FAILED;
- }
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::WakeupDetector()
- {
- Info("--Func-- Wakeup FPD {$}", m_nDeviceIndex);
- if (((TrixellCtrl*)m_pDetectors)->WakeupDetector(m_nDeviceIndex))
- {
- return RET_STATUS::RET_SUCCEED;
- }
- return RET_STATUS::RET_FAILED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::PrepareAcquisition()
- {
- Info("==============================PrepareAcquisition");
- if (!m_stDeviceConfig.bConnectStatus || m_WarnAndError->IsErrorExist())
- {
- Error("Detector status is error. Disable Ready.");
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ERROR));
- return RET_STATUS::RET_FAILED;
- }
- auto strFinfo = std::to_string(m_stDeviceConfig.nDoseOfEXI);
- m_DetectorCtrlUnit->SetFPDSensitivity(strFinfo);
- m_SyncUnit->FPDReadyNotify(false);
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- if (RET_STATUS::RET_SUCCEED == m_pDetectors->PrepareAcquisition(this))
- {
- m_SyncUnit->FPDReadyNotify(true);
- Ret = RET_STATUS::RET_SUCCEED;
- }
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- Info("==============================PrepareAcquisition over");
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::StartAcquisition(string in)
- {
- Info("==============================StartAcquisition");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- if (DETECTOR_STATUS_STANDBY != m_DetectorCtrlUnit->GetDetectorStatus())
- {
- if ((m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_RUNNING) ||
- (m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_ACTIVE))
- {
- Error("StartAcquisition failed. Detector at Calibration status");
- return RET_STATUS::RET_FAILED;
- }
- if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
- {
- Warn("Detector already at Acq status");
- return RET_STATUS::RET_SUCCEED;
- }
- }
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- if (RET_STATUS::RET_SUCCEED == ((TrixellCtrl*)m_pDetectors)->StartAcquisition(this))
- {
- Ret = RET_STATUS::RET_SUCCEED;
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));
- }
- else
- {
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- }
- Info("==============================StartAcquisition over");
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::StopAcquisition()
- {
- Info("==============================StopAcquisition");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- if (DETECTOR_STATUS_STANDBY == m_DetectorCtrlUnit->GetDetectorStatus())
- {
- Warn("Detector already at Standby status");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- if (RET_STATUS::RET_SUCCEED == ((TrixellCtrl*)m_pDetectors)->StopAcquisition(this))
- {
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- Ret = RET_STATUS::RET_SUCCEED;
- }
- Info("==============================StopAcquisition over");
- return Ret;
- }
- string nsFPD::FPDDeviceTrixell::GetFileVersion(string strFilePathName)
- {
- DWORD dwVerSize = GetFileVersionInfoSize(strFilePathName.c_str(), NULL);
- if (dwVerSize == 0)
- {
- return "null";
- }
- LPVOID pVersionBuffer = malloc(dwVerSize);
- if (pVersionBuffer == nullptr)
- {
- return "null";
- }
- GetFileVersionInfo(strFilePathName.c_str(), 0, dwVerSize, pVersionBuffer);
- VS_FIXEDFILEINFO* pInfo;
- UINT nInfoLen;
- char szValue[MAX_PATH] = { 0 };
- if (VerQueryValue(pVersionBuffer, ("\\"), (void**)&pInfo, &nInfoLen))
- {
- sprintf_s(szValue, ("%d.%d.%d.%d"), HIWORD(pInfo->dwFileVersionMS), LOWORD(pInfo->dwFileVersionMS), HIWORD(pInfo->dwFileVersionLS), LOWORD(pInfo->dwFileVersionLS));
- }
- string strVersion = szValue;
- return strVersion;
- }
- void nsFPD::FPDDeviceTrixell::SendTemperatureValue()
- {
- int nStatus = 0;
- m_Temperature->SetTemperature(m_stDeviceConfig.fCurrentTemperValue, nStatus);
- Info("SendTemperatureValue: {$}, status {$}\n", m_stDeviceConfig.fCurrentTemperValue, nStatus);
- }
- void nsFPD::FPDDeviceTrixell::SendWifiValue()
- {
- int nStatus = 0;
- m_Wifi->SetSignalValue(m_stDeviceConfig.nCurrentWifiValue, nStatus);
- Info("SendWifiValue: {$}, status {$}\n", m_stDeviceConfig.nCurrentWifiValue, nStatus);
- }
- void nsFPD::FPDDeviceTrixell::SendBatteryValue()
- {
- int nStatus = 0;
- m_Battery->SetRemainPowerValue(m_stDeviceConfig.nCurrentBatteryValue, nStatus);
- Info("SendBatteryValue: {$}, status {$}\n", m_stDeviceConfig.nCurrentBatteryValue, nStatus);
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::XWindowOnNotify()
- {
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- m_SyncUnit->XWindowOnNotify();
- Info("WindowOn\n");
- m_stImgCreateTime = { 0 };
- GetLocalTime(&m_stImgCreateTime);
- Info("Full image create time-%02d:%02d:%02d:%03d", m_stImgCreateTime.wHour, m_stImgCreateTime.wMinute, m_stImgCreateTime.wSecond, m_stImgCreateTime.wMilliseconds);
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::XWindowOffNotify()
- {
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- m_SyncUnit->XWindowOffNotify();
- Info("WindowOff\n");
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::ActiveCalibration(CCOS_CALIBRATION_TYPE eType)
- {
- Info("==============================ActiveCalibration is {$}", (int)eType);
- m_DetectorCtrlUnit->SetFPDSensitivity("100");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- if (eType == CCOS_CALIBRATION_TYPE_NONE || eType == CCOS_CALIBRATION_TYPE_MAX)
- {
- return RET_STATUS::RET_INVALID;
- }
- /*if (DETECTOR_STATUS_STANDBY != m_DetectorCtrlUnit->GetDetectorStatus())
- {
- if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
- {
- Error("ActiveCalibration {$} failed. Detector at Acq status", (int)eType);
- }
- return RET_STATUS::RET_FAILED;
- }*/
- m_eAppStatus = APP_STATUS_CAL_BEGIN;
- if (eType == CCOS_CALIBRATION_TYPE_XRAY)
- {
- ResetEvent(m_WaitCalibDoseEvt);
- int nCalibrationRounds = (int)m_CalibDoseList.size();
- ((TrixellCtrl*)m_pDetectors)->SetReferenceNum(nCalibrationRounds);
- }
- RET_STATUS Ret = ((TrixellCtrl*)m_pDetectors)->ActiveCalibration(eType);
- if (RET_STATUS::RET_SUCCEED == Ret)
- {
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ACTIVE));
- m_CalibUnit->SetCalibrationProgress("0");
- if (eType == CCOS_CALIBRATION_TYPE_XRAY)
- {
- Info("start to waitting CalibDoseEvt");
- DWORD nRet = WaitForSingleObject(m_WaitCalibDoseEvt, INFINITE);
- }
- m_nXrayCalibNum = 0;
- }
- //重置校正流程参数
- m_nCalibCurrentCalibrationRound = 1;
- m_nCalibCurrentExposureIndex = 1;
- m_nCalibCurrentExposureNum = 0;
- Info("==============================ActiveCalibration over");
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::GetRequestedDose(std::string& strDose)
- {
- Info("==============================GetRequestedDose");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- bool bGetDoseInfo = false;
- ResDataObject out;
- CCOS_CALIBRATION_TYPE nCalibrationType = m_CalibUnit->GetCalibrationType();
- if (CCOS_CALIBRATION_TYPE_DARK == nCalibrationType)
- {
- out.add("Dose", 0.0f);
- out.add("kV", 0.0f);
- out.add("mA", 0.0f);
- out.add("ms", 0.0f);
- out.add("mAs", 0.0f);
- bGetDoseInfo = true;
- }
- else if (CCOS_CALIBRATION_TYPE_XRAY == nCalibrationType)
- {
- for (int i = 0; i < m_CalibDoseList.size(); i++)
- {
- ResDataObject temp = m_CalibDoseList[i];
- int nDose = temp["Dose"];
- int nDoseParem = (int)(m_fDoseParam * 1000);
- if (nDoseParem == nDose)
- {
- out.add("Dose", nDoseParem);
- out.add("kV", temp["kV"]);
- out.add("mA", temp["mA"]);
- out.add("ms", temp["ms"]);
- out.add("mAs", temp["mAs"]);
- bGetDoseInfo = true;
- Info("Find target dose parameter");
- break;
- }
- }
- }
- else
- {
- Warn("Can not support CalibrationType({$})", (int)nCalibrationType);
- Ret = RET_STATUS::RET_FAILED;
- }
- if (bGetDoseInfo)
- {
- strDose = out.encode();
- Info("GetRequestedDose {$} over", strDose.c_str());
- }
- else
- {
- Error("GetRequestedDose failed");
- }
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::SetRequestedDose(std::string strDose)
- {
- Info("==============================SetRequestedDose");
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::PrepareCalibration()
- {
- Info("==============================PrepareCalibration");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- m_SyncUnit->FPDReadyNotify(false);
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- if (RET_STATUS::RET_SUCCEED == ((TrixellCtrl*)m_pDetectors)->PrepareCalibration(this))
- {
- m_SyncUnit->FPDReadyNotify(true);
- Ret = RET_STATUS::RET_SUCCEED;
- }
- else
- {
- Ret = RET_STATUS::RET_FAILED;
- }
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- Info("==============================PrepareCalibration over");
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::StartCalibration()
- {
- Info("==============================StartCalibration");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- /*if (DETECTOR_STATUS_STANDBY != m_DetectorCtrlUnit->GetDetectorStatus())
- {
- if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
- {
- Error("ActiveCalibration failed. Detector at Acq status");
- }
- return RET_STATUS::RET_FAILED;
- }*/
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- CCOS_CALIBRATION_TYPE eCalibrationType = m_CalibUnit->GetCalibrationType();
- if (eCalibrationType == CCOS_CALIBRATION_TYPE_DARK)
- {
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationProgress("100");
- Info("DarkCalibration finish");
- Info("==============================StartCalibration over");
- return RET_STATUS::RET_SUCCEED;
- }
-
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_RUNNING));
- if (RET_STATUS::RET_SUCCEED == m_pDetectors->StartCalibration(this))
- {
- Ret = RET_STATUS::RET_SUCCEED;
- }
- else
- {
- Ret = RET_STATUS::RET_FAILED;
- }
- Info("==============================StartCalibration over");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::PauseCalibration()
- {
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- m_nXrayCalibNum++;
- int nDose = (int)m_fDoseParam;
- if (nDose == 25 && m_nXrayCalibNum == 10)
- {
- Info("start to waitting CalibDoseEvt");
- DWORD nRet = WaitForSingleObject(m_WaitCalibDoseEvt, INFINITE);
- //m_nXrayCalibNum = 0;
- }
- else if (nDose != 25)
- {
- if (m_nXrayCalibNum != 13)
- {
- Info("start to waitting CalibDoseEvt");
- DWORD nRet = WaitForSingleObject(m_WaitCalibDoseEvt, INFINITE);
- }
- }
- ResetEvent(m_PauseCalibrationEvt);
- ResetEvent(m_WaitCalibDoseEvt);
- m_AcqUnit->SendNoNeedWaitImage(true);
- if (m_nXrayCalibNum != 13)
- {
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- m_CalibUnit->PauseCalibration();
- }
- Info("Driver PauseCalibration over,m_nXrayCalibNum {$}", m_nXrayCalibNum);
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::StopCalibration()
- {
- Info("==============================StopCalibration");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- return RET_STATUS::RET_THREAD_INVALID;
- }
- /*if (m_CalibUnit->GetCalibrationStatus() != CCOS_CALIBRATION_STATUS_RUNNING && m_CalibUnit->GetCalibrationStatus() != CCOS_CALIBRATION_STATUS_PAUSE)
- {
- return RET_STATUS::RET_FAILED;
- }*/
- RET_STATUS Ret = RET_STATUS::RET_FAILED;
- m_eAppStatus = APP_STATUS_CAL_END;
- if (RET_STATUS::RET_SUCCEED == ((TrixellCtrl*)m_pDetectors)->AbortCalibration(this))
- {
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- Ret = RET_STATUS::RET_SUCCEED;
- }
- else
- {
- Ret = RET_STATUS::RET_FAILED;
- }
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- Info("==============================StopCalibration over");
- return RET_STATUS::RET_SUCCEED;
- }
- bool nsFPD::FPDDeviceTrixell::CompleteCalibration()
- {
- m_stDeviceConfig.fCalibTemperature2 = m_stDeviceConfig.fCurrentTemperValue;
- m_stDeviceConfig.fCalibTemperature = (m_stDeviceConfig.fCalibTemperature1 + m_stDeviceConfig.fCalibTemperature2) / 2;
- ResetEvent(m_UploadCalibMapOver);
- ((TrixellCtrl*)m_pDetectors)->CompleteCalibration(this);
- DWORD nRet = WaitForSingleObject(m_UploadCalibMapOver, 60000);
- if (WAIT_OBJECT_0 == nRet)
- {
- Info("got event m_UploadCalibMapOver");
- }
- else if (WAIT_TIMEOUT == nRet)
- {
- Info("wait event m_UploadCalibMapOver timeout");
- }
- else
- {
- Info("wait event m_UploadCalibMapOver error");
- }
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- {
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationProgress("100");
- }
- return true;
- }
- void nsFPD::FPDDeviceTrixell::AbortCalibration()
- {
- Info("AbortCalibration");
- CCOS_CALIBRATION_TYPE nCalibrationType = m_CalibUnit->GetCalibrationType();
- if (CCOS_CALIBRATION_TYPE_DARK == nCalibrationType)
- {
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ERROR));
- m_CalibUnit->SetCalibrationProgress("100");
- Info("AbortDarkCalibration over");
- return;
- }
- m_eAppStatus = APP_STATUS_CAL_END;
- ((TrixellCtrl*)m_pDetectors)->AbortCalibration(this);
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ERROR));
- m_CalibUnit->SetCalibrationProgress("100");
- m_AcqUnit->SendNoNeedWaitImage(true);
- Info("AbortCalibration over");
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::GetCalibrationStep(int nDetectorID, string& strCalibrationStepInfo)
- {
- Info("## GetCalibrationStep ##");
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- Info("Calibration DetectorID: {$}", nDetectorID);
- ResDataObject out;
- int nCalibrationRounds = (int)m_CalibDoseList.size();
- int nExposureNumCurrentRound = (int)m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1]["ExpNum"];
- if (((TrixellCtrl*)m_pDetectors)->GetCalibrationStep(m_nCalibCurrentCalibrationRound, nCalibrationRounds, m_nCalibCurrentExposureIndex, nExposureNumCurrentRound))
- {
- Info("GetCalibrationStep over");
- Ret = RET_STATUS::RET_SUCCEED;
- }
- else
- {
- Error("GetCalibrationStep error");
- Ret = RET_STATUS::RET_FAILED;
- }
- out.add("CalibrationRounds", (int)m_CalibDoseList.size());
- out.add("TotalExposureNum", m_nCalibTotalExposureNum);
- out.add("CurrentCalibrationRound", m_nCalibCurrentCalibrationRound);
- out.add("ExposureNumCurrentRound", (int)m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1]["ExpNum"]);
- out.add("CurrentExposureIndex", m_nCalibCurrentExposureIndex);
- out.add("CurrentExposureNum", m_nCalibCurrentExposureNum);
- strCalibrationStepInfo = out.encode();
- Info("GetCalibrationStep over \n{$}", strCalibrationStepInfo.c_str());
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::AcceptCalibration()
- {
- Info("## AcceptCalibration ##");
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- if (((TrixellCtrl*)m_pDetectors)->AcceptCalibration())
- {
- Info("AcceptCalibration over");
- Ret = RET_STATUS::RET_SUCCEED;
- }
- else
- {
- Error("AcceptCalibration error");
- Ret = RET_STATUS::RET_FAILED;
- }
- int nExposureNumCurrentRound = (int)m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1]["ExpNum"];
- //完成校正条件:轮数够了,曝光次数够了
- if ((m_nCalibCurrentCalibrationRound == (int)m_CalibDoseList.size()) && (m_nCalibCurrentExposureIndex == nExposureNumCurrentRound))
- {
- Info("Calibration Round: {$}, Exposure Index: {$}, Finished", m_nCalibCurrentCalibrationRound, m_nCalibCurrentExposureIndex);
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationProgress("100");
- return Ret;
- }
- if (m_nCalibCurrentExposureIndex >= nExposureNumCurrentRound) //跳到下一轮校正参数
- {
- m_nCalibCurrentCalibrationRound++;
- m_nCalibCurrentExposureIndex = 1;
- ResDataObject temp = m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1];
- int nDose = temp["Dose"];
- m_fDoseParam = nDose / 1000.0f;
- }
- else
- {
- m_nCalibCurrentExposureIndex++;
- }
- m_nCalibCurrentExposureNum++;
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::RejectCalibration()
- {
- Info("## RejectCalibration ##");
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- if (((TrixellCtrl*)m_pDetectors)->RejectCalibration())
- {
- Info("RejectCalibration over");
- Ret = RET_STATUS::RET_SUCCEED;
- }
- else
- {
- Error("RejectCalibration error");
- Ret = RET_STATUS::RET_FAILED;
- }
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::SaveCalibrationFile(bool bSaveFlag)
- {
- Info("## SaveCalibrationFile ##");
- RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
- Info("SaveCalibrationFile by user: {$}", bSaveFlag);
- if (!bSaveFlag)
- {
- Warn("Not save calibration file");
- return Ret;
- }
- if (((TrixellCtrl*)m_pDetectors)->SaveCalibrationFile())
- {
- Info("SaveCalibrationFile over");
- m_CalibUnit->SetSaveCalibrationFileFinish(true);
- Ret = RET_STATUS::RET_SUCCEED;
- //更新配置文件中校正日期和时间
- time_t localtime = time(NULL);
- string strLocalTime = DatetimeToString(localtime);
- Info("strLocalTime:{$}", strLocalTime);
- m_CalibUnit->SetLastCalibrationDate(strLocalTime);
- //清除校正文件相关警告
- m_WarnAndError->ClearWarn(ERR_FPD_CAL_FILE_NOT_EXIST);
- m_WarnAndError->ClearWarn(ERR_FPD_CAL_FILE_OUTDATE);
- }
- else
- {
- Error("SaveCalibrationFile error");
- m_CalibUnit->SetSaveCalibrationFileFinish(false);
- Ret = RET_STATUS::RET_FAILED;
- }
- return Ret;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::GetDeviceDictionary(std::string& out)
- {
- ResDataObject m_DeviceDictionary;
- ResDataObject FPDinfo;
- //先用虚拟值
- FPDinfo.add("SysVersion", "1.1");
- FPDinfo.add("SubVersion", "1.1");
- FPDinfo.add("FPGAVersion", "1.1");
- m_DeviceDictionary.add("DriverType", "StaticDetector");
- m_DeviceDictionary.add("DeviceName", "Trixell");
- m_DeviceDictionary.add("DateOfManufacture", "2019.4.19");
- m_DeviceDictionary.add("SoftwareVersion", "1.1");
- m_DeviceDictionary.add("HardwareVersion", FPDinfo);
- m_DeviceDictionary.add("Description", m_stDeviceConfig.strDeviceName.c_str());
- m_DeviceDictionary.add("Model", "Pixium");
- m_DeviceDictionary.add("SerialNumber", m_DetectorConfiguration->m_Configurations["SerialNumber"]);
- out = m_DeviceDictionary.encode();
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::ResetConnect()
- {
- ((TrixellCtrl*)m_pDetectors)->DisConnect(this);
- ((TrixellCtrl*)m_pDetectors)->Connect(m_strWorkPath.c_str(), this);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::DisConnectFPD()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::DisConnectFPDForce()
- {
- return RET_STATUS::RET_SUCCEED;
- }
- void nsFPD::FPDDeviceTrixell::FullImageDateArrived(WORD* pImg)
- {
- AddFrameWithRawHead(IMAGE_FULL, pImg, m_stDeviceConfig.nFullImageWidth * m_stDeviceConfig.nFullImageHeight);
- }
- void nsFPD::FPDDeviceTrixell::PrevImageDateArrived(WORD* pImg)
- {
- AddFrameWithRawHead(IMAGE_PREVIEW, pImg, m_stDeviceConfig.nPreviewWidth * m_stDeviceConfig.nPreviewHeight);
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::EnterExam(int nExamMode)
- {
- Info("EnterExam");
- switch (nExamMode)
- {
- case APP_STATUS_WORK_BEGIN:
- Info("Enter into Exam Windows");
- m_eAppStatus = APP_STATUS_WORK_BEGIN;
- ResetError();
- CheckCalibrationDue();
- break;
- case APP_STATUS_WORK_END:
- Info("Quit Exam Windows");
- m_eAppStatus = APP_STATUS_WORK_END;
- m_WarnAndError->ClearAllWarn();
- break;
- case APP_STATUS_DETSHARE_BEGIN:
- Info("Enter into Detector Share Windows");
- m_eAppStatus = APP_STATUS_DETSHARE_BEGIN;
- break;
- case APP_STATUS_DETSHAR_END:
- m_eAppStatus = APP_STATUS_IDLE;
- Info("Quit Detector Share Windows");
- m_eAppStatus = APP_STATUS_DETSHAR_END;
- break;
- case APP_STATUS_CAL_BEGIN:
- Info("Enter into Calibration Windows");
- m_eAppStatus = APP_STATUS_CAL_BEGIN;
- break;
- case APP_STATUS_CAL_END:
- Info("Quit Calibration Windows");
- m_eAppStatus = APP_STATUS_CAL_END;
- break;
- case APP_STATUS_WORK_IN_SENSITIVITY:
- Info("Enter into sensitivity test interface");
- m_eAppStatus = APP_STATUS_WORK_IN_SENSITIVITY;
- break;
- default:
- break;
- }
- m_pDetectors->EnterExam(m_eAppStatus);
- return RET_STATUS::RET_SUCCEED;
- }
- bool nsFPD::FPDDeviceTrixell::GetLogicMode(string& strAcqMode, int& nLogicMode)
- {
- if (strAcqMode == "RAD")
- {
- nLogicMode = RAD;
- }
- else if (strAcqMode == "DDR")
- {
- nLogicMode = DDR;
- }
- else if (strAcqMode == "1")
- {
- nLogicMode = RAD;
- }
- else if (strAcqMode == "2")
- {
- nLogicMode = DDR;
- }
- else
- {
- Error("Not support mode!");
- return false;
- }
- return true;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::SetAcqMode(string strAcqMode)
- {
- Info("nsFPD::FPDDeviceTrixell::SetAcqMode(string)");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- Error("m_stDeviceConfig.bConnectStatus = false");
- return RET_STATUS::RET_FAILED;
- }
- int nAcqMode = 1;
- int nWidth = m_stDeviceConfig.nFullImageWidth;
- int nHeight = m_stDeviceConfig.nFullImageHeight;
- int nBit = m_stDeviceConfig.nImageBits;
- Info("ImageSize({$} {$}), bits({$})", nWidth, nHeight, nBit);
- m_AcqUnit->SetFulImageInfo(nHeight, nWidth, nBit, false);
- m_AcqUnit->SetPrevImageInfo(m_stDeviceConfig.bPreviewEnable, m_stDeviceConfig.nPreviewHeight, m_stDeviceConfig.nPreviewWidth, false);
- if (m_pDetectors->SelectExamMode(nAcqMode, this))
- {
- return RET_STATUS::RET_SUCCEED;
- }
- return RET_STATUS::RET_FAILED;
- }
- //设置采集模式
- RET_STATUS nsFPD::FPDDeviceTrixell::SetAcqMode(int nMode)
- {
- Info("nsFPD::FPDDeviceTrixell::SetAcqMode");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- Error("m_stDeviceConfig.bConnectStatus = false");
- return RET_STATUS::RET_FAILED;
- }
- int nWidth = m_stDeviceConfig.nFullImageWidth;
- int nHeight = m_stDeviceConfig.nFullImageHeight;
- int nBit = m_stDeviceConfig.nImageBits;
- Info("ImageSize({$} {$}), bits({$})", nWidth, nHeight, nBit);
- m_AcqUnit->SetFulImageInfo(nHeight, nWidth, nBit, false);
- m_AcqUnit->SetPrevImageInfo(m_stDeviceConfig.bPreviewEnable, m_stDeviceConfig.nPreviewHeight, m_stDeviceConfig.nPreviewWidth, false);
- if (m_pDetectors->SelectExamMode(1, this))
- {
- return RET_STATUS::RET_SUCCEED;
- }
- return RET_STATUS::RET_FAILED;
- }
- void nsFPD::FPDDeviceTrixell::OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- switch (nEventLevel)
- {
- case EVT_LEVEL_CONFIGURATION:
- {
- OnEventProcessConf(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
- break;
- }
- case EVT_LEVEL_INFORMATOION:
- {
- OnEventProcessInfo(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
- break;
- }
- case EVT_LEVEL_STATUS:
- {
- OnEventProcessStatus(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
- break;
- }
- case EVT_LEVEL_DATA:
- {
- OnEventProcessData(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
- break;
- }
- case EVT_LEVEL_WARNING:
- {
- OnEventProcessWarning(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
- break;
- }
- case EVT_LEVEL_ERROR:
- {
- OnEventProcessError(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
- break;
- }
- default:
- break;
- }
- }
- void nsFPD::FPDDeviceTrixell::OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- switch (nEventID)
- {
- case EVT_CONF_PANEL_SERIAL:
- {
- m_stDeviceConfig.strPanelSerial = pszMsg;
- Info("Receive Panel {$} SN {$}", nDetectorID, pszMsg);
- m_DetectorCtrlUnit->SetDetectorID(m_stDeviceConfig.strPanelSerial);
- break;
- }
- case EVT_CONF_RAW_WIDTH:
- {
- if (m_stDeviceConfig.nFullImageWidth != nParam1)
- {
- m_stDeviceConfig.nFullImageWidth = nParam1;
- }
- Info("Panel {$} nRawWidth:{$}", nDetectorID, m_stDeviceConfig.nRawWidth);
- break;
- }
- case EVT_CONF_RAW_HIGHT:
- {
- if (m_stDeviceConfig.nFullImageHeight != nParam1)
- {
- m_stDeviceConfig.nFullImageHeight = nParam1;
- }
- Info("Panel {$} nRawHeight:{$}", nDetectorID, m_stDeviceConfig.nRawHeight);
- break;
- }
- case EVT_CONF_RAW_BITS:
- {
- m_stDeviceConfig.nImageBits = nParam1;
- Info("Panel {$} nImageBits:{$}", nDetectorID, m_stDeviceConfig.nImageBits);
- break;
- }
- case EVT_CONF_PIXELSPACE:
- {
- m_stDeviceConfig.nPixelSpace = (int)fParam2;
- Info( "Panel {$} nPixelSpace:{$}", nDetectorID, m_stDeviceConfig.nPixelSpace);
- break;
- }
- case EVT_CONF_PREVIEW_WIDTH:
- {
- if (m_stDeviceConfig.nPreviewWidth != nParam1)
- {
- m_stDeviceConfig.nPreviewWidth = nParam1;
- }
- Info("Panel {$} nPreviewWidth:{$}", nDetectorID, m_stDeviceConfig.nPreviewWidth);
- break;
- }
- case EVT_CONF_PREVIEW_HIGHT:
- {
- if (m_stDeviceConfig.nPreviewHeight != nParam1)
- {
- m_stDeviceConfig.nPreviewHeight = nParam1;
- }
- Info("Panel {$} nPreviewHeight:{$}", nDetectorID, m_stDeviceConfig.nPreviewHeight);
- break;
- }
- case EVT_CONF_MODULE_TYPE:
- {
- //m_strModuleType = pszMsg;
- Info("Receive Panel {$} ModuleType {$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_MODULE_IP:
- {
- //m_strModuleIP = pszMsg;
- Info("Receive Panel {$} ModuleIP {$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_MODULE_SN:
- {
- //m_strModuleSN = pszMsg;
- Info("Receive Panel {$} ModuleSN {$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_FIRWARE_UPDATE:
- {
- m_stDeviceConfig.nFirmwareStatus = nParam1;
- Info("Panel {$} FirmwareUpdate:{$}", nDetectorID, m_stDeviceConfig.nFirmwareStatus);
- break;
- }
- case EVT_CONF_PART_NUMBER:
- {
- m_stDeviceConfig.strPartNumber = pszMsg;
- Info("Panel {$} PartNumber:{$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_BATTERY_SN:
- {
- Info("Panel {$} Battery SN:{$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_WIFI_SSID:
- {
- m_stDeviceConfig.strWifiSSID = pszMsg;
- Info("Panel {$} WifiSSID:{$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_IFBOARD:
- {
- Info("Panel {$} InterfaceBoard:{$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_DATECODE:
- {
- Info("Panel {$} DateCode:{$}", nDetectorID, pszMsg);
- break;
- }
- case EVT_CONF_LIFETIME:
- {
- int nLifeTime = nParam1;
- if ((nLifeTime != m_stDeviceConfig.nLifeTime))
- {
- Info("LifeTime:{$}", nLifeTime);
- m_stDeviceConfig.nLifeTime = nLifeTime;
- }
- break;
- }
- default:
- break;
- }
- }
- void nsFPD::FPDDeviceTrixell::OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- int nID = nDetectorID;
- switch (nEventID)
- {
- case EVT_INFO_POWER_ON:
- {
- int nPowerOn = nParam1;
- Info("Detector {$} PowerOn:{$}", nID, nPowerOn);
- if ((nPowerOn != m_stDeviceConfig.nPowerOn))
- {
- m_stDeviceConfig.nPowerOn = nPowerOn;
- }
- break;
- }
- case EVT_INFO_BATTERY_CAPACITY:
- {
- int nBatteryCapacity = nParam1;
- if ((nBatteryCapacity != m_nBatteryCapacity))
- {
- Info("{$}", nBatteryCapacity);
- m_nBatteryCapacity = nBatteryCapacity;
- }
- break;
- }
- case EVT_INFO_BATTERY_TEMPERATURE:
- {
- Info("Battery temperature: {$}", fParam2);
- break;
- }
- case EVT_INFO_BATTERY_CHARGES:
- {
- int nBatteryCharges = nParam1;
- if (nBatteryCharges != m_nBatteryCharges)
- {
- Info("Charge number:{$}", nBatteryCharges);
- m_nBatteryCharges = nBatteryCharges;
- }
- break;
- }
- case EVT_INFO_WIFI_DATARATE:
- {
- m_stDeviceConfig.nWifiDataRate = nParam1;
- Info("Detector {$} WifiDataRate:{$}", nID, m_stDeviceConfig.nWifiDataRate);
- break;
- }
- case EVT_INFO_WIFI_CHANNEL:
- {
- m_stDeviceConfig.nWifiChannel = nParam1;
- Info("Panel {$} WifiChannel:{$}", nID, m_stDeviceConfig.nWifiChannel);
- break;
- }
- case EVT_INFO_WIFI_SIGNALPOWER:
- {
- m_stDeviceConfig.nWifiSignalPower = nParam1;
- break;
- }
- case EVT_INFO_WIFI_NOISEPOWER:
- {
- m_stDeviceConfig.nWifiNoisePower = nParam1;
- Info("Panel {$} WifiNoisePower:{$}", nID, m_stDeviceConfig.nWifiNoisePower);
- break;
- }
- case EVT_INFO_FIRMWARE:
- {
- m_stDeviceConfig.strFirmware = pszMsg;
- Info("Panel {$} Firmware:{$}", nID, pszMsg);
- break;
- }
- case EVT_INFO_SHOCKSENSOR_INFO:
- {
- Info("Receive ShockSensor Info");
- break;
- }
- case EVT_INFO_CALIBRATIOIN_TIME:
- {
- m_stDeviceConfig.strCalibrationDate = pszMsg;
- Info("Panel {$} Calibration Time:{$}", nID, pszMsg);
- m_DetectorCtrlUnit->SetDateofLastDetectorCalibration(m_stDeviceConfig.strCalibrationDate);
- m_DetectorCtrlUnit->SetTimeofLastDetectorCalibration("");
- break;
- }
- case EVT_INFO_CALIBRATIOIN_TIMEL:
- {
- Info("Panel {$} Calibration LTE Time:{$}", nID, pszMsg);
- break;
- }
- case EVT_INFO_FPVOLTAGE:
- {
- break;
- }
- default:
- break;
- }
- }
- void nsFPD::FPDDeviceTrixell::OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- int nID = nDetectorID;
- switch (nEventID)
- {
- case EVT_STATUS_INIT:
- {
- string strPath = m_strWorkPath + "\\OEMDrivers\\Detector\\Trixell\\TrixellDRDetector\\PIXIUMAPI\\pixrad.dll";
- m_stDeviceConfig.strSoftware = GetFileVersion(strPath);
- Info("pixrad.dll version : {$} init staus {$}", m_stDeviceConfig.strSoftware.c_str(), nParam1);
- printf("-------- pixrad EVT_STATUS_INIT %d \n", nParam1);
- if (PANEL_EVENT_END_OK == nParam1)
- {
- OnInitResult(true);
- m_DetectorCtrlUnit->SetInitialStatus(to_string(DETECTOR_INI_SUCCESS));
- Info("connect FPD ok. Start Status Polling");
- }
- else if (PANEL_EVENT_END_ERROR == nParam1)
- {
- OnInitResult(false);
- m_DetectorCtrlUnit->SetInitialStatus(to_string(DETECTOR_INI_FAILED));
- }
- else if (PANEL_EVENT_END == nParam1) //未连接探测器
- {
- m_DetectorCtrlUnit->SetInitialStatus(to_string(DETECTOR_INI_SUCCESS));
- }
- else if (PANEL_EVENT_START == nParam1)
- {
- m_DetectorCtrlUnit->SetInitialStatus(to_string(DETECTOR_INI_START));
- }
- break;
- }
- case EVT_STATUS_MOTION:
- {
- break;
- }
- case EVT_STATUS_UPDATE_FIRMWARE:
- {
- if (PANEL_EVENT_START == nParam1)
- {
- Info("Start update firmware");
- m_DetectorCtrlUnit->SetUpdateFWStatus(to_string(DETECTOR_UFW_START));
- }
- else if (PANEL_EVENT_BEGIN == nParam1)
- {
- Info("Update firmware begin");
- m_stDeviceConfig.bConnectStatus = false;
- }
- else if (PANEL_EVENT_END_ERROR == nParam1)
- {
- Info("Update firmware failed");
- //SendDetectorInfo(); //更新探测器状态图标
- m_DetectorCtrlUnit->SetUpdateFWStatus(to_string(DETECTOR_UFW_ERROR));
- }
- else if (PANEL_EVENT_SUCCESS == nParam1)
- {
- Info("update firmware success");
- //SendDetectorInfo();
- m_DetectorCtrlUnit->SetUpdateFWStatus(to_string(DETECTOR_UFW_SUCCESS));
- }
- break;
- }
- case EVT_STATUS_SELFTEST:
- {
- break;
- }
- case EVT_STATUS_DETECTORSHARE:
- {
- break;
- }
- case EVT_STATUS_SINGLEINIT:
- {
- break;
- }
- case EVT_STATUS_SELECTPANEL:
- {
- break;
- }
- case EVT_STATUS_PANEL:
- {
- ENUM_PANEL_STATUS m_ePanelStatus = (ENUM_PANEL_STATUS)nParam1;
- if (PANEL_STANDBY == nParam1)
- {
- Info("Panel Status:PREPARE");
- }
- else if (PANEL_READY_EXP == nParam1)
- {
- Info("Panel Status:READY");
- Action_ExpReady();
- }
- else if (PANEL_OFFSET_CAL == nParam1)
- {
- Info("Panel Status:PANEL_OFFSET_CAL");
- }
- else if (PANEL_OFFSET_FINISH == nParam1)
- {
- Info("Panel Status:PANEL_OFFSET_FINISH");
- }
- else if (PANEL_XWINDOW_ON == nParam1) //Xwindow On
- {
- Info("Panel Status:XWINDOW_ON");
- XWindowOnNotify();
- }
- else if (PANEL_XWINDOW_OFF == nParam1) // Xwindow Off
- {
- Info("Panel Status:XWINDOW_OFF");
- XWindowOffNotify();
- if (APP_STATUS_CAL_BEGIN == m_eAppStatus)
- {
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
- }
- }
- else if (PANEL_GET_IMAGE == nParam1)
- {
- Info("Panel Status: PANEL_GET_IMAGE");
- }
- else if (PANEL_GAIN_FINISH == nParam1)
- {
- Info("Panel Status:CALIBRATION_FINISH");
- }
- else if (PANEL_GAIN_PREPARE == nParam1)
- {
- Info("Detector Notify Xray Prepare");
- }
- else if (PANEL_GAIN_READY_EXP == nParam1)
- {
- Action_ExpReady();
- }
- else if (PANEL_AED_XRAY_ON == nParam1)
- {
- Info("AED xray on");
- m_SyncUnit->XrayOnNotify();
- m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));
- }
- else if (PANEL_AED_XRAY_OFF == nParam1)
- {
- Info("AED xray off");
- m_SyncUnit->XrayOffNotify();
- }
- else
- {
- Info("Panel {$} Status is :{$}", nID, (int)m_ePanelStatus);
- }
- break;
- }
- case EVT_STATUS_CALIBRATIOIN:
- {
- ENUM_PANEL_EVENT_STATE eStatus = (ENUM_PANEL_EVENT_STATE)nParam1;
- switch (eStatus)
- {
- case PANEL_EVENT_START:
- break;
- case PANEL_EVENT_END_OK:
- Info("Calibration process is success");
- CompleteCalibration();
- break;
- case PANEL_EVENT_END_ERROR:
- Info("Calibration process is failed");
- break;
- case PANEL_EVENT_TIMEOUT:
- Info("Calibration timeout");
- Info("Calibration process is failed");
- break;
- default:
- break;
- }
- break;
- }
- case EVT_STATUS_SAVECALIB:
- {
- if (PANEL_EVENT_START == nParam1)
- {
- Info("Begin to Save Calibration Files");
- }
- else if (PANEL_EVENT_END_ERROR == nParam1)
- {
- SetEvent(m_UploadCalibMapOver);
- Info("Save Calibration Files failed");
- }
- else if (PANEL_EVENT_END == nParam1)
- {
- SetEvent(m_UploadCalibMapOver);
- Info("Save Calibration Files Success");
- }
- break;
- }
- case EVT_STATUS_SAVEDEFECT:
- {
- if (PANEL_EVENT_START == nParam1)
- {
- Info("Begin to Save Defect Files");
- }
- else if (PANEL_EVENT_END_ERROR == nParam1)
- {
- SetEvent(m_UploadCalibMapOver);
- Info("Save Defect Files failed");
- }
- else if (PANEL_EVENT_END == nParam1)
- {
- m_stDeviceConfig.bTaskEnd = true;
- Info("Save Defect Files Success");
- SetEvent(m_UploadCalibMapOver);
- }
- break;
- }
- case EVT_STATUS_ACQUISITION:
- {
- ENUM_PANEL_EVENT_STATE eStatus = (ENUM_PANEL_EVENT_STATE)nParam1;
- switch (eStatus)
- {
- case PANEL_EVENT_START:
- break;
- case PANEL_EVENT_END_OK:
- break;
- case PANEL_EVENT_END_ERROR:
- break;
- default:
- break;
- }
- break;
- }
- case EVT_STATUS_SINGLEEXP:
- {
- if (DOSE_TOO_HIGH == nParam1)
- {
- Info("Dose too high");
- OnError(nID, "ERR_FPD_DOSE_INVALID", m_strLastError);
- StopCalibration();
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationProgress("100");
- m_AcqUnit->SendNoNeedWaitImage(true);
- }
- else if (DOSE_TOO_LOW == nParam1)
- {
- Info("Dose too low");
- OnError(nID, "ERR_FPD_DOSE_INVALID", m_strLastError);
- StopCalibration();
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_CalibUnit->SetCalibrationProgress("100");
- m_AcqUnit->SendNoNeedWaitImage(true);
- }
- else if (DOSE_OBJECT == nParam1)
- {
- Info("Dose object");
- OnError(nID, "ERR_FPD_DOSE_INVALID", m_strLastError);
- StopCalibration();
- m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
- m_AcqUnit->SendNoNeedWaitImage(true);
- }
- else if (DOSE_ACCEPT == nParam1)
- {
- Info("Calibration Result is acceptable");
- SetEvent(m_PauseCalibrationEvt);
- }
- else if (EVT_STATUS_LASTERROR == nParam1)
- {
- m_strLastError = pszMsg;
- Info("Panel {$} LastError {$}", nID, pszMsg);
- }
- //endif
- break;
- }
- case EVT_STATUS_IMAGEPENDING:
- {
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- m_bImagePendingOrNot = true;
- }
- else
- {
- m_bImagePendingOrNot = false;
- }
- if (m_bImagePendingOrNot) // && !m_bResetDetector
- {
- OnError(nID, "ERR_FPD_IMAGE_PENDING");
- }
- else
- {
- m_bResetDetector = false;//可以再次reset
- }
- break;
- }
- case EVT_STATUS_TEMPERATURE:
- {
- float fTemperature = fParam2;
- OnProcessTemperature(nID, fTemperature);
- m_stDeviceConfig.fCurrentTemperValue = fTemperature;
- SendTemperatureValue();
- break;
- }
- case EVT_STATUS_WIFI:
- {
- int nWifiLevel = nParam1;
- if (m_stDeviceConfig.strDeviceName.find("3543DR") >= 0)
- {
- nWifiLevel = int(nWifiLevel / 0.75);
- if (nWifiLevel > 100)
- {
- nWifiLevel = 100;
- }
- }
- Info("Detector {$} Wifi Value:{$}", nID, nWifiLevel);
- if (nWifiLevel == 0) //WIFI值为0 表明是有线连接,不报错
- {
- ClearError(nID, ERR_FPD_WIFI_LOW);
- ClearWarn(nID, WAR_FPD_WIFI_LOW);
- }
- else if (nWifiLevel < m_stDeviceConfig.nWifiLimit)
- {
- ClearWarn(nID, WAR_FPD_WIFI_LOW);
- OnError(nID, ERR_FPD_WIFI_LOW);
- }
- else if (nWifiLevel <= m_stDeviceConfig.nWifiWarning)
- {
-
- ClearError(nID, ERR_FPD_WIFI_LOW);
- OnWarn(nID, WAR_FPD_WIFI_LOW);
- }
- else
- {
- ClearWarn(nID, WAR_FPD_WIFI_LOW);
- ClearError(nID, ERR_FPD_WIFI_LOW);
- }
- if (nWifiLevel != m_stDeviceConfig.nCurrentWifiValue)
- {
- Info("Channel:{$},SignalPower:{$},NoisePower:{$},DataRate:{$}", m_stDeviceConfig.nWifiChannel, m_stDeviceConfig.nWifiSignalPower, m_stDeviceConfig.nWifiNoisePower, m_stDeviceConfig.nWifiDataRate);
- }
- //endif
- m_stDeviceConfig.nCurrentWifiValue = nWifiLevel;
- SendWifiValue();
- //SendDetectorInfo();
- break;
- }
- case EVT_STATUS_BATTERY_VALUE:
- {
- int nBatteryValue = nParam1;
- Info("Detector {$} Battery:{$}", nID, nParam1);
- if (nBatteryValue < m_stDeviceConfig.nBatteryLimit)
- {
- //battery error
- ClearWarn(nID, WAR_FPD_BATTERY_LOW);
- OnError(nID, ERR_FPD_BATTERY_LOW);
- }
- else if (nBatteryValue < m_stDeviceConfig.nBatteryWarning)
- {
- //battery warning
- ClearError(nID, ERR_FPD_BATTERY_LOW);
- OnWarn(nID, WAR_FPD_BATTERY_LOW);
- }
- else
- {
- ClearWarn(nID, WAR_FPD_BATTERY_LOW);
- ClearError(nID, ERR_FPD_BATTERY_LOW);
- }
- m_stDeviceConfig.nCurrentBatteryValue = nBatteryValue;
- Info("Detector {$} Battery Value:{$}", nID, nBatteryValue);
- SendBatteryValue();
- break;
- }
- case EVT_STATUS_BATTERY_CHARGING:
- {
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- m_bBatteryCharging = true;
- }
- else
- {
- m_bBatteryCharging = false;
- }
- break;
- }
- case EVT_STATUS_SHOCK_SENSOR:
- {
- break;
- }
- case EVT_STATUS_HALL_SENSOR:
- {
- break;
- }
- case EVT_STATUS_PING:
- {
- break;
- }
- case EVT_STATUS_RESTOREFILES:
- {
- break;
- }
- case EVT_STATUS_LASTERROR:
- {
- m_strLastError = pszMsg;
- Info("Panel {$} LastError {$}", nID, pszMsg);
- break;
- }
- case EVT_STATUS_RESET:
- {
- Info("Detector reset status: {$}", nParam1);
- break;
- }
- case EVT_AUTONUMOUS_STATUS:
- {
- ENUM_PANEL_EVENT_STATE eStatus = (ENUM_PANEL_EVENT_STATE)nParam1;
- switch (eStatus)
- {
- case PANEL_CONNECT_ERROR:
- {
- break;
- }
- case PANEL_CONNECT_OK:
- {
- m_stDeviceConfig.bConnectStatus = true;
- break;
- }
- case PANEL_DISCONNECT_SUCCESS:
- {
- m_nBatteryCapacity = 0;
- m_stDeviceConfig.bExisted = false;
- m_stDeviceConfig.bConnectStatus = false;
- break;
- }
- case PANEL_DISCONNECT_ERROR:
- {
- break;
- }
- case PANEL_START_STOREDIMAGE:
- {
- Info("Send start autonumous to server");
- m_AcqUnit->SendAutonumousMapFinish(0);
- break;
- }
- case PANEL_END_STOREDIMAGE:
- {
- Info("Send finish autonumous to server");
- m_AcqUnit->SendAutonumousMapFinish(1);
- break;
- }
- case PANEL_EXPORT_AUTONUMOUS_FINISH:
- {
- Info("Send finish export local autonumous to server");
- m_AcqUnit->SendAutonumousMapFinish(2);
- break;
- }
- default:
- break;
- }
- break;
- }
- default:
- break;
- }
- }
- void nsFPD::FPDDeviceTrixell::OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- switch (nEventID)
- {
- case EVT_DATA_RAW_IMAGE:
- {
- Info("EVT_DATA_RAW_IMAGE");
- Info("Currenct Image Width:{$}, Height:{$}", m_stDeviceConfig.nFullImageWidth, m_stDeviceConfig.nFullImageHeight);
- float fImageReferUGY = 2.5;
- if (APP_STATUS_WORK_BEGIN == m_eAppStatus) //如果是在检查中
- {
- fImageReferUGY = 2.5;
- }
- if (NULL == m_pwRawImageData)
- {
- m_pwRawImageData = new WORD[m_stDeviceConfig.nFullImageWidth * m_stDeviceConfig.nFullImageHeight];
- }
- memcpy(m_pwRawImageData, pParam, m_stDeviceConfig.nFullImageWidth * m_stDeviceConfig.nFullImageHeight * sizeof(WORD));
- OnProcessImage(m_pwRawImageData, m_stDeviceConfig.nFullImageWidth, m_stDeviceConfig.nFullImageHeight, fImageReferUGY);
- break;
- }
- case EVT_DATA_PREVIEW_IMAGE:
- {
- Info("Preview Image Arrved");
- Info("Current FPD preview image width: {$}, height: {$}", m_stDeviceConfig.nPreviewWidth, m_stDeviceConfig.nPreviewHeight);
- m_SyncUnit->ImageReadingNotify();
- if (NULL == m_pwPreviewImg)
- {
- m_pwPreviewImg = new WORD[m_stDeviceConfig.nPreviewWidth * m_stDeviceConfig.nPreviewHeight];
- }
- memcpy(m_pwPreviewImg, pParam, m_stDeviceConfig.nPreviewWidth * m_stDeviceConfig.nPreviewHeight * sizeof(WORD));
- OnProcessPreviewImage(m_pwPreviewImg, m_stDeviceConfig.nPreviewWidth, m_stDeviceConfig.nPreviewHeight);
- break;
- }
- case EVT_DATA_DOSEPARAM:
- {
- m_fDoseParam = fParam2;
- SetEvent(m_WaitCalibDoseEvt);
- break;
- }
- default:
- break;
- }
- }
- void nsFPD::FPDDeviceTrixell::OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- string strErrorName = "";
- switch (nEventID)
- {
- case EVT_ERR_COMMUNICATE:
- {
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- m_stDeviceConfig.nWorkstation = -1;
- m_stDeviceConfig.bConnectStatus = false;
- m_nBatteryCapacity = 0;
- m_stDeviceConfig.fCurrentTemperValue = 0.0f;
- m_stDeviceConfig.nCurrentWifiValue = 0;
- m_stDeviceConfig.nCurrentBatteryValue = 0;
- SendWifiValue();
- SendBatteryValue();
- SendTemperatureValue();
- OnError(nDetectorID, ERR_FPD_DISCONNECT, "");
- m_DetectorCtrlUnit->SetConnectStatus(to_string(PANEL_CONNECT_ERROR));
- }
- else if (strTemp.find("false") != std::string::npos)//成功时交给WIFI发送SendDetectorInfo
- {
- m_stDeviceConfig.bConnectStatus = true;
- ClearError(nDetectorID, ERR_FPD_DISCONNECT);
- m_DetectorCtrlUnit->SetConnectStatus(to_string(PANEL_CONNECT_OK));
- }
- break;
- }
- case EVT_ERR_EXP_REQUEST:
- {
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- }
- else
- {
- return;
- }
- strErrorName = "ERR_FPD_ACQ_FAILED";
- break;
- }
- case EVT_ERR_GET_IMAGE:
- {
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- if (APP_STATUS_WORK_BEGIN != m_eAppStatus) //如果不在检查界面;
- {
- Fatal("there are image exist in current detector,do you want to continue");
- }
- else //if (m_bSiemensCmd)
- {
- Fatal("FPD has exposed Image!");
- //CallSiemensRecoverAction(true);
- }
- //endif
- }
- else if (strTemp.find("false") != std::string::npos)
- {
- //CallSiemensRecoverAction(false);
- }
- break;
- }
- case EVT_ERR_MAX_NUMBER:
- {
- //strErrorName = ERR_FPD_MAX_NUMBER;
- //string strTemp = pszMsg;
- //if (strTemp.find("true") != std::string::npos)
- //{
- // Error("Exceed max number");
- // OnError(nDetectorID, strErrorName);
- //}
- break;
- }
- case EVT_ERR_SN_NOTINLIST:
- {
- //strErrorName = ERR_FPD_SN_NOT_LIST;
- //Error("Not in List");
- //string strTemp = pszMsg;
- //if (strTemp.find("true") != std::string::npos)
- //{
- // OnError(nDetectorID, strErrorName);
- //}
- break;
- }
- case EVT_ERR_POWER_OFF:
- {
- strErrorName = "ERR_FPD_POWEROFF";
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- OnError(nDetectorID, strErrorName);
- m_stDeviceConfig.bConnectStatus = false;
- }
- else if (strTemp.find("false") != std::string::npos)
- {
- m_WarnAndError->ClearError(strErrorName);
- }
- break;
- }
- case EVT_ERR_INIT_FAILED:
- {
- strErrorName = "ERR_FPD_FATAL_ERROR";
- string strTemp = pszMsg;
- if (strTemp.find("true") != std::string::npos)
- {
- OnError(nDetectorID, strErrorName);
- m_stDeviceConfig.bConnectStatus = false;
- }
- else if (strTemp.find("false") != std::string::npos)
- {
- //m_WarnAndError->OnErrorX(strErrorName);
- }
- break;
- }
- default:
- break;
- }
- }
- void nsFPD::FPDDeviceTrixell::OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
- {
- Warn("Not support this warn({$})", nEventID);
- }
- bool nsFPD::FPDDeviceTrixell::OnInitResult(bool bSuccess)
- {
- if (bSuccess)
- {
- m_stDeviceConfig.bConnectStatus = true;
- //CheckCalibartionDue();
- //LoadSensitivity();
- }
- else
- {
- m_stDeviceConfig.bConnectStatus = false;
- }
- m_stDeviceConfig.bExisted = true;
- return true;
- }
- bool nsFPD::FPDDeviceTrixell::OnProcessPreviewImage(WORD* pwRawImage, int nWidth, int nHeight)
- {
- Info("Currenct PreviewImage Width:{$},Height:{$}", m_stDeviceConfig.nPreviewWidth, m_stDeviceConfig.nPreviewHeight);
- PrevImageDateArrived(pwRawImage);
- Info("Write PreviewImage Over");
- return true;
- }
- bool nsFPD::FPDDeviceTrixell::OnProcessImage(WORD* pwRawImage, int nImageWidth, int nImageHeight, float fImageReferUGY)
- {
- Info("OnProcessImage start");
- if (nImageWidth < m_nFullImgWidth + m_nLeftOffset)
- {
- Info("nImageWidth:{$},m_nFullImgWidth: {$},m_nLeftOffset:{$}", nImageWidth, m_nFullImgWidth, m_nLeftOffset);
- m_nFullImgWidth = nImageWidth;
- m_nLeftOffset = 0;
- }
- if (nImageHeight < m_nFullImgHeight + m_nTopOffset)
- {
- Info("nImageHeight:{$},m_nFullImgHeight: {$},m_nLeftOffset:{$}", nImageHeight, m_nFullImgHeight, m_nTopOffset);
- m_nFullImgHeight = nImageHeight;
- m_nTopOffset = 0;
- }
- /*bool bResult = GetEffectiveImage(pwRawImage, nImageWidth);
- if (!bResult)
- {
- return true;
- }*/
- //m_pwFullImageData[0] = 65535;//坐标原点 bug 8164
- //FullImageDateArrived(m_pwFullImageData);
- FullImageDateArrived(pwRawImage);
- Info("Write Frame Over");
- Info("OnProcessImage end");
- return true;
- }
- /***************************************************************
- 功能:将原始尺寸的图像裁剪为有效尺寸的图像
- [IN][OUT]:pOutImg 有效尺寸图像信息
- [IN]:pInImgData 原始尺寸图像数据
- [IN]:nInWidth 原始尺寸图像的宽度
- [IN]:nUpHeightOffset 要裁剪的上边高度
- [IN]:nLeftWidthOffset要裁剪的左边宽度
- ************************************************************/
- bool nsFPD::FPDDeviceTrixell::GetEffectiveImage(WORD* pwInImgData, int nRawImageWidth)
- {
- if (pwInImgData == NULL)
- {
- return false;
- }
- if (!m_pwFullImageData)
- {
- Info("Full ImgHeight:{$},Full ImgWidth:{$}", m_stDeviceConfig.nFullImageWidth, m_stDeviceConfig.nFullImageHeight);
- m_pwFullImageData = new WORD[m_stDeviceConfig.nFullImageWidth * m_stDeviceConfig.nFullImageHeight];
- }
- memcpy(m_pwFullImageData, pwInImgData, m_stDeviceConfig.nFullImageWidth * m_stDeviceConfig.nFullImageHeight * sizeof(WORD));
- return true;
- try
- {
- Info("TopOffset:{$},LeftOffset:{$},RawImgWidth:{$}", m_nTopOffset, m_nLeftOffset, nRawImageWidth);
- for (int i = 0; i < m_nFullImgHeight; i++)
- {
- memcpy(m_pwFullImageData + i * m_nFullImgWidth,
- pwInImgData + (i + m_nTopOffset) * nRawImageWidth + m_nLeftOffset,
- m_nFullImgWidth * sizeof(WORD));
- }
- }
- catch (...)
- {
- Info("Get Effective Image Crash");
- return false;
- }
- return true;
- }
- void nsFPD::FPDDeviceTrixell::OnProcessTemperature(int nID, float fTemperature)
- {
- if (fTemperature >= m_stDeviceConfig.fTemperMaxLimit)
- {
- Info("Exceed Max Temperature");
- m_stDeviceConfig.nTemperatureStatus = TEMP_TOO_HIGH;
- ClearWarn(nID, WAR_FPD_TEMPERATURE_HIGH);
- ClearWarn(nID, WAR_FPD_TEMPERATURE_LOW);
- ClearError(nID, ERR_FPD_TEMPERATURE_LOW);
- OnError(nID, ERR_FPD_TEMPERATURE_HIGH);
- }
- else if (fTemperature <= m_stDeviceConfig.fTemperMinLimit)
- {
- Info("Exceed Min Temperature");
- m_stDeviceConfig.nTemperatureStatus = TEMP_TOO_LOW;
- ClearWarn(nID, WAR_FPD_TEMPERATURE_HIGH);
- ClearWarn(nID, WAR_FPD_TEMPERATURE_LOW);
- ClearError(nID, ERR_FPD_TEMPERATURE_HIGH);
- OnError(nID, ERR_FPD_TEMPERATURE_LOW);
- }
- else if (fTemperature >= m_stDeviceConfig.fTemperUpperLimit)
- {
- Info("Exceed Temperature High Warning");
- m_stDeviceConfig.nTemperatureStatus = TEMP_WARNING;
- ClearError(nID, ERR_FPD_TEMPERATURE_LOW);
- ClearError(nID, ERR_FPD_TEMPERATURE_HIGH);
- ClearWarn(nID, WAR_FPD_TEMPERATURE_LOW);
- OnWarn(nID, WAR_FPD_TEMPERATURE_HIGH);
- }
- else if (fTemperature <= m_stDeviceConfig.fTemperLowLimit)
- {
- Info("Exceed Temperature Low Warning");
- m_stDeviceConfig.nTemperatureStatus = TEMP_WARNING;
- ClearError(nID, ERR_FPD_TEMPERATURE_LOW);
- ClearError(nID, ERR_FPD_TEMPERATURE_HIGH);
- ClearWarn(nID, WAR_FPD_TEMPERATURE_HIGH);
- OnWarn(nID, WAR_FPD_TEMPERATURE_LOW);
- }
- else if ((fTemperature < m_stDeviceConfig.fTemperUpperLimit) && (fTemperature > m_stDeviceConfig.fTemperLowLimit))
- {
- //Info("Temperature Normal");
- m_stDeviceConfig.nTemperatureStatus = TEMP_NORMAL;
- ClearError(nID, ERR_FPD_TEMPERATURE_LOW);
- ClearError(nID, ERR_FPD_TEMPERATURE_HIGH);
- ClearWarn(nID, WAR_FPD_TEMPERATURE_HIGH);
- ClearWarn(nID, WAR_FPD_TEMPERATURE_LOW);
- }//end if
- }
- void nsFPD::FPDDeviceTrixell::Action_ExpReady()
- {
- m_SyncUnit->FPDReadyNotify(true);
- }
- /***
- * 客户端获取探测器信息
- ***/
- RET_STATUS nsFPD::FPDDeviceTrixell::GetDetectorInfo(string& strFDI)
- {
- ResDataObject strDetectorInfo;
- string strTempTemp = " ";
- Info("Get Detector Info");
- if (m_stDeviceConfig.strPanelSerial == "")
- {
- Info("Get Detector Info Failed, Send Default Info");
- strDetectorInfo.add("DetectorName", "Simulator");
- strDetectorInfo.add("DetectorSN", "Simulator");
- strDetectorInfo.add("Firmware", " ");
- strDetectorInfo.add("APFirmware", " ");
- strDetectorInfo.add("Software", m_stDeviceConfig.strSoftware.c_str());
- strDetectorInfo.add("SSID", " ");
- strDetectorInfo.add("LifeTime", "0");
- strDetectorInfo.add("PowerOn", "0");
- strDetectorInfo.add("DateCode", " ");
- strDetectorInfo.add("PartNumber", " ");
- strDetectorInfo.add("WifiDataRate", " ");
- strDetectorInfo.add("WifiChannel", "0");
- strDetectorInfo.add("DetectorExist", "0");
- strDetectorInfo.add("SystemAS", "0");
- strDetectorInfo.add("CalibrationDate", "0");
- strDetectorInfo.add("CalibrationDue", "0");
- strDetectorInfo.add("CalibrationExist", "0");
- strDetectorInfo.add("CommunicationStatus", "0");
- strDetectorInfo.add("DetectorTemperature", "0");
- strDetectorInfo.add("FDCalibrationTemperature", "0");
- strDetectorInfo.add("TemperatureStatus", "0");
- strDetectorInfo.add("WaitTime", "0");
- strDetectorInfo.add("DetectorWifiSignal", "0");
- strDetectorInfo.add("DetectorBattery", "0");
- strDetectorInfo.add("ShockSensor", "NULL");
- strDetectorInfo.add("FirmwareUpdate", "0");
- //encode
- strFDI = strDetectorInfo.encode();
- return RET_STATUS::RET_SUCCEED;
- }
- strDetectorInfo.add("DetectorName", m_stDeviceConfig.strDeviceName.c_str());
- strDetectorInfo.add("DetectorSN", m_stDeviceConfig.strPanelSerial.c_str());
- strDetectorInfo.add("Firmware", m_stDeviceConfig.strFirmware.c_str());
- strDetectorInfo.add("APFirmware", "NULL");
- strDetectorInfo.add("Software", m_stDeviceConfig.strSoftware.c_str());
- strDetectorInfo.add("SSID", m_stDeviceConfig.strWifiSSID.c_str());
- strDetectorInfo.add("LifeTime", m_stDeviceConfig.nLifeTime);
- strDetectorInfo.add("PowerOn", m_stDeviceConfig.nPowerOn);
- strDetectorInfo.add("DateCode", " ");
- strDetectorInfo.add("PartNumber", m_stDeviceConfig.strPartNumber.c_str());
- strDetectorInfo.add("WifiDataRate", m_stDeviceConfig.nWifiDataRate);
- strDetectorInfo.add("WifiChannel", m_stDeviceConfig.nWifiChannel);
- strDetectorInfo.add("DetectorExist", m_stDeviceConfig.bExisted);
- //System Workstation
- if (m_stDeviceConfig.strDeviceName.find("3543") != std::string::npos)
- {
- strDetectorInfo.add("SystemAS", /*m_stDeviceConfig.nWorkstation*/3);
- }
- else
- {
- strDetectorInfo.add("SystemAS", /*m_stDeviceConfig.nWorkstation*/3);
- }
- //DetectorCalibrationDate
- if (m_stDeviceConfig.strCalibrationDate != " ")
- {
- if (m_stDeviceConfig.strCalibrationDate.find("19700101") != std::string::npos)
- {
- strDetectorInfo.add("CalibrationDate", "0");
- strDetectorInfo.add("CalibrationDue", "0");
- strDetectorInfo.add("CalibrationExist", 0);
- }
- else
- {
- strDetectorInfo.add("CalibrationDate", m_stDeviceConfig.strCalibrationDate.c_str()/*"20210610"*/);
- strDetectorInfo.add("CalibrationDue", m_stDeviceConfig.strCalibrationDue.c_str()/*"20210610"*/);
- strDetectorInfo.add("CalibrationExist", 1);
- }
- }
- else
- {
- strDetectorInfo.add("CalibrationDate", "0");
- strDetectorInfo.add("CalibrationDue", "0");
- strDetectorInfo.add("CalibrationExist", 0);
- }
- if (m_stDeviceConfig.bConnectStatus)
- {
- strDetectorInfo.add("CommunicationStatus", 1);
- }
- else
- {
- strDetectorInfo.add("CommunicationStatus", 0);
- }
- strDetectorInfo.add("FDCalibrationTemperature", m_stDeviceConfig.fCalibTemperature);
- strDetectorInfo.add("ShockSensor", m_nShockCounts);
- strDetectorInfo.add("FirmwareUpdate", 0);
- //Info( "{$}", strDetectorInfo.encode());
- strFDI = strDetectorInfo.encode();
- return RET_STATUS::RET_SUCCEED;
- }
- string nsFPD::FPDDeviceTrixell::MakeImageHead(IMAGE_VIEW_TYPE Type)
- {
- if (Type == IMAGE_FULL)
- {
- float fFactorEXI2UGY = 1.0f;
- if (APP_STATUS_WORK_BEGIN == m_eAppStatus)
- {
- fFactorEXI2UGY = m_fFactorEXI2UGY;
- }
- if (m_pFullImageHead == NULL)
- {
- m_pFullImageHead = new ResDataObject;
- ResDataObject json;
- json.add(SM_IMAGE_TYPE, (int)Type);
- json.add(SM_IMAGE_WIDTH, m_stDeviceConfig.nFullImageWidth);
- json.add(SM_IMAGE_HEIGHT, m_stDeviceConfig.nFullImageHeight);
- json.add(SM_IMAGE_BIT, 16);
- json.add(SM_IMAGE_TAG, 1);
- json.add(SM_IMAGE_INDEX, 1);
- json.add(SM_IMAGE_YEAR, m_stImgCreateTime.wYear);
- json.add(SM_IMAGE_MONTH, m_stImgCreateTime.wMonth);
- json.add(SM_IMAGE_DAY, m_stImgCreateTime.wDay);
- json.add(SM_IMAGE_HOUR, m_stImgCreateTime.wHour);
- json.add(SM_IMAGE_MINUTE, m_stImgCreateTime.wMinute);
- json.add(SM_IMAGE_SEC, m_stImgCreateTime.wSecond);
- json.add(SM_IMAGE_MILLSEC, m_stImgCreateTime.wMilliseconds);
- json.add(SM_IMAGE_LSB, "5000");
- json.add(SM_IMAGE_DOSE, m_stDeviceConfig.nDoseOfEXI);
- json.add(SM_IMAGE_PIXELREPRESENTATION, "1");
- json.add(SM_IMAGE_PIXELSPACING, m_stDeviceConfig.nPixelSpace);
- json.add(SM_IMAGE_ROTATION, "No");
- json.add(SM_IMAGE_FLIP, "No");
- json.add(SM_IMAGE_ORIGINX, "0");
- json.add(SM_IMAGE_ORIGINY, "0");
- json.add(SM_IMAGE_EXI2UGY, fFactorEXI2UGY);
- json.add(SM_IMAGE_TEMP, 0.0f);
- m_pFullImageHead->add(SM_IMAGE_HEAD, json);
- }
- else
- {
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_YEAR] = m_stImgCreateTime.wYear;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_MONTH] = m_stImgCreateTime.wMonth;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_DAY] = m_stImgCreateTime.wDay;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_HOUR] = m_stImgCreateTime.wHour;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_MINUTE] = m_stImgCreateTime.wMinute;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_SEC] = m_stImgCreateTime.wSecond;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_MILLSEC] = m_stImgCreateTime.wMilliseconds;
- (*m_pFullImageHead)[SM_IMAGE_HEAD][SM_IMAGE_TEMP] = m_stDeviceConfig.fCurrentTemperValue;
- Info("Temperature in image is {$}", m_stDeviceConfig.fCurrentTemperValue);
- }
- return (*m_pFullImageHead).encode();
- }
- else
- {
- if (m_pPreviewImageHead == NULL)
- {
- m_pPreviewImageHead = new ResDataObject;
- ResDataObject json;
- json.add(SM_IMAGE_TYPE, (int)Type);
- json.add(SM_IMAGE_WIDTH, m_stDeviceConfig.nPreviewWidth);
- json.add(SM_IMAGE_HEIGHT, m_stDeviceConfig.nPreviewHeight);
- json.add(SM_IMAGE_BIT, 16);
- json.add(SM_IMAGE_TAG, 1);
- json.add(SM_IMAGE_INDEX, 1);
- json.add(SM_IMAGE_YEAR, m_stImgCreateTime.wYear);
- json.add(SM_IMAGE_MONTH, m_stImgCreateTime.wMonth);
- json.add(SM_IMAGE_DAY, m_stImgCreateTime.wDay);
- json.add(SM_IMAGE_HOUR, m_stImgCreateTime.wHour);
- json.add(SM_IMAGE_MINUTE, m_stImgCreateTime.wMinute);
- json.add(SM_IMAGE_SEC, m_stImgCreateTime.wSecond);
- json.add(SM_IMAGE_MILLSEC, m_stImgCreateTime.wMilliseconds);
- json.add(SM_IMAGE_LSB, "5000");
- json.add(SM_IMAGE_DOSE, m_stDeviceConfig.nDoseOfEXI);
- json.add(SM_IMAGE_ROTATION, "No");
- json.add(SM_IMAGE_FLIP, "No");
- json.add(SM_IMAGE_ORIGINX, "0");
- json.add(SM_IMAGE_ORIGINY, "0");
- json.add(SM_IMAGE_PIXELSPACING, m_stDeviceConfig.nPixelSpace);
- json.add(SM_IMAGE_PIXELREPRESENTATION, "1");
- json.add(SM_IMAGE_TEMP, m_stDeviceConfig.fCurrentTemperValue);
- m_pPreviewImageHead->add(SM_IMAGE_HEAD, json);
- }
- else
- {
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_YEAR] = m_stImgCreateTime.wYear;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_MONTH] = m_stImgCreateTime.wMonth;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_DAY] = m_stImgCreateTime.wDay;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_HOUR] = m_stImgCreateTime.wHour;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_MINUTE] = m_stImgCreateTime.wMinute;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_SEC] = m_stImgCreateTime.wSecond;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_MILLSEC] = m_stImgCreateTime.wMilliseconds;
- (*m_pPreviewImageHead)[SM_IMAGE_HEAD][SM_IMAGE_TEMP] = m_stDeviceConfig.fCurrentTemperValue;
- }
- return (*m_pPreviewImageHead).encode();
- }
- return "";
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::AddFrameWithRawHead(IMAGE_VIEW_TYPE Type, WORD* pFrameBuff, DWORD FrameSize)
- {
- string strImageHead = MakeImageHead(Type);
- return m_AcqUnit->AddFrameWithRawHead(Type, strImageHead, pFrameBuff, FrameSize);
- }
- void nsFPD::FPDDeviceTrixell::OnError(int nIndex, string strErrCode, string strErr)
- {
- m_WarnAndError->SendError(strErrCode, strErr);
- }
- void nsFPD::FPDDeviceTrixell::ClearError(int nDetectorID, std::string strErrorCode, std::string strErr)
- {
- m_WarnAndError->ClearError(strErrorCode);
- }
- void nsFPD::FPDDeviceTrixell::OnWarn(int nIndex, string strWarnCode, string strWarn)
- {
- m_WarnAndError->SendWarn(strWarnCode, strWarn);
- }
- void nsFPD::FPDDeviceTrixell::ClearWarn(int nDetectorID, std::string strWarnCode, std::string strWarn)
- {
- m_WarnAndError->ClearWarn(strWarnCode);
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::ResetError()
- {
- m_WarnAndError->ClearAllError();
- m_WarnAndError->ClearAllWarn();
- return RET_STATUS::RET_SUCCEED;
- }
- void nsFPD::FPDDeviceTrixell::SendAllError()
- {
- m_WarnAndError->SendAllError();
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::SetSaveRawDataMode(int nSaveRawDataMode)
- {
- Info("## SetSaveRawDataMode ##");
- string strSaveMode = "";
- switch (nSaveRawDataMode)
- {
- case CCOS_NO_SAVE_RAW:
- strSaveMode = "No save raw image";
- break;
- case CCOS_SAVE_ORIGINAL:
- strSaveMode = "Save original raw image";
- break;
- case CCOS_SAVE_AFTER_CROP:
- strSaveMode = "Save after crop raw image";
- break;
- case CCOS_SAVE_AFTER_CALIB:
- strSaveMode = "Save after calibration raw image";
- break;
- case CCOS_SAVE_AFTER_GRID_SUPPRESSION:
- strSaveMode = "Save after GridSuppression raw image";
- break;
- case CCOS_SAVE_ALL:
- strSaveMode = "Save all raw image";
- break;
- default:
- strSaveMode = "Undefined";
- break;
- }
- Info("Set SaveRawData Mode: {$}({$})", strSaveMode, nSaveRawDataMode);
- m_pDetectors->SetSaveRawDataMode(nSaveRawDataMode);
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::OfflineFPD(int nOfflineFPDMode)
- {
- Info("## OfflineFPD ##");
- Info("Offline FPD mode: {$}", nOfflineFPDMode);
- if (nOfflineFPDMode == 1)
- {
- m_pDetectors->DisconnectDetector(0);
- }
- else if (nOfflineFPDMode == 2)
- {
- m_pDetectors->OfflineFPD(0);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::OnlineFPD(int nOnlineFPDMode)
- {
- Info("## OnlineFPD ##");
- Info("Online FPD mode: {$}", nOnlineFPDMode);
- if (nOnlineFPDMode == 1)
- {
- m_pDetectors->ConnectDetector(false, 0);
- }
- else if (nOnlineFPDMode == 2)
- {
- m_pDetectors->OnlineFPD(0);
- }
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::GetAutonumousImageList(int nDetectorID, vector<string>& AutonumousList)
- {
- Info("## GetAutonumousImageList ##");
- if (!m_pDetectors->GetAutonumousImageList(nDetectorID, AutonumousList))
- {
- Error("Get autonumous image list error");
- return RET_STATUS::RET_FAILED;
- }
- Info("Get autonumous image list success");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::RemoveAutonumousImageList(string strMeta)
- {
- Info("## RemoveAutonumousImageList ##");
- Info("Remove item: {$}", strMeta);
- if (!m_pDetectors->RemoveAutonumousImageList(strMeta))
- {
- Error("Remove autonumous image error");
- return RET_STATUS::RET_FAILED;
- }
- Error("Remove autonumous image success");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::RemoveAutonumousAll()
- {
- Info("## RemoveAutonumousAll ##");
- if (!m_pDetectors->RemoveAutonumousAll())
- {
- Error("Remove autonumous all image error");
- return RET_STATUS::RET_FAILED;
- }
- Info("Remove autonumous all image success");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::GetImageMetaData(string strMetaData)
- {
- Info("## GetImageMetaData ##");
- if (!m_pDetectors->GetImageMetaData(strMetaData))
- {
- Error("Get autonumous Meta Data error");
- return RET_STATUS::RET_FAILED;
- }
- Info("Get autonumous Meta Data success");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::ExportAutonumousAll()
- {
- Info("## ExportAutonumousAll ##");
- if (!m_pDetectors->ExportAutonumousAll())
- {
- Error("Get autonumous all image error");
- return RET_STATUS::RET_FAILED;
- }
- Info("Get autonumous all image success");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS nsFPD::FPDDeviceTrixell::ActiveSyncMode(int nSyncMode)
- {
- Info("ActiveSyncMode: {$}", nSyncMode);
- if (!m_pDetectors->SetSyncMode(0, nSyncMode))
- {
- Error("Set sync mode failed");
- }
- Info("ActiveSyncMode success");
- return RET_STATUS::RET_SUCCEED;
- }
- void nsFPD::FPDDeviceTrixell::CheckCalibrationDue()
- {
- Info("[Checking Calibration Date]");
- if (!m_stDeviceConfig.bConnectStatus)
- {
- Error("m_stDeviceConfig.bConnectStatus = false");
- return;
- }
- Info("LastCalibrationDate: {$}, DueDay: {$}", m_stDeviceConfig.strLastCalibrationDate, m_stDeviceConfig.strCalibrationFileExpireTime);
- if (!m_bNotifyCalWarn)
- {
- Info("skip notify calibration");
- return;
- }
- //进检查时判断当前校正文件是否过期,如果即将过期或者已过期都向上通知
- if (m_stDeviceConfig.strLastCalibrationDate == "0000-00-00 00:00:00")
- {
- //没有做过校正
- Warn("No calibration file, please make a calibration!");
- m_WarnAndError->SendWarn(ERR_FPD_CAL_FILE_NOT_EXIST, "");
- }
- else
- {
- time_t lastCalibDate = StringToDatetime(m_stDeviceConfig.strLastCalibrationDate);
- int nExpireTime = std::stoi(m_stDeviceConfig.strCalibrationFileExpireTime);//单位:天
- Info("nExpireTime:{$}", nExpireTime);
- time_t localtime = time(NULL);
- //判断是否过期
- if (localtime > lastCalibDate + nExpireTime * 24 * 3600)
- {
- //过期了报错
- Warn("Calibration file is expired! please make a calibration!");
- m_WarnAndError->SendWarn(ERR_FPD_CAL_FILE_OUTDATE, "");
- }
- }
- return;
- }
|