fix bugs
This commit is contained in:
parent
bbeeddd2ca
commit
8f7a32b57f
@ -699,6 +699,12 @@ void ImportConfig(std::string filename) {
|
||||
WriteStr2Config(SYSTEMINFOFILE, "Version", "WebVersion", jsSystemInfo["WebVersion"].asString());
|
||||
WriteStr2Config(SYSTEMINFOFILE, "Version", "GateWayHwVesion", jsSystemInfo["GateWayHwVesion"].asString());
|
||||
WriteStr2Config(SYSTEMINFOFILE, "Version", "GateWayProduct", jsSystemInfo["GateWayProduct"].asString());
|
||||
char whereCon[1024] = {0};
|
||||
char updateSql[1024] = { 0 };
|
||||
sprintf(updateSql, "zigbeePanID = '%s',zigbeeChannel = '%s'",\
|
||||
jsonValZigbee["PanID"].asString().c_str(),jsonValZigbee["channel"].asString().c_str());
|
||||
sprintf(whereCon, "gatewayMAC='%s'", GlobalConfig::MacAddr_G.c_str());
|
||||
sqlite_db_ctrl::instance().UpdateTableData(T_GATEWAY_INFO(TNAME), updateSql, whereCon);
|
||||
}
|
||||
|
||||
int UpdataDataNodeConfig(std::string filename) {
|
||||
|
||||
@ -18,7 +18,7 @@ enum enumZigBeeTransmitStatus {
|
||||
|
||||
|
||||
//#define NR5G_MODULE
|
||||
//#define Q4G_MODULE
|
||||
#define Q4G_MODULE
|
||||
//#define WIFI_MODULE
|
||||
//#define NR5G_MEIGE
|
||||
|
||||
|
||||
@ -768,6 +768,13 @@ std::string JsonData::JsonCmd_Cgi_31(Param_31 ¶m) {
|
||||
if (0 == param.mMode) {
|
||||
WriteStr2Config(ZIGBEECONFIG, "Zigbee", "channel", param.mChannelId);
|
||||
WriteStr2Config(ZIGBEECONFIG, "Zigbee", "PanID", param.mPanID);
|
||||
char whereCon[1024] = {0};
|
||||
char updateSql[1024] = { 0 };
|
||||
sprintf(updateSql, "zigbeePanID = '%s',zigbeeChannel = '%s'",\
|
||||
param.mPanID.c_str(),param.mChannelId.c_str());
|
||||
sprintf(whereCon, "gatewayMAC='%s'", GlobalConfig::MacAddr_G.c_str());
|
||||
sqlite_db_ctrl::instance().UpdateTableData(T_GATEWAY_INFO(TNAME), updateSql, whereCon);
|
||||
system("reboot");
|
||||
}
|
||||
Json::Value jsBody;
|
||||
jsonVal["message"] = "设置完成";
|
||||
|
||||
@ -59,6 +59,28 @@ void CheckThread() {
|
||||
iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str());
|
||||
if (iRet != 0) {
|
||||
zlog_error(zct, "MQTT connect failed ,time check");
|
||||
#ifdef Q4G_MODULE
|
||||
char localtimestamp[32] = { 0 };
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
char whereCon[100]={0};
|
||||
sprintf(whereCon,"DATE(timestamp, 'unixepoch') = DATE('now') ORDER BY timeStamp DESC limit 0,1");
|
||||
std::string strCount = sqlite_db_ctrl::instance().GetData(" reboot_record ", "count", whereCon);
|
||||
if (atoi(strCount.c_str()) < 3)//当天大于三次不再重启进程
|
||||
{
|
||||
char insertSql[64] = {0};
|
||||
sprintf(insertSql, "'%s',%d,'%s'",localtimestamp,atoi(strCount.c_str())+1,"4G connect failed ");
|
||||
sqlite_db_ctrl::instance().InsertData(" reboot_record ", insertSql);
|
||||
gpio_set(GlobalConfig::GPIO_G.commPower,0);
|
||||
zlog_warn(zct,"commPower start\n");
|
||||
sleep(2);
|
||||
gpio_set(GlobalConfig::GPIO_G.commPower,1);
|
||||
zlog_warn(zct,"commPower End\n");
|
||||
sleep(2);
|
||||
system("reboot");
|
||||
}else{
|
||||
zlog_error(zct,"Q4G_MODULE error\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef NR5G_MODULE
|
||||
dial.closePort();
|
||||
gpio_set(GlobalConfig::GPIO_G.commPower, 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user