LAPTOP-SNT8I5JK\Boounion
2025-01-13 2a6b8de3ee1ed419bbe54213dcb8428d2c436a69
SourceCode/Bond/BoounionPLC/Configuration.h
@@ -1,6 +1,14 @@
#pragma once
#include <vector>
#include <string>
#include <algorithm>
// PLC信息
struct PlcInfo {
   CString strName;  // PLC 名称
   CString strIp;    // IP 地址
   UINT nPort;       // 端口号
};
class CConfiguration
{
@@ -25,7 +33,21 @@
   void setP2RemoteEqReconnectInterval(int second);
   int getP2RemoteEqReconnectInterval();
public:
   // PLC配置操作
   bool addPLC(const CString& strName, const CString& strIp, UINT nPort);
   bool removePLC(const CString& strName);
   bool updatePLC(const CString& strOldName, const CString& strNewName, const CString& strNewIp, UINT nNewPort);
   bool getPLCByName(const CString& strName, CString& strIp, UINT& nPort);
   void getAllPLCInfo(std::vector<PlcInfo>& plcList);
   int getPLCListCount();
private:
   void loadPLCListFromFile();
   void savePLCListToFile();
private:
   CString m_strFilepath;
   std::vector<PlcInfo> m_plcList;
};