DIOS.Dev.FPD.CareRayRF.cpp 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916
  1. #include "stdafx.h"
  2. #include "FileVersion.hpp"
  3. #include "CCOS.Dev.FPD.CareRayRF.h"
  4. #include "common_api.h"
  5. #include "DICOMImageHeadKey.h"
  6. #include "Detector_CareRayRF.h"
  7. #include <sys/stat.h>
  8. namespace nsFPD = CCOS::Dev::Detail::Detector;
  9. static nsFPD::CareRayDriver gIODriver;
  10. Log4CPP::Logger* gLogger = nullptr;
  11. extern Detector_CareRayRF* g_pDetector;
  12. extern const char* g_szMouldPath;
  13. extern "C" CCOS::Dev::IODriver * __cdecl GetIODriver() // 返回静态对象的引用, 调用者不能删除 !
  14. {
  15. return &gIODriver;
  16. }
  17. extern "C" CCOS::Dev::IODriver * __cdecl CreateIODriver() // 返回新对象, 调用者必须自行删除此对象 !
  18. {
  19. return new nsFPD::CareRayDriver();
  20. }
  21. nsFPD::CareRayDriver::CareRayDriver()
  22. {
  23. pObjDev = nullptr;
  24. m_bDriverConnect = false; //缺省为false
  25. m_pAttribute.reset(new ResDataObject());
  26. m_pDescription.reset(new ResDataObject());
  27. }
  28. nsFPD::CareRayDriver::~CareRayDriver()
  29. {
  30. if (pObjDev != nullptr)
  31. {
  32. delete pObjDev;
  33. pObjDev = nullptr;
  34. }
  35. Close();
  36. Log4CPP::ThreadContext::Map::Clear();
  37. gLogger = nullptr;
  38. }
  39. void nsFPD::CareRayDriver::Prepare()
  40. {
  41. printf("--Driver-- prepare \r\n");
  42. string strLogPath = GetProcessDirectory() + R"(\Conf\Log4CPP.Config.xml)";
  43. auto rc = Log4CPP::LogManager::LoadConfigFile(strLogPath.c_str());
  44. gLogger = Log4CPP::LogManager::GetLogger("Module");
  45. FINFO("Code Build datetime [{$} {$}]", __DATE__, __TIME__);
  46. #ifdef _WIN64
  47. FINFO("=============================Version: {$} (64-bit)==================================", FileVersion(g_szMouldPath).GetVersionString());
  48. #else
  49. FINFO("=============================Version: {$} (32-bit)==================================", FileVersion(g_szMouldPath).GetVersionString());
  50. #endif
  51. FINFO("Driver Prepare get logger");
  52. }
  53. bool nsFPD::CareRayDriver::Connect()
  54. {
  55. printf("--Func-- driver connect \r\n");
  56. FINFO("--Func-- driver connect");
  57. pObjDev = new FPDDeviceCareRay(EventCenter, m_ConfigFileName);
  58. m_bDriverConnect = true; //connect执行完毕,置为true
  59. printf("CareRayRF driver module: Connect over\r\n");
  60. return true;
  61. }
  62. void nsFPD::CareRayDriver::Disconnect()
  63. {
  64. printf("--Func-- driver disconnect \r\n");
  65. FINFO("--Func-- driver disconnect");
  66. if (pObjDev != nullptr)
  67. {
  68. delete pObjDev;
  69. pObjDev = nullptr;
  70. }
  71. m_bDriverConnect = false;
  72. }
  73. bool nsFPD::CareRayDriver::isConnected() const
  74. {
  75. return m_bDriverConnect;
  76. }
  77. auto nsFPD::CareRayDriver::CreateDevice(int index)->std::unique_ptr <IODevice>
  78. {
  79. printf("--Func-- driver createdevice \r\n");
  80. FINFO("--Func-- driver createdevice \n");
  81. auto Device = std::unique_ptr<IODevice>(new IODevice(pObjDev));
  82. pObjDev->CreateDevice();
  83. pObjDev->Register();
  84. return Device;
  85. }
  86. std::string nsFPD::CareRayDriver::DriverProbe()
  87. {
  88. printf("--Func-- driver DriverProbe \r\n");
  89. FINFO("--Func-- driver DriverProbe \n");
  90. ResDataObject r_config, HardwareInfo;
  91. if (r_config.loadFile(m_ConfigFileName.c_str()))
  92. {
  93. HardwareInfo.add("MajorID", r_config["CONFIGURATION"]["MajorID"]);
  94. HardwareInfo.add("MinorID", r_config["CONFIGURATION"]["MinorID"]);
  95. HardwareInfo.add("VendorID", r_config["CONFIGURATION"]["VendorID"]);
  96. HardwareInfo.add("ProductID", r_config["CONFIGURATION"]["ProductID"]);
  97. HardwareInfo.add("SerialID", r_config["CONFIGURATION"]["SerialID"]);
  98. }
  99. else
  100. {
  101. HardwareInfo.add("MajorID", "Detector");
  102. HardwareInfo.add("MinorID", "RF");
  103. HardwareInfo.add("VendorID", "CareRay");
  104. HardwareInfo.add("ProductID", "CareRay");
  105. HardwareInfo.add("SerialID", "Driver");
  106. }
  107. string str = HardwareInfo.encode();
  108. return str;
  109. }
  110. /***
  111. ** 获取ID和配置
  112. ***/
  113. std::string nsFPD::CareRayDriver::GetResource()
  114. {
  115. printf("--Func-- driver GetResource \r\n");
  116. FINFO("--Func-- driver GetResource");
  117. ResDataObject r_config, temp;
  118. if (!temp.loadFile(m_ConfigFileName.c_str()))
  119. {
  120. FERROR("load file error! file name:{$}",m_ConfigFileName.c_str());
  121. return "";
  122. }
  123. m_ConfigAll = temp;
  124. r_config = temp["CONFIGURATION"];
  125. m_Configurations = r_config;
  126. ResDataObject DescriptionTemp;
  127. ResDataObject ListTemp;
  128. string strTemp = ""; //用于读取字符串配置信息
  129. string strIndex = ""; //用于读取配置信息中的List项
  130. int nTemp = -1; //用于读取整型配置信息
  131. char sstream[10] = { 0 }; //用于转换值
  132. string strValue = ""; //用于存储配置的值
  133. string strType = ""; //用于存储配置的类型 int/float/string...
  134. /***
  135. * 1. 通过循环,将所有配置项写到pDeviceConfig
  136. * 2. 记录配置项的内部key以及配置类型,类型对应了不同配置文件路径,用于读写真实值
  137. ***/
  138. try
  139. {
  140. int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
  141. //FINFO(g_pFPDCtrlLog, "ConfigInfo Count: {$}", nConfigInfoCount);
  142. m_pAttribute->clear();
  143. m_pDescription->clear();
  144. for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
  145. {
  146. DescriptionTemp.clear();
  147. ListTemp.clear();
  148. //AttributeType
  149. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Type"];
  150. DescriptionTemp.add(AttributeType, strTemp.c_str());
  151. //FINFO(g_pFPDCtrlLog, "--> {$}: {$}", AttributeType, strTemp.c_str());
  152. strType = strTemp; //记录配置项的类型
  153. //AttributeKey
  154. //1. 根据AttributeType,内部key和配置路径,拿到当前的真实值
  155. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
  156. nTemp = (int)m_Configurations["ConfigToolInfo"][nInfoIndex]["PathID"];
  157. GetDeviceConfigValue(r_config, strTemp.c_str(), nTemp, strValue);
  158. //2. 赋值
  159. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
  160. if ("int" == strType)
  161. {
  162. (*m_pAttribute).add(strTemp.c_str(), atoi(strValue.c_str()));
  163. //FINFO(g_pFPDCtrlLog, "Key {$}: {$}", strTemp.c_str(), atoi(strValue.c_str()));
  164. }
  165. else if ("float" == strType)
  166. {
  167. (*m_pAttribute).add(strTemp.c_str(), atof(strValue.c_str()));
  168. //FINFO(g_pFPDCtrlLog, "Key {$}: {$}", strTemp.c_str(), atof(strValue.c_str()));
  169. }
  170. else //其它先按string类型处理
  171. {
  172. (*m_pAttribute).add(strTemp.c_str(), strValue.c_str());
  173. //FINFO(g_pFPDCtrlLog, "Key {$}: {$}", strTemp.c_str(), strValue.c_str());
  174. }
  175. //AttributeAccess
  176. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Access"];
  177. DescriptionTemp.add(AttributeAccess, strTemp.c_str());
  178. //FINFO(g_pFPDCtrlLog, "{$}: {$}", AttributeAccess, strTemp.c_str());
  179. //AttributeRangeMin
  180. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["RangeMin"];
  181. if (strTemp != "") //不需要的配置项为空
  182. {
  183. DescriptionTemp.add(AttributeRangeMin, strTemp.c_str());
  184. //FINFO(g_pFPDCtrlLog, "{$}: {$}", AttributeRangeMin, strTemp.c_str());
  185. }
  186. //AttributeRangeMax
  187. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["RangeMax"];
  188. if (strTemp != "") //不需要的配置项为空
  189. {
  190. DescriptionTemp.add(AttributeRangeMax, strTemp.c_str());
  191. //FINFO(g_pFPDCtrlLog, "{$}: {$}", AttributeRangeMax, strTemp.c_str());
  192. }
  193. //AttributeList
  194. nTemp = m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListNum"];
  195. if (nTemp > 0) //ListNum不大于0时说明不需要list配置
  196. {
  197. for (int nListIndex = 0; nListIndex < nTemp; nListIndex++)
  198. {
  199. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListInfo"][nListIndex];
  200. //sprintf_s(sstream, "{$}", nListIndex);
  201. auto temKey = std::to_string(nListIndex);
  202. ListTemp.add(temKey.c_str(), strTemp.c_str());
  203. //FINFO(g_pFPDCtrlLog, "list {$}: {$}", nListIndex, strTemp.c_str());
  204. }
  205. DescriptionTemp.add(AttributeList, ListTemp);
  206. }
  207. //AttributeRequired
  208. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["Required"];
  209. DescriptionTemp.add(AttributeRequired, strTemp.c_str());
  210. //FINFO(g_pFPDCtrlLog, "{$}: {$}", AttributeRequired, strTemp.c_str());
  211. //AttributeDefaultValue
  212. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["DefaultValue"];
  213. if (strTemp != "") //不需要的配置项为空
  214. {
  215. DescriptionTemp.add(AttributeDefaultValue, strTemp.c_str());
  216. //FINFO(g_pFPDCtrlLog, "{$}: {$}", AttributeDefaultValue, strTemp.c_str());
  217. }
  218. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
  219. (*m_pDescription).add(strTemp.c_str(), DescriptionTemp);
  220. }
  221. }
  222. catch (exception e)
  223. {
  224. FERROR("Get config error: {$}", e.what());
  225. return "";
  226. }
  227. ResDataObject resDeviceResource;
  228. resDeviceResource.add(ConfKey::CcosDetectorAttribute, (*m_pAttribute));
  229. resDeviceResource.add(ConfKey::CcosDetectorDescription, (*m_pDescription));
  230. ResDataObject DescriptionTempEx;
  231. DescriptionTempEx.add(ConfKey::CcosDetectorConfig, resDeviceResource);
  232. m_DeviceConfig = DescriptionTempEx;
  233. string res = DescriptionTempEx.encode();
  234. printf("CareRayRF driver module: get resource over \r\n");
  235. //FINFO("get resource over {$}", res.c_str());//此处在调试读取配置的时候再放开,不然打印很长查日志不方便
  236. FINFO("get resource over!");
  237. return res;
  238. }
  239. std::string nsFPD::CareRayDriver::DeviceProbe()
  240. {
  241. printf("--Func-- driver DeviceProbe \r\n");
  242. FINFO("--Func-- driver DeviceProbe \n");
  243. ResDataObject r_config, HardwareInfo;
  244. if (r_config.loadFile(m_ConfigFileName.c_str()))
  245. {
  246. HardwareInfo.add("MajorID", r_config["CONFIGURATION"]["MajorID"]);
  247. HardwareInfo.add("MinorID", "Device");
  248. HardwareInfo.add("VendorID", r_config["CONFIGURATION"]["VendorID"]);
  249. HardwareInfo.add("ProductID", r_config["CONFIGURATION"]["ProductID"]);
  250. HardwareInfo.add("SerialID", r_config["CONFIGURATION"]["SerialID"]);
  251. }
  252. else
  253. {
  254. HardwareInfo.add("MajorID", "Detector");
  255. HardwareInfo.add("MinorID", "Device");
  256. HardwareInfo.add("VendorID", "CareRay");
  257. HardwareInfo.add("ProductID", "CareRay");
  258. HardwareInfo.add("SerialID", "1234");
  259. }
  260. string str = HardwareInfo.encode();
  261. return str;
  262. }
  263. bool nsFPD::CareRayDriver::GetDeviceConfig(std::string& Cfg)
  264. {
  265. printf("--Func-- driver GetDeviceConfig \r\n");
  266. FINFO("--Func-- driver GetDeviceConfig \n");
  267. Cfg = m_DeviceConfig.encode();
  268. FINFO("GetDeviceConfig over");
  269. return true;
  270. }
  271. bool nsFPD::CareRayDriver::SetDeviceConfig(std::string Cfg)
  272. {
  273. printf("--Func-- driver SetDeviceConfig \r\n");
  274. FINFO("--Func-- SetDeviceConfig {$}", Cfg.c_str());
  275. ResDataObject DeviceConfig;
  276. DeviceConfig.decode(Cfg.c_str());
  277. ResDataObject DescriptionTempEx;
  278. DescriptionTempEx = DeviceConfig["DeviceConfig"];
  279. bool bSaveFile = false; //true:重新保存配置文件
  280. string strAccess = "";
  281. for (int i = 0; i < DescriptionTempEx.size(); i++)
  282. {
  283. ResDataObject temp = DescriptionTempEx[i];
  284. FINFO("{$}", temp.encode());
  285. for (int j = 0; j < temp.size(); j++)
  286. {
  287. string strKey = temp.GetKey(j);
  288. FINFO("{$}", strKey.c_str());
  289. try
  290. {
  291. if (m_pAttribute->GetFirstOf(strKey.c_str()) >= 0)
  292. {
  293. strAccess = (string)(*m_pDescription)[strKey.c_str()]["Access"];
  294. if ("RW" == strAccess || "rw" == strAccess)
  295. {
  296. //修改对应配置,在其他单元的配置项要同时调用其修改函数修改真实值
  297. //1. 修改内存中的值,用于给上层发消息
  298. (*m_pAttribute)[strKey.c_str()] = temp[j];
  299. //2. 拿到Innerkey
  300. int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
  301. FINFO("ConfigInfo Count: {$}", nConfigInfoCount);
  302. string strTemp = ""; //存储AttributeKey
  303. for (int nInfoIndex = 0; nInfoIndex < nConfigInfoCount; nInfoIndex++)
  304. {
  305. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
  306. if (strTemp == strKey)
  307. {
  308. strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
  309. break;
  310. }
  311. }
  312. //3. 修改配置文件中的值
  313. if (SetDeviceConfigValue(m_Configurations, strTemp.c_str(), 1, temp[j]))
  314. {
  315. bSaveFile = true;
  316. }
  317. }
  318. else
  319. {
  320. FINFO("{$} is not a RW configuration item", strKey.c_str());
  321. }
  322. }
  323. }
  324. catch (ResDataObjectExption& e)
  325. {
  326. FERROR("SetDriverConfig crashed: {$}", e.what());
  327. return false;
  328. }
  329. }
  330. }
  331. if (bSaveFile)
  332. {
  333. //3. 重新保存配置文件
  334. SaveConfigFile(true);
  335. }
  336. return true;
  337. }
  338. bool nsFPD::CareRayDriver::SaveConfigFile(bool bSendNotify)
  339. {
  340. FINFO("SaveConfigFile start m_ConfigFileName:{$}", m_ConfigFileName);
  341. m_ConfigAll["CONFIGURATION"] = m_Configurations;
  342. m_ConfigAll.SaveFile(m_ConfigFileName.c_str());
  343. FINFO("SaveConfigFile over");
  344. return true;
  345. }
  346. bool nsFPD::CareRayDriver::GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue)
  347. {
  348. //strValue = "";
  349. //string strTemp = pInnerKey;
  350. //if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
  351. //{
  352. // if (WiredIP == strTemp || WirelessIP == strTemp || LocalIP == strTemp)
  353. // {
  354. // strValue = (string)config["connections"][pInnerKey];
  355. // }
  356. // else if (DetectorVender == strTemp || DetectorModel == strTemp ||
  357. // DetectorDescription == strTemp || DetectorSerialNumber == strTemp)
  358. // {
  359. // strValue = (string)config[pInnerKey];
  360. // }
  361. // else if (SyncType == strTemp || FPDWorkStation == strTemp || OperationMode == strTemp || ExamType == strTemp || ExiThreshold == strTemp ||
  362. // ImageWidth == strTemp || ImageHeight == strTemp || RawImgWidth == strTemp || RawImgHeight == strTemp)
  363. // {
  364. // strValue = (string)config["ModeTable"]["DetectorMode"][pInnerKey];
  365. // }
  366. // else if (TempMaxLimit == strTemp || ReConnect == strTemp ||
  367. // TempUpperLimit == strTemp || TempLowerLimit == strTemp || TempMinLimit == strTemp ||
  368. // BatLowerLimit == strTemp || BatMiniLimit == strTemp ||
  369. // BatLowerLimitInCali == strTemp || WifiLowerLimit == strTemp ||
  370. // WifiMiniLimit == strTemp || HighPowerTimeout == strTemp ||
  371. // ShowTemperature == strTemp || ShowWifi == strTemp ||
  372. // ShowBattery == strTemp || ShowBluetooth == strTemp ||
  373. // FPDExamMode == strTemp || FPDAcqMode == strTemp || FPDModeMatch == strTemp || CcosDetectorAttachedFlag == strTemp)
  374. // {
  375. // strValue = (string)config[pInnerKey];
  376. // }
  377. // else
  378. // {
  379. // strValue = "";
  380. // FERROR("Error Configuration item: {$}", pInnerKey);
  381. // }
  382. //}
  383. return true;
  384. }
  385. bool nsFPD::CareRayDriver::SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey,
  386. int nPathID, const char* szValue)
  387. {
  388. //string strTemp = pInnerKey;
  389. //FINFO("Begin to change {$} item value to {$}", pInnerKey, szValue);
  390. //if (1 == nPathID) //从DriverConfig路径下每个DPC自己的配置文件读取
  391. //{
  392. // if (WiredIP == strTemp || WirelessIP == strTemp || LocalIP == strTemp)
  393. // {
  394. // config["connections"][pInnerKey] = szValue;
  395. // }
  396. // else if (DetectorVender == strTemp || DetectorModel == strTemp ||
  397. // DetectorDescription == strTemp || DetectorSerialNumber == strTemp)
  398. // {
  399. // config[pInnerKey] = szValue;
  400. // }
  401. // else if (SyncType == strTemp || FPDWorkStation == strTemp || OperationMode == strTemp || ExamType == strTemp || ExiThreshold == strTemp ||
  402. // ImageWidth == strTemp || ImageHeight == strTemp || RawImgWidth == strTemp || RawImgHeight == strTemp)
  403. // {
  404. // config["ModeTable"]["DetectorMode"][pInnerKey] = szValue;
  405. // }
  406. // else if (TempMaxLimit == strTemp || ReConnect == strTemp ||
  407. // TempUpperLimit == strTemp || TempLowerLimit == strTemp ||
  408. // BatLowerLimit == strTemp || BatMiniLimit == strTemp ||
  409. // BatLowerLimitInCali == strTemp || WifiLowerLimit == strTemp ||
  410. // WifiMiniLimit == strTemp || HighPowerTimeout == strTemp ||
  411. // ShowTemperature == strTemp || ShowWifi == strTemp ||
  412. // ShowBattery == strTemp || ShowBluetooth == strTemp ||
  413. // FPDExamMode == strTemp || FPDAcqMode == strTemp || FPDModeMatch == strTemp || CcosDetectorAttachedFlag == strTemp)
  414. // {
  415. // config[pInnerKey] = szValue;
  416. // }
  417. // else
  418. // {
  419. // FERROR("Error Configuration item: {$}", pInnerKey);
  420. // return false;
  421. // }
  422. //}
  423. return true;
  424. }
  425. nsFPD::FPDDeviceCareRay::FPDDeviceCareRay(std::shared_ptr<IOEventCenter> center,std::string strConfigPath)
  426. {
  427. m_strWorkPath = GetProcessDirectory();
  428. m_nImageWidth = 0;
  429. m_nImageHeight = 0;
  430. m_nImgBits = 0;
  431. m_nAngle = 0;
  432. m_nPixelSpacing = 0;
  433. m_nSensitivity = 0;
  434. m_fDose = 0.0f;
  435. m_pImgBuffer = nullptr;
  436. m_eAppStatus = APP_STATUS_IDLE;
  437. m_bConnect = false;
  438. m_nCurrentAcqMode = 0;
  439. m_DetectorCtrlUnit.reset(new OemCtrl(center, this));
  440. m_AcqUnit.reset(new OemAcq(center, this));
  441. m_SyncUnit.reset(new OemSync(center, this));
  442. m_CalibUnit.reset(new OemCalib(center, this));
  443. m_DetectorConfiguration.reset(new DetectorConfiguration(strConfigPath));
  444. m_WarnAndError.reset(new FPDErrorWarning(center, DetectorUnitType, m_strWorkPath));
  445. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_INIT));
  446. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
  447. EventCenter = center;
  448. m_vDetectorModeList.clear();
  449. m_fCurrentPPS = 15.0f;
  450. m_fMaxFrameRate = 30.0f;
  451. m_vAcqModeInfoList.clear();
  452. m_nImageIndex = 1;
  453. m_fFactorEXI2UGY = 0.0f;
  454. }
  455. nsFPD::FPDDeviceCareRay::~FPDDeviceCareRay()
  456. {
  457. FINFO("~FPDDeviceCareRay");
  458. if (nullptr != g_pDetector)
  459. {
  460. delete g_pDetector;
  461. g_pDetector = nullptr;
  462. }
  463. if (nullptr != m_pImgBuffer)
  464. {
  465. delete m_pImgBuffer;
  466. m_pImgBuffer = nullptr;
  467. }
  468. m_vDetectorModeList.clear();
  469. m_vAcqModeInfoList.clear();
  470. }
  471. std::string nsFPD::FPDDeviceCareRay::GetGUID() const
  472. {
  473. return DetectorUnitType;
  474. }
  475. bool nsFPD::FPDDeviceCareRay::Prepare()
  476. {
  477. printf("--Func-- device Prepare \r\n");
  478. FINFO("--Func-- device prepare nMaxImgWidth:{$},nMaxImgHeight:{$}", m_stDeviceConfig.nMaxImgWidth, m_stDeviceConfig.nMaxImgHeight);
  479. //blockname, fullimage blocksize, blockcount,previewimage blocksize,blockcount
  480. EventCenter->OnMaxBlockSize("CareRayRfQue",m_stDeviceConfig.nMaxImgWidth * m_stDeviceConfig.nMaxImgHeight * 2, 20, 1500 * 1500 * 2, 1);
  481. Connect();
  482. return true;
  483. }
  484. bool nsFPD::FPDDeviceCareRay::CreateDevice()
  485. {
  486. printf("--Func-- device CreateDevice \r\n");
  487. FINFO("--Func-- device CreateDevice \n");
  488. if (!LoadConfig())
  489. {
  490. return false;
  491. }
  492. if (nullptr == g_pDetector)
  493. {
  494. g_pDetector = new Detector_CareRayRF();
  495. }
  496. g_pDetector->DriverEntry(this, m_DetectorConfiguration->m_Configurations);
  497. return true;
  498. }
  499. bool nsFPD::FPDDeviceCareRay::LoadConfig()
  500. {
  501. printf("--Func-- device LoadConfig \r\n");
  502. FINFO("--Func-- device LoadConfig start");
  503. //LoadConfigurations必须比下边俩函数先调用,否则会有问题
  504. if (!m_DetectorConfiguration->LoadConfigurations(m_stDeviceConfig, m_ACQMODElist, m_vAcqModeInfoList))
  505. {
  506. FERROR("Load configuration file failed!!!");
  507. return false;
  508. }
  509. m_DetectorCtrlUnit->SetDetectorWidth(to_string(m_stDeviceConfig.nDetectorWidth));
  510. m_DetectorCtrlUnit->SetDetectorHeight(to_string(m_stDeviceConfig.nDetectorHeight));
  511. m_stDeviceConfig.nMaxImgWidth = m_stDeviceConfig.nDetectorWidth;
  512. m_stDeviceConfig.nMaxImgHeight = m_stDeviceConfig.nDetectorHeight;
  513. m_CalibUnit->SetOffsetInterval(to_string(m_stDeviceConfig.nOffsetInterval));
  514. m_CalibUnit->SetOffsetStatus("Idle");
  515. m_CalibUnit->SetOffsetProgress(to_string(0));
  516. if (m_stDeviceConfig.bSupportDDR) //是否支持DDR采集功能
  517. {
  518. m_DetectorCtrlUnit->SetSupportDDR("1");
  519. }
  520. else
  521. {
  522. m_DetectorCtrlUnit->SetSupportDDR("0");
  523. }
  524. //加载校正时使用的剂量文件
  525. if (!m_DetectorConfiguration->LoadCalibrationDose(m_strWorkPath, m_CalibDoseList))
  526. {
  527. FERROR("Load Calibration Dose failed!!!");
  528. return false;
  529. }
  530. m_DetectorCtrlUnit->SetTargetEXI("5000");
  531. //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
  532. m_Battery.reset(new DeviceBatteryMould("DetectorBattery", 0,
  533. m_stDeviceConfig.nBatteryLimit,
  534. m_stDeviceConfig.nBatteryWarning,
  535. 90, 20, 90, 100, 0, EventCenter));
  536. //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
  537. m_Temperature.reset(new DeviceTemperatureMould("DetectorTemperature", 0.0f,
  538. m_stDeviceConfig.fTemperatureErrorMin,
  539. m_stDeviceConfig.fTemperatureWarnMin,
  540. m_stDeviceConfig.fTemperatureWarnMax,
  541. 20.0f, 100.0f,
  542. m_stDeviceConfig.fTemperatureErrorMax,
  543. 0.0f, EventCenter));
  544. //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
  545. m_Wifi.reset(new DeviceWifiMould("DetectorWifi", 0,
  546. m_stDeviceConfig.nWifiLimit,
  547. m_stDeviceConfig.nWifiWarning,
  548. 100, 10, 100, 100, 0, EventCenter));
  549. FINFO("--Func-- device LoadConfig end");
  550. return true;
  551. }
  552. void nsFPD::FPDDeviceCareRay::Register()
  553. {
  554. auto Disp = &Dispatch;
  555. RegisterCtrl(Disp);
  556. RegisterAcq(Disp);
  557. RegisterSync(Disp);
  558. RegisterCalib(Disp);
  559. RegisterOthers(Disp);
  560. }
  561. RET_STATUS nsFPD::FPDDeviceCareRay::Connect()
  562. {
  563. printf("--Func-- device Connect \r\n");
  564. FINFO("--Func-- device Connect \n");
  565. m_DetectorCtrlUnit->SetAttachStatus("1"); //没有attach功能,直接上发1,使客户端显示探测器状态
  566. if(g_pDetector->Connect(this, m_strWorkPath.c_str(), m_DetectorModeList))
  567. {
  568. m_bConnect = true;
  569. }
  570. else
  571. {
  572. FERROR("Connect Detector fail!");
  573. return RET_STATUS::RET_FAILED;
  574. }
  575. //读取detector mode list 后把内容保存到Vector中,当设置PPS时,从Vector中查找适合当前帧率的最大分辨率的模式
  576. unsigned long dpi = 0;
  577. float fTempMax = 0.0f;
  578. try
  579. {
  580. for (size_t i = 0; i < m_DetectorModeList.size(); i++)
  581. {
  582. ResDataObject temp = m_DetectorModeList[i];
  583. int nModeID = temp["ModeID"];
  584. int nWidth = temp["ImageWidth"];
  585. int nHeight = temp["ImageHeight"];
  586. int nCutOffX = temp["CutOffX"];
  587. int nCutOffY = temp["CutOffY"];
  588. string strBinningMode = temp["BinningMode"];
  589. float fMaxFrameRate = temp["MaxFrameRate"];
  590. int nGainID = temp["GainID"];
  591. int nExpTime = temp["ExpTime"];
  592. FINFO("Detector ModeID:{$} Width:{$} Height:{$} nCutOffX:{$} nCutOffY:{$} Binning:{$} MaxFrameRate:{$} GainID:{$} ExpTime:{$}",
  593. nModeID, nWidth, nHeight, nCutOffX, nCutOffY, strBinningMode, fMaxFrameRate, nGainID, nExpTime);
  594. DetectorMode tempMode;
  595. tempMode.modeID = nModeID;
  596. tempMode.imageWidth = nWidth;
  597. tempMode.imageHeight = nHeight;
  598. tempMode.cutOffX = nCutOffX;
  599. tempMode.cutOffY = nCutOffY;
  600. tempMode.binningMode = strBinningMode;
  601. tempMode.maxFrameRate = fMaxFrameRate;
  602. tempMode.gainID = nGainID;
  603. tempMode.expTime = nExpTime;
  604. m_vDetectorModeList.push_back(tempMode);
  605. if ((unsigned long)nWidth * (unsigned long)nHeight > dpi)
  606. {
  607. dpi = nWidth * nHeight;
  608. m_stDeviceConfig.nMaxImgWidth = nWidth;
  609. m_stDeviceConfig.nMaxImgHeight = nHeight;
  610. }
  611. if (fMaxFrameRate > fTempMax)
  612. {
  613. fTempMax = fMaxFrameRate;
  614. }
  615. }
  616. }
  617. catch (ResDataObjectExption& e)
  618. {
  619. FERROR("Get detector mode error: {$}", e.what());
  620. return RET_STATUS::RET_FAILED;
  621. }
  622. FINFO("m_stDeviceConfig.nMaxImgWidth:{$},m_stDeviceConfig.nMaxImgHeight:{$}", m_stDeviceConfig.nMaxImgWidth, m_stDeviceConfig.nMaxImgHeight);
  623. if (m_pImgBuffer)
  624. {
  625. delete m_pImgBuffer;
  626. m_pImgBuffer = nullptr;
  627. }
  628. m_pImgBuffer = new WORD[(size_t)m_stDeviceConfig.nMaxImgWidth * (size_t)m_stDeviceConfig.nMaxImgHeight];
  629. FINFO("Current detector max frame rate is:{$}", fTempMax);
  630. m_fMaxFrameRate = fTempMax;
  631. m_AcqUnit->SetMaxFrameRate(m_fMaxFrameRate);
  632. return RET_STATUS::RET_SUCCEED;
  633. }
  634. RET_STATUS nsFPD::FPDDeviceCareRay::EnterExam(int nExamMode)
  635. {
  636. FINFO("--Func-- EnterExam {$}", nExamMode);
  637. switch (nExamMode)
  638. {
  639. case APP_STATUS_WORK_BEGIN:
  640. FINFO("Enter into Exam Windows");
  641. m_eAppStatus = APP_STATUS_WORK_BEGIN;
  642. break;
  643. case APP_STATUS_WORK_END:
  644. FINFO("Quit Exam Windows");
  645. m_eAppStatus = APP_STATUS_WORK_END;
  646. break;
  647. case APP_STATUS_DETSHARE_BEGIN:
  648. FINFO("Enter into Detector Share Windows");
  649. m_eAppStatus = APP_STATUS_DETSHARE_BEGIN;
  650. break;
  651. case APP_STATUS_DETSHAR_END:
  652. m_eAppStatus = APP_STATUS_IDLE;
  653. FINFO("Quit Detector Share Windows");
  654. m_eAppStatus = APP_STATUS_DETSHAR_END;
  655. break;
  656. case APP_STATUS_CAL_BEGIN:
  657. FINFO("Enter into Calibration Windows");
  658. m_eAppStatus = APP_STATUS_CAL_BEGIN;
  659. break;
  660. case APP_STATUS_CAL_END:
  661. FINFO("Quit Calibration Windows");
  662. m_eAppStatus = APP_STATUS_CAL_END;
  663. break;
  664. case APP_STATUS_WORK_IN_SENSITIVITY:
  665. FINFO("Enter into sensitivity test interface");
  666. m_eAppStatus = APP_STATUS_WORK_IN_SENSITIVITY;
  667. break;
  668. default:
  669. break;
  670. }
  671. g_pDetector->EnterExamMode(nExamMode);
  672. return RET_STATUS::RET_SUCCEED;
  673. }
  674. bool nsFPD::FPDDeviceCareRay::GetLogicMode(string& strAcqMode, int& nLogicMode)
  675. {
  676. if (strAcqMode == "RAD")
  677. {
  678. nLogicMode = RAD;
  679. }
  680. else if (strAcqMode == "CF")
  681. {
  682. nLogicMode = CF;
  683. }
  684. else if (strAcqMode == "PF")
  685. {
  686. nLogicMode = PF;
  687. }
  688. else if (strAcqMode == "1")
  689. {
  690. nLogicMode = RAD;
  691. }
  692. else if (strAcqMode == "2")
  693. {
  694. nLogicMode = CF;
  695. }
  696. else if (strAcqMode == "3")
  697. {
  698. nLogicMode = PF;
  699. }
  700. else
  701. {
  702. FERROR("Not support mode!");
  703. return false;
  704. }
  705. return true;
  706. }
  707. RET_STATUS nsFPD::FPDDeviceCareRay::SetAcqMode(string strAcqMode)
  708. {
  709. printf("--Func-- SetAcqMode(%s) \r\n", strAcqMode.c_str());
  710. FINFO("--Func-- SetAcqMode strAcqMode:{$}", strAcqMode);
  711. RET_STATUS ret = RET_STATUS::RET_FAILED;
  712. //如果没连接,不执行
  713. if (!m_bConnect)
  714. {
  715. FERROR("Detector not connected, return");
  716. return ret;
  717. }
  718. //由于动态需要ready快,故通知探测器ready状态在这里通知
  719. if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus() || DETECTOR_STATUS_CALIB == m_DetectorCtrlUnit->GetDetectorStatus())
  720. {
  721. FINFO("SetAcqMode detector is not standby!");
  722. ret = StopAcquisition();
  723. if (ret != RET_STATUS::RET_SUCCEED)
  724. {
  725. FERROR("SetAcqMode StopAcquisition fail!!!");
  726. return ret;
  727. }
  728. else
  729. {
  730. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  731. }
  732. }
  733. else
  734. {
  735. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  736. }
  737. int nMode = RAD;
  738. bool bRet = GetLogicMode(strAcqMode, nMode);
  739. if (!bRet)
  740. {
  741. return RET_STATUS::RET_FAILED;
  742. }
  743. //只有RAD模式读取配置文件,CF和PF不读取全部配置文件,只读取部分
  744. try
  745. {
  746. ResDataObject objModeConfig = m_DetectorConfiguration->m_Configurations;
  747. int nModeCount = (int)objModeConfig["ModeTable"].size();
  748. for (int i = 0; i < nModeCount; i++)
  749. {
  750. //FINFO("ModeTable {$}, {$}",i, objModeConfig["ModeTable"][i].encode());
  751. int nAppModeID = (int)objModeConfig["ModeTable"][i]["LogicMode"];
  752. if (nAppModeID == nMode)
  753. {
  754. if (nMode == RAD)
  755. {
  756. m_nImageWidth = (int)objModeConfig["ModeTable"][i]["ImageWidth"];
  757. m_nImageHeight = (int)objModeConfig["ModeTable"][i]["ImageHeight"];
  758. }
  759. m_nImgBits = (int)objModeConfig["ModeTable"][i]["PhySizeInfoBit"];
  760. m_nPixelSpacing = (int)objModeConfig["ModeTable"][i]["PixelPitch"];
  761. m_nSensitivity = (int)objModeConfig["ModeTable"][i]["Sensitivity"];
  762. m_nAngle = (int)objModeConfig["ModeTable"][i]["RotateAngle"];
  763. string strDoseOfExi = std::to_string(m_nSensitivity);
  764. m_fFactorEXI2UGY = 100.0f / stof(strDoseOfExi) * 1.0f;//统一使用IEC标准 呈现四角信息,无单位 ugy * 100 -ugy。所有Zskk探测器的FactorEXI2UGY均需*100
  765. FINFO("m_fFactorEXI2UGY = {$} ", m_fFactorEXI2UGY);
  766. m_DetectorCtrlUnit->SetFPDSensitivity(std::to_string(m_fFactorEXI2UGY));
  767. break;
  768. }
  769. }
  770. }
  771. catch (ResDataObjectExption& e)
  772. {
  773. FERROR("Read configuration failed, Error code: {$}", e.what());
  774. ret = RET_STATUS::RET_FAILED;
  775. return ret;
  776. }
  777. m_nCurrentAcqMode = nMode;
  778. if (g_pDetector->SetAcqMode(nMode))
  779. {
  780. ret = RET_STATUS::RET_SUCCEED;
  781. m_AcqUnit->AcqModeNotify(strAcqMode);
  782. }
  783. else
  784. {
  785. ret = RET_STATUS::RET_FAILED;
  786. }
  787. return ret;
  788. }
  789. RET_STATUS nsFPD::FPDDeviceCareRay::PrepareAcquisition()
  790. {
  791. printf("--Func-- PrepareAcquisition \r\n");
  792. FINFO("--Func-- PrepareAcquisition");
  793. RET_STATUS ret = RET_STATUS::RET_FAILED;
  794. if (!m_bConnect)
  795. {
  796. FERROR("Detector not connected, return");
  797. return ret;
  798. }
  799. if ((m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_RUNNING) ||
  800. (m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_ACTIVE))
  801. {
  802. FERROR("PrepareAcquisition failed! Detector at Calibration status!");
  803. return ret;
  804. }
  805. if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
  806. {
  807. FERROR("Detector at Acq status!");
  808. return ret;
  809. }
  810. if (g_pDetector->PrepareAcquisition(this))
  811. {
  812. ret = RET_STATUS::RET_SUCCEED;
  813. }
  814. FINFO("PrepareAcquisition over");
  815. return ret;
  816. }
  817. RET_STATUS nsFPD::FPDDeviceCareRay::StartAcquisition(string in)
  818. {
  819. printf("--Func-- StartAcquisition \r\n");
  820. FINFO("--Func-- StartAcquisition");
  821. FINFO("StartAcquisition param in:{$}", in);
  822. RET_STATUS ret = RET_STATUS::RET_FAILED;
  823. if (!m_bConnect)
  824. {
  825. FERROR("Detector not connected, return");
  826. return ret;
  827. }
  828. FINFO("StartAcquisition m_nCurrentAcqMode:{$}", m_nCurrentAcqMode);
  829. //RAD时用固定的模式,从配置文件读取
  830. if (in == "RAD" || in == "CF" || in == "PF")
  831. {
  832. ret = SetAcqMode(in);
  833. if (ret != RET_STATUS::RET_SUCCEED)
  834. {
  835. FERROR("StartAcquisition SetAcqMode fail!");
  836. return ret;
  837. }
  838. }
  839. else
  840. {
  841. FERROR("Not support this mode, mode name:{$}",in);
  842. return ret;
  843. }
  844. ret = PrepareAcquisition();
  845. if (ret != RET_STATUS::RET_SUCCEED)
  846. {
  847. FERROR("StartAcquisition PrepareAcquisition fail!");
  848. return ret;
  849. }
  850. if (DETECTOR_STATUS_STANDBY != m_DetectorCtrlUnit->GetDetectorStatus())
  851. {
  852. if ((m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_RUNNING) ||
  853. (m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_ACTIVE))
  854. {
  855. //printf(("PrepareAcquisition failed. Detector at Calibration status.\n");
  856. FERROR("PrepareAcquisition failed. Detector at Calibration status.");
  857. }
  858. if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
  859. {
  860. //printf(("Detector already at Acq status.\n");
  861. FERROR("Detector already at Acq status.");
  862. }
  863. }
  864. else
  865. {
  866. if (g_pDetector->StartAcquisition(this))
  867. {
  868. ret = RET_STATUS::RET_SUCCEED;
  869. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));
  870. m_nImageIndex = 1;
  871. }
  872. else
  873. {
  874. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  875. }
  876. }
  877. FINFO("StartAcquisition over");
  878. return ret;
  879. }
  880. RET_STATUS nsFPD::FPDDeviceCareRay::StopAcquisition()
  881. {
  882. printf("--Func-- StopAcquisition \r\n");
  883. FINFO("--Func-- StopAcquisition");
  884. RET_STATUS ret = RET_STATUS::RET_FAILED;
  885. if (!m_bConnect)
  886. {
  887. FERROR("Detector not connected, return");
  888. return ret;
  889. }
  890. if (DETECTOR_STATUS_STANDBY == m_DetectorCtrlUnit->GetDetectorStatus())
  891. {
  892. //printf(("Detector already at stanby status.\n");
  893. FINFO("Detector already at stanby status.");
  894. ret = RET_STATUS::RET_SUCCEED;
  895. }
  896. else
  897. {
  898. if (g_pDetector->StopAcquisition(this))
  899. {
  900. ret = RET_STATUS::RET_SUCCEED;
  901. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  902. }
  903. }
  904. FINFO("StopAcquisition over");
  905. return ret;
  906. }
  907. RET_STATUS nsFPD::FPDDeviceCareRay::SetFluPPS(float fFluPPS)
  908. {
  909. FINFO("--Func-- SetFluPPS:{$}", fFluPPS);
  910. m_fCurrentPPS = fFluPPS;
  911. bool bFind = false;
  912. //更新m_fFrameRate值
  913. for (size_t i = 0; i < m_vAcqModeInfoList.size(); i++)
  914. {
  915. if (m_vAcqModeInfoList[i].fFrequency == fFluPPS)
  916. {
  917. FINFO("find config pps");
  918. bFind = true;
  919. g_pDetector->UpdateModeInRunning(m_vAcqModeInfoList[i].nModeID,fFluPPS);
  920. m_AcqUnit->FluPPSNotify(fFluPPS);
  921. break;
  922. }
  923. }
  924. if (!bFind)
  925. {
  926. FINFO("not find config pps");
  927. float fRealFps = g_pDetector->SetFluPPS(fFluPPS, m_vDetectorModeList);
  928. if (fRealFps > 0.0f)
  929. {
  930. m_AcqUnit->FluPPSNotify(fRealFps);
  931. }
  932. }
  933. return RET_STATUS::RET_SUCCEED;
  934. }
  935. RET_STATUS nsFPD::FPDDeviceCareRay::GetFluPPS(float& fFluPPS)
  936. {
  937. g_pDetector->GetFluPPS(fFluPPS);
  938. return RET_STATUS::RET_SUCCEED;
  939. }
  940. RET_STATUS nsFPD::FPDDeviceCareRay::SetXrayOnNum()
  941. {
  942. FINFO("--Func-- SetXrayOnNum");
  943. if (g_pDetector->SetXrayOnNum())
  944. {
  945. return RET_STATUS::RET_SUCCEED;
  946. }
  947. return RET_STATUS::RET_FAILED;
  948. }
  949. RET_STATUS nsFPD::FPDDeviceCareRay::SetExposureTimes(int nTimes)
  950. {
  951. FINFO("--Func-- SetExposureTimes({$})", nTimes);
  952. if (g_pDetector->SetExposureTimes(nTimes))
  953. {
  954. return RET_STATUS::RET_SUCCEED;
  955. }
  956. return RET_STATUS::RET_FAILED;
  957. }
  958. RET_STATUS nsFPD::FPDDeviceCareRay::ActiveCalibration(CCOS_CALIBRATION_TYPE eType)
  959. {
  960. printf("--Func-- ActiveCalibration eType:%d \r\n", eType);
  961. FINFO("--Func-- ActiveCalibration {$}", (int)eType);
  962. RET_STATUS ret = RET_STATUS::RET_FAILED;
  963. if (!m_bConnect)
  964. {
  965. FERROR("Detector not connected, return");
  966. return ret;
  967. }
  968. if (eType == CCOS_CALIBRATION_TYPE_NONE || eType == CCOS_CALIBRATION_TYPE_MAX)
  969. {
  970. return RET_STATUS::RET_INVALID;
  971. }
  972. if (DETECTOR_STATUS_STANDBY != m_DetectorCtrlUnit->GetDetectorStatus())
  973. {
  974. if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
  975. {
  976. //printf(("ActiveCalibration failed. Detector at Acq status\r\n");
  977. FERROR("ActiveCalibration failed. Detector at Acq status");
  978. }
  979. return RET_STATUS::RET_FAILED;
  980. }
  981. if (g_pDetector->ActiveCalibration(this, eType))
  982. {
  983. ret = RET_STATUS::RET_SUCCEED;
  984. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_ACTIVE));
  985. m_CalibUnit->SetCalibrationProgress("0");
  986. }
  987. else
  988. {
  989. FERROR("Active calibration failed");
  990. }
  991. FINFO("ActiveCalibration over");
  992. return ret;
  993. }
  994. RET_STATUS nsFPD::FPDDeviceCareRay::PrepareCalibration()
  995. {
  996. printf("--Func-- PrepareCalibration \r\n");
  997. FINFO("--Func-- PrepareCalibration");
  998. RET_STATUS ret = RET_STATUS::RET_FAILED;
  999. if (!m_bConnect)
  1000. {
  1001. FERROR("Detector not connected, return");
  1002. return ret;
  1003. }
  1004. if (g_pDetector->PrepareCalibration(this))
  1005. {
  1006. ret = RET_STATUS::RET_SUCCEED;
  1007. }
  1008. else
  1009. {
  1010. FERROR("Prepare calibration failed");
  1011. }
  1012. FINFO("PrepareCalibration over");
  1013. return ret;
  1014. }
  1015. RET_STATUS nsFPD::FPDDeviceCareRay::GetRequestedDose(std::string& strDose)
  1016. {
  1017. printf("--Func-- GetRequestedDose \r\n");
  1018. FINFO("--Func-- GetRequestedDose");
  1019. RET_STATUS Ret = RET_STATUS::RET_SUCCEED;
  1020. bool bGetDoseInfo = false;
  1021. ResDataObject out;
  1022. CCOS_CALIBRATION_TYPE nCalibrationType = m_CalibUnit->GetCalibrationType();
  1023. if (CCOS_CALIBRATION_TYPE_DARK == nCalibrationType)
  1024. {
  1025. out.add("Dose", 0.0f);
  1026. out.add("kV", 0.0f);
  1027. out.add("mA", 0.0f);
  1028. out.add("ms", 0.0f);
  1029. out.add("mAs", 0.0f);
  1030. bGetDoseInfo = true;
  1031. }
  1032. else if (CCOS_CALIBRATION_TYPE_XRAY == nCalibrationType)
  1033. {
  1034. for (int i = 0; i < m_CalibDoseList.size(); i++)
  1035. {
  1036. ResDataObject temp = m_CalibDoseList[i];
  1037. int nDose = temp["Dose"];
  1038. int nDoseParem = (int)(m_fDose * 1000);
  1039. if (nDoseParem == nDose)
  1040. {
  1041. out.add("Dose", nDoseParem);
  1042. out.add("kV", temp["kV"]);
  1043. out.add("mA", temp["mA"]);
  1044. out.add("ms", temp["ms"]);
  1045. out.add("mAs", temp["mAs"]);
  1046. bGetDoseInfo = true;
  1047. break;
  1048. }
  1049. }
  1050. }
  1051. else
  1052. {
  1053. Ret = RET_STATUS::RET_FAILED;
  1054. }
  1055. if (bGetDoseInfo)
  1056. {
  1057. strDose = out.encode();
  1058. FINFO("GetRequestedDose {$} over", strDose.c_str());
  1059. }
  1060. else
  1061. {
  1062. FERROR("GetRequestedDose failed");
  1063. }
  1064. return Ret;
  1065. }
  1066. RET_STATUS nsFPD::FPDDeviceCareRay::StartCalibration()
  1067. {
  1068. printf("--Func-- StartCalibration \r\n");
  1069. FINFO("--Func-- StartCalibration");
  1070. RET_STATUS ret = RET_STATUS::RET_FAILED;
  1071. if (!m_bConnect)
  1072. {
  1073. FERROR("Detector not connected, return");
  1074. return ret;
  1075. }
  1076. if ((m_CalibUnit->GetCalibrationStatus() != CCOS_CALIBRATION_STATUS_PAUSE) && (m_CalibUnit->GetCalibrationStatus() != CCOS_CALIBRATION_STATUS_ACTIVE))
  1077. {
  1078. FERROR("Start calibration failed, in {$} status", (int)m_CalibUnit->GetCalibrationStatus());
  1079. return ret;
  1080. }
  1081. if (DETECTOR_STATUS_STANDBY != m_DetectorCtrlUnit->GetDetectorStatus())
  1082. {
  1083. if (DETECTOR_STATUS_ACQ == m_DetectorCtrlUnit->GetDetectorStatus())
  1084. {
  1085. FERROR("Start calibration failed. Detector already at Acq status");
  1086. }
  1087. return ret;
  1088. }
  1089. if (m_CalibUnit->GetCalibrationStatus() == CCOS_CALIBRATION_STATUS_RUNNING)
  1090. {
  1091. FERROR("Detector already at calib status");
  1092. return ret;
  1093. }
  1094. if (g_pDetector->StartCalibration(this))
  1095. {
  1096. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_ACQ));
  1097. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_RUNNING));
  1098. ret = RET_STATUS::RET_SUCCEED;
  1099. }
  1100. else
  1101. {
  1102. FERROR("Start calibration failed");
  1103. return ret;
  1104. }
  1105. FINFO("StartCalibration over");
  1106. return ret;
  1107. }
  1108. RET_STATUS nsFPD::FPDDeviceCareRay::StopCalibration()
  1109. {
  1110. printf("--Func-- StopCalibration \r\n");
  1111. FINFO("--Func-- StopCalibration");
  1112. RET_STATUS ret = RET_STATUS::RET_FAILED;
  1113. if (!m_bConnect)
  1114. {
  1115. FERROR("Detector not connected, return");
  1116. return ret;
  1117. }
  1118. if (g_pDetector->StopCalibration(this))
  1119. {
  1120. ret = RET_STATUS::RET_SUCCEED;
  1121. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
  1122. m_CalibUnit->SetCalibrationProgress("100");
  1123. }
  1124. else
  1125. {
  1126. FERROR("Start calibration failed");
  1127. }
  1128. FINFO("StopCalibration over");
  1129. return ret;
  1130. }
  1131. bool nsFPD::FPDDeviceCareRay::Support_DarkCalib()
  1132. {
  1133. return true;
  1134. }
  1135. bool nsFPD::FPDDeviceCareRay::Support_XrayCalib()
  1136. {
  1137. return true;
  1138. }
  1139. //理论上定义的Action和Attr的名称要在CCOS.Dev.FPDDeviceMould.hpp中定义,之前由于不清楚导致有的名称在Detector_Model_Def.h中定义的 以后要规范
  1140. void nsFPD::FPDDeviceCareRay::RegisterCtrl(nsDetail::Dispatch* Dispatch)
  1141. {
  1142. Dispatch->Action.Push(ActionKey::GetFPDinformation, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorInfo);
  1143. Dispatch->Action.Push(ActionKey::ActiveDetector, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSActiveDetector);
  1144. Dispatch->Action.Push(ActionKey::EnterExam, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSEnterExam);
  1145. Dispatch->Action.Push(ActionKey::ExitExam, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSExitExam);
  1146. Dispatch->Action.Push(ActionKey::SetXrayOnNum, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSSetXrayOnNum);
  1147. Dispatch->Action.Push(ActionKey::SetExposureTimes, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSSetExposureTimes);
  1148. Dispatch->Get.Push(AttrKey::DetectorConnectStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetConnectStatus);
  1149. Dispatch->Get.Push(AttrKey::DetectorStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetFPDStatus);
  1150. Dispatch->Get.Push(AttrKey::Description, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDescription);
  1151. Dispatch->Get.Push(AttrKey::FPDSensitivity, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetFPDSensitivity);
  1152. Dispatch->Get.Push(AttrKey::TargetEXI, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetTargetEXI);
  1153. Dispatch->Get.Push(SupportDDR, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetSupportDDR);
  1154. Dispatch->Get.Push(AttrKey::DetectorID, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorID);
  1155. Dispatch->Get.Push(AttrKey::DetectorType, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorType);
  1156. Dispatch->Get.Push(AttrKey::PixelData, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetPixelData);
  1157. Dispatch->Get.Push(AttrKey::DetectorWidth, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorWidth);
  1158. Dispatch->Get.Push(AttrKey::DetectorHeight, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetDetectorHeight);
  1159. Dispatch->Get.Push(AttrKey::FPDAttached, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::JSGetAttachStatus);
  1160. Dispatch->Set.Push(AttrKey::DetectorConnectStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetConnectStatus);
  1161. Dispatch->Set.Push(AttrKey::DetectorStatus, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorStatus);
  1162. Dispatch->Set.Push(AttrKey::Description, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDescription);
  1163. Dispatch->Set.Push(AttrKey::FPDSensitivity, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetFPDSensitivity);
  1164. Dispatch->Set.Push(AttrKey::TargetEXI, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetTargetEXI);
  1165. Dispatch->Set.Push(SupportDDR, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetSupportDDR);
  1166. Dispatch->Set.Push(AttrKey::DetectorID, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorID);
  1167. Dispatch->Set.Push(AttrKey::DetectorType, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetDetectorType);
  1168. Dispatch->Set.Push(AttrKey::PixelData, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetPixelData);
  1169. Dispatch->Set.Push(AttrKey::FPDAttached, m_DetectorCtrlUnit.get(), &DetectorCtrlUnit::SetAttachStatus);
  1170. }
  1171. void nsFPD::FPDDeviceCareRay::RegisterAcq(nsDetail::Dispatch* Dispatch)
  1172. {
  1173. Dispatch->Action.Push(ActionKey::SetAcqMode, m_AcqUnit.get(), &AcqUnit::JSSetAcqMode);
  1174. Dispatch->Action.Push(ActionKey::SetValue_PPS, m_AcqUnit.get(), &AcqUnit::JSSetFluPPS);
  1175. Dispatch->Get.Push(AttrKey::AcqMode, m_AcqUnit.get(), &AcqUnit::JSGetAcqMode);
  1176. Dispatch->Get.Push(AttrKey::ZskkFPDState, m_AcqUnit.get(), &AcqUnit::JSGetZskkFPDState);
  1177. Dispatch->Get.Push(AttrKey::NoNeedWaitImage, m_AcqUnit.get(), &AcqUnit::JSGetNoNeedWaitImage);
  1178. Dispatch->Get.Push(AttrKey::ImgDataInfo, m_AcqUnit.get(), &AcqUnit::JSGetLastImage);
  1179. Dispatch->Get.Push(AttrKey::MaxFrameRate, m_AcqUnit.get(), &AcqUnit::JSGetMaxFrameRate);
  1180. Dispatch->Get.Push(AttrKey::FluPPS, m_AcqUnit.get(), &AcqUnit::JSGetFluPPS);
  1181. Dispatch->Set.Push(AttrKey::ZskkFPDState, m_AcqUnit.get(), &AcqUnit::SetZskkFPDState);
  1182. Dispatch->Set.Push(AttrKey::NoNeedWaitImage, m_AcqUnit.get(), &AcqUnit::JSSetNoNeedWaitImage);
  1183. Dispatch->Update.Push(AttrKey::ModeInRunning, m_AcqUnit.get(), &AcqUnit::JSUpdateModeInRunning);
  1184. }
  1185. void nsFPD::FPDDeviceCareRay::RegisterSync(nsDetail::Dispatch* Dispatch)
  1186. {
  1187. Dispatch->Action.Push(ActionKey::PrepareAcquisition, m_SyncUnit.get(), &SyncUnit::JSPrepareAcquisition);
  1188. Dispatch->Action.Push(ActionKey::StartAcquisition, m_SyncUnit.get(), &SyncUnit::JSStartAcquisition);
  1189. Dispatch->Action.Push(ActionKey::StopAcquisition, m_SyncUnit.get(), &SyncUnit::JSStopAcquisition);
  1190. Dispatch->Get.Push(AttrKey::FPDReadyStatus, m_SyncUnit.get(), &SyncUnit::JSGetFPDReady);
  1191. Dispatch->Get.Push(AttrKey::XwindowStatus, m_SyncUnit.get(), &SyncUnit::JSGetXWindowStatus);
  1192. Dispatch->Get.Push(AttrKey::ImageReadingStatus, m_SyncUnit.get(), &SyncUnit::JSGetImageReadingStatus);
  1193. Dispatch->Set.Push(AttrKey::FPDReadyStatus, m_SyncUnit.get(), &SyncUnit::JSSetFPDReady);
  1194. Dispatch->Set.Push(AttrKey::XwindowStatus, m_SyncUnit.get(), &SyncUnit::JSSetXWindowStatus);
  1195. Dispatch->Set.Push(AttrKey::ImageReadingStatus, m_SyncUnit.get(), &SyncUnit::JSSetImageReadingStatus);
  1196. }
  1197. void nsFPD::FPDDeviceCareRay::RegisterCalib(nsDetail::Dispatch* Dispatch)
  1198. {
  1199. Dispatch->Action.Push(ActionKey::ActiveCalibration, m_CalibUnit.get(), &CalibUnit::JSActiveCalibration);
  1200. Dispatch->Action.Push(ActionKey::GetRequestedDose, m_CalibUnit.get(), &CalibUnit::JSGetRequestedDose);
  1201. Dispatch->Action.Push(ActionKey::PrepareCalibration, m_CalibUnit.get(), &CalibUnit::JSPrepareCalibration);
  1202. Dispatch->Action.Push(ActionKey::StartCalibration, m_CalibUnit.get(), &CalibUnit::JSStartCalibration);
  1203. Dispatch->Action.Push(ActionKey::StopCalibration, m_CalibUnit.get(), &CalibUnit::JSStopCalibration);
  1204. Dispatch->Action.Push(ActionKey::SetCorrectionType, m_CalibUnit.get(), &CalibUnit::JSSetCorrectionType);
  1205. Dispatch->Action.Push(ActionKey::StartOffset, m_CalibUnit.get(), &CalibUnit::JSStartOffset);
  1206. Dispatch->Action.Push(ActionKey::AbortOffset, m_CalibUnit.get(), &CalibUnit::JSAbortOffset);
  1207. Dispatch->Get.Push(AttrKey::CalibrationStatus, m_CalibUnit.get(), &CalibUnit::JSGetCalibStatus);
  1208. Dispatch->Get.Push(AttrKey::CalibrationProgress, m_CalibUnit.get(), &CalibUnit::JSGetCalibProgress);
  1209. Dispatch->Get.Push(AttrKey::UploadCalibrationFilesResult, m_CalibUnit.get(), &CalibUnit::JSGetUploadCalibrationFilesResult);
  1210. Dispatch->Get.Push(AttrKey::OffsetStatus, m_CalibUnit.get(), &CalibUnit::JSGetOffsetStatus);
  1211. Dispatch->Get.Push(AttrKey::OffsetCounts, m_CalibUnit.get(), &CalibUnit::JSGetOffsetCounts);
  1212. Dispatch->Get.Push(AttrKey::OffsetProgress, m_CalibUnit.get(), &CalibUnit::JSGetOffsetProgress);
  1213. Dispatch->Get.Push(AttrKey::OffsetInterval, m_CalibUnit.get(), &CalibUnit::JSGetOffsetInterval);
  1214. Dispatch->Set.Push(AttrKey::CalibrationStatus, m_CalibUnit.get(), &CalibUnit::SetCalibrationStatus);
  1215. Dispatch->Set.Push(AttrKey::CalibrationProgress, m_CalibUnit.get(), &CalibUnit::SetCalibrationProgress);
  1216. Dispatch->Set.Push(AttrKey::UploadCalibrationFilesResult, m_CalibUnit.get(), &CalibUnit::SetUploadCalibrationFilesResult);
  1217. Dispatch->Set.Push(AttrKey::OffsetStatus, m_CalibUnit.get(), &CalibUnit::SetOffsetStatus);
  1218. Dispatch->Set.Push(AttrKey::OffsetCounts, m_CalibUnit.get(), &CalibUnit::SetOffsetCounts);
  1219. Dispatch->Set.Push(AttrKey::OffsetProgress, m_CalibUnit.get(), &CalibUnit::SetOffsetProgress);
  1220. Dispatch->Set.Push(AttrKey::OffsetInterval, m_CalibUnit.get(), &CalibUnit::SetOffsetInterval);
  1221. Dispatch->Update.Push(AttrKey::OffsetInterval, m_CalibUnit.get(), &CalibUnit::JSUpdateOffsetInterval);
  1222. }
  1223. void nsFPD::FPDDeviceCareRay::RegisterOthers(nsDetail::Dispatch* Dispatch)
  1224. {
  1225. Dispatch->Get.Push(AttrKey::Temperature_Value, m_Temperature.get(), &DeviceTemperatureMould::JSGetCurrentTemperatureValue);
  1226. Dispatch->Get.Push(AttrKey::Remain_Power_Value, m_Battery.get(), &DeviceBatteryMould::JSGetCurrentBatteryValue);
  1227. Dispatch->Get.Push(AttrKey::Wifi_Strength_Value, m_Wifi.get(), &DeviceWifiMould::JSGetCurrentSignalValue);
  1228. Dispatch->Get.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureWarningMax);
  1229. Dispatch->Get.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureWarningMin);
  1230. Dispatch->Get.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureErrorMax);
  1231. Dispatch->Get.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureErrorMin);
  1232. Dispatch->Get.Push(TemperatureCalibUpWarn, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureCalibWarningMax);
  1233. Dispatch->Get.Push(TemperatureCalibLowWarn, m_Temperature.get(), &DeviceTemperatureMould::JSGetTemperatureCalibWarningMin);
  1234. Dispatch->Get.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::JSGetBatteryWarningMin);
  1235. Dispatch->Get.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::JSGetBatteryErrorMin);
  1236. Dispatch->Get.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::JSGetSignalWarningMin);
  1237. Dispatch->Get.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::JSGetSignalErrorMin);
  1238. Dispatch->Set.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureWarningMax);
  1239. Dispatch->Set.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureWarningMin);
  1240. Dispatch->Set.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureErrorMax);
  1241. Dispatch->Set.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureErrorMin);
  1242. Dispatch->Set.Push(TemperatureCalibUpWarn, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureCalibWarningMax);
  1243. Dispatch->Set.Push(TemperatureCalibLowWarn, m_Temperature.get(), &DeviceTemperatureMould::SetTemperatureCalibWarningMin);
  1244. Dispatch->Set.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::SetBatteryWarningMin);
  1245. Dispatch->Set.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::SetBatteryErrorMin);
  1246. Dispatch->Set.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::SetSignalWarningMin);
  1247. Dispatch->Set.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::SetSignalErrorMin);
  1248. Dispatch->Update.Push(TempUpperLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureWarningMax);
  1249. Dispatch->Update.Push(TempLowerLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureWarningMin);
  1250. Dispatch->Update.Push(TempMaxLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureErrorMax);
  1251. Dispatch->Update.Push(TempMinLimit, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureErrorMin);
  1252. Dispatch->Update.Push(TemperatureCalibUpWarn, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureCalibWarningMax);
  1253. Dispatch->Update.Push(TemperatureCalibLowWarn, m_Temperature.get(), &DeviceTemperatureMould::JSUpdateTemperatureCalibWarningMin);
  1254. Dispatch->Update.Push(BatLowerLimit, m_Battery.get(), &DeviceBatteryMould::JSUpdateBatteryWarningMin);
  1255. Dispatch->Update.Push(BatMiniLimit, m_Battery.get(), &DeviceBatteryMould::JSUpdateBatteryErrorMin);
  1256. Dispatch->Update.Push(WifiLowerLimit, m_Wifi.get(), &DeviceWifiMould::JSUpdateSignalWarningMin);
  1257. Dispatch->Update.Push(WifiMiniLimit, m_Wifi.get(), &DeviceWifiMould::JSUpdateSignalErrorMin);
  1258. }
  1259. void nsFPD::FPDDeviceCareRay::OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel,
  1260. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1261. {
  1262. switch (nEventLevel)
  1263. {
  1264. case EVT_LEVEL_CONFIGURATION:
  1265. {
  1266. OnEventProcessConf(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1267. break;
  1268. }
  1269. case EVT_LEVEL_INFORMATOION:
  1270. {
  1271. OnEventProcessInfo(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1272. break;
  1273. }
  1274. case EVT_LEVEL_STATUS:
  1275. {
  1276. OnEventProcessStatus(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1277. break;
  1278. }
  1279. case EVT_LEVEL_DATA:
  1280. {
  1281. OnEventProcessData(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1282. break;
  1283. }
  1284. case EVT_LEVEL_WARNING:
  1285. {
  1286. OnEventProcessWarning(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1287. break;
  1288. }
  1289. case EVT_LEVEL_ERROR:
  1290. {
  1291. OnEventProcessError(nDetectorID, nEventID, nEventLevel, pszMsg, nParam1, fParam2, nPtrParamLen, pParam);
  1292. break;
  1293. }
  1294. default:
  1295. break;
  1296. }
  1297. }
  1298. void nsFPD::FPDDeviceCareRay::OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel,
  1299. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1300. {
  1301. switch (nEventID)
  1302. {
  1303. case EVT_CONF_PANEL_SERIAL:
  1304. {
  1305. m_stDeviceConfig.strPanelSerial = pszMsg;
  1306. FINFO("Receive Panel {$} SN {$}", nDetectorID, pszMsg);
  1307. m_DetectorCtrlUnit->SetDetectorID(m_stDeviceConfig.strPanelSerial);
  1308. break;
  1309. }
  1310. case EVT_CONF_RAW_WIDTH:
  1311. {
  1312. if (m_stDeviceConfig.nFullImageWidth != nParam1)
  1313. {
  1314. m_stDeviceConfig.nFullImageWidth = nParam1;
  1315. }
  1316. if (m_nImageWidth != nParam1)
  1317. {
  1318. m_nImageWidth = nParam1;
  1319. }
  1320. FINFO("Ratate angle: {$}", m_nAngle);
  1321. if (m_nAngle == 90 || m_nAngle == 270)
  1322. {
  1323. m_AcqUnit->SetFulImageInfo(m_nImageWidth, m_nImageHeight, m_nImgBits, false);
  1324. }
  1325. else
  1326. {
  1327. m_AcqUnit->SetFulImageInfo(m_nImageHeight, m_nImageWidth, m_nImgBits, false);
  1328. }
  1329. FINFO("Panel {$} m_nImageWidth:{$}", nDetectorID, m_nImageWidth);
  1330. break;
  1331. }
  1332. case EVT_CONF_RAW_HIGHT:
  1333. {
  1334. if (m_stDeviceConfig.nFullImageHeight != nParam1)
  1335. {
  1336. m_stDeviceConfig.nFullImageHeight = nParam1;
  1337. }
  1338. if (m_nImageHeight != nParam1)
  1339. {
  1340. m_nImageHeight = nParam1;
  1341. }
  1342. FINFO("Ratate angle: {$}", m_nAngle);
  1343. if (m_nAngle == 90 || m_nAngle == 270)
  1344. {
  1345. m_AcqUnit->SetFulImageInfo(m_nImageWidth, m_nImageHeight, m_nImgBits, false);
  1346. }
  1347. else
  1348. {
  1349. m_AcqUnit->SetFulImageInfo(m_nImageHeight, m_nImageWidth, m_nImgBits, false);
  1350. }
  1351. FINFO("Panel {$} m_nImageHeight:{$}", nDetectorID, m_nImageHeight);
  1352. break;
  1353. }
  1354. }
  1355. }
  1356. void nsFPD::FPDDeviceCareRay::OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel,
  1357. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1358. {
  1359. FERROR("Not support this info({$})", nEventID);
  1360. }
  1361. void nsFPD::FPDDeviceCareRay::OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel,
  1362. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1363. {
  1364. switch (nEventID)
  1365. {
  1366. case EVT_STATUS_PANEL:
  1367. {
  1368. ENUM_PANEL_STATUS ePanelStatus = (ENUM_PANEL_STATUS)nParam1;
  1369. if (PANEL_END_ACQ == nParam1)
  1370. {
  1371. FINFO("Panel Status: End acq");
  1372. if (g_pDetector->StopAcquisition(this))
  1373. {
  1374. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1375. }
  1376. }
  1377. else if (PANEL_XWINDOW_ON == nParam1) //Xwindow On
  1378. {
  1379. FINFO("XWindowOnNotify");
  1380. m_SyncUnit->XWindowOnNotify();
  1381. }
  1382. else if (PANEL_XWINDOW_OFF == nParam1) // Xwindow Off
  1383. {
  1384. FINFO("XWindowOffNotify");
  1385. m_SyncUnit->XWindowOffNotify();
  1386. }
  1387. break;
  1388. }
  1389. case EVT_STATUS_CALIBRATIOIN:
  1390. {
  1391. ENUM_PANEL_EVENT_STATE eStatus = (ENUM_PANEL_EVENT_STATE)nParam1;
  1392. switch (eStatus)
  1393. {
  1394. case PANEL_EVENT_START:
  1395. break;
  1396. case PANEL_EVENT_END_OK:
  1397. case PANEL_EVENT_END_ERROR:
  1398. m_DetectorCtrlUnit->SetDetectorStatus(to_string(DETECTOR_STATUS_STANDBY));
  1399. m_CalibUnit->SetCalibrationStatus(to_string(CCOS_CALIBRATION_STATUS_STANDBY));
  1400. m_CalibUnit->SetCalibrationProgress("100");//make progress
  1401. break;
  1402. case PANEL_EVENT_TIMEOUT:
  1403. break;
  1404. default:
  1405. break;
  1406. }
  1407. break;
  1408. }
  1409. case EVT_STATUS_OFFSET:
  1410. {
  1411. ENUM_PANEL_EVENT_STATE eStatus = (ENUM_PANEL_EVENT_STATE)nParam1;
  1412. switch (eStatus)
  1413. {
  1414. case PANEL_EVENT_END_OK:
  1415. m_CalibUnit->SetOffsetStatus("Idle");
  1416. break;
  1417. case PANEL_EVENT_END_ERROR:
  1418. m_CalibUnit->SetOffsetStatus("Error");
  1419. break;
  1420. case PANEL_EVENT_START:
  1421. m_CalibUnit->SetOffsetStatus("Running");
  1422. break;
  1423. default:
  1424. break;
  1425. }
  1426. break;
  1427. }
  1428. case EVT_STATUS_OFFSET_PROGRESS:
  1429. {
  1430. FINFO("EVT_STATUS_OFFSET_PROGRESS param:{$}", nParam1);
  1431. int nOffsetProgress = nParam1;
  1432. m_CalibUnit->SetOffsetProgress(to_string(nOffsetProgress));
  1433. break;
  1434. }
  1435. case EVT_STATUS_SINGLEEXP:
  1436. {
  1437. if (DOSE_ACCEPT == nParam1)
  1438. {
  1439. FINFO("Calibration Result is acceptable");
  1440. }
  1441. else
  1442. {
  1443. FERROR("Not support this param(%d)", nParam1);
  1444. }
  1445. break;
  1446. }
  1447. //case EVT_STATUS_TEMPERATURE:
  1448. //{
  1449. // float fTemperature = fParam2;
  1450. // if (fTemperature > m_fTemperMaxLimit)
  1451. // {
  1452. // AddErrMsg("14", "temperature_toohigh");
  1453. // }
  1454. // else if (fTemperature >= m_fTemperWarning)
  1455. // {
  1456. // AddWarnMsg("14", "temperature_high");
  1457. // }
  1458. // else if (fTemperature < m_fTemperMinLimit)
  1459. // {
  1460. // AddErrMsg("14", "temperature_toolow");
  1461. // }
  1462. // else if (fTemperature <= m_fTemperLowLimit)
  1463. // {
  1464. // AddWarnMsg("14", "temperature_low");
  1465. // }
  1466. // else
  1467. // {
  1468. // DelErrMsg("14");
  1469. // }
  1470. // SendTemperatureValue(fTemperature);
  1471. //}
  1472. //break;
  1473. //case EVT_STATUS_WIFI:
  1474. //{
  1475. // int nWifiLevel = nParam1;
  1476. // if (nWifiLevel < m_nWifiLimit)
  1477. // {
  1478. // AddErrMsg("15", "wifi_toolow");
  1479. // }
  1480. // else if (nWifiLevel <= m_nWifiWarning)
  1481. // {
  1482. // AddWarnMsg("15", "wifi_low");
  1483. // }
  1484. // else
  1485. // {
  1486. // DelErrMsg("15");
  1487. // }
  1488. // SendWifiValue(nWifiLevel);
  1489. //}
  1490. //break;
  1491. //case EVT_STATUS_BATTERY_VALUE:
  1492. //{
  1493. // int nBatteryValue = nParam1;
  1494. // if (nBatteryValue < m_nBatteryLimit)
  1495. // {
  1496. // AddErrMsg("16", "battery_toolow");
  1497. // }
  1498. // else if (nBatteryValue <= m_nBatteryWarning)
  1499. // {
  1500. // AddWarnMsg("16", "battery_low");
  1501. // }
  1502. // else
  1503. // {
  1504. // DelErrMsg("16");
  1505. // }
  1506. // SendBatteryValue(nBatteryValue);
  1507. //}
  1508. //break;
  1509. default:
  1510. FERROR("Not support this status({$})", nEventID);
  1511. break;
  1512. }
  1513. }
  1514. void nsFPD::FPDDeviceCareRay::OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel,
  1515. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1516. {
  1517. switch (nEventID)
  1518. {
  1519. case EVT_DATA_RAW_IMAGE:
  1520. {
  1521. FINFO("EVT_DATA_RAW_IMAGE");
  1522. FINFO("m_nImageWidth:{$},m_nImageHeight:{$}", m_nImageWidth, m_nImageHeight);
  1523. memcpy(m_pImgBuffer, pParam, (size_t)m_nImageWidth * (size_t)m_nImageHeight * sizeof(WORD));
  1524. //暂时先用假值,有需要再改
  1525. SYSTEMTIME stImgCreateTime = { 0 };
  1526. GetLocalTime(&stImgCreateTime);
  1527. ResDataObject objImageHead, objTemp;
  1528. objTemp.add(SM_IMAGE_TYPE, (int)IMAGE_FULL);
  1529. objTemp.add(SM_IMAGE_BIT, m_nImgBits);
  1530. objTemp.add(SM_IMAGE_TAG, 1);
  1531. if (m_nCurrentAcqMode == CF || m_nCurrentAcqMode == PF)
  1532. {
  1533. objTemp.add(SM_IMAGE_INDEX, m_nImageIndex);
  1534. m_nImageIndex++;
  1535. }
  1536. else
  1537. {
  1538. objTemp.add(SM_IMAGE_INDEX, 1);
  1539. }
  1540. objTemp.add(SM_IMAGE_YEAR, stImgCreateTime.wYear);
  1541. objTemp.add(SM_IMAGE_MONTH, stImgCreateTime.wMonth);
  1542. objTemp.add(SM_IMAGE_DAY, stImgCreateTime.wDay);
  1543. objTemp.add(SM_IMAGE_HOUR, stImgCreateTime.wHour);
  1544. objTemp.add(SM_IMAGE_MINUTE, stImgCreateTime.wMinute);
  1545. objTemp.add(SM_IMAGE_SEC, stImgCreateTime.wSecond);
  1546. objTemp.add(SM_IMAGE_MILLSEC, stImgCreateTime.wMilliseconds);
  1547. objTemp.add(SM_IMAGE_LSB, "5000");
  1548. objTemp.add(SM_IMAGE_DOSE, m_nSensitivity);
  1549. objTemp.add(SM_IMAGE_PIXELSPACING, m_nPixelSpacing);
  1550. objTemp.add(SM_IMAGE_PIXELREPRESENTATION, "1");
  1551. objTemp.add(SM_IMAGE_FLIP, "No");
  1552. objTemp.add(SM_IMAGE_ORIGINX, "0");
  1553. objTemp.add(SM_IMAGE_ORIGINY, "0");
  1554. objTemp.add(SM_IMAGE_EXI2UGY, m_fFactorEXI2UGY);//此项不添加的话会导致ImageSave计算EXI的值为0
  1555. m_AcqUnit->RotateImage(m_pImgBuffer, m_nImageHeight, m_nImageWidth, m_nAngle);
  1556. if (90 == m_nAngle || 270 == m_nAngle)
  1557. {
  1558. objTemp.add(SM_IMAGE_WIDTH, m_nImageHeight);
  1559. objTemp.add(SM_IMAGE_HEIGHT, m_nImageWidth);
  1560. objTemp.add(SM_IMAGE_ROTATION, "Yes");
  1561. }
  1562. else
  1563. {
  1564. objTemp.add(SM_IMAGE_WIDTH, m_nImageWidth);
  1565. objTemp.add(SM_IMAGE_HEIGHT, m_nImageHeight);
  1566. objTemp.add(SM_IMAGE_ROTATION, "No");
  1567. }
  1568. objImageHead.add(SM_IMAGE_HEAD, objTemp);
  1569. FINFO("Full image head: {$}", objImageHead.encode());
  1570. RET_STATUS ret = RET_STATUS::RET_FAILED;
  1571. ret = m_AcqUnit->AddFrameWithRawHead(IMAGE_FULL, objImageHead.encode(), m_pImgBuffer, m_nImageWidth * m_nImageHeight);
  1572. FINFO("Add image over");
  1573. }
  1574. break;
  1575. default:
  1576. FERROR("Not support this data({$})", nEventID);
  1577. break;
  1578. }
  1579. }
  1580. void nsFPD::FPDDeviceCareRay::OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel,
  1581. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1582. {
  1583. switch (nEventID)
  1584. {
  1585. case EVT_ERR_COMMUNICATE:
  1586. //{
  1587. // string strTemp = pszMsg;
  1588. // if (strTemp.find("true") != std::string::npos)
  1589. // {
  1590. // AddErrMsg("0", "communication error");
  1591. // SendTemperatureValue(0);
  1592. // SendWifiValue(0);
  1593. // SendBatteryValue(0);
  1594. // }
  1595. // else if (strTemp.find("false") != std::string::npos)
  1596. // {
  1597. // DelErrMsg("0");
  1598. // }
  1599. //}
  1600. break;
  1601. case EVT_ERR_INIT_FAILED:
  1602. //{
  1603. // string strTemp = pszMsg;
  1604. // if (strTemp.find("true") != std::string::npos)
  1605. // {
  1606. // AddErrMsg("6", "initialize error");
  1607. // }
  1608. // else if (strTemp.find("false") != std::string::npos)
  1609. // {
  1610. // //一般不可恢复
  1611. // }
  1612. //}
  1613. break;
  1614. default:
  1615. FERROR("Not support this error({$})", nEventID);
  1616. break;
  1617. }
  1618. }
  1619. void nsFPD::FPDDeviceCareRay::OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel,
  1620. const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam)
  1621. {
  1622. FERROR("Not support this warn({$})", nEventID);
  1623. }
  1624. RET_STATUS nsFPD::FPDDeviceCareRay::StartOffset(bool isAll)
  1625. {
  1626. FINFO("--Func-- StartOffset isAll:{$}", isAll);
  1627. if (isAll)
  1628. {
  1629. m_CalibUnit->SetOffsetCounts(to_string(m_vDetectorModeList.size()));
  1630. g_pDetector->SetFreshAllOffsetEvent(m_vDetectorModeList);
  1631. }
  1632. else
  1633. {
  1634. m_CalibUnit->SetOffsetCounts(to_string(2));
  1635. g_pDetector->SetfreshOffsetEvent();
  1636. }
  1637. return RET_SUCCEED;
  1638. }
  1639. RET_STATUS nsFPD::FPDDeviceCareRay::AbortOffset()
  1640. {
  1641. FINFO("--Func-- AbortOffset");
  1642. g_pDetector->AbortFreshOffset();
  1643. return RET_SUCCEED;
  1644. }
  1645. RET_STATUS nsFPD::FPDDeviceCareRay::UpdateModeInRunning(std::vector<AcqModeInfo>& vAcqModeList)
  1646. {
  1647. FINFO("--Func-- UpdateModeInRunning");
  1648. m_vAcqModeInfoList.assign(vAcqModeList.begin(),vAcqModeList.end());
  1649. for (size_t i = 0; i < m_vAcqModeInfoList.size(); i++)
  1650. {
  1651. if (m_vAcqModeInfoList[i].fFrequency == m_fCurrentPPS)
  1652. {
  1653. g_pDetector->UpdateModeInRunning(m_vAcqModeInfoList[i].nModeID, m_vAcqModeInfoList[i].fFrequency);
  1654. break;
  1655. }
  1656. }
  1657. return RET_SUCCEED;
  1658. }
  1659. /***
  1660. * 客户端获取探测器信息
  1661. ***/
  1662. RET_STATUS nsFPD::FPDDeviceCareRay::GetDetectorInfo(string& strInfo)
  1663. {
  1664. FINFO("--Func-- GetDetectorInfo");
  1665. ResDataObject strDetectorInfo;
  1666. if (m_stDeviceConfig.strPanelSerial == "")
  1667. {
  1668. FWARN("strPanelSerial is null, Send Default Info");
  1669. strDetectorInfo.add("DetectorName", "Simulator");
  1670. strDetectorInfo.add("DetectorSN", "Simulator");
  1671. strDetectorInfo.add("SSID", " ");
  1672. strDetectorInfo.add("LifeTime", "0");
  1673. strDetectorInfo.add("PowerOn", "0");
  1674. strDetectorInfo.add("DateCode", " ");
  1675. strDetectorInfo.add("PartNumber", " ");
  1676. strDetectorInfo.add("WifiDataRate", " ");
  1677. strDetectorInfo.add("WifiChannel", "0");
  1678. strDetectorInfo.add("DetectorExist", "0");
  1679. strDetectorInfo.add("SystemAS", "0");
  1680. strDetectorInfo.add("CalibrationDate", "0");
  1681. strDetectorInfo.add("CalibrationDue", "0");
  1682. strDetectorInfo.add("CalibrationExist", "0");
  1683. strDetectorInfo.add("CommunicationStatus", "0");
  1684. strDetectorInfo.add("DetectorTemperature", "0");
  1685. strDetectorInfo.add("FDCalibrationTemperature", "0");
  1686. strDetectorInfo.add("TemperatureStatus", "0");
  1687. strDetectorInfo.add("WaitTime", "0");
  1688. strDetectorInfo.add("DetectorWifiSignal", "0");
  1689. strDetectorInfo.add("DetectorBattery", "0");
  1690. strDetectorInfo.add("ShockSensor", "NULL");
  1691. strDetectorInfo.add("FirmwareUpdate", "0");
  1692. strInfo = strDetectorInfo.encode();
  1693. return RET_STATUS::RET_SUCCEED;
  1694. }
  1695. strDetectorInfo.add("DetectorName", m_stDeviceConfig.strDeviceName.c_str());
  1696. strDetectorInfo.add("DetectorSN", m_stDeviceConfig.strPanelSerial.c_str());
  1697. //strDetectorInfo.add("Firmware", m_stDeviceConfig.strFirmware.c_str());
  1698. //strDetectorInfo.add("APFirmware", "NULL");
  1699. //strDetectorInfo.add("Software", m_stDeviceConfig.strSoftware.c_str());
  1700. //strDetectorInfo.add("SSID", m_stDeviceConfig.strWifiSSID.c_str());
  1701. //strDetectorInfo.add("LifeTime", m_stDeviceConfig.nLifeTime);
  1702. //strDetectorInfo.add("PowerOn", m_stDeviceConfig.nPowerOn);
  1703. //strDetectorInfo.add("FD_Voltage_List1", m_strVoltage.c_str());
  1704. //strDetectorInfo.add("DateCode", m_stDeviceConfig.strDateCode.c_str());
  1705. //strDetectorInfo.add("PartNumber", m_stDeviceConfig.strPartNumber.c_str());
  1706. //strDetectorInfo.add("WifiDataRate", m_stDeviceConfig.nWifiDataRate);
  1707. //strDetectorInfo.add("WifiChannel", m_stDeviceConfig.nWifiChannel);
  1708. //strDetectorInfo.add("DetectorExist", m_stDeviceConfig.bExisted);
  1709. //strDetectorInfo.add("SystemAS", m_stDeviceConfig.pDetModeInfoStruct[0].nWorkStation);
  1710. strInfo = strDetectorInfo.encode();
  1711. return RET_STATUS::RET_SUCCEED;
  1712. }