From 16b86d966590ced67ac5305ed9a90422c122319d Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Wed, 13 Nov 2024 17:50:54 +0800 Subject: [PATCH] fix rssi save bugs --- jsonparse/web_cmd_parse3.cpp | 20 ++-- localserver/local_server.hpp | 3 +- localserver/web_cmd.cpp | 10 ++ threadfunc/check_thread.cpp | 182 +++++++++++++++++---------------- uart/uart.cpp | 102 ++++++++++-------- uart/uart.hpp | 1 - uart/uart_feature_parse.cpp | 12 +-- uart/uart_parameter_config.cpp | 154 +++------------------------- 8 files changed, 196 insertions(+), 288 deletions(-) diff --git a/jsonparse/web_cmd_parse3.cpp b/jsonparse/web_cmd_parse3.cpp index d037a68..5746c6a 100644 --- a/jsonparse/web_cmd_parse3.cpp +++ b/jsonparse/web_cmd_parse3.cpp @@ -549,7 +549,6 @@ std::string JsonData::JsonCmd_Cgi_59(Param_59 ¶m) { { sprintf(table_name,"t_dataStatic_%s",param.DataNodeNo.c_str()); interval = 10; - snprintf(sql, sizeof(sql), "WITH CTE AS (" " SELECT timestamp, " @@ -593,8 +592,8 @@ std::string JsonData::JsonCmd_Cgi_59(Param_59 ¶m) { for (size_t i = 0; i < arrResult.size(); i++) { Json::Value iTem; - iTem.append(arrResult[i][0]); iTem.append(arrResult[i][1]); + iTem.append(arrResult[i][0]); valData.append(iTem); } jsonVal["content"] = valData; @@ -677,12 +676,12 @@ std::string JsonData::JsonCmd_Cgi_60(Param_60 ¶m){ int packgeSize = 0; ch_crc = buffer[12]; packgeSize = BUILD_UINT32(buffer[8],buffer[9],buffer[10],buffer[11]); - zlog_info(zct,"sf_ver_m = %d\n",sf_ver_m); - zlog_info(zct,"sf_ver_s = %d\n",sf_ver_s); - zlog_info(zct,"hw_ver = %d\n",hw_ver); - zlog_info(zct,"sensor_type = %s\n",sensor_type); - zlog_info(zct,"packgeSize = %d\n",packgeSize); - zlog_info(zct,"ch_crc = %02x\n",ch_crc); + zlog_info(zct,"sf_ver_m = %d",sf_ver_m); + zlog_info(zct,"sf_ver_s = %d",sf_ver_s); + zlog_info(zct,"hw_ver = %d",hw_ver); + zlog_info(zct,"sensor_type = %s",sensor_type); + zlog_info(zct,"packgeSize = %d",packgeSize); + zlog_info(zct,"ch_crc = %02x",ch_crc); unsigned char sum = 0x00; for(size_t i = 13; i < thisSize;i++){ sum += buffer[i]; @@ -695,7 +694,7 @@ std::string JsonData::JsonCmd_Cgi_60(Param_60 ¶m){ return show_value_.write(jsonVal); } - printf("sum = %x\n",sum % 256); + zlog_info(zct,"sum = %x\n",sum % 256); char localtimestamp[32] = {0}; GetTimeNet(localtimestamp, 1); for (size_t i = 0; i < param.dataNodeNo.size(); i++) @@ -712,7 +711,6 @@ std::string JsonData::JsonCmd_Cgi_60(Param_60 ¶m){ free(buffer); return show_value_.write(jsonVal); } - sprintf(insertSql, " '%s','%s','','','','','%d.%d','%s',1,'%s'",vecResult[3].c_str(),localtimestamp,sf_ver_m,sf_ver_s,vecResult[1].c_str(),param.fileName.c_str()); sqlite_db_ctrl::instance().InsertData(" firmware_upgrade ", insertSql); //0 默认状态,1 升级中,2 升级成功,3 升级失败 @@ -834,7 +832,7 @@ std::string JsonData::JsonCmd_Cgi_62(Param_62 ¶m){ Json::Value jsonVal; jsonVal.clear(); - jsonVal[JSON_FIELD_CMD] = "61"; + jsonVal[JSON_FIELD_CMD] = "62"; jsonVal["success"] = true; jsonVal["message"] = " "; vec_t vetRes = sqlite_db_ctrl::instance().GetDataMultiLineOfOneColumn(T_SENSOR_INFO(TNAME), T_SENSOR_INFO(DATANODENO), NULL); diff --git a/localserver/local_server.hpp b/localserver/local_server.hpp index 349439b..807bf30 100644 --- a/localserver/local_server.hpp +++ b/localserver/local_server.hpp @@ -50,7 +50,8 @@ enum WebCommand { kSchedulingConfiguration = 58, kLostRecords = 59, kTransducerUpgrade = 60, - kWaveRecords = 61 + kWaveRecords = 61, + kWaveReceive = 62 }; class LocalServer { diff --git a/localserver/web_cmd.cpp b/localserver/web_cmd.cpp index 8d24f11..9710fc2 100644 --- a/localserver/web_cmd.cpp +++ b/localserver/web_cmd.cpp @@ -428,6 +428,16 @@ std::string LocalServer::HandleCgi_cmd(std::string &pData) { std::string data = jd.JsonCmd_Cgi_61(param); return data; }break; + case kWaveReceive:{ + JsonData jd; + Param_62 param; + param.mPackageFlag = recvBody["package"].asInt(); + param.timeStart = recvBody["timeStart"].asString(); + param.timeEnd = recvBody["timeEnd"].asString(); + param.MeasurementID = recvBody["MeasurementID"].asString(); + std::string data = jd.JsonCmd_Cgi_62(param); + return data; + }break; default: JsonData jd; std::string data = jd.JsonCmd_Cgi_default(); diff --git a/threadfunc/check_thread.cpp b/threadfunc/check_thread.cpp index a060436..851754a 100644 --- a/threadfunc/check_thread.cpp +++ b/threadfunc/check_thread.cpp @@ -52,97 +52,97 @@ void CheckThread() { GlobalConfig::IpAddr_G = ipTemp; heart_count = 0; } - if (7200 == time_check) { // 2h //校时暂时不测 + if (7200 == time_check) { // 2h time_check = 0; -// char buf[256] = {0}; -// char buf2[256] = {0}; -// sprintf(buf, "{\"dataNodeGatewayNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", GlobalConfig::MacAddr_G.c_str()); -// sprintf(buf2, "{\"dataWatchNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", GlobalConfig::MacAddr_G.c_str()); -// std::string str = std::string(buf); -// std::string str2 = std::string(buf2); -// -// int iRet = data_publish(str.c_str(), GlobalConfig::Topic_G.mPubTiming.c_str()); -// iRet = data_publish(str.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); -// iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubTiming.c_str()); -// iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); -// if (iRet != 0) { -// zlog_error(zct, "MQTT connect failed ,time check"); -// #ifdef IMX6UL_GATEWAY -// char connect[10] = {0x00}; -// readStringValue("config", "connect", connect, (char *)GlobalConfig::Config_G.c_str()); -// if (atoi(connect)) { -// zlog_error(zct, "MQTT connect failed,time check ,reboot"); -// exit(0); -// } -// #endif -// #ifdef NR5G_MODULE -// #ifdef IMX6UL_GATEWAY -// dial.closePort(); -// gpio_set(GlobalConfig::GPIO_G.commRest, 0); -// zlog_warn(zct, "GPIO 8 start"); -// sleep(2); -// gpio_set(GlobalConfig::GPIO_G.commRest, 1); -// zlog_warn(zct, "GPIO 8 End"); -// sleep(20); -// dial.openPort("/dev/ttyUSB2"); -// dial.setState(); -// #endif -// #ifdef G2UL_GATEWAY -// dial.closePort(); -// gpio_set(GlobalConfig::GPIO_G.commPower, 0); -// zlog_warn(zct, "commPower start"); -// sleep(2); -// gpio_set(GlobalConfig::GPIO_G.commPower, 1); -// zlog_warn(zct, "commPower End"); -// sleep(20); -// connectCount++; -// if (connectCount > 10) { -// zlog_error(zct, "5G reset error ,reboot!"); -// system("reboot"); -// } -// #ifndef NR5G_MEIGE -// dial.openPort("/dev/ttyUSB2"); -// dial.setState(); -// #else -// char szquectel[100] = {0x00}; -// std::string strAPN = ReadStrByOpt(SERVERCONFIG, "Server", "APN"); -// sprintf(szquectel, "/opt/quectel-CM/Meig-CM -s %s &", strAPN.c_str()); -// system(szquectel); -// #endif -// #endif -// #endif -// #ifdef WIFI_MODULE -// zlog_warn(zct, "WiFi reset!"); -// #ifdef IMX6UL_GATEWAY -// gpio_set(GlobalConfig::GPIO_G.wifiReset, 0); -// sleep(5); -// gpio_set(GlobalConfig::GPIO_G.wifiReset, 1); -// sleep(5); -// wifi::WPAClient wpa; -// wpa.ReconnectWiFi(); -// system("/etc/init.d/wpa_restart"); -// system("udhcpc -i wlan2 &"); -// #endif -// #ifdef G2UL_GATEWAY -// system("/etc/init.d/wpa_restart"); -// sleep(5); -// string strip = GetGwIp_("wlan0"); -// print_info("strip = %s\n", strip.c_str()); -// if (strip.compare("0.0.0.0") != 0) { -// } else { -// gpio_set(GlobalConfig::GPIO_G.wifiReset, 1); -// sleep(5); -// gpio_set(GlobalConfig::GPIO_G.wifiReset, 0); -// sleep(30); -// wifi::WPAClient wpa; -// wpa.ReconnectWiFi(); -// system("/etc/init.d/wpa_restart"); -// sleep(5); -// system("udhcpc -b -i wlan0 &"); -// } -// #endif -// #endif -// } + char buf[256] = {0}; + char buf2[256] = {0}; + sprintf(buf, "{\"dataNodeGatewayNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", GlobalConfig::MacAddr_G.c_str()); + sprintf(buf2, "{\"dataWatchNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", GlobalConfig::MacAddr_G.c_str()); + std::string str = std::string(buf); + std::string str2 = std::string(buf2); + + int iRet = data_publish(str.c_str(), GlobalConfig::Topic_G.mPubTiming.c_str()); + iRet = data_publish(str.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); + iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubTiming.c_str()); + iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); + if (iRet != 0) { + zlog_error(zct, "MQTT connect failed ,time check"); +#ifdef IMX6UL_GATEWAY + char connect[10] = {0x00}; + readStringValue("config", "connect", connect, (char *)GlobalConfig::Config_G.c_str()); + if (atoi(connect)) { + zlog_error(zct, "MQTT connect failed,time check ,reboot"); + exit(0); + } +#endif +#ifdef NR5G_MODULE +#ifdef IMX6UL_GATEWAY + dial.closePort(); + gpio_set(GlobalConfig::GPIO_G.commRest, 0); + zlog_warn(zct, "GPIO 8 start"); + sleep(2); + gpio_set(GlobalConfig::GPIO_G.commRest, 1); + zlog_warn(zct, "GPIO 8 End"); + sleep(20); + dial.openPort("/dev/ttyUSB2"); + dial.setState(); +#endif +#ifdef G2UL_GATEWAY + dial.closePort(); + gpio_set(GlobalConfig::GPIO_G.commPower, 0); + zlog_warn(zct, "commPower start"); + sleep(2); + gpio_set(GlobalConfig::GPIO_G.commPower, 1); + zlog_warn(zct, "commPower End"); + sleep(20); + connectCount++; + if (connectCount > 10) { + zlog_error(zct, "5G reset error ,reboot!"); + system("reboot"); + } +#ifndef NR5G_MEIGE + dial.openPort("/dev/ttyUSB2"); + dial.setState(); +#else + char szquectel[100] = {0x00}; + std::string strAPN = ReadStrByOpt(SERVERCONFIG, "Server", "APN"); + sprintf(szquectel, "/opt/quectel-CM/Meig-CM -s %s &", strAPN.c_str()); + system(szquectel); +#endif +#endif +#endif +#ifdef WIFI_MODULE + zlog_warn(zct, "WiFi reset!"); +#ifdef IMX6UL_GATEWAY + gpio_set(GlobalConfig::GPIO_G.wifiReset, 0); + sleep(5); + gpio_set(GlobalConfig::GPIO_G.wifiReset, 1); + sleep(5); + wifi::WPAClient wpa; + wpa.ReconnectWiFi(); + system("/etc/init.d/wpa_restart"); + system("udhcpc -i wlan2 &"); +#endif +#ifdef G2UL_GATEWAY + system("/etc/init.d/wpa_restart"); + sleep(5); + string strip = GetGwIp_("wlan0"); + print_info("strip = %s\n", strip.c_str()); + if (strip.compare("0.0.0.0") != 0) { + } else { + gpio_set(GlobalConfig::GPIO_G.wifiReset, 1); + sleep(5); + gpio_set(GlobalConfig::GPIO_G.wifiReset, 0); + sleep(30); + wifi::WPAClient wpa; + wpa.ReconnectWiFi(); + system("/etc/init.d/wpa_restart"); + sleep(5); + system("udhcpc -b -i wlan0 &"); + } +#endif +#endif + } } if (HardStatus == 3600) { // one hour 3600 JsonData jd; @@ -253,6 +253,8 @@ void CheckThread() { sprintf(whereCon, " timestamp < '%ld' ", atol(localtimestamp) - 2592000); //删除1个月前的数据 #endif sqlite_db_ctrl::instance().DeleteTableData(" t_battery_history ", whereCon); + + sqlite_db_ctrl::instance().DeleteTableData(" receive_wave_status ", whereCon); } #ifdef WIFI_MODULE if (wifi_reconnect_count == 600) { // 每 10分钟,重连WiFi网络 diff --git a/uart/uart.cpp b/uart/uart.cpp index b0d1e3a..fd02f3c 100644 --- a/uart/uart.cpp +++ b/uart/uart.cpp @@ -47,8 +47,8 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) { timeoutflag++; if (timeoutflag > 100) { DealReviveDuration(wave_shortAddr); - zlog_info(zct, "===============0x9999 timeout= %d offSize = %d===============shortAddr = %02x%02x", timeoutflag, offSize,UINT16_HIGH(wave_shortAddr),UINT16_LOW(wave_shortAddr)); - zlog_info(zct, "0x9999 timeout %d===============Size = %d", timeoutflag, offSize); + zlog_warn(zct, "===============0x9999 timeout= %d offSize = %d===============shortAddr = %02x%02x", timeoutflag, offSize,UINT16_HIGH(wave_shortAddr),UINT16_LOW(wave_shortAddr)); + zlog_warn(zct, "0x9999 timeout %d===============Size = %d", timeoutflag, offSize); FindRecvPackage(offSize, mUartRecvTmpBuf, head); now_task = -1; timeoutflag = 0; @@ -58,7 +58,7 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) { mssleep(10000); wave_trans_ = true; memset(mUartRecvTmpBuf, 0, BUF_LENGTH); - zlog_info(zct, "wave end"); + zlog_warn(zct, "wave end"); } mssleep(10000); } else if (ret > 0) { @@ -325,16 +325,16 @@ void Uart::UpdateZigbeeInfo(const char *pData) { sprintf(buff, "%d", pData[63]); GlobalConfig::ZigbeeInfo_G.TranTimeout = std::string(buff); - zlog_info(zct, "local zigbee module info Mode : %d Chan : %d PanID : %s MyAddr : %s DstAddr : %s,RetryNum:%s,TranTimeout:%s", GlobalConfig::ZigbeeInfo_G.DevMode, GlobalConfig::ZigbeeInfo_G.Channel, GlobalConfig::ZigbeeInfo_G.PanID.c_str(), + zlog_info(zbt, "local zigbee module info Mode : %d Chan : %d PanID : %s MyAddr : %s DstAddr : %s,RetryNum:%s,TranTimeout:%s", GlobalConfig::ZigbeeInfo_G.DevMode, GlobalConfig::ZigbeeInfo_G.Channel, GlobalConfig::ZigbeeInfo_G.PanID.c_str(), GlobalConfig::ZigbeeInfo_G.MyAddr.c_str(), GlobalConfig::ZigbeeInfo_G.DstAddr.c_str(), GlobalConfig::ZigbeeInfo_G.RetryNum.c_str(), GlobalConfig::ZigbeeInfo_G.TranTimeout.c_str()); - zlog_info(zct, "PanID = %s,MacAddr_G= %s", GlobalConfig::ZigbeeInfo_G.PanID.c_str(), GlobalConfig::MacAddr_G.c_str()); + zlog_info(zbt, "PanID = %s,MacAddr_G= %s", GlobalConfig::ZigbeeInfo_G.PanID.c_str(), GlobalConfig::MacAddr_G.c_str()); std::string strchan = ReadStrByOpt(ZIGBEECONFIG, "Zigbee", "channel"); - zlog_info(zct, "Channel = %d,strchan = %s", GlobalConfig::ZigbeeInfo_G.Channel, strchan.c_str()); + zlog_info(zbt, "Channel = %d,strchan = %s", GlobalConfig::ZigbeeInfo_G.Channel, strchan.c_str()); std::string strType = ReadStrByOpt(SYSTEMINFOFILE, "ZigbeeType", "type"); - zlog_info(zct, "TranTimeout = %02x,strType = %s ", GlobalConfig::Zigbee_G.TranTimeout, strType.c_str()); + zlog_info(zbt, "TranTimeout = %02x,strType = %s ", GlobalConfig::Zigbee_G.TranTimeout, strType.c_str()); if (strType == "aw21") { unsigned short TranTimeout = 0x0A; WriteTranTimeout2Zigbee(TranTimeout); @@ -377,17 +377,13 @@ int Uart::DealAskTask(uint16_t ushortAdd){ } else if (taskID == kScheduleWaveForm) //2.波形 { - GetLocalZigbeeRSSI(ushortAdd); - now_task = WAVE_CMD; - scheduleTask.cmd = WAVE_CMD; - scheduleTask.shortAddr = ushortAdd; wave_shortAddr = ushortAdd; - TaskResp(scheduleTask); - mssleep(50000); + GetLocalZigbeeRSSI(ushortAdd); scheduleTask.cmd = SIGNAL_STRENGTH; scheduleTask.shortAddr = ushortAdd; scheduleTask.duration = next_duration; TaskResp(scheduleTask); + } else if (taskID == kScheduleUpgrade) //3.升级 { @@ -467,29 +463,44 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){ return 0; } int Uart::DealSensorRSSI(const char *pData,uint16_t ushortAdd){ + + //传感器获取网关信号强度 + zlog_info(zct, "DealSensorRSSI ushortAdd = %02x%02x",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); + mssleep(200000); + ScheduleTask scheduleTask; + now_task = WAVE_CMD; + scheduleTask.cmd = WAVE_CMD; + scheduleTask.shortAddr = ushortAdd; + + TaskResp(scheduleTask); + char localtimestamp[32] = {0}; GetTimeNet(localtimestamp, 1); char sensor_rssi[10] = {0x00}; sprintf(sensor_rssi, "%02d", pData[7] & 0xFF); if (!strcmp(sensor_rssi, "00") || !strcmp(sensor_rssi, "0")) { char errorInfo[100] = {0x00}; - sprintf(errorInfo, "未检测到信号!%s", sensor_rssi); + sprintf(errorInfo, "No RSSI %s", sensor_rssi); zlog_error(zct, errorInfo); } else { - char insertSql[1024] = {0}; char tableName[100] = {0x00}; char whereCon[100] = {0}; char updateSql[100] = {0}; sprintf(whereCon, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); vec_t vecDataNodeNo = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), " MeasurementID,RSSI ", whereCon); - - sprintf(insertSql, "'%s','%s-S','','','','', '','','%s','','','%02d','','' ", vecDataNodeNo[0].c_str(),vecDataNodeNo[0].c_str(),localtimestamp,atoi(sensor_rssi)); // zigbeeRSSIType = 0 传感器获取网关信号强度 - sprintf(tableName, "t_dataStatic_%s", (char *)vecDataNodeNo[0].c_str()); - sqlite_db_ctrl::instance().InsertData(tableName, insertSql); + memset(whereCon,0,sizeof(whereCon)); + sprintf(whereCon, "dataNodeNo='%s'", vecDataNodeNo[0].c_str()); + std::string timestamp_last = sqlite_db_ctrl::instance().GetData(tableName, " timeStamp ", whereCon); + sprintf(updateSql, "zigbeeSignalNode = '%02d' ",atoi(sensor_rssi)); + 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); std::vector vParamRSSI; boost::split(vParamRSSI, vecDataNodeNo[1], boost::is_any_of(","), boost::token_compress_on); + memset(updateSql,0,sizeof(updateSql)); + memset(whereCon,0,sizeof(whereCon)); if (vParamRSSI.size() > 0) { sprintf(updateSql, "RSSI = '%s,%02d' ", vParamRSSI[0].c_str(), pData[7] & 0xFF); sprintf(whereCon, "dataNodeNo='%s'", (char *)vecDataNodeNo[0].c_str()); @@ -509,7 +520,7 @@ int Uart::DealUpgrade(uint16_t ushortAdd,int status){ sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), updateSql,wherecon); memset(updateSql,0,sizeof(updateSql)); memset(wherecon,0,sizeof(wherecon)); - sprintf(wherecon," short_addr = '%02x%02x' order by start_timestamp DESC",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd)); + sprintf(wherecon," short_addr = '%02x%02x' AND start_timestamp = ( SELECT start_timestamp FROM firmware_upgrade WHERE short_addr = '%02x%02x' ORDER BY start_timestamp DESC LIMIT 1)",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd)); sprintf(updateSql, " status = %d",status); sqlite_db_ctrl::instance().UpdateTableData(" firmware_upgrade ", updateSql,wherecon); @@ -542,12 +553,14 @@ void Uart::DealRecvData(const char *pData) { case UPGRADE: if (recvcode == 0){ DealUpgrade(ushortAdd,2); + zlog_info(zbt, "[UPGRADE SUCCESS]1"); scheduler::instance().UpgradeResult(ushortAdd,0); + zlog_info(zbt, "[UPGRADE SUCCESS]2"); zlog_info(zbt, "[UPGRADE SUCCESS] shortAdd = %02x%02x,command = %d,recvcode = %d ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd),command,recvcode); }else{ DealUpgrade(ushortAdd,3); scheduler::instance().UpgradeResult(ushortAdd,recvcode); - zlog_error(zbt, "[UPGRADE FAILED] shortAdd = %02x%02x,command = %d,recvcode = %d ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd),command,recvcode); + zlog_warn(zbt, "[UPGRADE FAILED] shortAdd = %02x%02x,command = %d,recvcode = %d ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd),command,recvcode); } break; case CONFIG: @@ -555,7 +568,7 @@ void Uart::DealRecvData(const char *pData) { DealReviveDuration(ushortAdd); DealConfig(ushortAdd); }else{ - zlog_error(zbt, "[CONFIG] shortAdd = %02x%02x,command = %d,recvcode = %d ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd),command,recvcode); + zlog_warn(zbt, "[CONFIG] shortAdd = %02x%02x,command = %d,recvcode = %d ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd),command,recvcode); } break; case WAVE_COMPRESS: @@ -636,9 +649,10 @@ void Uart::DealDataNodeName(const char *pData) { } void Uart::DealDataNodeInfo(const char *pData) { - zlog_info(zct, "recv remote zigbee module info"); + int res = 0; RecvData *pRecvData = (RecvData *)pData; + zlog_warn(zct, "recv remote zigbee module info shortAddr %02x%02x", pRecvData->Data[46], pRecvData->Data[47]); char buf[32] = {0}; char chTemp = pRecvData->Data[0]; //设备状态标志 1 byte DataNodeInfo dataNodeInfo; @@ -1025,9 +1039,9 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { } else if ((unsigned int)mPackgeIndex + 1 != (unsigned int)UartRecvBuf[i + 6] && mPackgeIndex != -1 && command != 2) { m_TimeStamp = 0; - zlog_error(zct, "mPackgeIndex error index1:%d,index2:%02d ShortAddr :%s ", mPackgeIndex, UartRecvBuf[i + 6] & 0xff, strShortAddr.c_str()); + zlog_warn(zct, "mPackgeIndex error index1:%d,index2:%02d ShortAddr :%s ", mPackgeIndex, UartRecvBuf[i + 6] & 0xff, strShortAddr.c_str()); mPackgeIndex = -1; - zlog_error(zct, "mPackgeIndex error ShortAddr :%s", strShortAddr.c_str()); + zlog_warn(zct, "mPackgeIndex error ShortAddr :%s", strShortAddr.c_str()); char tmp[10] = {0x00}; char tmp2[10] = {0x00}; @@ -1035,7 +1049,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { sprintf(tmp, "%02x ", UartRecvBuf[i + j] & 0xff); strcat(tmp2, tmp); } - zlog_error(zct, "error str = %s", tmp2); + zlog_warn(zct, "error str = %s", tmp2); char insertSql[100] = {0x00}; char whereCon[50] = {0x00}; @@ -1052,8 +1066,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { if (!CheckCrc(&UartRecvBuf[i], 99)) { m_TimeStamp = 0; mPackgeIndex = -1; - zlog_info(zct, "CheckCrc error ShortAddr :%s command = %d", strShortAddr.c_str(), command); - zlog_error(zct, "CheckCrc error ShortAddr :%s", strShortAddr.c_str()); + zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d", strShortAddr.c_str(), command); char tmp[10] = {0x00}; char tmp2[10] = {0x00}; for (int j = 0; j < 100; j++) { @@ -1093,7 +1106,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { { memcpy(RecvBuf, &UartRecvBuf[i], 8); if (!CheckCrc(RecvBuf, 7)) { - zlog_info(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); + zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); break; } } @@ -1101,7 +1114,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { { memcpy(RecvBuf, &UartRecvBuf[i], 9); if (!CheckCrc(RecvBuf, 8)) { - zlog_info(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); + zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); break; } } @@ -1109,7 +1122,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { { memcpy(RecvBuf, &UartRecvBuf[i], 100); if (!CheckCrc(RecvBuf, 99)) { - zlog_info(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); + zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); break; } } @@ -1118,7 +1131,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { }else if(now_task == WAVE_CMD && command == WAVE_COMPRESS){ memcpy(RecvBuf, &UartRecvBuf[i], 23); if (!CheckCrc(RecvBuf, 22)) { - zlog_info(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); + zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d ", strShortAddr.c_str(), command); break; } char tmp[23] = {0x00}; @@ -1127,15 +1140,15 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { sprintf(tmp, "%02x ", UartRecvBuf[i + j] & 0xff); strcat(tmp2, tmp); } - zlog_info(zct, "str = %s", tmp2); + zlog_warn(zct, "str = %s", tmp2); DealRecvData(RecvBuf); } else if (command == 35) { char signalNode[10] = {0x00}; sprintf(signalNode, "%02d", UartRecvBuf[i + 14] & 0xFF); if (!strcmp(signalNode, "00") || !strcmp(signalNode, "0")) { char errorInfo[100] = {0x00}; - sprintf(errorInfo, "未检测到信号!%s", signalNode); - zlog_error(zct, errorInfo); + sprintf(errorInfo, "No RSSI %s", signalNode); + zlog_warn(zct, errorInfo); } else { char whereCon[1024] = {0}; char updateSql[1024] = {0}; @@ -1197,22 +1210,25 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { zlog_info(zct, "%02x,%02x,%02x,%02x,%02x ", UartRecvBuf[i], UartRecvBuf[i + 1], UartRecvBuf[i + 2], UartRecvBuf[i + 3], UartRecvBuf[i + 4]); zlog_info(zct, "zigbeeShortAddr = %s , ret = %02d", m_strDestShortAddr.c_str(), UartRecvBuf[i + 4] & 0xFF); - } else if (command == 218) { // DA + } else if (command == 218) { // DA 网关获取传感器信号强度 char localtimestamp[32] = {0}; GetTimeNet(localtimestamp, 1); char whereCon[1024] = {0}; char updateSql[1024] = {0}; char tableName[100] = {0x00}; - char insertSql[100] = {0x00}; bZigbeeSinal = false; sprintf(whereCon, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(wave_shortAddr),UINT16_LOW(wave_shortAddr)); - vec_t vecDataNodeNo = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), " dataNodeNo,LooseValue,RSSI ", whereCon); + vec_t vecDataNodeNo = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), " MeasurementID,LooseValue,RSSI ", whereCon); memset(whereCon, 0x00, sizeof(whereCon)); + sprintf(tableName,"t_dataStatic_%s",(char*)vecDataNodeNo[0].c_str()); + memset(whereCon,0,sizeof(whereCon)); + sprintf(whereCon, "dataNodeNo='%s'", vecDataNodeNo[0].c_str()); + std::string timestamp_last = sqlite_db_ctrl::instance().GetData(tableName, " timeStamp ", whereCon); + sprintf(updateSql, "zigbeeSignal = '%02d' ",UartRecvBuf[i+6]&0xFF); + sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str()); + + sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); - sprintf(insertSql, "'%s','%s-S','','','','', '%02d','','%s','','','','','' ", vecDataNodeNo[0].c_str(),vecDataNodeNo[0].c_str(),UartRecvBuf[i + 6] & 0xFF,localtimestamp); // zigbeeRSSIType = 0 传感器获取网关信号强度 - - sprintf(tableName, "t_dataStatic_%s", (char *)vecDataNodeNo[0].c_str()); - sqlite_db_ctrl::instance().InsertData(tableName, insertSql); // zigbeeRSSIType = 1 网关获取传感器信号强度 Json::Value jsBody, jsonVal; @@ -1226,6 +1242,8 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) { } std::vector vParamRSSI; boost::split(vParamRSSI, vecDataNodeNo[2], boost::is_any_of(","), boost::token_compress_on); + memset(updateSql,0,sizeof(updateSql)); + memset(whereCon,0,sizeof(whereCon)); if (vParamRSSI.size() == 1) { sprintf(updateSql, "RSSI = '%02d,%s' ", UartRecvBuf[i + 6] & 0xFF, vParamRSSI[0].c_str()); diff --git a/uart/uart.hpp b/uart/uart.hpp index 5fba18e..49a0458 100644 --- a/uart/uart.hpp +++ b/uart/uart.hpp @@ -210,7 +210,6 @@ public: void UpdateWirelessNode(uint16_t ushortAdd); int UpdateWirelessNodeTime(unsigned char* pDestShortAddr, int modifyaddr); int UpdateConfig(uint16_t ushortAdd); - bool ReadUpdatePackge(uint16_t ushortAdd); int TaskResp(ScheduleTask scheduleTask); int SendReviveDuration(ReviveDuration recvDuration); void openSwitch(); diff --git a/uart/uart_feature_parse.cpp b/uart/uart_feature_parse.cpp index 2de52f4..df5749e 100644 --- a/uart/uart_feature_parse.cpp +++ b/uart/uart_feature_parse.cpp @@ -62,7 +62,7 @@ void Uart::DealDataNodeFeature(const char *pData, int flag) { vec_t vecResult = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), " softVersion,dataNodeNo,MeasurementID,ProductNo ", getLongAddr_sql); if (vecResult.size() < 1) { - zlog_error(zct, "device info not found %02x%02x ", pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]); + zlog_warn(zct, "device info not found %02x%02x ", pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]); return; } zlog_info(zct, "--------->the remote sensor short addr:%s strLongAddr=%s,softVersion = %s", buf, vecResult[1].c_str(), vecResult[0].c_str()); @@ -693,7 +693,7 @@ std::vector Uart::DealData(int iChannel, float coe, unsigned int sampleRa int r = lzo1x_decompress(data, count, outdata, &new_len, NULL); zlog_info(zct, "lzo1x_decompress end"); if (r == LZO_E_OK) { - zlog_info(zct, "iChannel = %d ,ShortAddr = %s decompressed %lu bytes back into %lu bytes", iChannel, strShortAddr.c_str(), (unsigned long)j * 92, (unsigned long)new_len); + zlog_warn(zct, "iChannel = %d ,ShortAddr = %s decompressed %lu bytes back into %lu bytes", iChannel, strShortAddr.c_str(), (unsigned long)j * 92, (unsigned long)new_len); } else { zlog_error(zct, "internal error - decompression failed: %d,channel = %d,ShortAddr = %s", r, iChannel, strShortAddr.c_str()); return vecData; @@ -954,12 +954,12 @@ void Uart::WriteDatFile(int sampleRate, std::string &strMeasurementID, int iChan char tmpWhere[128] = {0x00}; sprintf(tmpWhere, "channelID = '%s' and sendMsg = 0 ", strChannelID.c_str()); int count = sqlite_db_ctrl::instance().GetTableRows("t_data_waveSend", tmpWhere); - zlog_error(zct, "save channlID %s dat count = %d", strChannelID.c_str(), count); + zlog_info(zct, "save channlID %s dat count = %d", strChannelID.c_str(), count); + zlog_warn(zct, "send failed,filename %s,iRet = %d", strFileName.c_str(), iRet); if (count <= 12) { sprintf(whereCon, "channelID='%s' and timeStamp = '%s' ", strChannelID.c_str(), nowTimetamp.c_str()); sprintf(updateSql, "SendMsg = 0 , error_code = %d",iRet); - sqlite_db_ctrl::instance().UpdateTableData("t_data_waveSend", updateSql, whereCon); - zlog_error(zct, "send failed,filename %s,iRet = %d", strFileName.c_str(), iRet); + sqlite_db_ctrl::instance().UpdateTableData("t_data_waveSend", updateSql, whereCon); std::string strFileName_failed = strFileName + "_" + nowTimetamp; char tmpCmd[128] = {0x00}; sprintf(tmpCmd, "cp %s %s", strFileName.c_str(), strFileName_failed.c_str()); @@ -995,7 +995,7 @@ void Uart::WriteDatFile(int sampleRate, std::string &strMeasurementID, int iChan zlog_info(zct, "rm dat file %s \n", tmpCmd); } } else { - zlog_info(zct, "send data , filename %s,size = %d\n", strFileName.c_str(), vecData.size()); + zlog_warn(zct, "send data , filename %s,size = %d\n", strFileName.c_str(), vecData.size()); } #ifdef G2UL_GATEWAY //存储6条波形数据 diff --git a/uart/uart_parameter_config.cpp b/uart/uart_parameter_config.cpp index 1f0b081..0d3606f 100644 --- a/uart/uart_parameter_config.cpp +++ b/uart/uart_parameter_config.cpp @@ -21,10 +21,10 @@ unsigned char fw_senddata[50000]={0}; * of 'lzo_align_t' (instead of 'char') to make sure it is properly aligned. */ -#define HEAP_ALLOC(var,size) \ +/*#define HEAP_ALLOC(var,size) \ lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] -static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); +static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS);*/ void Uart::openSwitch() { char buffer[100] = {0x00}; @@ -43,126 +43,6 @@ void Uart::openSwitch() { close(fdSwitch); } -bool Uart::ReadUpdatePackge(unsigned short shortAdd) { - // compare hardversion in update list - // std::vector strHWversion; - std::string strFileName = "", strSoftVersion = ""; - // std::vector vecDataNodeUpdate; - // vecDataNodeUpdate = ReadStrUpdate("/opt/DataNode/config.json"); - // char gethardVersion_sql[32] = {0}; - // char selectsql[1024] = {0}; - // sprintf(gethardVersion_sql, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); - // sprintf(selectsql, "%s,%s", T_SENSOR_INFO(HARDVERSION), T_SENSOR_INFO(SOFTVERSION)); - // vec_t vecResult = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), selectsql, gethardVersion_sql); - // if (vecResult.size() < 1) { - // return false; - // } - // zlog_info(zct, "hardversion %s,softversion %s", vecResult[0].c_str(), vecResult[1].c_str()); - // int thisindex = -1; - // int flag = -1; - // for (size_t j = 0; j < vecDataNodeUpdate.size(); j++) { - // for (size_t i = 0; i < vecDataNodeUpdate[j].hwVersion.size(); i++) { - // if (vecResult[0] == vecDataNodeUpdate[j].hwVersion[i]) { - // if (vecResult[1] == vecDataNodeUpdate[j].strSoftVersion) { - // flag = 0; - // break; - // } else { - // thisindex = i; - // strFileName = vecDataNodeUpdate[j].strUpdataFileName; - // break; - // } - // } - // } - // if (thisindex >= 0 || flag == 0) break; - // } - - // if (thisindex < 0) return false; - - // zlog_info(zct, "thisindex = %d", thisindex); - - FILE* pFile = NULL; - unsigned char* buffer = NULL; - long unsigned int thisSize = 0; - DataNodeUpdateFile = "/opt/DataNode/Time_Trigger_CubeMX.bin.new"; - zlog_info(zct, "strFileName = %s", DataNodeUpdateFile.c_str()); - pFile = fopen(DataNodeUpdateFile.c_str(), "rb"); - if (pFile == NULL) { - return false; - } else { - while (fgetc(pFile) != EOF) { - ++thisSize; - } - rewind(pFile); - buffer = (unsigned char*)malloc(thisSize); - fread(buffer, sizeof(char), thisSize, pFile); - fclose(pFile); - } - unsigned char outdata[50000]={0}; - long unsigned int out_len = 0; - int compress = 0; - zlog_info(zct, "thisSize = %d", (int)thisSize); - int r = lzo1x_1_compress(buffer, thisSize, outdata, &out_len, wrkmem); - if (r == LZO_E_OK){ - zlog_warn(zct,"compressed %lu bytes into %lu bytes", - (unsigned long) thisSize, (unsigned long) out_len); - if (out_len < thisSize){ - compress = 1; - } - } - else - { - /* this should NEVER happen */ - zlog_error(zct,"internal error - compression failed: %d", r); - return 2; - } - /* check for an incompressible block */ - if (out_len >= thisSize) - { - zlog_error(zct,"This block contains incompressible data."); - return 0; - } - - unsigned char Data[100] = {0x00}; - unsigned char size[4] = {0x00}; - zlog_info(zct, "thisSize = %d", (int)thisSize); - //帧头[3byte] 节点地址[2byte] 数据类型[1byte] 序号[1byte] 升级包大小[4byte] CRC校验[1byte] - Data[0] = 0xAA; - Data[1] = 0x55; - Data[2] = 0xAA; - Data[3] = UINT16_HIGH(shortAdd); - Data[4] = UINT16_LOW(shortAdd); - Data[5] = 0x12; - Data[6] = 0x00; - if (compress == 1){ - int2bytes(out_len, size, 4); - }else{ - int2bytes(thisSize, size, 4); - } - Data[13] = size[3]; - Data[14] = size[2]; - Data[15] = size[1]; - Data[16] = size[0]; - Data[17] = compress & 0xFF; - - unsigned char tmp = 0x00; - for (int i = 0; i < 100; i++) { - tmp += Data[i]; - } - Data[99] = tmp; - sleep(1); - WriteToUart((const char*)Data, 100); - int iRet = CheckZigbeeACK(); - if (iRet == 0) { - zlog_info(zct, "Packge ACK send success,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); - } else { - zlog_error(zct, "Packge ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); - } - std::string strTime = GetLocalTimeWithMs(); - zlog_info(zct, "ReadUpdatePackge strTime = %s", strTime.c_str()); - free(buffer); - return true; -} - void Uart::UpdateWirelessNode(uint16_t shortAdd) { int upgrade_status = 2; @@ -190,7 +70,7 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) { } std::string strTime = GetLocalTimeWithMs(); - zlog_info(zct, "UpdateWirelessNode start = %s UpdateWirelessNode id = %02x %02x", strTime.c_str(), UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); + zlog_warn(zbt, "UpdateWirelessNode start = %s UpdateWirelessNode id = %02x %02x", strTime.c_str(), UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); bUpdate = true; FILE* pFile = NULL; long unsigned int thisSize = 0; @@ -293,14 +173,14 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) { if (iRet == 0) { zlog_info(zct, "Packge ACK send success,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); } else { - zlog_error(zct, "Packge ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); + zlog_warn(zct, "Packge ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); } mssleep(10000); int Count = thisSize / 92; int lastSize = thisSize % 92; unsigned char UpdateData[100] = {0x00}; //帧头[3byte] 节点地址[2byte] 数据类型[1byte] 序号[1byte] 数据包[92byte] CRC校验[1byte] - zlog_info(zbt, "Start Update!!! file Size = %d,fileName = %s,Count = %d,lastSize = %d,shortAddr = %02x%02x", (int)thisSize,DataNodeUpdateFile.c_str(),Count,lastSize,UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); + zlog_warn(zbt, "Start Update!!! file Size = %d,fileName = %s,Count = %d,lastSize = %d,shortAddr = %02x%02x", (int)thisSize,DataNodeUpdateFile.c_str(),Count,lastSize,UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); tmp = 0x00; gpio_set(GlobalConfig::GPIO_G.zigAckreset, 0); mssleep(1000); @@ -332,8 +212,8 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) { time += 1; }while(time < 150); if(time >= 150){ - zlog_error(zct, "gpio_read failed shortAdd %02x %02x,index = %d", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd),j); - zlog_error(zct, "gpio_read failed \n"); + zlog_warn(zct, "gpio_read failed shortAdd %02x %02x,index = %d", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd),j); + zlog_warn(zct, "gpio_read failed \n"); bUpdate = false; upgrade_status = 3; goto endUpdate; @@ -376,8 +256,8 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) { time += 1; }while(time < 150); if (time >= 150) { - zlog_error(zct, "gpio_read failed shortAdd %02x %02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); - zlog_error(zct, "gpio_read failed \n"); + zlog_warn(zct, "gpio_read failed shortAdd %02x %02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); + zlog_warn(zct, "gpio_read failed \n"); bUpdate = false; upgrade_status = 3; goto endUpdate; @@ -386,7 +266,7 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) { } zlog_warn(zct, "Update END!!! file Size = %d", (int)thisSize); } else { - zlog_error(zct, "open file failed "); + zlog_warn(zct, "open file failed "); } endUpdate: char localtimestamp_end[32] = {0}; @@ -403,7 +283,7 @@ endUpdate: bUpdate = false; bSendTimeStamp = false; DataNodeUpdateFile = ""; - zlog_info(zbt, "UpdateWirelessNode end,shortAddr = %02x%02x",UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); + zlog_warn(zbt, "UpdateWirelessNode end,shortAddr = %02x%02x",UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); } int Uart::UpdateConfig(uint16_t ushortAdd) { @@ -414,7 +294,7 @@ int Uart::UpdateConfig(uint16_t ushortAdd) { vec_t vecResultNode = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), "*", whereCon); if (vecResultNode.size() <= 0) return -1; - zlog_info(zct, "UpdateConfig"); + zlog_warn(zct, "UpdateConfig ushortAdd = %02x%02x",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = ENTER_TRANSMITTING_STATUS; GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0; @@ -579,7 +459,7 @@ int Uart::UpdateConfig(uint16_t ushortAdd) { if (iRet == 0) { zlog_info(zct, "updataconfig ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); } else { - zlog_error(zct, "updataconfig ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); + zlog_warn(zct, "updataconfig ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); } mssleep(50000); @@ -618,7 +498,7 @@ int Uart::UpdateConfig(uint16_t ushortAdd) { if (iRet == 0) { zlog_info(zct, "updataname ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); } else { - zlog_error(zct, "updataname ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); + zlog_warn(zct, "updataname ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); } return 0; } @@ -662,7 +542,7 @@ int Uart::UpdateWirelessNodeTime(unsigned char* pDestShortAddr, int modifyaddr / if (iRet == 0) { zlog_info(zct, "NodeTime ACK send success,shortAddr = %02x%02x", pDestShortAddr[0], pDestShortAddr[1]); } else { - zlog_error(zct, "NodeTime ACK send failed,shortAddr = %02x%02x", pDestShortAddr[0], pDestShortAddr[1]); + zlog_warn(zct, "NodeTime ACK send failed,shortAddr = %02x%02x", pDestShortAddr[0], pDestShortAddr[1]); } return iRet; } @@ -699,7 +579,7 @@ int Uart::TaskResp(ScheduleTask scheduleTask){ if (iRet == 0) { zlog_info(zct, "TaskResp ACK send success,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); } else { - zlog_error(zct, "TaskResp ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); + zlog_warn(zct, "TaskResp ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); } return iRet; } @@ -726,7 +606,7 @@ int Uart::SendReviveDuration(ReviveDuration recvDuration){ if (iRet == 0) { zlog_info(zct, "SendReviveDuration ACK send success,shortAddr = %d", recvDuration.shortAddr); } else { - zlog_error(zct, "SendReviveDuration ACK send failed,shortAddr = %d", recvDuration.shortAddr); + zlog_warn(zct, "SendReviveDuration ACK send failed,shortAddr = %d", recvDuration.shortAddr); } return iRet; }