From 6854907bb4797d8879e981da7838844ad4c39e9e Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Wed, 27 Nov 2024 14:19:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=B8=8A=E4=BC=A0=E9=A2=91=E7=8E=87=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 20 +++++++++++++++++++- jsonparse/mqtt_cmd_parse.cpp | 6 +----- threadfunc/check_thread.cpp | 13 +++++++------ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c4d1d33..2b7fc51 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -81,7 +81,25 @@ "typeindex": "cpp", "variant": "cpp", "xstring": "cpp", - "xlocinfo": "cpp" + "xlocinfo": "cpp", + "charconv": "cpp", + "format": "cpp", + "forward_list": "cpp", + "ios": "cpp", + "locale": "cpp", + "xfacet": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xtr1common": "cpp", + "xtree": "cpp", + "xutility": "cpp" }, "C_Cpp.errorSquiggles": "disabled" } \ No newline at end of file diff --git a/jsonparse/mqtt_cmd_parse.cpp b/jsonparse/mqtt_cmd_parse.cpp index 820e620..aa18137 100644 --- a/jsonparse/mqtt_cmd_parse.cpp +++ b/jsonparse/mqtt_cmd_parse.cpp @@ -708,16 +708,12 @@ void JsonData::DataNodeStatusCheck() { char whereCon[32] = {0}; sprintf(whereCon, "dataNodeNo='%s'", strDataNodeNo.c_str()); sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), "status='0'", whereCon); + count++; } else { char whereCon[32] = {0}; sprintf(whereCon, "dataNodeNo='%s'", strDataNodeNo.c_str()); sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), "status='1'", whereCon); } - if (lTimeTemp > atoi(vetRes[i][21].c_str()) * 5 * 60) //判定传感器是否超过五次未传特征值 - { - zlog_info(zct, "lTimeTemp = %d,featureInterVal = %d", lTimeTemp, atoi(vetRes[i][21].c_str())); - count++; - } } } if (count == nSize && nodeOnline && count != 0) { diff --git a/threadfunc/check_thread.cpp b/threadfunc/check_thread.cpp index e238560..e698339 100644 --- a/threadfunc/check_thread.cpp +++ b/threadfunc/check_thread.cpp @@ -115,10 +115,9 @@ void CheckThread() { } } - if (120 == online_check) { + if (1800 == online_check) { online_check = 0; int Count = sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), NULL); - JsonData jd; if (Count > 0) { jd.DataNodeStatusCheck(); char localtimestamp[32] = {0}; @@ -131,15 +130,17 @@ void CheckThread() { long lTime = atol(nowTimetamp.c_str()) - atol(strTime.c_str()); zlog_info(zct, "online check = %ld", lTime); } - jd.JsonCmd_07(); - jd.JsonCmd_29(); - jd.JsonCmd_30(); - jd.JsonCmd_31(); + } if (7200 == Battery) { Battery = 0; zlog_info(zct, "Battery"); sqlite_db_ctrl::instance().CalculateBattery(); + JsonData jd; + jd.JsonCmd_07(); + jd.JsonCmd_29(); + jd.JsonCmd_30(); + jd.JsonCmd_31(); } if (3500 == loose_check) {