From 5f6fc096a3ac667e811438e77a4adbc047562b3b Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Wed, 9 Oct 2024 10:24:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E5=92=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/SH_global.h | 2 +- jsonparse/SH_JsonCmd.cpp | 13 ++++++++++++- threadfunc/SH_ThreadFunc.cpp | 2 +- uart/SH_Uart.cpp | 9 +++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/common/SH_global.h b/common/SH_global.h index c670268..614818d 100644 --- a/common/SH_global.h +++ b/common/SH_global.h @@ -79,7 +79,7 @@ public : #ifdef IMX6UL_GATEWAY #define SAVE_COUNT 4320 -#define OneWeek 259359 +#define OneWeek 432000 //5天 #endif #ifdef G2UL_GATEWAY #define SAVE_COUNT 4800*4 diff --git a/jsonparse/SH_JsonCmd.cpp b/jsonparse/SH_JsonCmd.cpp index a68d6bd..4d60fd9 100644 --- a/jsonparse/SH_JsonCmd.cpp +++ b/jsonparse/SH_JsonCmd.cpp @@ -568,6 +568,7 @@ void JsonData::DataNodeStatusCheck() int lNowTime = atoi(nowTimetamp.c_str()); int onlineCheck = readIntValue( "config", "online",(char*)GlobalConfig::Config_G.c_str()); int loseTime = readIntValue( "config", "loseTime",(char*)GlobalConfig::Config_G.c_str()); + int count = 0; if (nSize > 0) { for (int i = 0; i < nSize; i++) { std::string strDataNodeNo = vetRes[i][0]; @@ -586,7 +587,7 @@ void JsonData::DataNodeStatusCheck() char whereCon[32] = { 0 }; sprintf(whereCon, "dataNodeNo='%s'", strDataNodeNo.c_str()); sql_ctl->UpdateTableData(T_SENSOR_INFO(TNAME), "status='0'", whereCon); - } + } // }else if(lTimeTemp > (loseTime * atoi(vetRes[i][21].c_str()) * 60)){ // LOG_DEBUG("掉线 DataNodeStatusCheck lNowTime = %d,llastTime = %d,interval = %s\n",lNowTime,llastTime,vetRes[i][21].c_str()); // char whereCon[32] = { 0 }; @@ -598,8 +599,18 @@ void JsonData::DataNodeStatusCheck() sprintf(whereCon, "dataNodeNo='%s'", strDataNodeNo.c_str()); sql_ctl->UpdateTableData(T_SENSOR_INFO(TNAME), "status='1'", whereCon); } + if (lTimeTemp > atoi(vetRes[i][21].c_str()) * 3 )//判定传感器是否超过三次未传特征值 + { + count ++; + } } } + if (count == nSize) + { + LOG_ERROR("ALL Node offline\n"); + exit(0); + } + } } diff --git a/threadfunc/SH_ThreadFunc.cpp b/threadfunc/SH_ThreadFunc.cpp index 0127d21..632b6d4 100644 --- a/threadfunc/SH_ThreadFunc.cpp +++ b/threadfunc/SH_ThreadFunc.cpp @@ -225,7 +225,7 @@ void CheckThread() } } - if(mqttresend == 1800){ + if(mqttresend == 7200){ mqttresend = 0; #ifdef WIFI_MODULE bool status = Ping( GlobalConfig::ServerIP.c_str(), 10000); diff --git a/uart/SH_Uart.cpp b/uart/SH_Uart.cpp index bfdaa53..f667e0c 100644 --- a/uart/SH_Uart.cpp +++ b/uart/SH_Uart.cpp @@ -2048,8 +2048,6 @@ void Uart::DealDataNodeFeature(const char *pData, int flag) if (flag == 1) { LOG_INFO("DealDataNodeFeature %02x%02x, %d\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1],flag); - }else{ - LOG_INFO("DealDataNodeFeature %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]); } @@ -3531,8 +3529,11 @@ void Uart::DealDataNodeFeature(const char *pData, int flag) sprintf(selectCon, "zigbeeSignal <> '' ORDER BY timeStamp desc LIMIT 0,1"); strTime = sql_ctl->GetData(szTableNameStatic, "timeStamp", selectCon); - - LOG_INFO("DealDataNodeFeature end %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]); + if (flag == 1) + { + LOG_INFO("DealDataNodeFeature end %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]); + } + } void Uart::DealDataNodeWave(const char *pData,int comand)