refine platform func.
This commit is contained in:
parent
2c29f2ec19
commit
6044171563
@ -206,13 +206,14 @@ void PlatformInit::SystemInfoInit() {
|
||||
//从配置文件中读取json数据
|
||||
if (ifileOut.is_open()) {
|
||||
zlog_info(zbt, "open %s", SYSTEMINFOFILE);
|
||||
} else {
|
||||
zlog_error(zbt, "fail to open:%s", SYSTEMINFOFILE);
|
||||
return;
|
||||
}
|
||||
if (!recvReader.parse(ifileOut, Systeminfo, false)) {
|
||||
if (ifileOut.is_open()) {
|
||||
ifileOut.close();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ifileOut.close();
|
||||
zlog_error(zbt, "fail to parse:%s", SYSTEMINFOFILE);
|
||||
return;
|
||||
}
|
||||
ifileOut.close();
|
||||
|
||||
@ -231,10 +232,22 @@ void PlatformInit::SystemInfoInit() {
|
||||
|
||||
void PlatformInit::UserInit() {
|
||||
std::string userName = ReadStrByOpt(SYSTEMINFOFILE, "UserInfo", "UserName");
|
||||
int ret = 0;
|
||||
if (userName.length() == 0) {
|
||||
WriteStr2Config(SYSTEMINFOFILE, "UserInfo", "UserName", "Admin");
|
||||
WriteStr2Config(SYSTEMINFOFILE, "UserInfo", "adminPassword", "njchaos");
|
||||
WriteStr2Config(SYSTEMINFOFILE, "UserInfo", "userPassword", "");
|
||||
ret = WriteStr2Config(SYSTEMINFOFILE, "UserInfo", "UserName", "Admin");
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = WriteStr2Config(SYSTEMINFOFILE, "UserInfo", "adminPassword", "njchaos");
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = WriteStr2Config(SYSTEMINFOFILE, "UserInfo", "userPassword", "");
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,11 +331,15 @@ void PlatformInit::EquipIpInit(std::string eth) {
|
||||
// flag = 1;
|
||||
}
|
||||
#ifdef IMX6UL_GATEWAY
|
||||
|
||||
zlog_info(zbt, "system reboot by reboot system call");
|
||||
system("sync");
|
||||
sleep(1);
|
||||
system("reboot");
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef G2UL_GATEWAY
|
||||
zlog_info(zbt, "network restart by systemctl call");
|
||||
system("systemctl restart systemd-networkd.service");
|
||||
#endif
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user