修改字段类型

This commit is contained in:
DESKTOP-LBGFPFF\CHAOS-PC 2021-11-13 15:38:32 +08:00
parent 79c3f9dff2
commit 5f24f2b7c3
3 changed files with 25 additions and 26 deletions

View File

@ -144,9 +144,9 @@ struct DataNodeInfo {
std::string BpNo; std::string BpNo;
std::string SerialNo; std::string SerialNo;
std::string FirstPowerTime; std::string FirstPowerTime;
std::string WakeupTime; int WakeupTime;
std::string StaticTime; int StaticTime;
std::string WaveTime; int WaveTime;
int BateryV; int BateryV;
std::string ProductNo; std::string ProductNo;
int RSSI; // 接收信号强度 int RSSI; // 接收信号强度

View File

@ -192,9 +192,9 @@ std::string JsonData::JsonCmd_26(Param_26 &param)
jsSensorData["bpNo"] = arrRes[j][10]; jsSensorData["bpNo"] = arrRes[j][10];
jsSensorData["serialNo"] = arrRes[j][11]; jsSensorData["serialNo"] = arrRes[j][11];
jsSensorData["firstPowerTime"] = arrRes[j][12]; jsSensorData["firstPowerTime"] = arrRes[j][12];
jsSensorData["WakeupTime"] = arrRes[j][13]; jsSensorData["WakeupTime"] = boost::lexical_cast<int>(arrRes[j][13]);
jsSensorData["StaticTime"] = arrRes[j][14]; jsSensorData["StaticTime"] = boost::lexical_cast<int>(arrRes[j][14]);
jsSensorData["WaveTime"] = arrRes[j][15]; jsSensorData["WaveTime"] = boost::lexical_cast<int>(arrRes[j][15]);
jsSensorData["BateryV"] = arrRes[j][16]; jsSensorData["BateryV"] = arrRes[j][16];
jsSensorData["ProductNo"] = arrRes[j][17]; jsSensorData["ProductNo"] = arrRes[j][17];
jsSensorData["configFlag"] = boost::lexical_cast<int>(arrRes[j][18]); jsSensorData["configFlag"] = boost::lexical_cast<int>(arrRes[j][18]);
@ -213,14 +213,14 @@ std::string JsonData::JsonCmd_26(Param_26 &param)
jsSensorData["zigbeeAddr"] = arrRes[j][30]; jsSensorData["zigbeeAddr"] = arrRes[j][30];
jsSensorData["zigbeeLongAddr"] = arrRes[j][31]; jsSensorData["zigbeeLongAddr"] = arrRes[j][31];
jsSensorData["zigbeeDesAddr"] = arrRes[j][32]; jsSensorData["zigbeeDesAddr"] = arrRes[j][32];
jsSensorData["ZigbeePower"] = arrRes[j][33]; jsSensorData["ZigbeePower"] = boost::lexical_cast<int>(arrRes[j][33]);
jsSensorData["ZigbeeRetry"] = arrRes[j][34]; jsSensorData["ZigbeeRetry"] = boost::lexical_cast<int>(arrRes[j][34]);
jsSensorData["ZigbeeRetryGap"] = arrRes[j][35]; jsSensorData["ZigbeeRetryGap"] = boost::lexical_cast<int>(arrRes[j][35]);
jsSensorData["ACCSampleTime"] = arrRes[j][36]; jsSensorData["ACCSampleTime"] = boost::lexical_cast<int>(arrRes[j][36]);
jsSensorData["status"] = boost::lexical_cast<int>(arrRes[j][37]); jsSensorData["status"] = boost::lexical_cast<int>(arrRes[j][37]);
jsSensorData["timeStamp"] = arrRes[j][38]; jsSensorData["timeStamp"] = arrRes[j][38];
jsSensorData["viff"] = arrRes[j][39]; jsSensorData["viff"] = boost::lexical_cast<int>(arrRes[j][39]);
jsSensorData["RSSI"] = arrRes[j][40]; jsSensorData["RSSI"] = boost::lexical_cast<int>(arrRes[j][40]);
jsArray.append(jsSensorData); jsArray.append(jsSensorData);
} }
} else { } else {

View File

@ -459,19 +459,19 @@ void Uart::DealDataNodeInfo(const char *pData)
memset(buf, 0, 32); memset(buf, 0, 32);
sprintf(buf, "%d", BUILD_UINT32(pRecvData->Data[23], pRecvData->Data[24], pRecvData->Data[25], pRecvData->Data[26])); sprintf(buf, "%d", BUILD_UINT32(pRecvData->Data[23], pRecvData->Data[24], pRecvData->Data[25], pRecvData->Data[26]));
dataNodeInfo.WakeupTime = std::string(buf);//唤醒次数 4 byte dataNodeInfo.WakeupTime = boost::lexical_cast<int>(buf);//唤醒次数 4 byte
printf("WakeupTime = %d\n",dataNodeInfo.WakeupTime);
memset(buf, 0, 32); memset(buf, 0, 32);
sprintf(buf, "%d", BUILD_UINT32(pRecvData->Data[27], pRecvData->Data[28], pRecvData->Data[29], pRecvData->Data[30])); sprintf(buf, "%d", BUILD_UINT32(pRecvData->Data[27], pRecvData->Data[28], pRecvData->Data[29], pRecvData->Data[30]));
dataNodeInfo.StaticTime = std::string(buf);//特征值发送次数 4 byte dataNodeInfo.StaticTime = boost::lexical_cast<int>(buf);//特征值发送次数 4 byte
printf("StaticTime = %d\n",dataNodeInfo.StaticTime);
memset(buf, 0, 32); memset(buf, 0, 32);
sprintf(buf, "%d", BUILD_UINT32(pRecvData->Data[31], pRecvData->Data[32], pRecvData->Data[33], pRecvData->Data[34])); // sprintf(buf, "%d", BUILD_UINT32(pRecvData->Data[31], pRecvData->Data[32], pRecvData->Data[33], pRecvData->Data[34]));
dataNodeInfo.WaveTime = std::string(buf);//原始波形发送次数 4 byte
dataNodeInfo.WaveTime = BUILD_UINT32(pRecvData->Data[31], pRecvData->Data[32], pRecvData->Data[33], pRecvData->Data[34]);//原始波形发送次数 4 byte
printf("dataNodeInfo.WaveTime = %d\n",dataNodeInfo.WaveTime);
memset(buf, 0, 32); memset(buf, 0, 32);
sprintf(buf, "%02x%02x", pRecvData->Data[35], pRecvData->Data[36]); // sprintf(buf, "%02x%02x", pRecvData->Data[35], pRecvData->Data[36]);
dataNodeInfo.BateryV = BUILD_UINT16(pRecvData->Data[35],pRecvData->Data[36]);//电池电压 2 byte dataNodeInfo.BateryV = BUILD_UINT16(pRecvData->Data[35],pRecvData->Data[36]);//电池电压 2 byte
memset(buf, 0, 32); memset(buf, 0, 32);
@ -522,7 +522,7 @@ void Uart::DealDataNodeInfo(const char *pData)
dataNodeInfo.ZigbeePower = boost::lexical_cast<unsigned int>(buf); dataNodeInfo.ZigbeePower = boost::lexical_cast<unsigned int>(buf);
memset(buf, 0, 32); memset(buf, 0, 32);
sprintf(buf, "%02x", pRecvData->Data[51]);//Zigbee 重试次数 1 byte sprintf(buf, "%d", BUILD_UINT16(00,pRecvData->Data[51]));//Zigbee 重试次数 1 byte
dataNodeInfo.ZigbeeRetry = boost::lexical_cast<unsigned int>(buf); dataNodeInfo.ZigbeeRetry = boost::lexical_cast<unsigned int>(buf);
memset(buf, 0, 32); memset(buf, 0, 32);
@ -601,17 +601,16 @@ void Uart::DealDataNodeInfo(const char *pData)
if (sql_ctl->GetTableRows(T_SENSOR_INFO(TNAME), whereCon) > 0) { if (sql_ctl->GetTableRows(T_SENSOR_INFO(TNAME), whereCon) > 0) {
sql_ctl->DeleteTableData(T_SENSOR_INFO(TNAME), whereCon); sql_ctl->DeleteTableData(T_SENSOR_INFO(TNAME), whereCon);
} }
printf("11111111111\n");
char insertSql[1024] = { 0 }; char insertSql[1024] = { 0 };
sprintf(insertSql, "'%s','%s','%d','%d','%d','%d','%d','%d',\ sprintf(insertSql, "'%s','%s','%d','%d','%d','%d','%d','%d',\
'%s','%s','%s','%s','%s','%s',\ '%s','%s','%s','%s','%s','%d',\
'%s','%d','%d','%s','%d','%s',\ '%d','%d','%d','%s','%d','%s',\
'%s','%u','%d','%d','%s','%d','%s','%s',\ '%s','%u','%d','%d','%s','%d','%s','%s',\
'%s','%d','%s','%s','%s',\ '%s','%d','%s','%s','%s',\
'%d','%d','%d','%d','%s','%s','%d','%d'", '%d','%d','%d','%d','%s','%s','%d','%d'",
dataNodeInfo.ZigbeeLongAddr.c_str(), " ", dataNodeInfo.InitFlag, dataNodeInfo.AccFlag, dataNodeInfo.ZigbeeFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.TemBotFlag,dataNodeInfo.EquipSta,\ dataNodeInfo.ZigbeeLongAddr.c_str(), " ", dataNodeInfo.InitFlag, dataNodeInfo.AccFlag, dataNodeInfo.ZigbeeFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.TemBotFlag,dataNodeInfo.EquipSta,\
dataNodeInfo.HardVersion.c_str(), dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.BpNo.c_str(), dataNodeInfo.SerialNo.c_str(), dataNodeInfo.FirstPowerTime.c_str(), dataNodeInfo.WakeupTime.c_str(),\ dataNodeInfo.HardVersion.c_str(), dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.BpNo.c_str(), dataNodeInfo.SerialNo.c_str(), dataNodeInfo.FirstPowerTime.c_str(), dataNodeInfo.WakeupTime,\
dataNodeInfo.StaticTime.c_str(),dataNodeInfo.WaveTime.c_str(),dataNodeInfo.BateryV,dataNodeInfo.ProductNo.c_str(),dataNodeInfo.ConfigFlag, dataNodeInfo.StartBrands.c_str(), \ dataNodeInfo.StaticTime,dataNodeInfo.WaveTime,dataNodeInfo.BateryV,dataNodeInfo.ProductNo.c_str(),dataNodeInfo.ConfigFlag, dataNodeInfo.StartBrands.c_str(), \
dataNodeInfo.StopBrands.c_str(), dataNodeInfo.FeatureInterVal, dataNodeInfo.WaveInterVal, dataNodeInfo.SamplingRate,"",dataNodeInfo.Range, dataNodeInfo.EnvelopeBandPass.c_str(), dataNodeInfo.FaultFrequency.c_str(),\ dataNodeInfo.StopBrands.c_str(), dataNodeInfo.FeatureInterVal, dataNodeInfo.WaveInterVal, dataNodeInfo.SamplingRate,"",dataNodeInfo.Range, dataNodeInfo.EnvelopeBandPass.c_str(), dataNodeInfo.FaultFrequency.c_str(),\
dataNodeInfo.ZigbeePanId.c_str(), dataNodeInfo.ZigbeeChannel, dataNodeInfo.ZigbeeShortAddr.c_str(), dataNodeInfo.ZigbeeLongAddr.c_str(), dataNodeInfo.ZigbeeDesAddr.c_str(), \ dataNodeInfo.ZigbeePanId.c_str(), dataNodeInfo.ZigbeeChannel, dataNodeInfo.ZigbeeShortAddr.c_str(), dataNodeInfo.ZigbeeLongAddr.c_str(), dataNodeInfo.ZigbeeDesAddr.c_str(), \
dataNodeInfo.ZigbeePower,dataNodeInfo.ZigbeeRetry,dataNodeInfo.ZigbeeRetryGap,dataNodeInfo.ACCSampleTime,"1", dataNodeInfo.ConfigDate.c_str(),dataNodeInfo.VIntegralFilterFrequency,dataNodeInfo.RSSI); dataNodeInfo.ZigbeePower,dataNodeInfo.ZigbeeRetry,dataNodeInfo.ZigbeeRetryGap,dataNodeInfo.ACCSampleTime,"1", dataNodeInfo.ConfigDate.c_str(),dataNodeInfo.VIntegralFilterFrequency,dataNodeInfo.RSSI);