From 44d96b6db375851660b1a6b87d2cb5858881a914 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 9 Mar 2026 13:40:30 +0800 Subject: [PATCH] modify bugs --- uart/uart.cpp | 27 +++++++++++++++++++++++---- uart/uart.hpp | 3 +++ uart/uart_feature_parse.cpp | 8 ++++++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/uart/uart.cpp b/uart/uart.cpp index 8762b5d..d2a8e59 100644 --- a/uart/uart.cpp +++ b/uart/uart.cpp @@ -516,7 +516,7 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){ std::string productNo = res[17]; compressWaveChannel tempchannel; if ((compareVersions(softVersion, "2.6") == -1 && productNo == "02") || productNo == "01"){ // DN101所有版本和DN102 2.6以前版本 - ScheduleStatus schedule_status = scheduler::instance().GetScheduleStatus(); + schedule_status = scheduler::instance().GetScheduleStatus(); if(schedule_status == kScheduleStatusDebug || schedule_status == kScheduleStatusUpgrade){ zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status); scheduler::instance().WaveSuccess(ushortAdd,true); @@ -531,14 +531,15 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){ tempchannel.CountY = BUILD_UINT32(pData[17], pData[16],pData[15],pData[14]); tempchannel.CountZ = BUILD_UINT32(pData[21], pData[20],pData[19],pData[18]); sprintf(sensor_rssi, "%02d", pData[22] & 0xFF); - }else{ - int ret = 0;//= WaveSendCondition(shortAdd); + }else + { + int ret = WaveSendCondition(shortAdd); if(ret == 1){ zlog_warn(zct, "WaveSendCondition not meet condition ,shortAddr = %s",shortAdd); scheduler::instance().WaveSuccess(ushortAdd,true); return 1; }else{ - ScheduleStatus schedule_status = scheduler::instance().GetScheduleStatus(); + schedule_status = scheduler::instance().GetScheduleStatus(); if(schedule_status == kScheduleStatusUpgrade){ zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status); scheduler::instance().WaveSuccess(ushortAdd,true); @@ -633,6 +634,15 @@ int Uart::DealSensorRSSI(const char *pData,uint16_t ushortAdd){ memset(whereCon,0,sizeof(whereCon)); sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str()); sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); + if(schedule_status == kScheduleStatusDebug){ + memset(whereCon,0,sizeof(whereCon)); + memset(updateSql,0,sizeof(updateSql)); + memset(tableName,0,sizeof(tableName)); + sprintf(tableName, "t_debug_info"); + sprintf(updateSql, " datanodeRSSI = '%s' ", sensor_rssi); + sprintf(whereCon, "shortAddr = '%02x%02x' ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); + sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); + } } return 0; } @@ -1584,6 +1594,15 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str()); sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); + if(schedule_status == kScheduleStatusDebug){ + memset(whereCon,0,sizeof(whereCon)); + memset(updateSql,0,sizeof(updateSql)); + memset(tableName,0,sizeof(tableName)); + sprintf(tableName, "t_debug_info"); + sprintf(updateSql, " gatewayRSSI = '%02d' ", UartRecvBuf[i+6]&0xFF); + sprintf(whereCon, "MeasurementID = '%s' ",(char*)vecDataNodeNo[0].c_str()); + sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); + } // zigbeeRSSIType = 1 网关获取传感器信号强度 diff --git a/uart/uart.hpp b/uart/uart.hpp index 4e198a3..68756cc 100644 --- a/uart/uart.hpp +++ b/uart/uart.hpp @@ -8,6 +8,7 @@ #include "common/global.hpp" #include "dbaccess/sql_db.hpp" #include "utility/calculation.hpp" +#include "scheduler/status_mgr.hpp" typedef void (*pTestRecvCallBack)(int Status); @@ -285,6 +286,8 @@ private: long last_time; bool current_z; std::map> map_send_data; + + ScheduleStatus schedule_status; }; typedef boost::container::dtl::singleton_default uart_inst; diff --git a/uart/uart_feature_parse.cpp b/uart/uart_feature_parse.cpp index 7541fc0..faad0f8 100644 --- a/uart/uart_feature_parse.cpp +++ b/uart/uart_feature_parse.cpp @@ -63,7 +63,7 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s if (res_static.size() > 0){ int zigbeeSignal = atoi(res_static[6].c_str()); int zigbeeSignalNode = atoi(res_static[11].c_str()); - float standardRate = 5000.0f; //5kB/s + float standardRate = 5.0f; //5kB/s float actualRate = 0.0f; if (dataStatic.nodeSendTime > 0){ actualRate = (wave_dataLen / 1024.0f) / (dataStatic.nodeSendTime / 1000.0f); //单位:KB/s @@ -73,7 +73,8 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s comprehensiveRSSI = 1.0f; //综合信号强度最大为1 } - zlog_info(zct, "dataNodeNo='%s',wave_dataLen=%d,nodeSendTime=%f,actualRate=%f", strLongAddr.c_str(), wave_dataLen, dataStatic.nodeSendTime, actualRate); + zlog_info(zct, "dataNodeNo='%s',zigbeeSignal = '%d',zigbeeSignalNode = '%d',wave_dataLen=%d,nodeSendTime=%f,actualRate=%f", + strLongAddr.c_str(),zigbeeSignal, zigbeeSignalNode,wave_dataLen, dataStatic.nodeSendTime, actualRate); //更新综合信号强度到数据库 char updateSql[256] = {0}; memset(whereCon, 0x00, sizeof(whereCon)); @@ -271,6 +272,9 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) { iTemp = (int)strtol(buf, NULL, 16); dataStatic.instantaneousBatteryVoltage = iTemp; + if(schedule_status == kScheduleStatusDebug){ + + } char szTableName[50] = {0x00}, szTableNameStatic[50] = {0x00}, szTableNameData[50] = {0x00}; sprintf(szTableName, "t_dataStatic_%s", strMeasurementID.c_str()); memcpy(szTableNameStatic, szTableName, sizeof(szTableNameStatic));