25-1023工业控制-火力发电厂辅助控制系统
hk
2025-03-12 cfa43bdeea0b1fd7ea175fe72e609a76f1ba2747
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include "stdafx.h"
#include <iostream>
#include "NetworkConfig.h"
 
 
 
int main() {
    //¼ÓÔØInfo.xmlÅäÖÃÎļþ
    NetworkConfig parser("Info.xml");
    if (!parser.isLoaded()) {  // ¼ì²é XML ÎļþÊÇ·ñ³É¹¦¼ÓÔØ
        cout << "ÅäÖÃÎļþ¼ÓÔØÊ§°Ü" << endl;
        return 1;
    }
    else {
        cout << "-----------ÅäÖÃÎļþ¼ÓÔØ³É¹¦------------" << endl;
    }
 
    // ÈÃÓû§Ñ¡ÔñÆô¶¯Ä£Ê½
//     string selectedMode;
//     time_t lastModifiedTime = 0;
//     cout << "ÇëÑ¡ÔñÆô¶¯Ä£Ê½ (cold_start/hot_start): " << endl;
//     cin >> selectedMode;
// 
//     if (parser.setStartupMode(selectedMode)) {
//         cout << "ÒÑÑ¡Ôñ " << selectedMode << endl;
//         if (parser.saveXML("config.xml")) {
//             cout << "( XML Îļþ±£´æ³É¹¦ )" << endl;
//         }
//         else {
//             cout << "( XML Îļþ±£´æÊ§°Ü )" << endl;
//         }
// 
//         if (selectedMode == "cold_start") {
//             StartupMode currentMode = StartupMode::ColdStart;
//             parser.restartServices(currentMode, "config.xml", lastModifiedTime);
//         }
//         else {
//             NetworkConfig new_Parser("Info.xml");
//             StartupMode currentMode = StartupMode::HotStart;
//             parser.restartServices(currentMode, "config.xml", lastModifiedTime);
//         }
//     }
//     else {
//         cout << "ÎÞЧµÄÆô¶¯Ä£Ê½£¬ÇëÊäÈë cold_start »ò hot_start¡£" << endl;
//     }
 
 
    //»ñÈ¡ TCP ÅäÖÃÐÅÏ¢
    string TCP_IP;
    int TCP_Port;
    if (parser.getTCPConfig(TCP_IP, TCP_Port)) {
        cout << "TCP" << endl;
        cout << "    IP: " << TCP_IP << "\n    Port: " << TCP_Port << endl;
    }
    else {
        cout << "TCPÅäÖÃÐÅÏ¢»ñȡʧ°Ü" << endl;
    }
 
    //»ñÈ¡ RTSP ÅäÖÃÐÅÏ¢
    string RTSP_IP;
    int RTSP_Port;
    if (parser.getRTSPConfig(RTSP_IP, RTSP_Port)) {
        cout << "RTSP" << endl;
        cout << "    IP: " << RTSP_IP << "\n    Port: " << RTSP_Port << endl;
    }
    else {
        cout << "RTSPÅäÖÃÐÅÏ¢»ñȡʧ°Ü" << endl;
    }
 
    //»ñÈ¡ Log ÎļþÐÅÏ¢
    string logPath;
    int logSize;
    if (parser.getLogConfig(logPath, logSize)) {
        cout << "Log" << endl;
        cout << "    Path: " << logPath << endl;
        cout << "    Size: " << logSize << " bytes" << endl;
    }
    else {
        cout << "Log ÅäÖÃÐÅÏ¢»ñȡʧ°Ü" << endl;
    }    
 
    //»ñÈ¡ MySQL ÅäÖÃÐÅÏ¢
    string mysqlIp, mysqlDb, mysqlUser, mysqlPassword;
    int mysqlPort;
    if (parser.getMySQLConfig(mysqlIp, mysqlPort, mysqlDb, mysqlUser, mysqlPassword)) {
        cout << "MyQSL" << endl;
        cout << "    IP: " << mysqlIp << std::endl;
        cout << "    Port: " << mysqlPort << std::endl;
        cout << "    Database: " << mysqlDb << std::endl;
        cout << "    User: " << mysqlUser << std::endl;
        cout << "    Password: " << mysqlPassword << std::endl;
    }else {
        cout << "MySQL Ïà¹ØÅäÖÃÐÅÏ¢ »ñȡʧ°Ü" << endl;
    }
    
    //»ñȡͼÏñ¹ÜÀí¸ù·¾¶
    string pictureRootPath;
    if (parser.getPictureManagementRootPath(pictureRootPath)) {
        cout << "PictureManagement" << endl;
        cout << "    RootPath: " << pictureRootPath << endl;
    }
    else {
        cout << "ͼÏñ¹ÜÀí¸ù·¾¶ »ñȡʧ°Ü" << endl;
    }
 
    //»ñÈ¡ÊÓÆµ¹ÜÀí¸ù·¾¶
    string VideoRootPath;
    if (parser.getVideoManagementRootPath(VideoRootPath)) {
        cout << "VideoManagement" << endl;
        cout << "    RootPath: " << VideoRootPath << endl;
    }
    else {
        cout << "ÊÓÆµ¹ÜÀí¸ù·¾¶ »ñȡʧ°Ü" << endl;
    }
 
    // »ñÈ¡ CNN Ä£Ðͱ£´æÂ·¾¶
    string CNNPath;
    if (parser.getCNNModelSavePath(CNNPath)) {
        cout << "CNNModel" << endl;
        cout << "    SavePath: " << CNNPath << endl;
    }
    else {
        cout << "CNN Ä£Ðͱ£´æÂ·¾¶ »ñȡʧ°Ü" << endl;
    }
 
    //»ñÈ¡°æ±¾¹ÜÀí¸ù·¾¶
    string versionRootPath;
    if (parser.getVersionManagementRootPath(versionRootPath)) {
        cout << "VersionManagement" << endl;
        cout << "    RootPath: " << versionRootPath << endl;
    }
    else {
        cout << "°æ±¾¹ÜÀí¸ù·¾¶ »ñȡʧ°Ü" << endl;
    }
 
    // »ñÈ¡Æô¶¯Ä£Ê½
    string startupMode;
    if (parser.getStartupMode(startupMode)) {
        cout << "StartupMode" << endl;
        cout << "    StartupMode: " << startupMode << endl;
    }
    return 0;
}