fix bugs
This commit is contained in:
parent
011221569e
commit
5342a1cae3
@ -1098,36 +1098,15 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
std::string MeasurementID = "";
|
||||
char szTableName[100] = {0x00}, whereCon[256] = {0x00};
|
||||
if (nSize > 0) {
|
||||
int packgeNo = param.mPackageFlag;
|
||||
int packgeMax = 0;
|
||||
int packgeNum = 0;
|
||||
jsonVal["package"] = packgeNo;
|
||||
int lastSize = nSize % 5;
|
||||
int index = nSize / 5;
|
||||
if (lastSize > 0 && index > 0) {
|
||||
packgeMax = index + 1;
|
||||
if (packgeNo + 1 == packgeMax) {
|
||||
packgeNum = nSize;
|
||||
jsonVal["packageMax"] = index + 1;
|
||||
} else {
|
||||
packgeNum = (packgeNo + 1)*5;
|
||||
jsonVal["packageMax"] = index + 1;
|
||||
}
|
||||
} else if (lastSize == 0 && index > 0) {
|
||||
packgeNum = (packgeNo + 1) * 5;
|
||||
packgeMax = index;
|
||||
jsonVal["packageMax"] = index;
|
||||
} else if (lastSize > 0 && index == 0) {
|
||||
packgeNum = 0;
|
||||
packgeMax = index + 1;
|
||||
jsonVal["packageMax"] = index;
|
||||
}
|
||||
|
||||
int interval = atol(param.timeEnd.c_str()) - atol(param.timeStart.c_str());
|
||||
int featureInterVal = 0,waveInterVal = 0,featureInterTime = 0,waveInterTime = 0,maxSensorNum = 0;
|
||||
scheduler::instance().GetScheduleConfig(featureInterVal,waveInterVal,featureInterTime,waveInterTime,maxSensorNum);
|
||||
Json::Value jsBody;
|
||||
zlog_info(zct, "packgeNo = %d,packgeMax = %d,packgeNum = %d", packgeNo, packgeMax, packgeNum);
|
||||
char count_sql[1024] = {0};
|
||||
int recive_feature = 0, send_feature = 0;
|
||||
int recive_x = 0, recive_y = 0, recive_z = 0;
|
||||
int send_x = 0, send_y = 0, send_z = 0;
|
||||
for (size_t i = 0; i < nSize; i++)
|
||||
{
|
||||
Json::Value iTem;
|
||||
@ -1138,8 +1117,7 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
|
||||
sprintf(szTableName,"t_data_%s",vetRes[i][1].c_str());
|
||||
sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' ", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
//int recive_feature = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
int recive_feature = 0, send_feature = 0;
|
||||
|
||||
memset(count_sql,0,sizeof(count_sql));
|
||||
snprintf(count_sql,sizeof(count_sql),
|
||||
"SELECT "
|
||||
@ -1155,25 +1133,7 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
send_feature = atoi(vecResult1[1].c_str());
|
||||
}
|
||||
iTem.append(MeasurementID);
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName,"receive_wave_status");
|
||||
// sprintf(whereCon, " data_nodeno = '%s-X' and timeStamp < '%s' and timeStamp > '%s' ", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
|
||||
// int recive_x = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName,"receive_wave_status");
|
||||
// sprintf(whereCon, " data_nodeno = '%s-Y' and timeStamp < '%s' and timeStamp > '%s' ", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
|
||||
// int recive_y = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName,"receive_wave_status");
|
||||
// sprintf(whereCon, " data_nodeno = '%s-Z' and timeStamp < '%s' and timeStamp > '%s' ", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
|
||||
// int recive_z = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
int recive_x = 0, recive_y = 0, recive_z = 0;
|
||||
memset(count_sql,0,sizeof(count_sql));
|
||||
snprintf(count_sql,sizeof(count_sql),
|
||||
"SELECT "
|
||||
@ -1189,7 +1149,6 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
recive_x = atoi(vecResult2[0].c_str());
|
||||
recive_y = atoi(vecResult2[1].c_str());
|
||||
recive_z = atoi(vecResult2[2].c_str());
|
||||
}
|
||||
iTem.append((float(recive_feature)/(interval/featureInterVal)));
|
||||
iTem.append(recive_feature);
|
||||
iTem.append((float( recive_x)/(interval/waveInterVal)));
|
||||
@ -1198,31 +1157,8 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
iTem.append(recive_y);
|
||||
iTem.append((float(recive_z)/(interval/waveInterVal)));
|
||||
iTem.append(recive_z);
|
||||
}
|
||||
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName,"t_data_%s",vetRes[i][1].c_str());
|
||||
// sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' and sendMsg = 1", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
// int send_feature = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName," t_data_waveSend ");
|
||||
// sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' and sendMsg = 1", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
// int send_x = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName," t_data_waveSend ");
|
||||
// sprintf(whereCon, " channelID = '%s-Y' and timeStamp < '%s' and timeStamp > '%s' and sendMsg = 1", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
// int send_y = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
|
||||
// memset(szTableName,0,sizeof(szTableName));
|
||||
// memset(whereCon,0,sizeof(whereCon));
|
||||
// sprintf(szTableName," t_data_waveSend ");
|
||||
// sprintf(whereCon, " channelID = '%s-Z' and timeStamp < '%s' and timeStamp > '%s' and sendMsg = 1", MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
// int send_z = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
int send_x = 0, send_y = 0, send_z = 0;
|
||||
memset(count_sql,0,sizeof(count_sql));
|
||||
snprintf(count_sql,sizeof(count_sql),
|
||||
"SELECT "
|
||||
@ -1238,8 +1174,6 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
send_x = atoi(vecResult3[0].c_str());
|
||||
send_y = atoi(vecResult3[1].c_str());
|
||||
send_z = atoi(vecResult3[2].c_str());
|
||||
}
|
||||
|
||||
iTem.append((float(send_feature)/(interval/featureInterVal)));
|
||||
iTem.append(send_feature);
|
||||
iTem.append((float(send_x)/(interval/waveInterVal)));
|
||||
@ -1248,8 +1182,9 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
iTem.append(send_y);
|
||||
iTem.append((float(send_z)/(interval/waveInterVal)));
|
||||
iTem.append(send_z);
|
||||
|
||||
}
|
||||
jsBody.append(iTem);
|
||||
|
||||
}
|
||||
if (jsBody.size() == 0) {
|
||||
jsonVal["success"] = false;
|
||||
|
||||
@ -519,7 +519,6 @@ std::string LocalServer::HandleCgi_cmd(std::string &pData) {
|
||||
param.timeStart = recvBody["timeStart"].asString();
|
||||
param.timeEnd = recvBody["timeEnd"].asString();
|
||||
std::string data = jd.JsonCmd_Cgi_65(param);
|
||||
printf("return data = %s\n", data.c_str());
|
||||
return data;
|
||||
}
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user