This commit is contained in:
zhangsheng 2025-02-12 17:36:41 +08:00
parent bbeeddd2ca
commit 8f7a32b57f
4 changed files with 36 additions and 1 deletions

View File

@ -699,6 +699,12 @@ void ImportConfig(std::string filename) {
WriteStr2Config(SYSTEMINFOFILE, "Version", "WebVersion", jsSystemInfo["WebVersion"].asString()); WriteStr2Config(SYSTEMINFOFILE, "Version", "WebVersion", jsSystemInfo["WebVersion"].asString());
WriteStr2Config(SYSTEMINFOFILE, "Version", "GateWayHwVesion", jsSystemInfo["GateWayHwVesion"].asString()); WriteStr2Config(SYSTEMINFOFILE, "Version", "GateWayHwVesion", jsSystemInfo["GateWayHwVesion"].asString());
WriteStr2Config(SYSTEMINFOFILE, "Version", "GateWayProduct", jsSystemInfo["GateWayProduct"].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) { int UpdataDataNodeConfig(std::string filename) {

View File

@ -18,7 +18,7 @@ enum enumZigBeeTransmitStatus {
//#define NR5G_MODULE //#define NR5G_MODULE
//#define Q4G_MODULE #define Q4G_MODULE
//#define WIFI_MODULE //#define WIFI_MODULE
//#define NR5G_MEIGE //#define NR5G_MEIGE

View File

@ -768,6 +768,13 @@ std::string JsonData::JsonCmd_Cgi_31(Param_31 &param) {
if (0 == param.mMode) { if (0 == param.mMode) {
WriteStr2Config(ZIGBEECONFIG, "Zigbee", "channel", param.mChannelId); WriteStr2Config(ZIGBEECONFIG, "Zigbee", "channel", param.mChannelId);
WriteStr2Config(ZIGBEECONFIG, "Zigbee", "PanID", param.mPanID); 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; Json::Value jsBody;
jsonVal["message"] = "设置完成"; jsonVal["message"] = "设置完成";

View File

@ -59,6 +59,28 @@ void CheckThread() {
iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str());
if (iRet != 0) { if (iRet != 0) {
zlog_error(zct, "MQTT connect failed ,time check"); 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 #ifdef NR5G_MODULE
dial.closePort(); dial.closePort();
gpio_set(GlobalConfig::GPIO_G.commPower, 0); gpio_set(GlobalConfig::GPIO_G.commPower, 0);