25-1023工业控制-火力发电厂辅助控制系统
wjt123456
2025-03-11 98abbb969f11a26879314257871bb4e602c0db73
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 "stdafx.h"
#include <iostream>
#include "tinyxml2.h"
#include <string>
#include <ctime>
 
using namespace std;
using namespace tinyxml2;
 
 
 
enum class StartupMode {
    ColdStart,
    HotStart
};
 
class NetworkConfig
{
private:
    tinyxml2::XMLDocument doc;  // ÓÃÓÚ´æ´¢ XML ÎĵµµÄ¶ÔÏó
    bool loaded;  // ±ê¼Ç XML ÎļþÊÇ·ñ³É¹¦¼ÓÔØ
    static bool startupModeSelected;
 
public:
    NetworkConfig(const string& xmlFilePath);
    ~NetworkConfig();
 
 
    bool isLoaded() const;// ¼ì²é XML ÎļþÊÇ·ñ³É¹¦¼ÓÔØ
    bool getTCPConfig(string& ipAddress, int& portNumber);//»ñÈ¡TCPÅäÖÃÐÅÏ¢£¬·µ»ØIPµØÖ·ºÍ¶Ë¿ÚºÅ
    bool getRTSPConfig(string& ipAddress, int& portNumber);//»ñÈ¡RTSPÅäÖÃÐÅÏ¢£¬·µ»ØIPµØÖ·ºÍ¶Ë¿ÚºÅ
    bool getLogConfig(string& path, int& size);// »ñÈ¡ ÈÕÖ¾ ÅäÖÃÐÅÏ¢
    bool getMySQLConfig(string& ip, int& port, string& db, string& user, string& password);// »ñÈ¡ MySQL ÅäÖÃÐÅÏ¢
    bool getPictureManagementRootPath(string& rootPath);// »ñÈ¡ Í¼Æ¬¹ÜÀí ¸ù·¾¶
    // Ìí¼Ó»ñȡԤ´¦ÀíÉú³ÉͼƬµÄ¸ù·¾¶µÄ³ÉÔ±º¯Êý
    bool getPreprocessedPictureRootPath(std::string & rootPath);
    bool getVideoManagementRootPath(string& rootPath);// »ñÈ¡ ÊÓÆµ¹ÜÀí ¸ù·¾¶
    bool getCNNModelSavePath(string& path);// »ñÈ¡ CNN Ä£Ðͱ£´æÂ·¾¶
    bool getVersionManagementRootPath(string& rootPath);    // »ñÈ¡ °æ±¾¹ÜÀí ¸ù·¾¶
    bool getStartupMode(string& mode);// »ñÈ¡ Æô¶¯Ä£Ê½
    bool setStartupMode(const string& mode);// ÉèÖàÆô¶¯Ä£Ê½
    bool saveXML(const string& xmlFilePath);// ±£´æÐ޸ĺóµÄ XML Îļþµ½Ö¸¶¨Â·¾¶
 
    void coldStart();
    void hotStart(NetworkConfig& oldParser);
    bool isConfigUpdated(const string& xmlFilePath, time_t& lastModifiedTime);// ¼ì²éÅäÖÃÎļþÊÇ·ñÓиüÐÂ
    void restartServices(StartupMode currentMode, const string& xmlFilePath, time_t& lastModifiedTime);
 
    bool setTCPConfig(const std::string& ipAddress, int portNumber);
 
};