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