modify bugs
This commit is contained in:
parent
2354a60390
commit
44d96b6db3
@ -516,7 +516,7 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
|
|||||||
std::string productNo = res[17];
|
std::string productNo = res[17];
|
||||||
compressWaveChannel tempchannel;
|
compressWaveChannel tempchannel;
|
||||||
if ((compareVersions(softVersion, "2.6") == -1 && productNo == "02") || productNo == "01"){ // DN101所有版本和DN102 2.6以前版本
|
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){
|
if(schedule_status == kScheduleStatusDebug || schedule_status == kScheduleStatusUpgrade){
|
||||||
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
|
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
|
||||||
scheduler::instance().WaveSuccess(ushortAdd,true);
|
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.CountY = BUILD_UINT32(pData[17], pData[16],pData[15],pData[14]);
|
||||||
tempchannel.CountZ = BUILD_UINT32(pData[21], pData[20],pData[19],pData[18]);
|
tempchannel.CountZ = BUILD_UINT32(pData[21], pData[20],pData[19],pData[18]);
|
||||||
sprintf(sensor_rssi, "%02d", pData[22] & 0xFF);
|
sprintf(sensor_rssi, "%02d", pData[22] & 0xFF);
|
||||||
}else{
|
}else
|
||||||
int ret = 0;//= WaveSendCondition(shortAdd);
|
{
|
||||||
|
int ret = WaveSendCondition(shortAdd);
|
||||||
if(ret == 1){
|
if(ret == 1){
|
||||||
zlog_warn(zct, "WaveSendCondition not meet condition ,shortAddr = %s",shortAdd);
|
zlog_warn(zct, "WaveSendCondition not meet condition ,shortAddr = %s",shortAdd);
|
||||||
scheduler::instance().WaveSuccess(ushortAdd,true);
|
scheduler::instance().WaveSuccess(ushortAdd,true);
|
||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
ScheduleStatus schedule_status = scheduler::instance().GetScheduleStatus();
|
schedule_status = scheduler::instance().GetScheduleStatus();
|
||||||
if(schedule_status == kScheduleStatusUpgrade){
|
if(schedule_status == kScheduleStatusUpgrade){
|
||||||
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
|
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
|
||||||
scheduler::instance().WaveSuccess(ushortAdd,true);
|
scheduler::instance().WaveSuccess(ushortAdd,true);
|
||||||
@ -633,6 +634,15 @@ int Uart::DealSensorRSSI(const char *pData,uint16_t ushortAdd){
|
|||||||
memset(whereCon,0,sizeof(whereCon));
|
memset(whereCon,0,sizeof(whereCon));
|
||||||
sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str());
|
sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str());
|
||||||
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
|
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;
|
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());
|
sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str());
|
||||||
|
|
||||||
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
|
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 网关获取传感器信号强度
|
// zigbeeRSSIType = 1 网关获取传感器信号强度
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "common/global.hpp"
|
#include "common/global.hpp"
|
||||||
#include "dbaccess/sql_db.hpp"
|
#include "dbaccess/sql_db.hpp"
|
||||||
#include "utility/calculation.hpp"
|
#include "utility/calculation.hpp"
|
||||||
|
#include "scheduler/status_mgr.hpp"
|
||||||
|
|
||||||
typedef void (*pTestRecvCallBack)(int Status);
|
typedef void (*pTestRecvCallBack)(int Status);
|
||||||
|
|
||||||
@ -285,6 +286,8 @@ private:
|
|||||||
long last_time;
|
long last_time;
|
||||||
bool current_z;
|
bool current_z;
|
||||||
std::map<uint16_t, std::vector<uint8_t>> map_send_data;
|
std::map<uint16_t, std::vector<uint8_t>> map_send_data;
|
||||||
|
|
||||||
|
ScheduleStatus schedule_status;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::container::dtl::singleton_default<Uart> uart_inst;
|
typedef boost::container::dtl::singleton_default<Uart> uart_inst;
|
||||||
|
|||||||
@ -63,7 +63,7 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s
|
|||||||
if (res_static.size() > 0){
|
if (res_static.size() > 0){
|
||||||
int zigbeeSignal = atoi(res_static[6].c_str());
|
int zigbeeSignal = atoi(res_static[6].c_str());
|
||||||
int zigbeeSignalNode = atoi(res_static[11].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;
|
float actualRate = 0.0f;
|
||||||
if (dataStatic.nodeSendTime > 0){
|
if (dataStatic.nodeSendTime > 0){
|
||||||
actualRate = (wave_dataLen / 1024.0f) / (dataStatic.nodeSendTime / 1000.0f); //单位:KB/s
|
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
|
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};
|
char updateSql[256] = {0};
|
||||||
memset(whereCon, 0x00, sizeof(whereCon));
|
memset(whereCon, 0x00, sizeof(whereCon));
|
||||||
@ -271,6 +272,9 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
|||||||
iTemp = (int)strtol(buf, NULL, 16);
|
iTemp = (int)strtol(buf, NULL, 16);
|
||||||
dataStatic.instantaneousBatteryVoltage = iTemp;
|
dataStatic.instantaneousBatteryVoltage = iTemp;
|
||||||
|
|
||||||
|
if(schedule_status == kScheduleStatusDebug){
|
||||||
|
|
||||||
|
}
|
||||||
char szTableName[50] = {0x00}, szTableNameStatic[50] = {0x00}, szTableNameData[50] = {0x00};
|
char szTableName[50] = {0x00}, szTableNameStatic[50] = {0x00}, szTableNameData[50] = {0x00};
|
||||||
sprintf(szTableName, "t_dataStatic_%s", strMeasurementID.c_str());
|
sprintf(szTableName, "t_dataStatic_%s", strMeasurementID.c_str());
|
||||||
memcpy(szTableNameStatic, szTableName, sizeof(szTableNameStatic));
|
memcpy(szTableNameStatic, szTableName, sizeof(szTableNameStatic));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user