DIOS.Dev.FPD.CareRayDR.cpp 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229
  1. #include "stdafx.h"
  2. #include "FileVersion.hpp"
  3. #include "CCOS.Dev.FPD.CareRayDR.h"
  4. #include "common_api.h"
  5. #include "DICOMImageHeadKey.h"
  6. #include "Detector_CareRayDR.h"
  7. namespace nsFPD = CCOS::Dev::Detail::Detector;
  8. //-----------------------------------------------------------------------------
  9. // FPDDeviceCareRay
  10. //-----------------------------------------------------------------------------
  11. extern Detector_CareRayDR* g_pDetector;
  12. static nsFPD::CareRayDriver gIODriver;
  13. Log4CPP::Logger* //mLog::gLogger = nullptr;
  14. extern const char* g_szMouldPath;
  15. CareRayDriver* g_Driver = nullptr;
  16. extern "C" CCOS::Dev::IODriver * __cdecl GetIODriver() // 返回静态对象的引用, 调用者不能删除 !
  17. {
  18. return &gIODriver;
  19. }
  20. extern "C" CCOS::Dev::IODriver * __cdecl CreateIODriver() // 返回新对象, 调用者必须自行删除此对象 !
  21. {
  22. g_Driver = new nsFPD::CareRayDriver();
  23. return g_Driver;
  24. }
  25. nsFPD::CareRayDriver::CareRayDriver()
  26. {
  27. pObjDev = nullptr;
  28. m_bDriverConnect = false; //缺省为false
  29. m_pAttribute.reset(new ResDataObject());
  30. m_pDescription.reset(new ResDataObject());
  31. }
  32. nsFPD::CareRayDriver::~CareRayDriver()
  33. {
  34. if (pObjDev != nullptr)
  35. {
  36. delete pObjDev;
  37. pObjDev = nullptr;
  38. }
  39. //mLog::Close();
  40. Log4CPP::ThreadContext::Map::Clear();
  41. //mLog::gLogger = nullptr;
  42. }
  43. void nsFPD::CareRayDriver::Prepare()
  44. {
  45. printf("--Driver-- prepare \r\n");
  46. string strLogPath = GetProcessDirectory() + R"(\Conf\Log4CPP.Config.xml)";
  47. auto rc = Log4CPP::LogManager::LoadConfigFile(strLogPath.c_str());
  48. //mLog::gLogger = Log4CPP::LogManager::GetLogger("Module");
  49. //mLog::FINFO("Code Build datetime [{$} {$}]", __DATE__, __TIME__);
  50. #ifdef _WIN64
  51. //mLog::FINFO("=============================Version: {$} (64-bit)==================================", FileVersion(g_szMouldPath).GetVersionString());
  52. #else
  53. //mLog::FINFO("=============================Version: {$} (32-bit)==================================", FileVersion(g_szMouldPath).GetVersionString());
  54. #endif
  55. //mLog::FINFO("Driver Prepare get logger");
  56. }
  57. auto nsFPD::CareRayDriver::CreateDevice(int index)->std::unique_ptr <IODevice>
  58. {
  59. printf("--Driver-- CreateDevice \r\n");
  60. //mLog::FINFO("--Driver-- CreateDevice");
  61. pObjDev = new FPDDeviceCareRay(EventCenter, m_ConfigFileName);
  62. auto Device = std::unique_ptr<IODevice>(new IODevice(pObjDev));
  63. pObjDev->CreateDevice();
  64. pObjDev->Register();
  65. return Device;
  66. }
  67. bool nsFPD::CareRayDriver::Connect()
  68. {
  69. printf("--Driver-- Connect \r\n");
  70. //mLog::FINFO("--Driver-- connect m_bDriverConnect:{$}", m_bDriverConnect);
  71. if (pObjDev && g_pDetector && !m_bDriverConnect)
  72. {
  73. RET_STATUS ret = pObjDev->Connect();
  74. if (ret != RET_SUCCEED)
  75. {
  76. //mLog::FERROR("Connect error!");
  77. }
  78. }
  79. return m_bDriverConnect;
  80. }
  81. void nsFPD::CareRayDriver::Disconnect()
  82. {
  83. printf("--Driver-- Disconnect \r\n");
  84. //mLog::FINFO("--Driver-- Disconnect");
  85. if (pObjDev != nullptr)
  86. {
  87. delete pObjDev;
  88. pObjDev = nullptr;
  89. }
  90. m_bDriverConnect = false; //disconnect置为false
  91. }
  92. bool nsFPD::CareRayDriver::isConnected() const
  93. {
  94. return m_bDriverConnect;
  95. }
  96. std::string nsFPD::CareRayDriver::DriverProbe()
  97. {
  98. printf("--Driver-- DriverProbe \r\n");
  99. //mLog::FINFO("--Driver-- DriverProbe config name:{$}", m_ConfigFileName);
  100. ResDataObject r_config, HardwareInfo;
  101. if (r_config.loadFile(m_ConfigFileName.c_str()))
  102. {
  103. HardwareInfo.add("MajorID", r_config["CONFIGURATION"]["MajorID"]);
  104. HardwareInfo.add("MinorID", r_config["CONFIGURATION"]["MinorID"]);
  105. HardwareInfo.add("VendorID", r_config["CONFIGURATION"]["VendorID"]);
  106. HardwareInfo.add("ProductID", r_config["CONFIGURATION"]["ProductID"]);
  107. HardwareInfo.add("SerialID", r_config["CONFIGURATION"]["SerialID"]);
  108. }
  109. else
  110. {
  111. HardwareInfo.add("MajorID", "Detector");
  112. HardwareInfo.add("MinorID", "DR");
  113. HardwareInfo.add("VendorID", "CareRay");
  114. HardwareInfo.add("ProductID", "CareRay");
  115. HardwareInfo.add("SerialID", "Driver");
  116. }
  117. string str = HardwareInfo.encode();
  118. return str;
  119. }
  120. std::string nsFPD::CareRayDriver::GetResource()
  121. {
  122. printf("--Driver-- GetResource \r\n");
  123. //mLog::FINFO("--Driver-- GetResource");
  124. ResDataObject r_config, temp;
  125. printf("m_ConfigFileName:%s\n", m_ConfigFileName.c_str());
  126. //mLog::FINFO("m_ConfigFileName:{$}", m_ConfigFileName);
  127. if (!temp.loadFile(m_ConfigFileName.c_str()))
  128. {
  129. return "";
  130. }
  131. m_ConfigAll = temp;
  132. r_config = temp["CONFIGURATION"];
  133. m_Configurations = r_config;
  134. ResDataObject DescriptionTemp;
  135. ResDataObject ListTemp;
  136. //ResDataObject m_pAttribute;
  137. //ResDataObject m_pDescription;
  138. string strTemp = ""; //用于读取字符串配置信息
  139. string strIndex = ""; //用于读取配置信息中的List项
  140. int nTemp = -1; //用于读取整型配置信息
  141. char sstream[10] = { 0 }; //用于转换值
  142. string strValue = ""; //用于存储配置的值
  143. string strType = ""; //用于存储配置的类型 int/float/string...
  144. string strAccess = ""; //用于存储权限的类型 R/W/RW
  145. string strRequired = ""; // TRUE/FALSE
  146. string strDefaultValue = "";
  147. string strRangeMin = "";
  148. string strRangeMax = "";
  149. try
  150. {
  151. int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
  152. ////mLog::FINFO(g_pFPDCtrlLog, "ConfigInfo Count: {$}", nConfigInfoCount);
  153. m_pAttribute->clear();
  154. m_pDescription->clear();
  155. for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
  156. {
  157. DescriptionTemp.clear();
  158. ListTemp.clear();
  159. //AttributeType
  160. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Type"];
  161. DescriptionTemp.add(AttributeType, strTemp.c_str());
  162. ////mLog::FINFO("DescriptionTemp--> {$}: {$}", AttributeType, strTemp.c_str());
  163. strType = strTemp; //记录配置项的类型
  164. //AttributeKey
  165. //1. 根据AttributeType,内部key和配置路径,拿到当前的真实值
  166. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
  167. nTemp = (int)m_Configurations["ConfigToolInfo"][nInfoIndex]["PathID"];
  168. GetDeviceConfigValue(r_config, strTemp.c_str(), nTemp, strValue);
  169. //2. 赋值
  170. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
  171. if ("int" == strType)
  172. {
  173. (*m_pAttribute).add(strTemp.c_str(), atoi(strValue.c_str()));
  174. }
  175. else if ("float" == strType)
  176. {
  177. (*m_pAttribute).add(strTemp.c_str(), atof(strValue.c_str()));
  178. }
  179. else //其它先按string类型处理
  180. {
  181. (*m_pAttribute).add(strTemp.c_str(), strValue.c_str());
  182. }
  183. //AttributeAccess
  184. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Access"];
  185. DescriptionTemp.add(AttributeAccess, strTemp.c_str());
  186. //AttributeRangeMin
  187. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["RangeMin"];
  188. if (strTemp != "") //不需要的配置项为空
  189. {
  190. DescriptionTemp.add(AttributeRangeMin, strTemp.c_str());
  191. }
  192. //AttributeRangeMax
  193. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["RangeMax"];
  194. if (strTemp != "") //不需要的配置项为空
  195. {
  196. DescriptionTemp.add(AttributeRangeMax, strTemp.c_str());
  197. }
  198. //AttributeList
  199. nTemp = m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListNum"];
  200. if (nTemp > 0) //ListNum不大于0时说明不需要list配置
  201. {
  202. for (int nListIndex = 0; nListIndex < nTemp; nListIndex++)
  203. {
  204. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListInfo"][nListIndex];
  205. //sprintf_s(sstream, "{$}", nListIndex);
  206. auto temKey = std::to_string(nListIndex);
  207. ListTemp.add(temKey.c_str(), strTemp.c_str());
  208. }
  209. DescriptionTemp.add(AttributeList, ListTemp);
  210. }
  211. //AttributeRequired
  212. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Required"];
  213. DescriptionTemp.add(AttributeRequired, strTemp.c_str());
  214. //AttributeDefaultValue
  215. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["DefaultValue"];
  216. if (strTemp != "") //不需要的配置项为空
  217. {
  218. DescriptionTemp.add(AttributeDefaultValue, strTemp.c_str());
  219. }
  220. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
  221. (*m_pDescription).add(strTemp.c_str(), DescriptionTemp);
  222. }
  223. }
  224. catch (ResDataObjectExption& e)
  225. {
  226. //mLog::FERROR("Get config error: {$}", e.what());
  227. return "";
  228. }
  229. ResDataObject resDeviceResource;
  230. resDeviceResource.add(ConfKey::CcosDetectorAttribute, (*m_pAttribute));
  231. resDeviceResource.add(ConfKey::CcosDetectorDescription, (*m_pDescription));
  232. ResDataObject DescriptionTempEx;
  233. DescriptionTempEx.add(ConfKey::CcosDetectorConfig, resDeviceResource);
  234. m_DeviceConfig = DescriptionTempEx;
  235. string res = DescriptionTempEx.encode();
  236. printf("CareRayDriver module: get resource over \r\n");
  237. //mLog::FINFO("CareRayDriver module: get resource over");
  238. return res;
  239. }
  240. std::string nsFPD::CareRayDriver::DeviceProbe()
  241. {
  242. printf("--Driver-- DeviceProbe \r\n");
  243. //mLog::FINFO("--Driver-- DeviceProbe");
  244. ResDataObject r_config, HardwareInfo;
  245. if (r_config.loadFile(m_ConfigFileName.c_str()))
  246. {
  247. HardwareInfo.add("MajorID", r_config["CONFIGURATION"]["MajorID"]);
  248. HardwareInfo.add("MinorID", "Device");
  249. HardwareInfo.add("VendorID", r_config["CONFIGURATION"]["VendorID"]);
  250. HardwareInfo.add("ProductID", r_config["CONFIGURATION"]["ProductID"]);
  251. HardwareInfo.add("SerialID", r_config["CONFIGURATION"]["SerialID"]);
  252. }
  253. else
  254. {
  255. HardwareInfo.add("MajorID", "Detector");
  256. HardwareInfo.add("MinorID", "Device");
  257. HardwareInfo.add("VendorID", "CareRay");
  258. HardwareInfo.add("ProductID", "CareRay");
  259. HardwareInfo.add("SerialID", "1234");
  260. }
  261. string str = HardwareInfo.encode();
  262. //mLog::FINFO("CareRayDriver module DeviceProbe over");
  263. return str;
  264. }
  265. bool nsFPD::CareRayDriver::GetDeviceConfig(std::string& Cfg)
  266. {
  267. Cfg = m_DeviceConfig.encode();
  268. //mLog::FINFO("--Driver-- GetDeviceConfig Cfg:{$}", Cfg);
  269. return true;
  270. }
  271. bool nsFPD::CareRayDriver::SetDeviceConfig(std::string Cfg)
  272. {
  273. //mLog::FINFO("--Driver-- SetDeviceConfig {$}", Cfg.c_str());
  274. ResDataObject DeviceConfig;
  275. DeviceConfig.decode(Cfg.c_str());
  276. ResDataObject DescriptionTempEx;
  277. DescriptionTempEx = DeviceConfig["DeviceConfig"];
  278. bool bSaveFile = false; //true:重新保存配置文件
  279. string strAccess = "";
  280. for (int i = 0; i < DescriptionTempEx.size(); i++)
  281. {
  282. ResDataObject temp = DescriptionTempEx[i];
  283. //mLog::FINFO("{$}", temp.encode());
  284. for (int j = 0; j < temp.size(); j++)
  285. {
  286. string strKey = temp.GetKey(j);
  287. //mLog::FINFO("{$}", strKey.c_str());
  288. try
  289. {
  290. if (m_pAttribute->GetFirstOf(strKey.c_str()) >= 0)
  291. {
  292. strAccess = (string)(*m_pDescription)[strKey.c_str()]["Access"];
  293. if ("RW" == strAccess || "rw" == strAccess)
  294. {
  295. //修改对应配置,在其他单元的配置项要同时调用其修改函数修改真实值
  296. //1. 修改内存中的值,用于给上层发消息
  297. (*m_pAttribute)[strKey.c_str()] = temp[j];
  298. //2. 拿到Innerkey
  299. int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
  300. //mLog::FINFO("ConfigInfo Count: {$}", nConfigInfoCount);
  301. string strTemp = ""; //存储AttributeKey
  302. for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
  303. {
  304. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
  305. if (strTemp == strKey)
  306. {
  307. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
  308. break;
  309. }
  310. }
  311. //3. 修改配置文件中的值
  312. if (SetDeviceConfigValue(m_Configurations, strTemp.c_str(), 1, temp[j]))
  313. {
  314. bSaveFile = true;
  315. }
  316. }
  317. else
  318. {
  319. //mLog::FINFO("{$} is not a RW configuration item", strKey.c_str());
  320. }
  321. }
  322. }
  323. catch (ResDataObjectExption& e)
  324. {
  325. //mLog::FERROR("SetDriverConfig crashed: {$}", e.what());
  326. return false;
  327. }
  328. }
  329. }
  330. if (bSaveFile)
  331. {
  332. //3. 重新保存配置文件
  333. SaveConfigFile(true);
  334. }
  335. return true;
  336. }
  337. bool nsFPD::CareRayDriver::SaveConfigFile(bool bSendNotify)
  338. {
  339. //mLog::FINFO("--Driver-- SaveConfigFile m_ConfigFileName:{$}", m_ConfigFileName);
  340. m_ConfigAll["CONFIGURATION"] = m_Configurations;
  341. bool ret = m_ConfigAll.SaveFile(m_ConfigFileName.c_str());
  342. if (ret)
  343. {
  344. //mLog::FINFO("SaveConfigFile Success!");
  345. return true;
  346. }
  347. else
  348. {
  349. //mLog::FERROR("SaveConfigFile Fail!");
  350. return false;
  351. }
  352. }
  353. bool nsFPD::CareRayDriver::GetDeviceConfigValue(ResDataObject config, const char* pInnerKey,
  354. int nPathID, string& strValue)
  355. {
  356. strValue = "";
  357. string strTemp = pInnerKey;
  358. if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
  359. {
  360. if (WiredIP == strTemp || WirelessIP == strTemp || LocalIP == strTemp)
  361. {
  362. strValue = (string)config["connections"][pInnerKey];
  363. }
  364. else if (DetectorVender == strTemp || DetectorModel == strTemp ||
  365. DetectorDescription == strTemp || DetectorSerialNumber == strTemp)
  366. {
  367. strValue = (string)config[pInnerKey];
  368. }
  369. else if (SyncType == strTemp || FPDWorkStation == strTemp ||
  370. ImageWidth == strTemp || ImageHeight == strTemp)
  371. {
  372. strValue = (string)config["ModeTable"]["DetectorMode"][pInnerKey];
  373. }
  374. else if (TempMaxLimit == strTemp || ReConnect == strTemp ||
  375. TempUpperLimit == strTemp || TempLowerLimit == strTemp || TempMinLimit == strTemp ||
  376. BatLowerLimit == strTemp || BatMiniLimit == strTemp ||
  377. BatLowerLimitInCali == strTemp || WifiLowerLimit == strTemp ||
  378. WifiMiniLimit == strTemp || HighPowerTimeout == strTemp ||
  379. ShowTemperature == strTemp || ShowWifi == strTemp ||
  380. ShowBattery == strTemp || ShowBluetooth == strTemp ||
  381. FPDExamMode == strTemp || FPDAcqMode == strTemp || FPDModeMatch == strTemp ||
  382. CcosDetectorAttachedFlag == strTemp)
  383. {
  384. strValue = (string)config[pInnerKey];
  385. }
  386. else
  387. {
  388. strValue = "";
  389. //mLog::FERROR("Error Configuration item: {$}", pInnerKey);
  390. }
  391. }
  392. ////mLog::FINFO("GetDeviceConfigValue pInnerKey:{$},nPathID:{$},strValue:{$}", pInnerKey, nPathID, strValue);
  393. return true;
  394. }
  395. bool nsFPD::CareRayDriver::SetDeviceConfigValue(ResDataObject &config, const char* pInnerKey,
  396. int nPathID, const char* szValue)
  397. {
  398. //mLog::FINFO("--Driver-- SetDeviceConfigValue change {$} item value to {$}", pInnerKey, szValue);
  399. string strTemp = pInnerKey;
  400. if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
  401. {
  402. if (WiredIP == strTemp || WirelessIP == strTemp || LocalIP == strTemp)
  403. {
  404. config["connections"][pInnerKey] = szValue;
  405. }
  406. else if (DetectorVender == strTemp || DetectorModel == strTemp ||
  407. DetectorDescription == strTemp || DetectorSerialNumber == strTemp)
  408. {
  409. config[pInnerKey] = szValue;
  410. }
  411. else if (SyncType == strTemp || FPDWorkStation == strTemp ||
  412. ImageWidth == strTemp || ImageHeight == strTemp)
  413. {
  414. config["ModeTable"]["DetectorMode"][pInnerKey] = szValue;
  415. }
  416. else if (TempMaxLimit == strTemp || ReConnect == strTemp ||
  417. TempUpperLimit == strTemp || TempLowerLimit == strTemp ||
  418. BatLowerLimit == strTemp || BatMiniLimit == strTemp ||
  419. BatLowerLimitInCali == strTemp || WifiLowerLimit == strTemp ||
  420. WifiMiniLimit == strTemp || HighPowerTimeout == strTemp ||
  421. ShowTemperature == strTemp || ShowWifi == strTemp ||
  422. ShowBattery == strTemp || ShowBluetooth == strTemp ||
  423. FPDExamMode == strTemp || FPDAcqMode == strTemp || FPDModeMatch == strTemp ||
  424. CcosDetectorAttachedFlag == strTemp)
  425. {
  426. config[pInnerKey] = szValue;
  427. }
  428. else
  429. {
  430. //mLog::FERROR("Error Configuration item: {$}", pInnerKey);
  431. return false;
  432. }
  433. }
  434. return true;
  435. }
  436. nsFPD::FPDDeviceCareRay::FPDDeviceCareRay(std::shared_ptr<IOEventCenter> center,std::string strConfigPath)
  437. : m_nCalibTotalExposureNum(0),
  438. m_nCalibCurrentCalibrationRound(0),
  439. m_nCalibCurrentExposureIndex(0),
  440. m_nCalibCurrentExposureNum(0)
  441. {
  442. m_bDeviceConnect = false;
  443. m_nFullImageHeight = 0;
  444. m_nFullImageWidth = 0;
  445. m_nPreviewEnable = 0;
  446. m_nPreviewImageWidth = 0;
  447. m_nPreviewImageHeight = 0;
  448. m_pFullImgBuffer = nullptr;
  449. m_pPreviewImgBuffer = nullptr;
  450. m_nImgBits = 0;
  451. m_nAngle = 0;
  452. m_nPixelSpacing = 0;
  453. m_nSensitivity = 0;
  454. m_eSyncMode = SYNC_SOFTWARE;
  455. m_fFactorEXI2UGY = 0.0f;
  456. m_strWorkPath = GetProcessDirectory();
  457. m_DetectorCtrlUnit.reset(new OemCtrl(center, this));
  458. m_AcqUnit.reset(new OemAcq(center, this));
  459. m_SyncUnit.reset(new OemSync(center, this));
  460. m_CalibUnit.reset(new OemCalib(center, this));
  461. m_DetectorConfiguration.reset(new DetectorConfiguration(strConfigPath));
  462. string fullpath = g_szMouldPath;
  463. string::size_type firstHit = fullpath.find_last_of('\\');
  464. if (firstHit == string::npos || firstHit == 0)
  465. {
  466. //mLog::FERROR("Get DLL path error!");
  467. }
  468. else
  469. {
  470. //mLog::FINFO("g_szMouldPath:{$}", g_szMouldPath);
  471. }
  472. string strInfoPath = fullpath.substr(0, firstHit);
  473. m_WarnAndError.reset(new FPDErrorWarning(center, DetectorUnitType, strInfoPath));
  474. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_INIT));
  475. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ERROR));
  476. EventCenter = center;
  477. m_eAppStatus = APP_STATUS_IDLE;
  478. m_bEnterAcqStatus = false;
  479. m_CalibType = CCOS_CALIBRATION_TYPE_NONE;
  480. }
  481. nsFPD::FPDDeviceCareRay::~FPDDeviceCareRay()
  482. {
  483. if (nullptr != m_pFullImgBuffer)
  484. {
  485. delete[]m_pFullImgBuffer;
  486. m_pFullImgBuffer = nullptr;
  487. }
  488. if (nullptr != m_pPreviewImgBuffer)
  489. {
  490. delete[]m_pPreviewImgBuffer;
  491. m_pPreviewImgBuffer = nullptr;
  492. }
  493. }
  494. std::string nsFPD::FPDDeviceCareRay::GetGUID() const
  495. {
  496. return DetectorUnitType;
  497. }
  498. bool nsFPD::FPDDeviceCareRay::Prepare()
  499. {
  500. printf("--Func-- device Prepare \r\n");
  501. //mLog::FINFO("--Func-- device prepare");
  502. //如果同SDK双板的场景,一个图大一个图小,如果图小的申请了共享内存后,当切换到图大的板时,上图时就会因为共享内存不够大导致崩溃的问题,所以这里写死5000*5000
  503. EventCenter->OnMaxBlockSize("CareRayDrQue", 5000 * 5000 * 2, 5, 4000 * 4000 * 2, 1);
  504. return true;
  505. }
  506. bool nsFPD::FPDDeviceCareRay::CreateDevice()
  507. {
  508. //mLog::FINFO("--Func-- CreateDevice start");
  509. if (!LoadConfig())
  510. {
  511. //mLog::FERROR("LoadConfig fail!");
  512. return false;
  513. }
  514. if (nullptr == g_pDetector)
  515. {
  516. g_pDetector = new Detector_CareRayDR();
  517. }
  518. g_pDetector->DriverEntry(this, m_DetectorConfiguration->m_Configurations);
  519. //把通知状态信息的时间间隔传给ctrl
  520. g_pDetector->SetNotifyStatusTimePeriod(m_stDeviceConfig.nNotifyStatusTimePeriod);
  521. g_pDetector->SetReconnectTimePeriod(m_stDeviceConfig.nReconnectTimePeriod);
  522. m_DetectorCtrlUnit->SetAttachStatus("1"); //没有attach功能,直接上发1,使客户端显示探测器状态
  523. m_SyncUnit->SetSupportSyncMode(m_stDeviceConfig.strSupportSyncMode);
  524. m_CalibUnit->SetLastCalibrationDate(m_stDeviceConfig.strLastCalibrationDate);
  525. m_CalibUnit->SetCalibrationFileExpireTime(m_stDeviceConfig.strCalibrationFileExpireTime);
  526. string strTemp = (string)m_DetectorConfiguration->m_Configurations["SerialNumber"];
  527. m_DetectorCtrlUnit->SetSerialNumber(strTemp);
  528. strTemp = (string)m_DetectorConfiguration->m_Configurations["DetectorType"];
  529. m_DetectorCtrlUnit->SetDetectorType(strTemp);
  530. strTemp = (string)m_DetectorConfiguration->m_Configurations["Description"];
  531. m_DetectorCtrlUnit->SetDescription(strTemp);
  532. strTemp = (string)m_DetectorConfiguration->m_Configurations["DetectorWiredIP"];
  533. m_DetectorCtrlUnit->SetDetectorWiredIP(strTemp);
  534. strTemp = (string)m_DetectorConfiguration->m_Configurations["DetectorWirelessIP"];
  535. m_DetectorCtrlUnit->SetDetectorWirelessIP(strTemp);
  536. strTemp = (string)m_DetectorConfiguration->m_Configurations["LocalIP"];
  537. m_DetectorCtrlUnit->SetLocalIP(strTemp);
  538. strTemp = (string)m_DetectorConfiguration->m_Configurations["ShowTemperature"];
  539. m_DetectorCtrlUnit->SetShowTemperature(strTemp);
  540. strTemp = (string)m_DetectorConfiguration->m_Configurations["ShowWifi"];
  541. m_DetectorCtrlUnit->SetShowWifi(strTemp);
  542. strTemp = (string)m_DetectorConfiguration->m_Configurations["ShowBattery"];
  543. m_DetectorCtrlUnit->SetShowBattery(strTemp);
  544. strTemp = (string)m_DetectorConfiguration->m_Configurations["ShowBluetooth"];
  545. m_DetectorCtrlUnit->SetShowBluetooth(strTemp);
  546. if (m_stDeviceConfig.bSupportDDR) //是否支持DDR采集功能
  547. {
  548. m_DetectorCtrlUnit->SetSupportDDR("1");
  549. }
  550. else
  551. {
  552. m_DetectorCtrlUnit->SetSupportDDR("0");
  553. }
  554. //mLog::FINFO("CreateDevice end");
  555. return true;
  556. }
  557. void nsFPD::FPDDeviceCareRay::Register()
  558. {
  559. //mLog::FINFO("--Func-- Register");
  560. auto Disp = &Dispatch;
  561. RegisterCtrl(Disp);
  562. RegisterAcq(Disp);
  563. RegisterSync(Disp);
  564. RegisterCalib(Disp);
  565. RegisterOthers(Disp);
  566. }
  567. RET_STATUS nsFPD::FPDDeviceCareRay::Connect()
  568. {
  569. printf("--Func-- device Connect \r\n");
  570. //mLog::FINFO("--Func-- device Connect");
  571. RET_STATUS ret = RET_STATUS::RET_FAILED;
  572. if (g_pDetector->Connect(this, m_strWorkPath.c_str()))
  573. {
  574. ret = RET_STATUS::RET_SUCCEED;
  575. }
  576. return ret;
  577. }
  578. RET_STATUS nsFPD::FPDDeviceCareRay::EnterExam(int nExamMode)
  579. {
  580. //mLog::FINFO("--Func-- EnterExam {$}", nExamMode);
  581. switch (nExamMode)
  582. {
  583. case APP_STATUS_WORK_BEGIN:
  584. //mLog::FINFO("Enter into Exam Windows");
  585. m_eAppStatus = APP_STATUS_WORK_BEGIN;
  586. //mLog::FINFO("strLastCalibrationDate:{$},strCalibrationFileExpirationReminder:{$}", m_stDeviceConfig.strLastCalibrationDate, m_stDeviceConfig.strCalibrationFileExpirationReminder);
  587. if (m_stDeviceConfig.strCalibrationFileExpirationReminder == "1")
  588. {
  589. //进检查时判断当前校正文件是否过期,如果即将过期或者已过期都向上通知
  590. if (m_stDeviceConfig.strLastCalibrationDate == "0000-00-00 00:00:00")
  591. {
  592. //没有做过校正
  593. //mLog::FWARN("No calibration file, please make a calibration!");
  594. m_WarnAndError->SendWarn(ERR_FPD_CAL_FILE_NOT_EXIST, "");
  595. }
  596. else
  597. {
  598. time_t lastCalibDate = StringToDatetime(m_stDeviceConfig.strLastCalibrationDate);
  599. int nExpireTime = std::stoi(m_stDeviceConfig.strCalibrationFileExpireTime);//单位:天
  600. //mLog::FINFO("nExpireTime:{$}", nExpireTime);
  601. time_t localtime = time(NULL);
  602. //判断是否过期
  603. if (localtime > lastCalibDate + nExpireTime * 24 * 3600)
  604. {
  605. //过期了报错
  606. //mLog::FWARN("Calibration file is expired! please make a calibration!");
  607. m_WarnAndError->SendWarn(ERR_FPD_CAL_FILE_OUTDATE, "");
  608. }
  609. }
  610. }
  611. break;
  612. case APP_STATUS_WORK_END:
  613. //mLog::FINFO("Quit Exam Windows");
  614. m_eAppStatus = APP_STATUS_WORK_END;
  615. //mLog::FINFO("strCalibrationFileExpirationReminder:{$}", m_stDeviceConfig.strCalibrationFileExpirationReminder);
  616. if (m_stDeviceConfig.strCalibrationFileExpirationReminder == "1")
  617. {
  618. m_WarnAndError->ClearWarn(ERR_FPD_CAL_FILE_NOT_EXIST);
  619. m_WarnAndError->ClearWarn(ERR_FPD_CAL_FILE_OUTDATE);
  620. }
  621. break;
  622. case APP_STATUS_DETSHARE_BEGIN:
  623. //mLog::FINFO("Enter into Detector Share Windows");
  624. m_eAppStatus = APP_STATUS_DETSHARE_BEGIN;
  625. break;
  626. case APP_STATUS_DETSHAR_END:
  627. //mLog::FINFO("Quit Detector Share Windows");
  628. m_eAppStatus = APP_STATUS_DETSHAR_END;
  629. break;
  630. case APP_STATUS_CAL_BEGIN:
  631. //mLog::FINFO("Enter into Calibration Windows");
  632. m_eAppStatus = APP_STATUS_CAL_BEGIN;
  633. break;
  634. case APP_STATUS_CAL_END:
  635. //mLog::FINFO("Quit Calibration Windows");
  636. m_eAppStatus = APP_STATUS_CAL_END;
  637. break;
  638. case APP_STATUS_WORK_IN_SENSITIVITY:
  639. //mLog::FINFO("Enter into sensitivity test interface");
  640. m_eAppStatus = APP_STATUS_WORK_IN_SENSITIVITY;
  641. break;
  642. default:
  643. break;
  644. }
  645. g_pDetector->EnterExamMode(nExamMode);
  646. if (nExamMode == APP_STATUS_WORK_END || nExamMode == APP_STATUS_CAL_END)
  647. {
  648. if (m_bEnterAcqStatus)
  649. {
  650. RET_STATUS ret = StopAcquisition();
  651. if (ret != RET_STATUS::RET_SUCCEED)
  652. {
  653. //mLog::FERROR("EnterExam StopAcquisition fail!");
  654. return ret;
  655. }
  656. }
  657. }
  658. return RET_STATUS::RET_SUCCEED;
  659. }
  660. bool nsFPD::FPDDeviceCareRay::GetLogicMode(string& strAcqMode, int& nLogicMode)
  661. {
  662. if (strAcqMode == "RAD")
  663. {
  664. nLogicMode = RAD;
  665. }
  666. else if (strAcqMode == "DualEnergy")
  667. {
  668. nLogicMode = DUALENERGY;
  669. }
  670. else if (strAcqMode == "DDR")
  671. {
  672. nLogicMode = DDR;
  673. }
  674. else if (strAcqMode == "1")
  675. {
  676. nLogicMode = RAD;
  677. }
  678. else if (strAcqMode == "2")
  679. {
  680. nLogicMode = DUALENERGY;
  681. }
  682. else if (strAcqMode == "3")
  683. {
  684. nLogicMode = DDR;
  685. }
  686. else
  687. {
  688. //mLog::FERROR("Not support mode!");
  689. return false;
  690. }
  691. return true;
  692. }
  693. RET_STATUS nsFPD::FPDDeviceCareRay::SetAcqMode(string strAcqMode)
  694. {
  695. //mLog::FINFO("--Func-- SetAcqMode({$})", strAcqMode);
  696. RET_STATUS ret = RET_STATUS::RET_FAILED;
  697. //如果没连接,不执行
  698. if (!m_bDeviceConnect)
  699. {
  700. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  701. return ret;
  702. }
  703. //设置采集模式时发一次非Standby状态,配合子系统走流程,使界面ready状态和探测器同步
  704. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_WAKEUP));
  705. int nMode = RAD;
  706. bool bRet = GetLogicMode(strAcqMode, nMode);
  707. if (!bRet)
  708. {
  709. return ret;
  710. }
  711. try
  712. {
  713. ResDataObject objModeConfig = m_DetectorConfiguration->m_Configurations;
  714. int nModeCount = (int)objModeConfig["ModeTable"].size();
  715. for (int i = 0; i < nModeCount; i++)
  716. {
  717. int nLogicMode = (int)objModeConfig["ModeTable"][i]["LogicMode"];
  718. if (nLogicMode == nMode)
  719. {
  720. m_nFullImageWidth = (int)objModeConfig["ModeTable"][i]["ImageWidth"];
  721. m_nFullImageHeight = (int)objModeConfig["ModeTable"][i]["ImageHeight"];
  722. m_nImgBits = (int)objModeConfig["ModeTable"][i]["PhySizeInfoBit"];
  723. m_nAngle = (int)objModeConfig["ModeTable"][i]["RotateAngle"];
  724. m_nPixelSpacing = (int)objModeConfig["ModeTable"][i]["PixelPitch"];
  725. m_nSensitivity = (int)objModeConfig["ModeTable"][i]["Sensitivity"];
  726. m_nPreviewEnable = (int)objModeConfig["ModeTable"][i]["PreviewEnable"];
  727. m_nPreviewImageWidth = (int)objModeConfig["ModeTable"][i]["PreviewWidth"];
  728. m_nPreviewImageHeight = (int)objModeConfig["ModeTable"][i]["PreviewHeight"];
  729. if (m_nPreviewEnable)
  730. {
  731. m_AcqUnit->SetPrevImageInfo(true, m_nPreviewImageHeight, m_nPreviewImageWidth, 0);
  732. if (!m_pPreviewImgBuffer)
  733. {
  734. m_pPreviewImgBuffer = new WORD[m_nPreviewImageWidth * m_nPreviewImageHeight];
  735. }
  736. }
  737. if (nullptr != m_pFullImgBuffer)
  738. {
  739. delete[]m_pFullImgBuffer;
  740. m_pFullImgBuffer = nullptr;
  741. }
  742. m_pFullImgBuffer = new WORD[m_nFullImageWidth * m_nFullImageHeight];
  743. if (m_nAngle == 90 || m_nAngle == 270)
  744. {
  745. m_AcqUnit->SetFulImageInfo(m_nFullImageWidth, m_nFullImageHeight, m_nImgBits, false);
  746. }
  747. else
  748. {
  749. m_AcqUnit->SetFulImageInfo(m_nFullImageHeight, m_nFullImageWidth, m_nImgBits, false);
  750. }
  751. string strDoseOfExi = std::to_string(m_nSensitivity);
  752. m_fFactorEXI2UGY = 100.0f / stof(strDoseOfExi) * 1.0f;//统一使用IEC标准 呈现四角信息,无单位 ugy * 100 -ugy。所有Zskk探测器的FactorEXI2UGY均需*100
  753. //mLog::FINFO("m_fFactorEXI2UGY = {$} ", m_fFactorEXI2UGY);
  754. m_DetectorCtrlUnit->SetFPDSensitivity(std::to_string(m_fFactorEXI2UGY));
  755. if (g_pDetector->SetAcqMode(nMode))
  756. {
  757. ret = RET_STATUS::RET_SUCCEED;
  758. m_AcqUnit->AcqModeNotify(strAcqMode);
  759. }
  760. else
  761. {
  762. ret = RET_STATUS::RET_FAILED;
  763. }
  764. break;
  765. }
  766. }
  767. }
  768. catch (ResDataObjectExption& e)
  769. {
  770. //mLog::FERROR("Read configuration failed, Error code: {$}", e.what());
  771. }
  772. return ret;
  773. }
  774. RET_STATUS nsFPD::FPDDeviceCareRay::GetSyncMode(SYNC_MODE& eSyncMode)
  775. {
  776. //mLog::FINFO("--Func-- GetSyncMode");
  777. eSyncMode = m_eSyncMode;
  778. return RET_STATUS::RET_SUCCEED;
  779. }
  780. RET_STATUS nsFPD::FPDDeviceCareRay::PrepareAcquisition()
  781. {
  782. //mLog::FINFO("--Func-- PrepareAcquisition");
  783. RET_STATUS ret = RET_STATUS::RET_FAILED;
  784. if (!m_bDeviceConnect)
  785. {
  786. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  787. return ret;
  788. }
  789. //mLog::FINFO("m_bEnterAcqStatus:{$}", m_bEnterAcqStatus);
  790. if (m_bEnterAcqStatus)
  791. {
  792. //mLog::FINFO("Detector is acq status need to stop");
  793. if (g_pDetector->StopAcquisition(this))
  794. {
  795. ret = RET_STATUS::RET_SUCCEED;
  796. m_bEnterAcqStatus = false;
  797. }
  798. if (ret != RET_STATUS::RET_SUCCEED)
  799. {
  800. //mLog::FERROR("StopAcquisition fail!");
  801. return ret;
  802. }
  803. }
  804. if (g_pDetector->PrepareAcquisition(this))
  805. {
  806. ret = RET_STATUS::RET_SUCCEED;
  807. if (m_eSyncMode == SYNC_AED)
  808. {
  809. m_bEnterAcqStatus = true;
  810. }
  811. }
  812. //mLog::FINFO("PrepareAcquisition over");
  813. return ret;
  814. }
  815. RET_STATUS nsFPD::FPDDeviceCareRay::StartAcquisition(string in)
  816. {
  817. printf("--Func-- StartAcquisition \r\n");
  818. //mLog::FINFO("--Func-- StartAcquisition");
  819. RET_STATUS ret = RET_STATUS::RET_FAILED;
  820. if (!m_bDeviceConnect)
  821. {
  822. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  823. return ret;
  824. }
  825. if (g_pDetector->StartAcquisition(this))
  826. {
  827. ret = RET_STATUS::RET_SUCCEED;
  828. if (m_eSyncMode == SYNC_AED)
  829. {
  830. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));//StartAcquisition
  831. m_SyncUnit->XWindowOnNotify();
  832. }
  833. }
  834. else
  835. {
  836. //mLog::FERROR("StartAcquisition fail!");
  837. return ret;
  838. }
  839. //mLog::FINFO("StartAcquisition over");
  840. return ret;
  841. }
  842. RET_STATUS nsFPD::FPDDeviceCareRay::StopAcquisition()
  843. {
  844. printf("--Func-- StopAcquisition \r\n");
  845. //mLog::FINFO("--Func-- StopAcquisition");
  846. RET_STATUS ret = RET_STATUS::RET_FAILED;
  847. if (!m_bDeviceConnect)
  848. {
  849. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  850. return ret;
  851. }
  852. //调用stop前探测器需处于采集状态,否则会报错
  853. if (m_bEnterAcqStatus)
  854. {
  855. if (g_pDetector->StopAcquisition(this))
  856. {
  857. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  858. m_bEnterAcqStatus = false;
  859. ret = RET_STATUS::RET_SUCCEED;
  860. }
  861. }
  862. else
  863. {
  864. ret = RET_STATUS::RET_SUCCEED;
  865. }
  866. //mLog::FINFO("StopAcquisition over");
  867. return ret;
  868. }
  869. RET_STATUS nsFPD::FPDDeviceCareRay::ActiveCalibration(CCOS_CALIBRATION_TYPE eType)
  870. {
  871. printf("--Func-- ActiveCalibration %d \r\n", eType);
  872. //mLog::FINFO("--Func-- ActiveCalibration {$}", (int)eType);
  873. RET_STATUS ret = RET_STATUS::RET_FAILED;
  874. if (!m_bDeviceConnect)
  875. {
  876. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  877. return ret;
  878. }
  879. if (eType == CCOS_CALIBRATION_TYPE_NONE || eType == CCOS_CALIBRATION_TYPE_MAX)
  880. {
  881. //mLog::FERROR("calibration type is invalid!");
  882. return RET_STATUS::RET_INVALID;
  883. }
  884. else
  885. {
  886. m_CalibType = eType;
  887. }
  888. m_eAppStatus = APP_STATUS_CAL_BEGIN;
  889. if (eType == CCOS_CALIBRATION_TYPE_XRAY)
  890. {
  891. //mLog::FINFO("calibration type: XRAY");
  892. int nCalibrationRounds = (int)m_CalibDoseList.size();
  893. g_pDetector->SetCalibRounds(nCalibrationRounds);
  894. }
  895. if (g_pDetector->ActiveCalibration(this, eType))
  896. {
  897. ret = RET_STATUS::RET_SUCCEED;
  898. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ACTIVE));
  899. m_CalibUnit->SetCalibrationProgress("0");
  900. }
  901. else
  902. {
  903. //mLog::FERROR("Active calibration failed");
  904. ret = RET_STATUS::RET_FAILED;
  905. }
  906. //重置校正流程参数
  907. m_nCalibCurrentCalibrationRound = 1;
  908. m_nCalibCurrentExposureIndex = 1;
  909. m_nCalibCurrentExposureNum = 0;
  910. //mLog::FINFO("ActiveCalibration over");
  911. return ret;
  912. }
  913. RET_STATUS nsFPD::FPDDeviceCareRay::PrepareCalibration()
  914. {
  915. printf("--Func-- PrepareCalibration------ \n");
  916. //mLog::FINFO("--Func-- PrepareCalibration");
  917. RET_STATUS ret = RET_STATUS::RET_FAILED;
  918. if (!m_bDeviceConnect)
  919. {
  920. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  921. return ret;
  922. }
  923. //mLog::FINFO("m_bEnterAcqStatus:{$}", m_bEnterAcqStatus);
  924. if (m_bEnterAcqStatus)
  925. {
  926. //mLog::FINFO("Detector is acq status need to stop");
  927. ret = StopAcquisition();
  928. if (ret != RET_STATUS::RET_SUCCEED)
  929. {
  930. //mLog::FERROR("StopAcquisition fail!");
  931. return ret;
  932. }
  933. }
  934. if (g_pDetector->PrepareCalibration(this))
  935. {
  936. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_PREPARE));
  937. CCOS_CALIBRATION_TYPE nCalibrationType = m_CalibUnit->GetCalibrationType();
  938. if (nCalibrationType == CCOS_CALIBRATION_TYPE_XRAY && m_eSyncMode == SYNC_AED)
  939. {
  940. //mLog::FINFO("set m_bEnterAcqStatus true");
  941. m_bEnterAcqStatus = true;
  942. }
  943. ret = RET_STATUS::RET_SUCCEED;
  944. //m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  945. }
  946. else
  947. {
  948. printf("PrepareCalibration failed!\n");
  949. //mLog::FERROR("PrepareCalibration failed!");
  950. return ret;
  951. }
  952. //mLog::FINFO("--Func-- PrepareCalibration over");
  953. return ret;
  954. }
  955. RET_STATUS nsFPD::FPDDeviceCareRay::GetRequestedDose(std::string& strDose)
  956. {
  957. //mLog::FINFO("--Func-- GetRequestedDose");
  958. RET_STATUS ret = RET_STATUS::RET_FAILED;
  959. ResDataObject out;
  960. if (!m_bDeviceConnect)
  961. {
  962. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  963. return ret;
  964. }
  965. CCOS_CALIBRATION_TYPE nCalibrationType = m_CalibUnit->GetCalibrationType();
  966. //mLog::FINFO("GetRequestedDose calib type is {$}", (int)nCalibrationType);
  967. if (CCOS_CALIBRATION_TYPE_DARK == nCalibrationType)
  968. {
  969. out.add("Dose", 0.0f);
  970. out.add("kV", 0.0f);
  971. out.add("mA", 0.0f);
  972. out.add("ms", 0.0f);
  973. out.add("mAs", 0.0f);
  974. }
  975. else if (CCOS_CALIBRATION_TYPE_XRAY == nCalibrationType)
  976. {
  977. //mLog::FINFO("calib dose list size is {$}", m_CalibDoseList.size());
  978. ResDataObject temp = m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1];
  979. int nTargetExi = (int)temp["TargetGainEXI"];
  980. m_DetectorCtrlUnit->SetTargetEXI(std::to_string(nTargetExi));
  981. //mLog::FINFO("nTargetExi:{$}", nTargetExi);
  982. out.add("Dose", nTargetExi);
  983. out.add("kV", temp["KV"]);
  984. out.add("mA", temp["MA"]);
  985. out.add("ms", temp["MS"]);
  986. out.add("mAs", temp["MAS"]);
  987. }
  988. else
  989. {
  990. //mLog::FERROR("Don't support CalibrationType($)", (int)nCalibrationType);
  991. return ret;
  992. }
  993. strDose = out.encode();
  994. //mLog::FINFO("GetRequestedDose:{$}", strDose);
  995. ret = RET_STATUS::RET_SUCCEED;
  996. //mLog::FINFO("--Func-- GetRequestedDose over");
  997. return ret;
  998. }
  999. RET_STATUS nsFPD::FPDDeviceCareRay::SetRequestedDose(std::string strDose)
  1000. {
  1001. //mLog::FINFO("--Func-- SetRequestedDose");
  1002. RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
  1003. return Ret;
  1004. }
  1005. RET_STATUS nsFPD::FPDDeviceCareRay::GetCalibrationStep(int nDetectorID, string& strCalibrationStepInfo)
  1006. {
  1007. printf("--Func-- GetCalibrationStep\n");
  1008. //mLog::FINFO("--Func-- GetCalibrationStep DetectorID:{$}", nDetectorID);
  1009. RET_STATUS ret = RET_STATUS::RET_SUCCEED;
  1010. ResDataObject out;
  1011. int nCalibrationRounds = (int)m_CalibDoseList.size();
  1012. int nExposureNumCurrentRound = (int)m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1]["ExpNum"];
  1013. if (g_pDetector->GetCalibrationStep(m_nCalibCurrentCalibrationRound, nCalibrationRounds, m_nCalibCurrentExposureIndex, nExposureNumCurrentRound))
  1014. {
  1015. //mLog::FINFO("GetCalibrationStep success");
  1016. }
  1017. else
  1018. {
  1019. //mLog::FERROR("GetCalibrationStep error");
  1020. ret = RET_STATUS::RET_FAILED;
  1021. return ret;
  1022. }
  1023. out.add("CalibrationRounds", (int)m_CalibDoseList.size());
  1024. out.add("TotalExposureNum", m_nCalibTotalExposureNum);
  1025. out.add("CurrentCalibrationRound", m_nCalibCurrentCalibrationRound);
  1026. out.add("ExposureNumCurrentRound", (int)m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1]["ExpNum"]);
  1027. out.add("CurrentExposureIndex", m_nCalibCurrentExposureIndex);
  1028. out.add("CurrentExposureNum", m_nCalibCurrentExposureNum);
  1029. strCalibrationStepInfo = out.encode();
  1030. //mLog::FINFO("GetCalibrationStep over,strCalibrationStepInfo: {$}", strCalibrationStepInfo.c_str());
  1031. return ret;
  1032. }
  1033. RET_STATUS nsFPD::FPDDeviceCareRay::StartCalibration()
  1034. {
  1035. printf("--Func-- StartCalibration \r\n");
  1036. //mLog::FINFO("--Func-- StartCalibration");
  1037. RET_STATUS ret = RET_STATUS::RET_FAILED;
  1038. if (!m_bDeviceConnect)
  1039. {
  1040. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  1041. return ret;
  1042. }
  1043. if (m_CalibUnit->GetCalibrationStatus() != CCOS_CALIBRATION_STATUS_PREPARE)
  1044. {
  1045. printf("CCOS_CALIBRATION_STATUS = %d\r\n", (int)m_CalibUnit->GetCalibrationStatus());
  1046. //mLog::FERROR("Start calibration failed, in {$} status", (int)m_CalibUnit->GetCalibrationStatus());
  1047. return ret;
  1048. }
  1049. if (g_pDetector->StartCalibration(this))
  1050. {
  1051. printf("start calibration success set detector status\n");
  1052. //mLog::FINFO("start calibration success set detector status");
  1053. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_RUNNING));
  1054. ret = RET_STATUS::RET_SUCCEED;
  1055. if (m_eSyncMode == SYNC_AED)
  1056. {
  1057. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));//StartCalibration
  1058. }
  1059. }
  1060. else
  1061. {
  1062. //mLog::FERROR("StartCalibration failed");
  1063. ret = RET_STATUS::RET_FAILED;
  1064. return ret;
  1065. }
  1066. //mLog::FINFO("StartCalibration over");
  1067. return ret;
  1068. }
  1069. RET_STATUS nsFPD::FPDDeviceCareRay::StopCalibration()
  1070. {
  1071. //mLog::FINFO("--Func-- StopCalibration");
  1072. RET_STATUS ret = RET_STATUS::RET_FAILED;
  1073. if (!m_bDeviceConnect)
  1074. {
  1075. //mLog::FERROR("m_bDeviceConnect is false, detector not connect, return");
  1076. return ret;
  1077. }
  1078. m_eAppStatus = APP_STATUS_CAL_END;
  1079. if (g_pDetector->StopCalibration(this))
  1080. {
  1081. ret = RET_STATUS::RET_SUCCEED;
  1082. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_BESTOPPED));
  1083. }
  1084. else
  1085. {
  1086. //mLog::FERROR("StopCalibration failed");
  1087. }
  1088. //这里也应该判断探测器的采集状态,如果是采集状态再调用停止采集
  1089. if (m_bEnterAcqStatus)
  1090. {
  1091. //mLog::FINFO("Detector is acq status need to stop");
  1092. ret = StopAcquisition();
  1093. if (ret != RET_STATUS::RET_SUCCEED)
  1094. {
  1095. //mLog::FERROR("StopAcquisition fail!");
  1096. return ret;
  1097. }
  1098. }
  1099. //mLog::FINFO("StopCalibration over");
  1100. return ret;
  1101. }
  1102. void nsFPD::FPDDeviceCareRay::AbortCalibration()
  1103. {
  1104. //mLog::FINFO("--Func-- AbortCalibration");
  1105. m_eAppStatus = APP_STATUS_CAL_END;
  1106. CCOS_CALIBRATION_TYPE nCalibrationType = m_CalibUnit->GetCalibrationType();
  1107. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1108. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ERROR));
  1109. m_CalibUnit->SetCalibrationProgress("100");
  1110. if(CCOS_CALIBRATION_TYPE_XRAY == nCalibrationType)
  1111. {
  1112. g_pDetector->AbortCalibration(this);
  1113. m_AcqUnit->SendNoNeedWaitImage(true);
  1114. }
  1115. //如果中止的时候探测器在采集状态需要停止采集
  1116. //mLog::FINFO("--Func-- AbortCalibration over");
  1117. }
  1118. RET_STATUS nsFPD::FPDDeviceCareRay::AcceptCalibration()
  1119. {
  1120. //mLog::FINFO("--Func-- AcceptCalibration");
  1121. RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
  1122. if (g_pDetector->AcceptCalibration())
  1123. {
  1124. //mLog::FINFO("AcceptCalibration over");
  1125. Ret = RET_STATUS::RET_SUCCEED;
  1126. }
  1127. else
  1128. {
  1129. //mLog::FERROR("AcceptCalibration error");
  1130. Ret = RET_STATUS::RET_FAILED;
  1131. }
  1132. int nExposureNumCurrentRound = (int)m_CalibDoseList[m_nCalibCurrentCalibrationRound - 1]["ExpNum"];
  1133. //完成校正条件:轮数够了,曝光次数够了
  1134. if ((m_nCalibCurrentCalibrationRound == (int)m_CalibDoseList.size()) && (m_nCalibCurrentExposureIndex == nExposureNumCurrentRound))
  1135. {
  1136. //mLog::FINFO("Calibration Round: {$}, Exposure Index: {$}, Finished", m_nCalibCurrentCalibrationRound, m_nCalibCurrentExposureIndex);
  1137. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1138. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
  1139. m_CalibUnit->SetCalibrationProgress("100");
  1140. return Ret;
  1141. }
  1142. if (m_nCalibCurrentExposureIndex >= nExposureNumCurrentRound) //跳到下一轮校正参数
  1143. {
  1144. m_nCalibCurrentCalibrationRound++;
  1145. m_nCalibCurrentExposureIndex = 1;
  1146. }
  1147. else
  1148. {
  1149. m_nCalibCurrentExposureIndex++;
  1150. }
  1151. m_nCalibCurrentExposureNum++;
  1152. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1153. //mLog::FINFO("--Func-- AcceptCalibration over");
  1154. return Ret;
  1155. }
  1156. RET_STATUS nsFPD::FPDDeviceCareRay::RejectCalibration()
  1157. {
  1158. printf("--Func-- RejectCalibration \n");
  1159. //mLog::FINFO("--Func-- RejectCalibration");
  1160. RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
  1161. if (g_pDetector->RejectCalibration())
  1162. {
  1163. Ret = RET_STATUS::RET_SUCCEED;
  1164. }
  1165. else
  1166. {
  1167. //mLog::FERROR("RejectCalibration error");
  1168. Ret = RET_STATUS::RET_FAILED;
  1169. }
  1170. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1171. //mLog::FINFO("--Func-- RejectCalibration over");
  1172. return Ret;
  1173. }
  1174. bool nsFPD::FPDDeviceCareRay::CompleteCalibration()
  1175. {
  1176. printf("--Func-- CompleteCalibration \n");
  1177. //mLog::FINFO("--Func-- CompleteCalibration");
  1178. if (!g_pDetector->CompleteCalibration(this))
  1179. {
  1180. //mLog::FERROR("CompleteCalibration fail!");
  1181. return false;
  1182. }
  1183. if (g_pDetector->GetCalibType() == CCOS_CALIBRATION_TYPE_DARK)
  1184. {
  1185. printf("CompleteCalibration Calibration Type DARK\n");
  1186. //mLog::FINFO("CompleteCalibration Calibration Type DARK");
  1187. }
  1188. else if (g_pDetector->GetCalibType() == CCOS_CALIBRATION_TYPE_XRAY)
  1189. {
  1190. printf("CompleteCalibration Calibration Type XRAY\n");
  1191. //mLog::FINFO("CompleteCalibration Calibration Type XRAY");
  1192. m_eAppStatus = APP_STATUS_CAL_END;
  1193. }
  1194. //mLog::FINFO("CompleteCalibration set detector status standby");
  1195. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1196. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
  1197. m_CalibUnit->SetCalibrationProgress("100");
  1198. //mLog::FINFO("--Func-- CompleteCalibration over");
  1199. return true;
  1200. }
  1201. RET_STATUS nsFPD::FPDDeviceCareRay::SaveCalibrationFile(bool bSaveFlag)
  1202. {
  1203. printf("--Func-- SaveCalibrationFile \n");
  1204. //mLog::FINFO("--Func-- SaveCalibrationFile");
  1205. RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
  1206. //mLog::FINFO("SaveCalibrationFile bSaveFlag: {$}", bSaveFlag);
  1207. if (!bSaveFlag)
  1208. {
  1209. //mLog::FERROR("Not save calibration file");
  1210. return Ret;
  1211. }
  1212. //点击save按钮时先调用compelte再调用save
  1213. CompleteCalibration();
  1214. if (g_pDetector->SaveCalibrationFile())
  1215. {
  1216. m_CalibUnit->SetSaveCalibrationFileFinish(true);
  1217. Ret = RET_STATUS::RET_SUCCEED;
  1218. //更新配置文件中校正日期和时间
  1219. time_t localtime = time(NULL);
  1220. string strLocalTime = DatetimeToString(localtime);
  1221. //mLog::FINFO("strLocalTime:{$}", strLocalTime);
  1222. m_CalibUnit->SetLastCalibrationDate(strLocalTime);
  1223. //清除校正文件相关警告
  1224. m_WarnAndError->ClearWarn(ERR_FPD_CAL_FILE_NOT_EXIST);
  1225. m_WarnAndError->ClearWarn(ERR_FPD_CAL_FILE_OUTDATE);
  1226. }
  1227. else
  1228. {
  1229. //mLog::FERROR("SaveCalibrationFile error");
  1230. m_CalibUnit->SetSaveCalibrationFileFinish(false);
  1231. Ret = RET_STATUS::RET_FAILED;
  1232. }
  1233. //mLog::FINFO("--Func-- SaveCalibrationFile over");
  1234. return Ret;
  1235. }
  1236. bool nsFPD::FPDDeviceCareRay::Support_DarkCalib()
  1237. {
  1238. return true;
  1239. }
  1240. bool nsFPD::FPDDeviceCareRay::Support_XrayCalib()
  1241. {
  1242. return true;
  1243. }
  1244. void nsFPD::FPDDeviceCareRay::SendTemperatureValue(float fValue)
  1245. {
  1246. int nStatus = 0;
  1247. m_Temperature->SetTemperature(fValue, nStatus);
  1248. //mLog::FINFO("SendTemperatureValue: {$}, status {$}", fValue, nStatus);
  1249. return;
  1250. }
  1251. void nsFPD::FPDDeviceCareRay::SendWifiValue(int nValue)
  1252. {
  1253. int nStatus = 0;
  1254. m_Wifi->SetSignalValue(nValue, nStatus);
  1255. //mLog::FINFO("SendWifiValue: {$}, status {$}", nValue, nStatus);
  1256. return;
  1257. }
  1258. void nsFPD::FPDDeviceCareRay::SendBatteryValue(int nValue)
  1259. {
  1260. int nStatus = 0;
  1261. m_Battery->SetRemainPowerValue(nValue, nStatus);
  1262. //mLog::FINFO("SendBatteryValue: {$}, status {$}", nValue, nStatus);
  1263. return;
  1264. }
  1265. bool nsFPD::FPDDeviceCareRay::LoadConfig()
  1266. {
  1267. //mLog::FINFO("--Func-- LoadConfig start");
  1268. if (!m_DetectorConfiguration->LoadConfigurations(m_stDeviceConfig, m_CalibDoseList, m_nCalibTotalExposureNum))
  1269. {
  1270. //mLog::FERROR("Load configuration file failed!!!");
  1271. return false;
  1272. }
  1273. //mLog::FINFO("m_CalibDoseList:{$}", m_CalibDoseList.encode());
  1274. //mLog::FINFO("m_nCalibTotalExposureNum:{$}", m_nCalibTotalExposureNum);
  1275. //const char* strkey, int initialvalue, int min, int WarnMin, int WarnMax, int CalibWarnMin, int CalibWarnMax, int max, int accuracy, std::shared_ptr <CCOS::Dev::IOEventCenter> EventCenter
  1276. m_Battery.reset(new DeviceBatteryMould("DetectorBattery", 0,
  1277. m_stDeviceConfig.nBatteryLimit,
  1278. m_stDeviceConfig.nBatteryWarning,
  1279. 90, 20, 90, 100, 0, EventCenter));
  1280. //const char* strkey, float initialvalue, float min, float WarnMin, float WarnMax, float CalibWarnMin, float CalibWarnMax, float max, float accuracy,std::shared_ptr <CCOS::Dev::IOEventCenter> EventCenter
  1281. m_Temperature.reset(new DeviceTemperatureMould("DetectorTemperature", 0.0f,
  1282. m_stDeviceConfig.fTemperatureErrorMin,
  1283. m_stDeviceConfig.fTemperatureWarnMin,
  1284. m_stDeviceConfig.fTemperatureWarnMax,
  1285. 20.0f, 100.0f,
  1286. m_stDeviceConfig.fTemperatureErrorMax,
  1287. 0.0f, EventCenter));
  1288. //const char* strkey, int initialvalue, int min, int WarnMin, int WarnMax, int CalibWarnMin, int CalibWarnMax, int max, int accuracy, std::shared_ptr <CCOS::Dev::IOEventCenter> EventCenter
  1289. m_Wifi.reset(new DeviceWifiMould("DetectorWifi", 0, m_stDeviceConfig.nWifiLimit,
  1290. m_stDeviceConfig.nWifiWarning, 100, 10, 100, 100, 0, EventCenter));
  1291. //mLog::FINFO("--Func-- LoadConfig end");
  1292. return true;
  1293. }
  1294. void nsFPD::FPDDeviceCareRay::RegisterCtrl(nsDetail::Dispatch* Dispatch)
  1295. {
  1296. Dispatch->Action.Push(ActionKey::GetFPDinformation, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorInfo);
  1297. Dispatch->Action.Push(ActionKey::EnterExam, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSEnterExam);
  1298. Dispatch->Action.Push(ActionKey::ExitExam, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSExitExam);
  1299. Dispatch->Action.Push(ActionKey::SetExposureTimes, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSSetExposureTimes);
  1300. Dispatch->Action.Push(ActionKey::SetXrayOnNum, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSSetXrayOnNum);
  1301. Dispatch->Action.Push(ActionKey::ActiveDetector, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSActiveDetector);
  1302. Dispatch->Get.Push(AttrKey::DetectorConnectStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetConnectStatus);
  1303. Dispatch->Get.Push(AttrKey::DetectorStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetFPDStatus);
  1304. Dispatch->Get.Push(AttrKey::DetectorType, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorType);
  1305. Dispatch->Get.Push(AttrKey::Description, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDescription);
  1306. Dispatch->Get.Push(AttrKey::DetectorID, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorID);
  1307. Dispatch->Get.Push(AttrKey::FPDSensitivity, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetFPDSensitivity);
  1308. Dispatch->Get.Push(AttrKey::PixelData, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetPixelData);
  1309. Dispatch->Get.Push(AttrKey::TargetEXI, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetTargetEXI);
  1310. Dispatch->Get.Push(AttrKey::FPDAttached, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetAttachStatus);
  1311. Dispatch->Get.Push(SupportDDR, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetSupportDDR);
  1312. Dispatch->Get.Push(AttrKey::DetectorWiredIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorWiredIP);
  1313. Dispatch->Get.Push(AttrKey::DetectorWirelessIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorWirelessIP);
  1314. Dispatch->Get.Push(LocalIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetLocalIP);
  1315. Dispatch->Get.Push(AttrKey::SerialNumber, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetSerialNumber);
  1316. Dispatch->Get.Push(ShowTemperature, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetShowTemperature);
  1317. Dispatch->Get.Push(ShowWifi, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetShowWifi);
  1318. Dispatch->Get.Push(ShowBattery, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetShowBattery);
  1319. Dispatch->Get.Push(ShowBluetooth, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetShowBluetooth);
  1320. Dispatch->Set.Push(AttrKey::DetectorConnectStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetConnectStatus);
  1321. Dispatch->Set.Push(AttrKey::DetectorStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorStatus);
  1322. Dispatch->Set.Push(AttrKey::DetectorType, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorType);
  1323. Dispatch->Set.Push(AttrKey::Description, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDescription);
  1324. Dispatch->Set.Push(AttrKey::DetectorID, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorID);
  1325. Dispatch->Set.Push(AttrKey::PixelData, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetPixelData);
  1326. Dispatch->Set.Push(AttrKey::TargetEXI, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetTargetEXI);
  1327. Dispatch->Set.Push(AttrKey::FPDAttached, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetAttachStatus);
  1328. Dispatch->Set.Push(SupportDDR, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetSupportDDR);
  1329. Dispatch->Set.Push(AttrKey::DetectorWiredIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorWiredIP);
  1330. Dispatch->Set.Push(AttrKey::DetectorWirelessIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorWirelessIP);
  1331. Dispatch->Set.Push(LocalIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetLocalIP);
  1332. Dispatch->Set.Push(AttrKey::SerialNumber, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetSerialNumber);
  1333. Dispatch->Set.Push(ShowTemperature, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetShowTemperature);
  1334. Dispatch->Set.Push(ShowWifi, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetShowWifi);
  1335. Dispatch->Set.Push(ShowBattery, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetShowBattery);
  1336. Dispatch->Set.Push(ShowBluetooth, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetShowBluetooth);
  1337. Dispatch->Update.Push(AttrKey::NotifyStatusTimePeriod, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateNotifyStatusTimePeriod);
  1338. Dispatch->Update.Push(AttrKey::ReconnectTimePeriod, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateReconnectTimePeriod);
  1339. Dispatch->Update.Push(AttrKey::DetectorWiredIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateDetectorWiredIP);
  1340. Dispatch->Update.Push(AttrKey::DetectorWirelessIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateDetectorWirelessIP);
  1341. Dispatch->Update.Push(LocalIP, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateLocalIP);
  1342. Dispatch->Update.Push(AttrKey::SerialNumber, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateSerialNumber);
  1343. Dispatch->Update.Push(ShowTemperature, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateShowTemperature);
  1344. Dispatch->Update.Push(ShowWifi, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateShowWifi);
  1345. Dispatch->Update.Push(ShowBattery, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateShowBattery);
  1346. Dispatch->Update.Push(ShowBluetooth, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSUpdateShowBluetooth);
  1347. }
  1348. void nsFPD::FPDDeviceCareRay::RegisterAcq(nsDetail::Dispatch* Dispatch)
  1349. {
  1350. Dispatch->Action.Push(ActionKey::SetAcqMode, m_AcqUnit.get(), &AcqUnit::JSSetAcqMode);
  1351. Dispatch->Get.Push(AttrKey::AcqMode, m_AcqUnit.get(), &AcqUnit::JSGetAcqMode);
  1352. Dispatch->Get.Push(AttrKey::ZskkFPDState, m_AcqUnit.get(), &AcqUnit::JSGetZskkFPDState);
  1353. Dispatch->Get.Push(AttrKey::NoNeedWaitImage, m_AcqUnit.get(), &AcqUnit::JSGetNoNeedWaitImage);
  1354. Dispatch->Get.Push(AttrKey::ImgDataInfo, m_AcqUnit.get(), &AcqUnit::JSGetLastImage);
  1355. Dispatch->Set.Push(AttrKey::ZskkFPDState, m_AcqUnit.get(), &AcqUnit::SetZskkFPDState);
  1356. Dispatch->Set.Push(AttrKey::NoNeedWaitImage, m_AcqUnit.get(), &AcqUnit::JSSetNoNeedWaitImage);
  1357. }
  1358. void nsFPD::FPDDeviceCareRay::RegisterSync(nsDetail::Dispatch* Dispatch)
  1359. {
  1360. Dispatch->Action.Push(ActionKey::SetSyncMode, m_SyncUnit.get(), &SyncUnit::JSSetSyncMode);
  1361. Dispatch->Action.Push(ActionKey::SetXwindowSize, m_SyncUnit.get(), &SyncUnit::JSSetXwindowSize);
  1362. Dispatch->Action.Push(ActionKey::PrepareAcquisition, m_SyncUnit.get(), &SyncUnit::JSPrepareAcquisition);
  1363. Dispatch->Action.Push(ActionKey::StartAcquisition, m_SyncUnit.get(), &SyncUnit::JSStartAcquisition);
  1364. Dispatch->Action.Push(ActionKey::StopAcquisition, m_SyncUnit.get(), &SyncUnit::JSStopAcquisition);
  1365. Dispatch->Action.Push(ActionKey::ActiveSyncMode, m_SyncUnit.get(), &SyncUnit::JSActiveSyncMode);
  1366. Dispatch->Get.Push(AttrKey::FPDReadyStatus, m_SyncUnit.get(), &SyncUnit::JSGetFPDReady);
  1367. Dispatch->Get.Push(AttrKey::XwindowStatus, m_SyncUnit.get(), &SyncUnit::JSGetXWindowStatus);
  1368. Dispatch->Get.Push(AttrKey::ImageReadingStatus, m_SyncUnit.get(), &SyncUnit::JSGetImageReadingStatus);
  1369. Dispatch->Get.Push(AttrKey::FPDExpReady, m_SyncUnit.get(), &SyncUnit::JSGetExpReadyStatus);
  1370. Dispatch->Get.Push(AttrKey::SyncMode, m_SyncUnit.get(), &SyncUnit::JSGetSyncMode);
  1371. Dispatch->Get.Push(AttrKey::SupportSyncMode, m_SyncUnit.get(), &SyncUnit::JSGetSupportSyncMode);
  1372. Dispatch->Set.Push(AttrKey::FPDReadyStatus, m_SyncUnit.get(), &SyncUnit::JSSetFPDReady);
  1373. Dispatch->Set.Push(AttrKey::XwindowStatus, m_SyncUnit.get(), &SyncUnit::JSSetXWindowStatus);
  1374. Dispatch->Set.Push(AttrKey::ImageReadingStatus, m_SyncUnit.get(), &SyncUnit::JSSetImageReadingStatus);
  1375. Dispatch->Set.Push(AttrKey::SupportSyncMode, m_SyncUnit.get(), &SyncUnit::SetSupportSyncMode);
  1376. }
  1377. void nsFPD::FPDDeviceCareRay::RegisterCalib(nsDetail::Dispatch* Dispatch)
  1378. {
  1379. Dispatch->Action.Push(ActionKey::ActiveCalibration, m_CalibUnit.get(), &CalibUnit::JSActiveCalibration);
  1380. Dispatch->Action.Push(ActionKey::GetRequestedDose, m_CalibUnit.get(), &CalibUnit::JSGetRequestedDose);
  1381. Dispatch->Action.Push(ActionKey::SetRequestedDose, m_CalibUnit.get(), &CalibUnit::JSSetRequestedDose);
  1382. Dispatch->Action.Push(ActionKey::PrepareCalibration, m_CalibUnit.get(), &CalibUnit::JSPrepareCalibration);
  1383. Dispatch->Action.Push(ActionKey::StartCalibration, m_CalibUnit.get(), &CalibUnit::JSStartCalibration);
  1384. Dispatch->Action.Push(ActionKey::StopCalibration, m_CalibUnit.get(), &CalibUnit::JSStopCalibration);
  1385. Dispatch->Action.Push(ActionKey::SetCorrectionType, m_CalibUnit.get(), &CalibUnit::JSSetCorrectionType);
  1386. Dispatch->Action.Push(ActionKey::AcceptCalibration, m_CalibUnit.get(), &CalibUnit::JSAcceptCalibration);
  1387. Dispatch->Action.Push(ActionKey::RejectCalibration, m_CalibUnit.get(), &CalibUnit::JSRejectCalibration);
  1388. Dispatch->Action.Push(ActionKey::SaveCalibrationFile, m_CalibUnit.get(), &CalibUnit::JSSaveCalibrationFile);
  1389. Dispatch->Action.Push(ActionKey::GetCalibrationStep, m_CalibUnit.get(), &CalibUnit::JSGetCalibrationStep);
  1390. Dispatch->Get.Push(AttrKey::CalibrationStatus, m_CalibUnit.get(), &CalibUnit::JSGetCalibStatus);
  1391. Dispatch->Get.Push(AttrKey::CalibrationProgress, m_CalibUnit.get(), &CalibUnit::JSGetCalibProgress);
  1392. Dispatch->Get.Push(AttrKey::UploadCalibrationFilesResult, m_CalibUnit.get(), &CalibUnit::JSGetUploadCalibrationFilesResult);
  1393. Dispatch->Get.Push(AttrKey::SupportCalibrationType, m_CalibUnit.get(), &CalibUnit::JSGetSupportCalibrationType);
  1394. Dispatch->Get.Push(AttrKey::HaveImgCalibration, m_CalibUnit.get(), &CalibUnit::JSGetHaveImgCalibration);
  1395. Dispatch->Get.Push(AttrKey::SaveCalibrationFileFinish, m_CalibUnit.get(), &CalibUnit::JSGetSaveCalibrationFileFinish);
  1396. Dispatch->Get.Push(AttrKey::CalibMode, m_CalibUnit.get(), &CalibUnit::JSGetCalibMode);
  1397. Dispatch->Get.Push(AttrKey::LastCalibrationDate, m_CalibUnit.get(), &CalibUnit::JSGetLastCalibrationDate);
  1398. Dispatch->Get.Push(AttrKey::CalibrationFileExpireTime, m_CalibUnit.get(), &CalibUnit::JSGetCalibrationFileExpireTime);
  1399. Dispatch->Get.Push(AttrKey::CalibrationFileExpirationReminder, m_CalibUnit.get(), &CalibUnit::JSGetCalibrationFileExpirationReminder);
  1400. Dispatch->Set.Push(AttrKey::CalibrationStatus, m_CalibUnit.get(), &CalibUnit::SetCalibrationStatus);
  1401. Dispatch->Set.Push(AttrKey::CalibrationProgress, m_CalibUnit.get(), &CalibUnit::SetCalibrationProgress);
  1402. Dispatch->Set.Push(AttrKey::UploadCalibrationFilesResult, m_CalibUnit.get(), &CalibUnit::SetUploadCalibrationFilesResult);
  1403. Dispatch->Set.Push(AttrKey::CalibMode, m_CalibUnit.get(), &CalibUnit::SetCalibMode);
  1404. Dispatch->Set.Push(AttrKey::LastCalibrationDate, m_CalibUnit.get(), &CalibUnit::SetLastCalibrationDate);
  1405. Dispatch->Set.Push(AttrKey::CalibrationFileExpireTime, m_CalibUnit.get(), &CalibUnit::SetCalibrationFileExpireTime);
  1406. Dispatch->Set.Push(AttrKey::CalibrationFileExpirationReminder, m_CalibUnit.get(), &CalibUnit::SetCalibrationFileExpirationReminder);
  1407. Dispatch->Update.Push(AttrKey::CalibMode, m_CalibUnit.get(), &CalibUnit::JSUpdateCalibMode);
  1408. Dispatch->Update.Push(AttrKey::LastCalibrationDate, m_CalibUnit.get(), &CalibUnit::JSUpdateLastCalibrationDate);
  1409. Dispatch->Update.Push(AttrKey::CalibrationFileExpireTime, m_CalibUnit.get(), &CalibUnit::JSUpdateCalibrationFileExpireTime);
  1410. Dispatch->Update.Push(AttrKey::CalibrationFileExpirationReminder, m_CalibUnit.get(), &CalibUnit::JSUpdateCalibrationFileExpirationReminder);
  1411. }
  1412. void nsFPD::FPDDeviceCareRay::RegisterOthers(nsDetail::Dispatch* Dispatch)
  1413. {
  1414. Dispatch->Get.Push(AttrKey::Temperature_Value, m_Temperature.get(), &DeviceTemperatureMould::JSGetCurrentTemperatureValue);
  1415. Dispatch->Get.Push(AttrKey::Remain_Power_Value, m_Battery.get(), &DeviceBatteryMould::JSGetCurrentBatteryValue);
  1416. Dispatch->Get.Push(AttrKey::Wifi_Strength_Value, m_Wifi.get(), &DeviceWifiMould::JSGetCurrentSignalValue);
  1417. Dispatch->Get.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureWarningMax);
  1418. Dispatch->Get.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureWarningMin);
  1419. Dispatch->Get.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureErrorMax);
  1420. Dispatch->Get.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureErrorMin);
  1421. Dispatch->Get.Push(TemperatureCalibUpWarn, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureCalibWarningMax);
  1422. Dispatch->Get.Push(TemperatureCalibLowWarn, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureCalibWarningMin);
  1423. Dispatch->Get.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::JSGetBatteryWarningMin);
  1424. Dispatch->Get.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::JSGetBatteryErrorMin);
  1425. Dispatch->Get.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::JSGetSignalWarningMin);
  1426. Dispatch->Get.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::JSGetSignalErrorMin);
  1427. //Error
  1428. Dispatch->Get.Push(nDetail::AttrKey::ErrorList, m_WarnAndError.get(), &FPDErrorWarning::JSGetErrorList);
  1429. Dispatch->Set.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureWarningMax);
  1430. Dispatch->Set.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureWarningMin);
  1431. Dispatch->Set.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureErrorMax);
  1432. Dispatch->Set.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureErrorMin);
  1433. Dispatch->Set.Push(TemperatureCalibUpWarn, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureCalibWarningMax);
  1434. Dispatch->Set.Push(TemperatureCalibLowWarn, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureCalibWarningMin);
  1435. Dispatch->Set.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::SetBatteryWarningMin);
  1436. Dispatch->Set.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::SetBatteryErrorMin);
  1437. Dispatch->Set.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::SetSignalWarningMin);
  1438. Dispatch->Set.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::SetSignalErrorMin);
  1439. Dispatch->Update.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureWarningMax);
  1440. Dispatch->Update.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureWarningMin);
  1441. Dispatch->Update.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureErrorMax);
  1442. Dispatch->Update.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureErrorMin);
  1443. Dispatch->Update.Push(TemperatureCalibUpWarn, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureCalibWarningMax);
  1444. Dispatch->Update.Push(TemperatureCalibLowWarn, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureCalibWarningMin);
  1445. Dispatch->Update.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::JSUpdateBatteryWarningMin);
  1446. Dispatch->Update.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::JSUpdateBatteryErrorMin);
  1447. Dispatch->Update.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::JSUpdateSignalWarningMin);
  1448. Dispatch->Update.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::JSUpdateSignalErrorMin);
  1449. }
  1450. void nsFPD::FPDDeviceCareRay::OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel,
  1451. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1452. {
  1453. switch (nEventLevel)
  1454. {
  1455. case EVT_LEVEL_CONFIGURATION:
  1456. {
  1457. OnEventProcessConf(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1458. break;
  1459. }
  1460. case EVT_LEVEL_INFORMATOION:
  1461. {
  1462. OnEventProcessInfo(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1463. break;
  1464. }
  1465. case EVT_LEVEL_STATUS:
  1466. {
  1467. OnEventProcessStatus(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1468. break;
  1469. }
  1470. case EVT_LEVEL_DATA:
  1471. {
  1472. OnEventProcessData(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1473. break;
  1474. }
  1475. case EVT_LEVEL_WARNING:
  1476. {
  1477. OnEventProcessWarning(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1478. break;
  1479. }
  1480. case EVT_LEVEL_ERROR:
  1481. {
  1482. OnEventProcessError(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1483. break;
  1484. }
  1485. default:
  1486. break;
  1487. }
  1488. }
  1489. void nsFPD::FPDDeviceCareRay::OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel,
  1490. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1491. {
  1492. //mLog::FERROR("Not support this conf({$})", nEventID);
  1493. }
  1494. void nsFPD::FPDDeviceCareRay::OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel,
  1495. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1496. {
  1497. //mLog::FERROR("Not support this info({$})", nEventID);
  1498. }
  1499. void nsFPD::FPDDeviceCareRay::OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel,
  1500. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1501. {
  1502. switch (nEventID)
  1503. {
  1504. case EVT_STATUS_INIT:
  1505. {
  1506. //mLog::FINFO("EVT_STATUS_INIT nParam1:{$}", nParam1);
  1507. break;
  1508. }
  1509. case EVT_STATUS_PANEL:
  1510. {
  1511. PanelStatus m_ePanelStatus = (PanelStatus)nParam1;
  1512. if (PANEL_CLOSE == nParam1)
  1513. {
  1514. //mLog::FINFO("EVT_STATUS_PANEL PANEL_CLOSE");
  1515. m_bDeviceConnect = false;
  1516. g_Driver->m_bDriverConnect = false;
  1517. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_SHUTDOWN));
  1518. m_DetectorCtrlUnit->SetConnectStatus(to_string(PANEL_DISCONNECT_SUCCESS));
  1519. m_WarnAndError->SendError(ERR_FPD_DISCONNECT,"");
  1520. }
  1521. else if (PANEL_CONNECT == nParam1)
  1522. {
  1523. //mLog::FINFO("EVT_STATUS_PANEL PANEL_CONNECT");
  1524. g_Driver->m_bDriverConnect = true;
  1525. m_bDeviceConnect = true;
  1526. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_WAKEUP));
  1527. m_DetectorCtrlUnit->SetConnectStatus(to_string(PANEL_CONNECT_OK));
  1528. m_WarnAndError->ClearError(ERR_FPD_DISCONNECT);
  1529. }
  1530. else if (PANEL_STANDBY == nParam1)
  1531. {
  1532. //mLog::FINFO("EVT_STATUS_PANEL PANEL_STANDBY");
  1533. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1534. }
  1535. else if (PANEL_READY_EXP == nParam1)
  1536. {
  1537. //mLog::FINFO("EVT_STATUS_PANEL PANEL_READY_EXP");
  1538. m_AcqUnit->SetZskkFPDState(to_string(ZSKK_FPD_STATE_READY));
  1539. }
  1540. else if (PANEL_XWINDOW_ON == nParam1) //Xwindow On
  1541. {
  1542. m_stImgCreateTime = { 0 };
  1543. GetLocalTime(&m_stImgCreateTime);
  1544. //mLog::FINFO("XWindowOn at {$:d04}-{$:d02}-{$:d02} {$:d02}:{$:d02}:{$:d02}:{$:d03}",
  1545. m_stImgCreateTime.wYear, m_stImgCreateTime.wMonth, m_stImgCreateTime.wDay,
  1546. m_stImgCreateTime.wHour, m_stImgCreateTime.wMinute, m_stImgCreateTime.wSecond, m_stImgCreateTime.wMilliseconds);
  1547. m_SyncUnit->XWindowOnNotify();
  1548. }
  1549. else if (PANEL_XWINDOW_OFF == nParam1) // Xwindow Off
  1550. {
  1551. m_stImgCreateTime = { 0 };
  1552. GetLocalTime(&m_stImgCreateTime);
  1553. //mLog::FINFO("XWindowOff at {$:d04}-{$:d02}-{$:d02} {$:d02}:{$:d02}:{$:d02}:{$:d03}",
  1554. m_stImgCreateTime.wYear, m_stImgCreateTime.wMonth, m_stImgCreateTime.wDay,
  1555. m_stImgCreateTime.wHour, m_stImgCreateTime.wMinute, m_stImgCreateTime.wSecond, m_stImgCreateTime.wMilliseconds);
  1556. m_SyncUnit->XWindowOffNotify();
  1557. }
  1558. else if (PANEL_START_ACQ == nParam1)
  1559. {
  1560. //mLog::FINFO("EVT_STATUS_PANEL PANEL_START_ACQ");
  1561. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));//PANEL_START_ACQ
  1562. m_bEnterAcqStatus = true;
  1563. }
  1564. else if (PANEL_XRAY_ON == nParam1)
  1565. {
  1566. //mLog::FINFO("EVT_STATUS_PANEL PANEL_XRAY_ON");
  1567. m_SyncUnit->XrayOnNotify();
  1568. }
  1569. else if (PANEL_XRAY_OFF == nParam1)
  1570. {
  1571. //mLog::FINFO("EVT_STATUS_PANEL PANEL_XRAY_OFF");
  1572. m_SyncUnit->XrayOffNotify();
  1573. }
  1574. break;
  1575. }
  1576. case EVT_STATUS_CALIBRATIOIN:
  1577. {
  1578. //mLog::FINFO("EVT_STATUS_PANEL EVT_STATUS_CALIBRATIOIN");
  1579. PanelEventState eStatus = (PanelEventState)nParam1;
  1580. switch (eStatus)
  1581. {
  1582. case PANEL_EVENT_START:
  1583. break;
  1584. case PANEL_EVENT_END_OK:
  1585. case PANEL_EVENT_END_ERROR:
  1586. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1587. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
  1588. m_CalibUnit->SetCalibrationProgress("100");
  1589. break;
  1590. case PANEL_EVENT_TIMEOUT:
  1591. break;
  1592. default:
  1593. break;
  1594. }
  1595. break;
  1596. }
  1597. case EVT_STATUS_SAVECALIB:
  1598. {
  1599. //mLog::FINFO("EVT_STATUS_SAVECALIB");
  1600. PanelEventState eStatus = (PanelEventState)nParam1;
  1601. switch (eStatus)
  1602. {
  1603. case PANEL_EVENT_START:
  1604. {
  1605. //mLog::FINFO("save calib file start");
  1606. break;
  1607. }
  1608. case PANEL_EVENT_END:
  1609. {
  1610. //mLog::FINFO("save calib file end");
  1611. break;
  1612. }
  1613. default:
  1614. break;
  1615. }
  1616. break;
  1617. }
  1618. case EVT_STATUS_SINGLEEXP:
  1619. {
  1620. //mLog::FINFO("EVT_STATUS_PANEL EVT_STATUS_SINGLEEXP");
  1621. if (DOSE_ACCEPT == nParam1)
  1622. {
  1623. //mLog::FINFO("Calibration Result is acceptable");
  1624. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1625. m_CalibUnit->PauseCalibration();
  1626. }
  1627. else
  1628. {
  1629. //mLog::FERROR("Not support this param({$})", nParam1);
  1630. }
  1631. break;
  1632. }
  1633. case EVT_STATUS_TEMPERATURE:
  1634. {
  1635. //mLog::FINFO("EVT_STATUS_PANEL EVT_STATUS_TEMPERATURE");
  1636. float fTemperature = fParam2;
  1637. // if (fTemperature > m_fTemperMaxLimit)
  1638. // {
  1639. // AddErrMsg("14", "temperature_toohigh");
  1640. // }
  1641. // else if (fTemperature >= m_fTemperWarning)
  1642. // {
  1643. // AddWarnMsg("14", "temperature_high");
  1644. // }
  1645. // else if (fTemperature < m_fTemperMinLimit)
  1646. // {
  1647. // AddErrMsg("14", "temperature_toolow");
  1648. // }
  1649. // else if (fTemperature <= m_fTemperLowLimit)
  1650. // {
  1651. // AddWarnMsg("14", "temperature_low");
  1652. // }
  1653. // else
  1654. // {
  1655. // DelErrMsg("14");
  1656. // }
  1657. SendTemperatureValue(fTemperature);
  1658. break;
  1659. }
  1660. case EVT_STATUS_WIFI:
  1661. {
  1662. //mLog::FINFO("EVT_STATUS_PANEL EVT_STATUS_WIFI");
  1663. int nWifiLevel = nParam1;
  1664. // if (nWifiLevel < m_nWifiLimit)
  1665. // {
  1666. // AddErrMsg("15", "wifi_toolow");
  1667. // }
  1668. // else if (nWifiLevel <= m_nWifiWarning)
  1669. // {
  1670. // AddWarnMsg("15", "wifi_low");
  1671. // }
  1672. // else
  1673. // {
  1674. // DelErrMsg("15");
  1675. // }
  1676. SendWifiValue(nWifiLevel);
  1677. break;
  1678. }
  1679. case EVT_STATUS_BATTERY_VALUE:
  1680. {
  1681. //mLog::FINFO("EVT_STATUS_PANEL EVT_STATUS_BATTERY_VALUE");
  1682. int nBatteryValue = nParam1;
  1683. // if (nBatteryValue < m_nBatteryLimit)
  1684. // {
  1685. // AddErrMsg("16", "battery_toolow");
  1686. // }
  1687. // else if (nBatteryValue <= m_nBatteryWarning)
  1688. // {
  1689. // AddWarnMsg("16", "battery_low");
  1690. // }
  1691. // else
  1692. // {
  1693. // DelErrMsg("16");
  1694. // }
  1695. SendBatteryValue(nBatteryValue);
  1696. break;
  1697. }
  1698. default:
  1699. //mLog::FERROR("Not support this event({$})", nEventID);
  1700. break;
  1701. }
  1702. }
  1703. string nsFPD::FPDDeviceCareRay::MakeImageHead(IMAGE_VIEW_TYPE Type)
  1704. {
  1705. ResDataObject pFullImageHead;
  1706. ResDataObject pPreviewImageHead;
  1707. SYSTEMTIME SystemTime = { 0 };
  1708. GetLocalTime(&SystemTime);
  1709. if (Type == IMAGE_FULL)
  1710. {
  1711. ResDataObject json;
  1712. json.add(SM_IMAGE_TYPE, (int)Type);
  1713. json.add(SM_IMAGE_BIT, m_nImgBits);
  1714. json.add(SM_IMAGE_TAG, 1);
  1715. json.add(SM_IMAGE_INDEX, 1);
  1716. json.add(SM_IMAGE_YEAR, SystemTime.wYear);
  1717. json.add(SM_IMAGE_MONTH, SystemTime.wMonth);
  1718. json.add(SM_IMAGE_DAY, SystemTime.wDay);
  1719. json.add(SM_IMAGE_HOUR, SystemTime.wHour);
  1720. json.add(SM_IMAGE_MINUTE, SystemTime.wMinute);
  1721. json.add(SM_IMAGE_SEC, SystemTime.wSecond);
  1722. json.add(SM_IMAGE_MILLSEC, SystemTime.wMilliseconds);
  1723. json.add(SM_IMAGE_LSB, "5000");
  1724. json.add(SM_IMAGE_DOSE, m_nSensitivity);
  1725. json.add(SM_IMAGE_PIXELREPRESENTATION, "1");
  1726. json.add(SM_IMAGE_PIXELSPACING, m_nPixelSpacing);
  1727. json.add(SM_IMAGE_FLIP, "No");
  1728. json.add(SM_IMAGE_ORIGINX, "0");
  1729. json.add(SM_IMAGE_ORIGINY, "0");
  1730. json.add(SM_IMAGE_EXI2UGY, m_fFactorEXI2UGY);
  1731. json.add(SM_IMAGE_TEMP, 0.0f);
  1732. if (90 == m_nAngle || 270 == m_nAngle)
  1733. {
  1734. json.add(SM_IMAGE_WIDTH, m_nFullImageHeight);
  1735. json.add(SM_IMAGE_HEIGHT, m_nFullImageWidth);
  1736. json.add(SM_IMAGE_ROTATION, "Yes");
  1737. }
  1738. else
  1739. {
  1740. json.add(SM_IMAGE_WIDTH, m_nFullImageWidth);
  1741. json.add(SM_IMAGE_HEIGHT, m_nFullImageHeight);
  1742. json.add(SM_IMAGE_ROTATION, "No");
  1743. }
  1744. pFullImageHead.add(SM_IMAGE_HEAD, json);
  1745. return pFullImageHead.encode();
  1746. }
  1747. else
  1748. {
  1749. ResDataObject json;
  1750. json.add(SM_IMAGE_TYPE, (int)Type);
  1751. json.add(SM_IMAGE_WIDTH, m_nPreviewImageWidth);
  1752. json.add(SM_IMAGE_HEIGHT, m_nPreviewImageHeight);
  1753. json.add(SM_IMAGE_BIT, m_nImgBits);
  1754. json.add(SM_IMAGE_TAG, 1);
  1755. json.add(SM_IMAGE_INDEX, 1);
  1756. json.add(SM_IMAGE_YEAR, SystemTime.wYear);
  1757. json.add(SM_IMAGE_MONTH, SystemTime.wMonth);
  1758. json.add(SM_IMAGE_DAY, SystemTime.wDay);
  1759. json.add(SM_IMAGE_HOUR, SystemTime.wHour);
  1760. json.add(SM_IMAGE_MINUTE, SystemTime.wMinute);
  1761. json.add(SM_IMAGE_SEC, SystemTime.wSecond);
  1762. json.add(SM_IMAGE_MILLSEC, SystemTime.wMilliseconds);
  1763. json.add(SM_IMAGE_LSB, "5000");
  1764. json.add(SM_IMAGE_DOSE, m_nSensitivity);
  1765. json.add(SM_IMAGE_ROTATION, "No");
  1766. json.add(SM_IMAGE_FLIP, "No");
  1767. json.add(SM_IMAGE_ORIGINX, "0");
  1768. json.add(SM_IMAGE_ORIGINY, "0");
  1769. json.add(SM_IMAGE_PIXELSPACING, m_nPixelSpacing);
  1770. json.add(SM_IMAGE_PIXELREPRESENTATION, "1");
  1771. json.add(SM_IMAGE_TEMP, m_stDeviceConfig.fCurrentTemperValue);
  1772. pPreviewImageHead.add(SM_IMAGE_HEAD, json);
  1773. return pPreviewImageHead.encode();
  1774. }
  1775. }
  1776. void nsFPD::FPDDeviceCareRay::OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel,
  1777. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1778. {
  1779. switch (nEventID)
  1780. {
  1781. case EVT_DATA_RAW_IMAGE:
  1782. {
  1783. //mLog::FINFO("EVT_DATA_RAW_IMAGE");
  1784. m_AcqUnit->ImagerPixelSpacingNotify(m_nPixelSpacing);
  1785. memcpy(m_pFullImgBuffer, pParam, (size_t)m_nFullImageWidth * (size_t)m_nFullImageHeight * sizeof(WORD));
  1786. string strImageHeader = MakeImageHead(IMAGE_FULL);
  1787. //mLog::FINFO("Full image head: {$}", strImageHeader);
  1788. if (0 != m_nAngle)
  1789. {
  1790. m_AcqUnit->RotateImage(m_pFullImgBuffer, m_nFullImageHeight, m_nFullImageWidth, m_nAngle);
  1791. }
  1792. m_AcqUnit->AddFrameWithRawHead(IMAGE_FULL, strImageHeader, m_pFullImgBuffer, m_nFullImageWidth * m_nFullImageHeight);
  1793. //mLog::FINFO("Add image over");
  1794. break;
  1795. }
  1796. case EVT_DATA_PREVIEW_IMAGE:
  1797. {
  1798. //mLog::FINFO("EVT_DATA_PREVIEW_IMAGE");
  1799. memcpy(m_pPreviewImgBuffer, pParam, (size_t)m_nPreviewImageWidth * (size_t)m_nPreviewImageHeight * sizeof(WORD));
  1800. string strImageHeader = MakeImageHead(IMAGE_PREVIEW);
  1801. //mLog::FINFO("Preview image head: {$}", strImageHeader);
  1802. m_AcqUnit->AddFrameWithRawHead(IMAGE_PREVIEW, strImageHeader, m_pPreviewImgBuffer, m_nPreviewImageWidth * m_nPreviewImageHeight);
  1803. break;
  1804. }
  1805. case EVT_DATA_DOSEPARAM:
  1806. {
  1807. m_nTargetCalibExi = nParam1;
  1808. //mLog::FINFO("EVT_DATA_DOSEPARAM m_nTargetCalibExi:{$}", m_nTargetCalibExi);
  1809. break;
  1810. }
  1811. default:
  1812. //mLog::FERROR("Not support this data({$})", nEventID);
  1813. break;
  1814. }
  1815. }
  1816. void nsFPD::FPDDeviceCareRay::OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel,
  1817. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1818. {
  1819. switch (nEventID)
  1820. {
  1821. case EVT_ERR_COMMUNICATE:
  1822. //{
  1823. // string strTemp = pszMsg;
  1824. // if (strTemp.find("true") != std::string::npos)
  1825. // {
  1826. // AddErrMsg("0", "communication error");
  1827. // SendTemperatureValue(0);
  1828. // SendWifiValue(0);
  1829. // SendBatteryValue(0);
  1830. // }
  1831. // else if (strTemp.find("false") != std::string::npos)
  1832. // {
  1833. // DelErrMsg("0");
  1834. // }
  1835. //}
  1836. break;
  1837. case EVT_ERR_INIT_FAILED:
  1838. //{
  1839. // string strTemp = pszMsg;
  1840. // if (strTemp.find("true") != std::string::npos)
  1841. // {
  1842. // AddErrMsg("6", "initialize error");
  1843. // }
  1844. // else if (strTemp.find("false") != std::string::npos)
  1845. // {
  1846. // //一般不可恢复
  1847. // }
  1848. //}
  1849. break;
  1850. default:
  1851. //mLog::FERROR("Not support this error({$})", nEventID);
  1852. break;
  1853. }
  1854. }
  1855. void nsFPD::FPDDeviceCareRay::OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel,
  1856. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1857. {
  1858. //mLog::FERROR("Not support this warn({$})", nEventID);
  1859. }
  1860. RET_STATUS nsFPD::FPDDeviceCareRay::ActiveSyncMode(int nSyncMode)
  1861. {
  1862. //mLog::FINFO("--Func-- ActiveSyncMode nSyncMode:{$}", nSyncMode);
  1863. m_eSyncMode = (SYNC_MODE)nSyncMode;
  1864. if (g_pDetector->SetSyncMode(nSyncMode))
  1865. {
  1866. return RET_SUCCEED;
  1867. }
  1868. else
  1869. {
  1870. //mLog::FERROR("ActiveSyncMode fail!");
  1871. return RET_FAILED;
  1872. }
  1873. }
  1874. RET_STATUS nsFPD::FPDDeviceCareRay::ActiveDetector(bool bActive)
  1875. {
  1876. //mLog::FINFO("--Func-- ActiveDetector bActive:{$}", bActive);
  1877. if (g_pDetector->ActiveDetector(this, bActive))
  1878. {
  1879. if (bActive)
  1880. {
  1881. //mLog::FINFO("ActiveDetector success!");
  1882. }
  1883. else
  1884. {
  1885. //mLog::FINFO("InActiveDetector success!");
  1886. }
  1887. return RET_SUCCEED;
  1888. }
  1889. else
  1890. {
  1891. if (bActive)
  1892. {
  1893. //mLog::FERROR("ActiveDetector fail!");
  1894. }
  1895. else
  1896. {
  1897. //mLog::FERROR("InActiveDetector fail!");
  1898. }
  1899. return RET_FAILED;
  1900. }
  1901. }
  1902. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateCalibMode(CCOS_CALIBRATION_MODE eCalibMode)
  1903. {
  1904. //mLog::FINFO("--Func-- UpdateCalibMode eCalibMode:{$}", (int)eCalibMode);
  1905. m_stDeviceConfig.nCalibMode = (int)eCalibMode;
  1906. if (g_pDetector->UpdateCalibMode(eCalibMode))
  1907. {
  1908. //mLog::FINFO("UpdateCalibMode success!");
  1909. return RET_SUCCEED;
  1910. }
  1911. else
  1912. {
  1913. //mLog::FERROR("UpdateCalibMode fail!");
  1914. return RET_FAILED;
  1915. }
  1916. }
  1917. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateNotifyStatusTimePeriod(int nTime)
  1918. {
  1919. //mLog::FINFO("--Func-- UpdateNotifyStatusTimePeriod nTime:{$}", nTime);
  1920. m_stDeviceConfig.nNotifyStatusTimePeriod = nTime;
  1921. g_pDetector->SetNotifyStatusTimePeriod(nTime);
  1922. return RET_SUCCEED;
  1923. }
  1924. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateReconnectTimePeriod(int nTime)
  1925. {
  1926. //mLog::FINFO("--Func-- UpdateReconnectTimePeriod nTime:{$}", nTime);
  1927. m_stDeviceConfig.nReconnectTimePeriod = nTime;
  1928. g_pDetector->SetReconnectTimePeriod(nTime);
  1929. return RET_SUCCEED;
  1930. }
  1931. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateLastCalibrationDate(std::string in)
  1932. {
  1933. //mLog::FINFO("--Func-- UpdateLastCalibrationDate in:{$}", in);
  1934. m_stDeviceConfig.strLastCalibrationDate = in;
  1935. return RET_SUCCEED;
  1936. }
  1937. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateCalibrationFileExpireTime(std::string in)
  1938. {
  1939. //mLog::FINFO("--Func-- UpdateCalibrationFileExpireTime in:{$}", in);
  1940. m_stDeviceConfig.strCalibrationFileExpireTime = in;
  1941. return RET_SUCCEED;
  1942. }
  1943. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateCalibrationFileExpirationReminder(std::string in)
  1944. {
  1945. //mLog::FINFO("--Func-- UpdateCalibrationFileExpirationReminder in:{$}", in);
  1946. m_stDeviceConfig.strCalibrationFileExpirationReminder = in;
  1947. return RET_SUCCEED;
  1948. }
  1949. /***
  1950. * 客户端获取探测器信息
  1951. ***/
  1952. RET_STATUS nsFPD::FPDDeviceCareRay::GetDetectorInfo(string& strInfo)
  1953. {
  1954. //mLog::FINFO("--Func-- GetDetectorInfo");
  1955. ResDataObject strDetectorInfo;
  1956. if (m_stDeviceConfig.strPanelSerial == "")
  1957. {
  1958. //mLog::FWARN("strPanelSerial is null, Send Default Info");
  1959. strDetectorInfo.add("DetectorName", "Simulator");
  1960. strDetectorInfo.add("DetectorSN", "Simulator");
  1961. strDetectorInfo.add("SSID", " ");
  1962. strDetectorInfo.add("LifeTime", "0");
  1963. strDetectorInfo.add("PowerOn", "0");
  1964. strDetectorInfo.add("DateCode", " ");
  1965. strDetectorInfo.add("PartNumber", " ");
  1966. strDetectorInfo.add("WifiDataRate", " ");
  1967. strDetectorInfo.add("WifiChannel", "0");
  1968. strDetectorInfo.add("DetectorExist", "0");
  1969. strDetectorInfo.add("SystemAS", "0");
  1970. strDetectorInfo.add("CalibrationDate", "0");
  1971. strDetectorInfo.add("CalibrationDue", "0");
  1972. strDetectorInfo.add("CalibrationExist", "0");
  1973. strDetectorInfo.add("CommunicationStatus", "0");
  1974. strDetectorInfo.add("DetectorTemperature", "0");
  1975. strDetectorInfo.add("FDCalibrationTemperature", "0");
  1976. strDetectorInfo.add("TemperatureStatus", "0");
  1977. strDetectorInfo.add("WaitTime", "0");
  1978. strDetectorInfo.add("DetectorWifiSignal", "0");
  1979. strDetectorInfo.add("DetectorBattery", "0");
  1980. strDetectorInfo.add("ShockSensor", "NULL");
  1981. strDetectorInfo.add("FirmwareUpdate", "0");
  1982. strInfo = strDetectorInfo.encode();
  1983. return RET_STATUS::RET_SUCCEED;
  1984. }
  1985. strDetectorInfo.add("DetectorName", m_stDeviceConfig.strDeviceName.c_str());
  1986. strDetectorInfo.add("DetectorSN", m_stDeviceConfig.strPanelSerial.c_str());
  1987. //strDetectorInfo.add("Firmware", m_stDeviceConfig.strFirmware.c_str());
  1988. //strDetectorInfo.add("APFirmware", "NULL");
  1989. //strDetectorInfo.add("Software", m_stDeviceConfig.strSoftware.c_str());
  1990. //strDetectorInfo.add("SSID", m_stDeviceConfig.strWifiSSID.c_str());
  1991. //strDetectorInfo.add("LifeTime", m_stDeviceConfig.nLifeTime);
  1992. //strDetectorInfo.add("PowerOn", m_stDeviceConfig.nPowerOn);
  1993. //strDetectorInfo.add("FD_Voltage_List1", m_strVoltage.c_str());
  1994. //strDetectorInfo.add("DateCode", m_stDeviceConfig.strDateCode.c_str());
  1995. //strDetectorInfo.add("PartNumber", m_stDeviceConfig.strPartNumber.c_str());
  1996. //strDetectorInfo.add("WifiDataRate", m_stDeviceConfig.nWifiDataRate);
  1997. //strDetectorInfo.add("WifiChannel", m_stDeviceConfig.nWifiChannel);
  1998. //strDetectorInfo.add("DetectorExist", m_stDeviceConfig.bExisted);
  1999. //strDetectorInfo.add("SystemAS", m_stDeviceConfig.pDetModeInfoStruct[0].nWorkStation);
  2000. strInfo = strDetectorInfo.encode();
  2001. return RET_STATUS::RET_SUCCEED;
  2002. }