2024-04-09 16:53:02 +08:00
|
|
|
|
#include "HBDSystem.h"
|
2024-03-22 11:28:06 +08:00
|
|
|
|
#include <iostream>
|
2024-03-15 12:31:34 +08:00
|
|
|
|
|
2024-04-07 17:09:01 +08:00
|
|
|
|
|
2024-03-27 16:09:22 +08:00
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
HBDSystem* hbd = new HBDSystem();
|
|
|
|
|
hbd->Init();
|
2024-03-19 17:45:12 +08:00
|
|
|
|
|
2024-04-09 16:53:02 +08:00
|
|
|
|
hbd->Usage();
|
2024-03-19 17:45:12 +08:00
|
|
|
|
|
2024-03-22 11:28:06 +08:00
|
|
|
|
std::string userInput;
|
2024-04-07 17:09:01 +08:00
|
|
|
|
bool unknowCmd = false;
|
2024-03-22 11:28:06 +08:00
|
|
|
|
while (true) {
|
2024-04-07 17:09:01 +08:00
|
|
|
|
if (!unknowCmd)printf("*请输入命令:");
|
2024-03-22 11:28:06 +08:00
|
|
|
|
std::getline(std::cin, userInput); // 读取用户输入
|
2024-04-07 17:09:01 +08:00
|
|
|
|
unknowCmd = false;
|
2024-03-22 11:28:06 +08:00
|
|
|
|
if (userInput == "r" || userInput == "run") {
|
|
|
|
|
printf("service is running...\n");
|
2024-04-09 16:53:02 +08:00
|
|
|
|
hbd->Run();
|
2024-03-22 11:28:06 +08:00
|
|
|
|
}
|
2024-04-07 17:09:01 +08:00
|
|
|
|
else if (userInput == "s" || userInput == "stop") {
|
2024-04-09 16:53:02 +08:00
|
|
|
|
hbd->Stop();
|
2024-04-07 17:09:01 +08:00
|
|
|
|
printf("service is stoped...\n");
|
|
|
|
|
}
|
|
|
|
|
else if (userInput == "e" || userInput == "exit") {
|
2024-04-08 13:43:56 +08:00
|
|
|
|
printf("service is exiting...\n");
|
2024-03-22 11:28:06 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-07 17:09:01 +08:00
|
|
|
|
else if (userInput == "h" || userInput == "help") {
|
2024-04-09 16:53:02 +08:00
|
|
|
|
hbd->Usage();
|
2024-04-07 17:09:01 +08:00
|
|
|
|
}
|
2024-03-22 11:28:06 +08:00
|
|
|
|
else {
|
2024-04-07 17:09:01 +08:00
|
|
|
|
printf("未识别的命令,请重新输入命令:");
|
|
|
|
|
unknowCmd = true;
|
2024-03-22 11:28:06 +08:00
|
|
|
|
}
|
2024-04-07 17:09:01 +08:00
|
|
|
|
|
2024-03-22 11:28:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-27 16:09:22 +08:00
|
|
|
|
DELP(hbd);
|
2024-03-15 12:31:34 +08:00
|
|
|
|
return 0;
|
|
|
|
|
}
|