LAPTOP-SNT8I5JK\Boounion
2025-06-21 ba74624d44eb5bfaa45b259a985d2d64e1c51e22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include <vector>
#include <string>
#include <algorithm>
 
// PLCÐÅÏ¢
struct PlcInfo {
    CString strName;  // PLC Ãû³Æ
    CString strIp;    // IP µØÖ·
    UINT nPort;       // ¶Ë¿ÚºÅ
};
 
class CConfiguration
{
public:
    CConfiguration();
    CConfiguration(const char* pszFilepath);
    ~CConfiguration();
 
public:
    void setFilepath(const char* pszFilepath);
    void getUnitId(CString& strUnitId);
    void getBond1(CString& strIp, UINT& port, UINT& doorCount);
    int getLogcatLevel();
    void setLogcatLevel(int level);
    int setLogcatIncludeText(CString& strInclude);
    int getLogcatIncludeText(CString& strInclude);
    void setLogcatIncludeRegex(BOOL bRegex);
    BOOL isLogcatIncludeRegex();
    int getCustomLogcatIncludeTexts(std::vector<std::string>& texts);
 
public:
    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;
};