diff --git a/Cidn-SH b/Cidn-SH deleted file mode 100755 index d9bcab7..0000000 Binary files a/Cidn-SH and /dev/null differ diff --git a/Makefile b/Makefile index 54d941c..dd0e9b4 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ INCLUDES = -I../Tools/GatewayThirdParty/boost/include \ -I../Tools/GatewayThirdParty/jsoncpp/include \ -I../Tools/GatewayThirdParty/sqlite/include/ \ -I../Tools/GatewayThirdParty/curl/include/ \ + -I../Tools/GatewayThirdParty/zlog/include/ \ -I ./ \ LIBS = -L../Tools/renesas_thirdparty/lib \ diff --git a/jsonparse/web_cmd_parse3.cpp b/jsonparse/web_cmd_parse3.cpp index ff88d62..363d540 100644 --- a/jsonparse/web_cmd_parse3.cpp +++ b/jsonparse/web_cmd_parse3.cpp @@ -1485,7 +1485,7 @@ std::string JsonData::JsonCmd_Cgi_67(Param_67 ¶m){ char whereCon[512] = {0}; char updateSql[256] = {0}; sprintf(whereCon, " MeasurementID = '%s' ", param.measurementID[i].c_str()); - sprintf(updateSql, " status = '%d' ", 1);// 0 未调试,1 调试中,2 调试完成 + sprintf(updateSql, " status = '%d' ", 1);// 0 未调试,1 调试中,2 调试完成,3 停止调试 sqlite_db_ctrl::instance().UpdateTableData("t_debug_info", updateSql, whereCon); uint16_t short_addr; char *end_ptr = NULL; @@ -1499,7 +1499,7 @@ std::string JsonData::JsonCmd_Cgi_67(Param_67 ¶m){ char whereCon[512] = {0}; char updateSql[256] = {0}; sprintf(whereCon, " status = '1' "); - sprintf(updateSql, " status = '%d' ", 0);// 0 未调试,1 调试中,2 调试完成 + sprintf(updateSql, " status = '%d' ", 3);// 0 未调试,1 调试中,2 调试完成,3 停止调试 sqlite_db_ctrl::instance().UpdateTableData("t_debug_info", updateSql, whereCon); scheduler::instance().CloseDebugMode(); } @@ -1585,7 +1585,7 @@ std::string JsonData::JsonCmd_Cgi_69(Param_69 ¶m){ memset(updateSql,0,sizeof(updateSql)); sprintf(whereCon, " MeasurementID = '%s' ", param.vecParam69[i].measurementID.c_str()); sprintf(updateSql, " status = '%d',trigerType = '%d',statisticType = '%d', threshold = '%f'",param.vecParam69[i].status,param.vecParam69[i].trigerType,param.vecParam69[i].statisticType,param.vecParam69[i].threshold); - sqlite_db_ctrl::instance().UpdateTableData(" t_waveTriger_info ", updateSql, whereCon); + sqlite_db_ctrl::instance().UpdateTableData(" t_wave_triger_info ", updateSql, whereCon); } } } else if (param.mMode == 0) { diff --git a/uart/uart.cpp b/uart/uart.cpp index f97e521..2a6e003 100644 --- a/uart/uart.cpp +++ b/uart/uart.cpp @@ -489,7 +489,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); @@ -511,7 +511,7 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){ 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); @@ -563,6 +563,15 @@ int Uart::DealWaveCompress(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); + } } zlog_warn(zct, "count X = %d,Y = %d,Z = %d,vol X = %d,vol Y = %d,vol Z = %d short_add = %s", tempchannel.CountX, tempchannel.CountY, tempchannel.CountZ,tempchannel.CountVolX,tempchannel.CountVolY,tempchannel.CountVolZ,strShortAddr.c_str()); @@ -1565,6 +1574,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 d27ed6d..cc08dbd 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 3fc5d3e..80cc66f 100644 --- a/uart/uart_feature_parse.cpp +++ b/uart/uart_feature_parse.cpp @@ -86,6 +86,16 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s sprintf(updateSql,"RSSI = '%f'", comprehensiveRSSI); sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon); zlog_info(zct, "dataNodeNo='%s',zigbeeSignal=%d,zigbeeSignalNode=%d,actualRate=%f,comprehensiveRSSI=%f", strLongAddr.c_str(), zigbeeSignal, zigbeeSignalNode, actualRate, comprehensiveRSSI); + if (schedule_status == kScheduleStatusDebug) + { + char localtimestamp[32] = { 0 }; + GetTimeNet(localtimestamp, 1); + memset(updateSql,0,sizeof(updateSql)); + memset(tableName,0,sizeof(tableName)); + sprintf(tableName, "t_debug_info"); + sprintf(updateSql, " comprehensiveRSSI = '%f',minnumVoltage = '%d',status = '2',timeStamp = '%s' ", comprehensiveRSSI,dataStatic.instantaneousBatteryVoltage,localtimestamp); + sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); + } } } void Uart::DealTriger(uint16_t ushortAdd,std::string & measurementID){