ConfigurationManager.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. #include "stdafx.h"
  2. #include "ConfigurationManager.h"
  3. using namespace DIOS::Dev::Detail::MachineryECOM;
  4. ConfigurationManager *ConfigurationManager::m_instance = nullptr;
  5. const std::string CONFIG_MANUFACTURE_CONFIG = "Config_Manufacturer.xml";
  6. const std::string CONFIG_COMPONENT_CONTROLLER = "Config_ComponentController.xml";
  7. const std::string CONFIG_POSITIONNUMBER = "Config_PositionNumber.xml";
  8. const std::string CONFIG_CALIBRATION = "Config_MotionCalibration.xml";
  9. const std::string CONFIG_MACHINERY = "Config_Machinery.xml";
  10. const std::string CONFIG_TOMO = "Config_Tomo.xml";
  11. const std::string CONFIG_SERVO_DRIVE = "Config_ServoDrive.xml";
  12. const std::string CONFIG_EXPOSURE_DELAY = "Config_ExposureDelayTime.xml";
  13. const std::string CONFIG_WORKSTATION = "Config_Workstaion.xml";
  14. const std::string CONFIG_MOTION_VERTICAL = "Config_MotionTubeVertical.xml";
  15. const std::string CONFIG_MOTION_HORIZONTAL = "Config_MotionTubeHorizontal.xml";
  16. const std::string CONFIG_MOTION_ROTATION = "Config_MotionTubeRotation.xml";
  17. const std::string CONFIG_TOMO_MOTION = "Config_TomoMotion.xml";
  18. ConfigurationManager::ConfigurationManager() :m_workPath(""), m_configPath("")
  19. {
  20. }
  21. ConfigurationManager::~ConfigurationManager()
  22. {
  23. }
  24. ConfigurationManager *ConfigurationManager::Instance()
  25. {
  26. if (m_instance == nullptr)
  27. {
  28. m_instance = new ConfigurationManager();
  29. }
  30. return m_instance;
  31. }
  32. void ConfigurationManager::Initialize(const std::string &workpath)
  33. {
  34. m_workPath = workpath;
  35. try
  36. {
  37. m_configPath = GetConfigPath(workpath);
  38. TPRINTA_DEBUG("WorkPath is %s,ConfigPath is %s", m_workPath.c_str(), m_configPath.c_str());
  39. LoadComponentControllerConfig();
  40. LoadPositionNumberConfig();
  41. LoadCalibrationConfig();
  42. LoadMachineryConfig();
  43. LoadMotionConfigVertical();
  44. LoadMotionConfigHorizontal();
  45. LoadMotionConfigRotation();
  46. LoadTomoConfig();
  47. LoadServoDriveConfig();
  48. LoadExposureDelayTimeConfig();
  49. LoadWorkstationConfig();
  50. LoadConfigTomoMotionLimitation();
  51. }
  52. catch (ResDataObjectExption &e)
  53. {
  54. gdriverLog->Error("[ConfigurationManager][Initialize]->[Exception][{$}]", e.what());
  55. }
  56. catch (...)
  57. {
  58. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][Initialize]->[Exception][Unknown]");
  59. }
  60. }
  61. BOOL ConfigurationManager::GetAllMachineryConfigs(ResDataObject &out)
  62. {
  63. out = m_machineryConfig;
  64. return TRUE;
  65. }
  66. BOOL ConfigurationManager::GetAllTomoConfigs(ResDataObject &out)
  67. {
  68. out = m_tomoConfig;
  69. return TRUE;
  70. }
  71. ResDataObject &ConfigurationManager::GetPositionNumberConfig(const std::string &key)
  72. {
  73. return m_positionNumber[key.c_str()];
  74. }
  75. ResDataObject &ConfigurationManager::GetServoDriveConfig(const std::string &key)
  76. {
  77. return m_servoDrive[key.c_str()];
  78. }
  79. ResDataObject &ConfigurationManager::GetExpousreDelayTimeConfig()
  80. {
  81. return m_exposureDelayTime;
  82. }
  83. ResDataObject &ConfigurationManager::GetCalibrationConfig(const std::string &key)
  84. {
  85. try
  86. {
  87. if (m_motionParamCalRoot.GetFirstOf("CONFIGURATION") >= 0)
  88. {
  89. auto motionParamCal = &(m_motionParamCalRoot)["CONFIGURATION"];
  90. return (*motionParamCal)[key.c_str()];
  91. }
  92. throw new exception("key not exist");
  93. }
  94. catch (exception *e)
  95. {
  96. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][GetCalibrationConfig]->[Exception][{$}][{$}]", key.c_str(), e->what());
  97. }
  98. return m_motionParamCalRoot["CONFIGURATION"];
  99. }
  100. ResDataObject &ConfigurationManager::GetTomoConfig(const std::string &key)
  101. {
  102. return m_tomoConfig[key.c_str()];
  103. }
  104. ResDataObject &ConfigurationManager::GetMachineryConfig(const std::string &key)
  105. {
  106. if (m_machineryConfig.GetFirstOf(key.c_str()) >= 0)
  107. {
  108. return m_machineryConfig[key.c_str()];
  109. }
  110. return (ResDataObject());
  111. }
  112. ResDataObject& ConfigurationManager::GetConfigTubeVertical(const std::string& key)
  113. {
  114. if (m_motionConfigVertical.GetFirstOf(key.c_str()) >= 0)
  115. {
  116. return m_motionConfigVertical[key.c_str()];
  117. }
  118. return (ResDataObject());
  119. }
  120. ResDataObject& ConfigurationManager::GetConfigTubeHorizontal(const std::string& key)
  121. {
  122. if (m_motionConfigHorizontal.GetFirstOf(key.c_str()) >= 0)
  123. {
  124. return m_motionConfigHorizontal[key.c_str()];
  125. }
  126. return (ResDataObject());
  127. }
  128. ResDataObject& ConfigurationManager::GetConfigTubeRotation(const std::string& key)
  129. {
  130. if (m_motionConfigRotation.GetFirstOf(key.c_str()) >= 0)
  131. {
  132. return m_motionConfigRotation[key.c_str()];
  133. }
  134. return (ResDataObject());
  135. }
  136. ResDataObject& ConfigurationManager::GetWSConfig(const std::string& key)
  137. {
  138. if (m_wsConfig.GetFirstOf(key.c_str()) >= 0)
  139. {
  140. return m_wsConfig[key.c_str()];
  141. }
  142. return (ResDataObject());
  143. }
  144. ResDataObject& ConfigurationManager::GetConfigTomoMotionLimitation(const std::string& key)
  145. {
  146. if (m_TomoMotionConfig.GetFirstOf(key.c_str()) >= 0)
  147. {
  148. return m_TomoMotionConfig[key.c_str()];
  149. }
  150. return (ResDataObject());
  151. }
  152. std::string ConfigurationManager::GetControllerClassID(const std::string &key)
  153. {
  154. if (m_componentController.GetKeyCount(key.c_str()) <= 0)
  155. {
  156. return "";
  157. }
  158. return string((const char *)m_componentController[key.c_str()]);
  159. }
  160. std::string ConfigurationManager::GetConfigPath(const std::string &workpath)
  161. {
  162. std::string ret = workpath;
  163. std::string filename = workpath + CONFIG_MANUFACTURE_CONFIG;
  164. try
  165. {
  166. HANDLE hFind = NULL;
  167. WIN32_FIND_DATA FindFileData;
  168. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  169. if (hFind == INVALID_HANDLE_VALUE)
  170. {
  171. throw new exception("Load file failed");
  172. }
  173. FindClose(hFind);
  174. ResDataObject componnetConfig;
  175. if (componnetConfig.loadFile(filename.c_str()))
  176. {
  177. if (componnetConfig.GetFirstOf("CONFIGURATION") >= 0)
  178. {
  179. auto config = componnetConfig["CONFIGURATION"];
  180. if (config.GetFirstOf("ManufacturerPath") >= 0)
  181. {
  182. ret = workpath + string((const char *)config["ManufacturerPath"]) + "\\";
  183. }
  184. }
  185. }
  186. else
  187. {
  188. throw new exception("Load file failed");
  189. }
  190. }
  191. catch (exception *e)
  192. {
  193. if (gdriverLog != nullptr)
  194. {
  195. gdriverLog->Error("[ConfigurationManager][GetConfigPath]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  196. }
  197. }
  198. return ret;
  199. }
  200. void ConfigurationManager::LoadComponentControllerConfig()
  201. {
  202. std::string filename = m_configPath + CONFIG_COMPONENT_CONTROLLER;
  203. try
  204. {
  205. HANDLE hFind = NULL;
  206. WIN32_FIND_DATA FindFileData;
  207. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  208. if (hFind == INVALID_HANDLE_VALUE)
  209. {
  210. throw new exception("Load file failed");
  211. }
  212. FindClose(hFind);
  213. ResDataObject componnetConfig;
  214. if (componnetConfig.loadFile(filename.c_str()))
  215. {
  216. if (componnetConfig.GetFirstOf("CONFIGURATION") >= 0)
  217. {
  218. m_componentController = componnetConfig["CONFIGURATION"];
  219. }
  220. }
  221. else
  222. {
  223. throw new exception("Load file failed");
  224. }
  225. }
  226. catch (exception *e)
  227. {
  228. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadComponentControllerConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  229. }
  230. }
  231. void ConfigurationManager::LoadMachineryConfig()
  232. {
  233. std::string filename = m_configPath + CONFIG_MACHINERY;
  234. try
  235. {
  236. HANDLE hFind = NULL;
  237. WIN32_FIND_DATA FindFileData;
  238. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  239. if (hFind == INVALID_HANDLE_VALUE)
  240. {
  241. throw new exception("Load file failed");
  242. }
  243. FindClose(hFind);
  244. ResDataObject machineryConfig;
  245. if (machineryConfig.loadFile(filename.c_str()))
  246. {
  247. if (machineryConfig.GetFirstOf("CONFIGURATION") >= 0)
  248. {
  249. m_machineryConfig = machineryConfig["CONFIGURATION"];
  250. }
  251. }
  252. else
  253. {
  254. throw new exception("Load file failed");
  255. }
  256. }
  257. catch (exception *e)
  258. {
  259. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadMachineryConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  260. }
  261. }
  262. void ConfigurationManager::LoadMotionConfigVertical()
  263. {
  264. std::string filename = m_configPath + CONFIG_MOTION_VERTICAL;
  265. try
  266. {
  267. HANDLE hFind = NULL;
  268. WIN32_FIND_DATA FindFileData;
  269. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  270. if (hFind == INVALID_HANDLE_VALUE)
  271. {
  272. throw new exception("Load file failed");
  273. }
  274. FindClose(hFind);
  275. //ResDataObject motionConfigVertical;
  276. if (m_motionConfigVerticalRoot.loadFile(filename.c_str()))
  277. {
  278. if (m_motionConfigVerticalRoot.GetFirstOf("CONFIGURATION") >= 0)
  279. {
  280. m_motionConfigVertical = m_motionConfigVerticalRoot["CONFIGURATION"];
  281. }
  282. }
  283. else
  284. {
  285. throw new exception("Load file failed");
  286. }
  287. }
  288. catch (exception* e)
  289. {
  290. if (gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadMotionConfigVertical]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  291. }
  292. }
  293. void ConfigurationManager::LoadMotionConfigHorizontal()
  294. {
  295. std::string filename = m_configPath + CONFIG_MOTION_HORIZONTAL;
  296. try
  297. {
  298. HANDLE hFind = NULL;
  299. WIN32_FIND_DATA FindFileData;
  300. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  301. if (hFind == INVALID_HANDLE_VALUE)
  302. {
  303. throw new exception("Load file failed");
  304. }
  305. FindClose(hFind);
  306. //ResDataObject motionConfigHorizontal;
  307. if (m_motionConfigHorizontalRoot.loadFile(filename.c_str()))
  308. {
  309. if (m_motionConfigHorizontalRoot.GetFirstOf("CONFIGURATION") >= 0)
  310. {
  311. m_motionConfigHorizontal = m_motionConfigHorizontalRoot["CONFIGURATION"];
  312. }
  313. }
  314. else
  315. {
  316. throw new exception("Load file failed");
  317. }
  318. }
  319. catch (exception* e)
  320. {
  321. if (gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadMotionConfigHorizontal]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  322. }
  323. }
  324. void ConfigurationManager::LoadMotionConfigRotation()
  325. {
  326. std::string filename = m_configPath + CONFIG_MOTION_ROTATION;
  327. try
  328. {
  329. HANDLE hFind = NULL;
  330. WIN32_FIND_DATA FindFileData;
  331. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  332. if (hFind == INVALID_HANDLE_VALUE)
  333. {
  334. throw new exception("Load file failed");
  335. }
  336. FindClose(hFind);
  337. //ResDataObject motionConfigRotation;
  338. if (m_motionConfigRotationRoot.loadFile(filename.c_str()))
  339. {
  340. if (m_motionConfigRotationRoot.GetFirstOf("CONFIGURATION") >= 0)
  341. {
  342. m_motionConfigRotation = m_motionConfigRotationRoot["CONFIGURATION"];
  343. }
  344. }
  345. else
  346. {
  347. throw new exception("Load file failed");
  348. }
  349. }
  350. catch (exception* e)
  351. {
  352. if (gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadMotionConfigRotation]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  353. }
  354. }
  355. void ConfigurationManager::LoadTomoConfig()
  356. {
  357. std::string filename = m_configPath + CONFIG_TOMO;
  358. try
  359. {
  360. HANDLE hFind = NULL;
  361. WIN32_FIND_DATA FindFileData;
  362. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  363. if (hFind == INVALID_HANDLE_VALUE)
  364. {
  365. throw new exception("Load file failed");
  366. }
  367. FindClose(hFind);
  368. ResDataObject tomoConfig;
  369. if (tomoConfig.loadFile(filename.c_str()))
  370. {
  371. if (tomoConfig.GetFirstOf("CONFIGURATION") >= 0)
  372. {
  373. m_tomoConfig = tomoConfig["CONFIGURATION"];
  374. }
  375. }
  376. else
  377. {
  378. throw new exception("Load file failed");
  379. }
  380. }
  381. catch (exception *e)
  382. {
  383. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadTomoConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  384. }
  385. }
  386. void ConfigurationManager::LoadPositionNumberConfig()
  387. {
  388. string filename = m_configPath + CONFIG_POSITIONNUMBER;
  389. try
  390. {
  391. WIN32_FIND_DATA FindFileData;
  392. HANDLE hFind = FindFirstFile(filename.c_str(), &FindFileData);
  393. if (hFind == INVALID_HANDLE_VALUE)
  394. {
  395. throw new exception("Load file failed");
  396. }
  397. FindClose(hFind);
  398. if (m_positionNumber.loadFile(filename.c_str()))
  399. {
  400. }
  401. else
  402. {
  403. throw new exception("Load file failed");
  404. }
  405. }
  406. catch(exception *e)
  407. {
  408. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadPositionNumberConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  409. }
  410. }
  411. void ConfigurationManager::LoadCalibrationConfig()
  412. {
  413. std::string filename = m_configPath + CONFIG_CALIBRATION;
  414. try
  415. {
  416. HANDLE hFind = NULL;
  417. WIN32_FIND_DATA FindFileData;
  418. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  419. if (hFind == INVALID_HANDLE_VALUE)
  420. {
  421. throw new exception("Load file failed");
  422. }
  423. FindClose(hFind);
  424. if (!m_motionParamCalRoot.loadFile(filename.c_str()))
  425. {
  426. throw new exception("Load file failed");
  427. }
  428. }
  429. catch (exception *e)
  430. {
  431. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadCalibrationConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  432. }
  433. }
  434. void ConfigurationManager::LoadServoDriveConfig()
  435. {
  436. string filename = m_configPath + CONFIG_SERVO_DRIVE;
  437. try
  438. {
  439. WIN32_FIND_DATA FindFileData;
  440. HANDLE hFind = FindFirstFile(filename.c_str(), &FindFileData);
  441. if (hFind == INVALID_HANDLE_VALUE)
  442. {
  443. throw new exception("Load file failed");
  444. }
  445. FindClose(hFind);
  446. if (m_servoDrive.loadFile(filename.c_str()))
  447. {
  448. }
  449. else
  450. {
  451. throw new exception("Load file failed");
  452. }
  453. }
  454. catch (exception *e)
  455. {
  456. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadServoDriveConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  457. }
  458. }
  459. void ConfigurationManager::LoadExposureDelayTimeConfig()
  460. {
  461. string filename = m_configPath + CONFIG_EXPOSURE_DELAY;
  462. try
  463. {
  464. WIN32_FIND_DATA FindFileData;
  465. HANDLE hFind = FindFirstFile(filename.c_str(), &FindFileData);
  466. if (hFind == INVALID_HANDLE_VALUE)
  467. {
  468. throw new exception("Load file failed");
  469. }
  470. FindClose(hFind);
  471. ResDataObject root;
  472. if (root.loadFile(filename.c_str()))
  473. {
  474. if (root.GetFirstOf("CONFIGURATION") >= 0)
  475. {
  476. m_exposureDelayTime = root["CONFIGURATION"];
  477. }
  478. }
  479. else
  480. {
  481. throw new exception("Load file failed");
  482. }
  483. }
  484. catch (exception *e)
  485. {
  486. if(gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadServoDriveConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  487. }
  488. }
  489. void ConfigurationManager::LoadWorkstationConfig()
  490. {
  491. std::string filename = m_configPath + CONFIG_WORKSTATION;
  492. try
  493. {
  494. HANDLE hFind = NULL;
  495. WIN32_FIND_DATA FindFileData;
  496. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  497. if (hFind == INVALID_HANDLE_VALUE)
  498. {
  499. throw new exception("Load file failed");
  500. }
  501. FindClose(hFind);
  502. ResDataObject wsConfig;
  503. if (wsConfig.loadFile(filename.c_str()))
  504. {
  505. if (wsConfig.GetFirstOf("CONFIGURATION") >= 0)
  506. {
  507. m_wsConfig = wsConfig["CONFIGURATION"];
  508. }
  509. }
  510. else
  511. {
  512. throw new exception("Load file failed");
  513. }
  514. }
  515. catch (exception* e)
  516. {
  517. if (gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadWorkstationConfig]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  518. }
  519. }
  520. void ConfigurationManager::LoadConfigTomoMotionLimitation()
  521. {
  522. std::string filename = m_configPath + CONFIG_TOMO_MOTION;
  523. try
  524. {
  525. HANDLE hFind = NULL;
  526. WIN32_FIND_DATA FindFileData;
  527. hFind = FindFirstFile(filename.c_str(), &FindFileData);
  528. if (hFind == INVALID_HANDLE_VALUE)
  529. {
  530. throw new exception("Load file failed");
  531. }
  532. FindClose(hFind);
  533. ResDataObject motionConfig;
  534. if (motionConfig.loadFile(filename.c_str()))
  535. {
  536. if (motionConfig.GetFirstOf("CONFIGURATION") >= 0)
  537. {
  538. m_TomoMotionConfig = motionConfig["CONFIGURATION"];
  539. }
  540. }
  541. else
  542. {
  543. throw new exception("Load file failed");
  544. }
  545. }
  546. catch (exception* e)
  547. {
  548. if (gdriverLog) gdriverLog->Error("[ConfigurationManager][LoadConfigTomoMotionLimitation]->[Exception][{$}][{$}]", filename.c_str(), e->what());
  549. }
  550. }
  551. BOOL ConfigurationManager::UpdateCalibrationConfig(const std::string &key, ResDataObject &params)
  552. {
  553. if (m_motionParamCalRoot.GetFirstOf("CONFIGURATION") >= 0)
  554. {
  555. auto *motionParamCal = &(m_motionParamCalRoot)["CONFIGURATION"];
  556. motionParamCal->update(key.c_str(), params[key.c_str()]);
  557. std::string filename = m_configPath + CONFIG_CALIBRATION;
  558. m_motionParamCalRoot.SaveFile(filename.c_str());
  559. return TRUE;
  560. }
  561. return FALSE;
  562. }
  563. BOOL ConfigurationManager::UpdateMotionConfigTubeAngle(const std::string& key, ResDataObject& params)
  564. {
  565. if (m_motionConfigRotationRoot.GetFirstOf("CONFIGURATION") >= 0)
  566. {
  567. auto* motionParam = &(m_motionConfigRotationRoot)["CONFIGURATION"];
  568. motionParam->update(key.c_str(), params[key.c_str()]);
  569. std::string filename = m_configPath + CONFIG_MOTION_ROTATION;
  570. m_motionConfigRotationRoot.SaveFile(filename.c_str());
  571. return TRUE;
  572. }
  573. return FALSE;
  574. }
  575. BOOL ConfigurationManager::UpdateMotionConfigTubeHeight(const std::string& key, ResDataObject& params)
  576. {
  577. if (m_motionConfigVerticalRoot.GetFirstOf("CONFIGURATION") >= 0)
  578. {
  579. auto* motionParam = &(m_motionConfigVerticalRoot)["CONFIGURATION"];
  580. motionParam->update(key.c_str(), params[key.c_str()]);
  581. std::string filename = m_configPath + CONFIG_MOTION_VERTICAL;
  582. m_motionConfigVerticalRoot.SaveFile(filename.c_str());
  583. return TRUE;
  584. }
  585. return FALSE;
  586. }
  587. BOOL ConfigurationManager::UpdateMotionConfigTubeHorizontal(const std::string& key, ResDataObject& params)
  588. {
  589. if (m_motionConfigHorizontalRoot.GetFirstOf("CONFIGURATION") >= 0)
  590. {
  591. auto* motionParam = &(m_motionConfigHorizontalRoot)["CONFIGURATION"];
  592. motionParam->update(key.c_str(), params[key.c_str()]);
  593. std::string filename = m_configPath + CONFIG_MOTION_HORIZONTAL;
  594. m_motionConfigHorizontalRoot.SaveFile(filename.c_str());
  595. return TRUE;
  596. }
  597. return FALSE;
  598. }