#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;
|
}
|