浏览代码

#IQRV #comment [BugFix][Healthmanager] 写入root.ini文件失败的缺陷修复

gifur 4 年之前
父节点
当前提交
99e74ffb76
共有 1 个文件被更改,包括 12 次插入8 次删除
  1. 12 8
      Module/mod_healthmanager/mod_healthmanager.cpp

+ 12 - 8
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -2873,7 +2873,7 @@ void CHealthManagerEntity::DeployTerminal(SpReqAnsContext<HealthManagerService_D
             CSimpleStringA& strAdapterFileName = ctx->Req.param3;
             CAutoArray<CSimpleStringA> adapterInfo;
             tmpResult = SplitAdapterFileName(strAdapterFileName, adapterInfo);
-
+            Dbg("%s, %s", strAdapterFileName.GetData(), SpStrError((ErrorCodeEnum)tmpResult));
             if (tmpResult == 0) {
                 CSimpleStringA strDevice(adapterInfo[0]);
                 CSimpleStringA strDeviceSection("Device.");
@@ -2901,19 +2901,23 @@ void CHealthManagerEntity::DeployTerminal(SpReqAnsContext<HealthManagerService_D
                         tmpResult = inifile_write_int(strRootTmpFile, strDeviceSection, "Baudrate", baudrate);
                     }
 				} else { //更新到root.ini
-                    CSmartPointer<IConfigInfo> pConfig;
-                    GetFunction()->OpenConfig(Config_Root, pConfig);
+                    CSmartPointer<IConfigInfo> pRootConfig;
+                    GetFunction()->OpenConfig(Config_Root, pRootConfig);
 
-					tmpResult = pConfig->WriteConfigValue(strDeviceSection, "Vendor", strVendor);
+					tmpResult = pRootConfig->WriteConfigValue(strDeviceSection, "Vendor", strVendor);
+					Dbg("%s,%s,%s,%s,%s", strDeviceSection.GetData(), strVendor.GetData(), strVersion.GetData(), strBatch.GetData(), SpStrError((ErrorCodeEnum)tmpResult));
 					if (tmpResult == 0) {
-						pConfig->WriteConfigValue(strDeviceSection, "Version", strVersion);
-                        pConfig->WriteConfigValueInt(strDeviceSection, "Port", port);
-                        pConfig->WriteConfigValueInt(strDeviceSection, "Baudrate", baudrate);
+						pRootConfig->WriteConfigValue(strDeviceSection, "Version", strVersion);
+						pRootConfig->WriteConfigValue(strDeviceSection, "Batch", strBatch);
+						pRootConfig->WriteConfigValueInt(strDeviceSection, "Port", port);
+						pRootConfig->WriteConfigValueInt(strDeviceSection, "Baudrate", baudrate);
 					} else {
 						tmpMsg = CSimpleStringA::Format("写入ROOT配置文件失败:%s", SpStrError((ErrorCodeEnum)tmpResult));
 					}
 				}
-            }
+			} else {
+				tmpMsg = CSimpleStringA::Format("适配器文件名称不符合规范:%s", strAdapterFileName.GetData());
+			}
 		}
 		else if ((ctx->Req.options & 0x4)) { //启动实体
 			CSimpleStringA& strEntityName = ctx->Req.param3;