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 = "";
|
std::string MeasurementID = "";
|
||||||
char szTableName[100] = {0x00}, whereCon[256] = {0x00};
|
char szTableName[100] = {0x00}, whereCon[256] = {0x00};
|
||||||
if (nSize > 0) {
|
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 interval = atol(param.timeEnd.c_str()) - atol(param.timeStart.c_str());
|
||||||
int featureInterVal = 0,waveInterVal = 0,featureInterTime = 0,waveInterTime = 0,maxSensorNum = 0;
|
int featureInterVal = 0,waveInterVal = 0,featureInterTime = 0,waveInterTime = 0,maxSensorNum = 0;
|
||||||
scheduler::instance().GetScheduleConfig(featureInterVal,waveInterVal,featureInterTime,waveInterTime,maxSensorNum);
|
scheduler::instance().GetScheduleConfig(featureInterVal,waveInterVal,featureInterTime,waveInterTime,maxSensorNum);
|
||||||
Json::Value jsBody;
|
Json::Value jsBody;
|
||||||
zlog_info(zct, "packgeNo = %d,packgeMax = %d,packgeNum = %d", packgeNo, packgeMax, packgeNum);
|
|
||||||
char count_sql[1024] = {0};
|
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++)
|
for (size_t i = 0; i < nSize; i++)
|
||||||
{
|
{
|
||||||
Json::Value iTem;
|
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(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());
|
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));
|
memset(count_sql,0,sizeof(count_sql));
|
||||||
snprintf(count_sql,sizeof(count_sql),
|
snprintf(count_sql,sizeof(count_sql),
|
||||||
"SELECT "
|
"SELECT "
|
||||||
@ -1155,25 +1133,7 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
|||||||
send_feature = atoi(vecResult1[1].c_str());
|
send_feature = atoi(vecResult1[1].c_str());
|
||||||
}
|
}
|
||||||
iTem.append(MeasurementID);
|
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));
|
memset(count_sql,0,sizeof(count_sql));
|
||||||
snprintf(count_sql,sizeof(count_sql),
|
snprintf(count_sql,sizeof(count_sql),
|
||||||
"SELECT "
|
"SELECT "
|
||||||
@ -1189,40 +1149,16 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
|||||||
recive_x = atoi(vecResult2[0].c_str());
|
recive_x = atoi(vecResult2[0].c_str());
|
||||||
recive_y = atoi(vecResult2[1].c_str());
|
recive_y = atoi(vecResult2[1].c_str());
|
||||||
recive_z = atoi(vecResult2[2].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)));
|
||||||
|
iTem.append(recive_x);
|
||||||
|
iTem.append((float(recive_y)/(interval/waveInterVal)));
|
||||||
|
iTem.append(recive_y);
|
||||||
|
iTem.append((float(recive_z)/(interval/waveInterVal)));
|
||||||
|
iTem.append(recive_z);
|
||||||
}
|
}
|
||||||
iTem.append((float(recive_feature)/(interval/featureInterVal)));
|
|
||||||
iTem.append(recive_feature);
|
|
||||||
iTem.append((float( recive_x)/(interval/waveInterVal)));
|
|
||||||
iTem.append(recive_x);
|
|
||||||
iTem.append((float(recive_y)/(interval/waveInterVal)));
|
|
||||||
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));
|
memset(count_sql,0,sizeof(count_sql));
|
||||||
snprintf(count_sql,sizeof(count_sql),
|
snprintf(count_sql,sizeof(count_sql),
|
||||||
"SELECT "
|
"SELECT "
|
||||||
@ -1238,18 +1174,17 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
|||||||
send_x = atoi(vecResult3[0].c_str());
|
send_x = atoi(vecResult3[0].c_str());
|
||||||
send_y = atoi(vecResult3[1].c_str());
|
send_y = atoi(vecResult3[1].c_str());
|
||||||
send_z = atoi(vecResult3[2].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)));
|
||||||
|
iTem.append(send_x);
|
||||||
|
iTem.append((float(send_y)/(interval/waveInterVal)));
|
||||||
|
iTem.append(send_y);
|
||||||
|
iTem.append((float(send_z)/(interval/waveInterVal)));
|
||||||
|
iTem.append(send_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
iTem.append((float(send_feature)/(interval/featureInterVal)));
|
|
||||||
iTem.append(send_feature);
|
|
||||||
iTem.append((float(send_x)/(interval/waveInterVal)));
|
|
||||||
iTem.append(send_x);
|
|
||||||
iTem.append((float(send_y)/(interval/waveInterVal)));
|
|
||||||
iTem.append(send_y);
|
|
||||||
iTem.append((float(send_z)/(interval/waveInterVal)));
|
|
||||||
iTem.append(send_z);
|
|
||||||
|
|
||||||
jsBody.append(iTem);
|
jsBody.append(iTem);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (jsBody.size() == 0) {
|
if (jsBody.size() == 0) {
|
||||||
jsonVal["success"] = false;
|
jsonVal["success"] = false;
|
||||||
|
|||||||
@ -519,7 +519,6 @@ std::string LocalServer::HandleCgi_cmd(std::string &pData) {
|
|||||||
param.timeStart = recvBody["timeStart"].asString();
|
param.timeStart = recvBody["timeStart"].asString();
|
||||||
param.timeEnd = recvBody["timeEnd"].asString();
|
param.timeEnd = recvBody["timeEnd"].asString();
|
||||||
std::string data = jd.JsonCmd_Cgi_65(param);
|
std::string data = jd.JsonCmd_Cgi_65(param);
|
||||||
printf("return data = %s\n", data.c_str());
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user