Compare commits
10 Commits
011201a6c7
...
53a94037cf
| Author | SHA1 | Date | |
|---|---|---|---|
| 53a94037cf | |||
| 466cbdaca0 | |||
| 48eb60ed26 | |||
| f406bd903a | |||
| 54985fd568 | |||
| b19f3027fd | |||
| acfed5f9b3 | |||
| 9c32e6499e | |||
| f7e27c5638 | |||
| e08f3c1e7b |
@ -567,7 +567,7 @@ void ImportConfig(std::string filename) {
|
||||
'%s','%s','%s','%s','%s','%s',\
|
||||
'%s','%s','%s','%s','%s','%s','%s','%s',\
|
||||
'%s','%s','%s','%s','%s',\
|
||||
'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'",
|
||||
'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'",
|
||||
vecDataNode[0].c_str(), dataNodeName, vecDataNode[2].c_str(), vecDataNode[3].c_str(),
|
||||
vecDataNode[4].c_str(), vecDataNode[5].c_str(), vecDataNode[6].c_str(),
|
||||
vecDataNode[7].c_str(), vecDataNode[8].c_str(), vecDataNode[9].c_str(), vecDataNode[10].c_str(),
|
||||
@ -580,7 +580,8 @@ void ImportConfig(std::string filename) {
|
||||
vecDataNode[31].c_str(), vecDataNode[32].c_str(), vecDataNode[33].c_str(), vecDataNode[34].c_str(),
|
||||
vecDataNode[35].c_str(), vecDataNode[36].c_str(), vecDataNode[37].c_str(), vecDataNode[38].c_str(),
|
||||
vecDataNode[39].c_str(), vecDataNode[40].c_str(),
|
||||
vecDataNode[41].c_str(), vecDataNode[42].c_str(), vecDataNode[43].c_str(), vecDataNode[44].c_str());
|
||||
vecDataNode[41].c_str(), vecDataNode[42].c_str(), vecDataNode[43].c_str(), vecDataNode[44].c_str(),
|
||||
vecDataNode[45].c_str(),vecDataNode[46].c_str());
|
||||
res = sqlite_db_ctrl::instance().InsertData(T_SENSOR_INFO(TNAME), insertSql);
|
||||
if (res != 0){
|
||||
zlog_error(zbt, "res:%d", res);
|
||||
|
||||
@ -18,7 +18,7 @@ enum enumZigBeeTransmitStatus {
|
||||
|
||||
|
||||
//#define NR5G_MODULE
|
||||
//#define Q4G_MODULE
|
||||
#define Q4G_MODULE
|
||||
//#define WIFI_MODULE
|
||||
//#define NR5G_MEIGE
|
||||
|
||||
@ -57,7 +57,7 @@ public :
|
||||
};
|
||||
|
||||
|
||||
#define SAVE_COUNT 6048
|
||||
#define SAVE_COUNT 6148
|
||||
#define OneWeek 86400 * 7
|
||||
|
||||
|
||||
|
||||
@ -107,6 +107,10 @@ void SqliteDB::SqliteInit(const char *pDbName) {
|
||||
if(iRet == 0){
|
||||
CreateTable("ALTER TABLE t_sensor_info ADD COLUMN 'upgradeStatus'");
|
||||
}
|
||||
iRet = GetTableRows(" sqlite_master "," name = 'receive_wave_status' and sql LIKE '%resend%' ");
|
||||
if(iRet == 0){
|
||||
CreateTable("ALTER TABLE receive_wave_status ADD COLUMN 'resend'");
|
||||
}
|
||||
|
||||
memset(sql_exec, 0, 2048);
|
||||
sprintf(sql_exec,"update t_sensor_info set MeasurementID = dataNodeNo where MeasurementID IS NULL ;");
|
||||
@ -1366,7 +1370,27 @@ int SqliteDB::QueryofflineData() {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int SqliteDB::ClearExpireData(){
|
||||
char whereCon[1024] = {0};
|
||||
char deleteSql[1024] = {0};
|
||||
char selectSql[1024] = {0};
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
memset(deleteSql, 0x00, sizeof(deleteSql));
|
||||
memset(selectSql, 0x00, sizeof(selectSql));
|
||||
sprintf(selectSql, " MeasurementID ");
|
||||
array_t vecRes;
|
||||
char localtimestamp[32] = {0};
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
vecRes = GetDataMultiLine(T_SENSOR_INFO(TNAME), selectSql, NULL);
|
||||
for (size_t i = 0; i < vecRes.size(); i++) {
|
||||
sprintf(whereCon, " timeStamp < %ld", atol(localtimestamp) - 2592000);//前一个月
|
||||
sprintf(deleteSql, "delete from t_dataStatic_%s where %s", vecRes[i][0].c_str(), whereCon);
|
||||
ExeSql(deleteSql);
|
||||
sprintf(deleteSql, "delete from t_data_%s where %s", vecRes[i][0].c_str(), whereCon);
|
||||
ExeSql(deleteSql);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int SqliteDB::TransBegin() { return sqlite3_exec(mDBAcess, "begin;", 0, 0, 0); }
|
||||
|
||||
int SqliteDB::TransRollback() { return sqlite3_exec(mDBAcess, "rollback;", 0, 0, 0); }
|
||||
|
||||
@ -68,6 +68,7 @@ public:
|
||||
int CalculateDip();
|
||||
int InintGateway();
|
||||
int QueryofflineData();
|
||||
int ClearExpireData();
|
||||
int CalculateWaveRate();
|
||||
std::string GetNodeConfigureInfor(const char *whereCon);
|
||||
int CloseDB();
|
||||
|
||||
@ -299,7 +299,7 @@ std::string JsonData::JsonCmd_Cgi_10(Param_10 ¶m) {
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> ''", param.MeasurementID.c_str(), param.strStatic.c_str());
|
||||
|
||||
} else {
|
||||
sprintf(whereCon, " channelID like '%%%s%%' and %s <> '' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(), param.strStatic.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
sprintf(whereCon, " channelID like '%%%s%%' and %s <> '' and timeStamp < '%s' and timeStamp > '%s' and nodeResend = 0 ", param.MeasurementID.c_str(), param.strStatic.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
}
|
||||
|
||||
int rows = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||
@ -333,7 +333,7 @@ std::string JsonData::JsonCmd_Cgi_10(Param_10 ¶m) {
|
||||
if (param.timeEnd == "") {
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), 550, packgeNum);
|
||||
} else {
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' and timeStamp < '%s' and timeStamp > '%s' and nodeResend = 0 order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
}
|
||||
array_t vecRes;
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ std::string JsonData::JsonCmd_Cgi_54(Param_54 ¶m) {
|
||||
nodeArray.append(arrRes[j][0]);
|
||||
stringToHex(arrRes[j][1].c_str(), hex);
|
||||
nodeArray.append(hex);
|
||||
for (int k = 2; k <= 44; ++k) {
|
||||
for (int k = 2; k <= 46; ++k) {
|
||||
nodeArray.append(arrRes[j][k]);
|
||||
}
|
||||
jsArray.append(nodeArray);
|
||||
|
||||
@ -649,7 +649,7 @@ std::string JsonData::JsonCmd_Cgi_60(Param_60 ¶m){
|
||||
jsonVal["success"] = true;
|
||||
jsonVal["message"] = "";
|
||||
char file_path[64]={0};
|
||||
char cmd[64]={0};
|
||||
char cmd[128]={0};
|
||||
sprintf(cmd, "mv /opt/%s /opt/DataNode/",param.fileName.c_str());
|
||||
system(cmd);
|
||||
sprintf(file_path, "/opt/DataNode/%s",param.fileName.c_str());
|
||||
@ -908,16 +908,16 @@ std::string JsonData::JsonCmd_Cgi_62(Param_62 ¶m){
|
||||
|
||||
if(param.straxis == ""){
|
||||
if (param.mMode == 1){
|
||||
sprintf(whereCon, " channelID like '%s-X' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
sprintf(whereCon, " channelID like '%s-X' and timeStamp < '%s' and timeStamp > '%s' and (nodeResend = 0 or nodeResend is null)", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
}else{
|
||||
sprintf(whereCon, " data_nodeno like '%%%s%%' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
sprintf(whereCon, " data_nodeno like '%%%s%%' and timeStamp < '%s' and timeStamp > '%s' and (resend = 0 or resend == '')", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (param.mMode == 1){
|
||||
sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' and (nodeResend = 0 or nodeResend is null)", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
}else{
|
||||
sprintf(whereCon, " data_nodeno = '%s-%s' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(),param.straxis.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
sprintf(whereCon, " data_nodeno = '%s-%s' and timeStamp < '%s' and timeStamp > '%s' and (resend = 0 or resend == '')", param.MeasurementID.c_str(),param.straxis.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,15 +951,15 @@ std::string JsonData::JsonCmd_Cgi_62(Param_62 ¶m){
|
||||
if(param.straxis == "")
|
||||
{
|
||||
if (param.mMode == 1){
|
||||
sprintf(whereCon, " channelID like '%s-X' and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, " channelID like '%s-X' and timeStamp < '%s' and timeStamp > '%s' and (nodeResend = 0 or nodeResend is null) order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
}else{
|
||||
sprintf(whereCon, " data_nodeno like '%%%s%%' and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, " data_nodeno like '%%%s%%' and timeStamp < '%s' and timeStamp > '%s' and (resend = 0 or resend == '') order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
}
|
||||
}else{
|
||||
if (param.mMode == 1){
|
||||
sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, " channelID = '%s-X' and timeStamp < '%s' and timeStamp > '%s' and (nodeResend = 0 or nodeResend is null) order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
}else{
|
||||
sprintf(whereCon, "data_nodeno = '%s-%s' and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(),param.straxis.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, "data_nodeno = '%s-%s' and timeStamp < '%s' and timeStamp > '%s' and (resend = 0 or resend == '') order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(),param.straxis.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
}
|
||||
}
|
||||
array_t vecRes;
|
||||
@ -1104,9 +1104,9 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
scheduler::instance().GetScheduleConfig(featureInterVal,waveInterVal,featureInterTime,waveInterTime,maxSensorNum);
|
||||
Json::Value jsBody;
|
||||
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;
|
||||
int recive_feature = 0, send_feature = 0,resend_feature = 0;
|
||||
int recive_x = 0, recive_y = 0, recive_z = 0,resend_z = 0;
|
||||
//int send_x = 0, send_y = 0, send_z = 0;
|
||||
for (size_t i = 0; i < nSize; i++)
|
||||
{
|
||||
Json::Value iTem;
|
||||
@ -1121,16 +1121,18 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
memset(count_sql,0,sizeof(count_sql));
|
||||
snprintf(count_sql,sizeof(count_sql),
|
||||
"SELECT "
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-X') AS recive_feature,"
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-X' and sendMsg = 1) AS send_feature "
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-X' and nodeResend = 0 ) AS recive_feature,"
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-X' and sendMsg = 1 and nodeResend = 0 ) AS send_feature, "
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-X' and nodeResend <> 0) AS resend_feature "
|
||||
"FROM ( "
|
||||
"SELECT * FROM %s "
|
||||
"WHERE timeStamp BETWEEN '%s' AND '%s');",MeasurementID.c_str(),MeasurementID.c_str(),szTableName,param.timeStart.c_str(),param.timeEnd.c_str());
|
||||
vec_t vecResult1 = sqlite_db_ctrl::instance().GetDataSingleLine(count_sql);
|
||||
if (vecResult1.size() > 0)
|
||||
"WHERE timeStamp BETWEEN '%s' AND '%s');",MeasurementID.c_str(),MeasurementID.c_str(),MeasurementID.c_str(),szTableName,param.timeStart.c_str(),param.timeEnd.c_str());
|
||||
vec_t vecResult = sqlite_db_ctrl::instance().GetDataSingleLine(count_sql);
|
||||
if (vecResult.size() > 0)
|
||||
{
|
||||
recive_feature = atoi(vecResult1[0].c_str());
|
||||
send_feature = atoi(vecResult1[1].c_str());
|
||||
recive_feature = atoi(vecResult[0].c_str());
|
||||
send_feature = atoi(vecResult[1].c_str());
|
||||
resend_feature = atoi(vecResult[2].c_str());
|
||||
}
|
||||
iTem.append(MeasurementID);
|
||||
|
||||
@ -1139,16 +1141,18 @@ std::string JsonData::JsonCmd_Cgi_65(Param_65 ¶m){
|
||||
"SELECT "
|
||||
"COUNT(*) FILTER (WHERE data_nodeno = '%s-X') AS recive_x,"
|
||||
"COUNT(*) FILTER (WHERE data_nodeno = '%s-Y') AS recive_y,"
|
||||
"COUNT(*) FILTER (WHERE data_nodeno = '%s-Z') AS recive_z "
|
||||
"COUNT(*) FILTER (WHERE data_nodeno = '%s-Z') AS recive_z, "
|
||||
"COUNT(*) FILTER (WHERE data_nodeno = '%s-Z' and resend is NOT NULL and resend <> '') AS resend_z "
|
||||
"FROM ( "
|
||||
"SELECT * FROM receive_wave_status "
|
||||
"WHERE error_code = 1 and timeStamp BETWEEN '%s' AND '%s');",MeasurementID.c_str(),MeasurementID.c_str(),MeasurementID.c_str(),param.timeStart.c_str(),param.timeEnd.c_str());
|
||||
"WHERE error_code = 1 and timeStamp BETWEEN '%s' AND '%s');",MeasurementID.c_str(),MeasurementID.c_str(),MeasurementID.c_str(),MeasurementID.c_str(),param.timeStart.c_str(),param.timeEnd.c_str());
|
||||
vec_t vecResult2 = sqlite_db_ctrl::instance().GetDataSingleLine(count_sql);
|
||||
if (vecResult2.size() > 0)
|
||||
{
|
||||
recive_x = atoi(vecResult2[0].c_str());
|
||||
recive_y = atoi(vecResult2[1].c_str());
|
||||
recive_z = atoi(vecResult2[2].c_str());
|
||||
resend_z = atoi(vecResult2[3].c_str());
|
||||
iTem.append((float(recive_feature)/(interval/featureInterVal)));
|
||||
iTem.append(recive_feature);
|
||||
iTem.append((float( recive_x)/(interval/waveInterVal)));
|
||||
@ -1157,39 +1161,48 @@ 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(count_sql,0,sizeof(count_sql));
|
||||
snprintf(count_sql,sizeof(count_sql),
|
||||
"SELECT "
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-X') AS send_x,"
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-Y') AS send_y,"
|
||||
"COUNT(*) FILTER (WHERE channelID = '%s-Z') AS send_z "
|
||||
"FROM ( "
|
||||
"SELECT * FROM t_data_waveSend "
|
||||
"WHERE sendMsg = 1 and timeStamp BETWEEN '%s' AND '%s');",MeasurementID.c_str(),MeasurementID.c_str(),MeasurementID.c_str(),param.timeStart.c_str(),param.timeEnd.c_str());
|
||||
vec_t vecResult3 = sqlite_db_ctrl::instance().GetDataSingleLine(count_sql);
|
||||
if (vecResult3.size() > 0)
|
||||
{
|
||||
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)));
|
||||
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);
|
||||
}
|
||||
// memset(count_sql,0,sizeof(count_sql));
|
||||
// snprintf(count_sql,sizeof(count_sql),
|
||||
// "SELECT "
|
||||
// "COUNT(*) FILTER (WHERE channelID = '%s-X') AS send_x,"
|
||||
// "COUNT(*) FILTER (WHERE channelID = '%s-Y') AS send_y,"
|
||||
// "COUNT(*) FILTER (WHERE channelID = '%s-Z') AS send_z "
|
||||
// "FROM ( "
|
||||
// "SELECT * FROM t_data_waveSend "
|
||||
// "WHERE sendMsg = 1 and timeStamp BETWEEN '%s' AND '%s');",MeasurementID.c_str(),MeasurementID.c_str(),MeasurementID.c_str(),param.timeStart.c_str(),param.timeEnd.c_str());
|
||||
// vec_t vecResult3 = sqlite_db_ctrl::instance().GetDataSingleLine(count_sql);
|
||||
// if (vecResult3.size() > 0)
|
||||
// {
|
||||
// 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)));
|
||||
// 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(0);
|
||||
iTem.append(0);
|
||||
iTem.append(0);
|
||||
iTem.append(0);
|
||||
iTem.append(0);
|
||||
iTem.append(0);
|
||||
iTem.append(0);
|
||||
iTem.append(0);
|
||||
std::vector<std::string> vRssi;
|
||||
boost::split(vRssi, vetRes[i][2], boost::is_any_of(","), boost::token_compress_on);
|
||||
if (vRssi.size() > 0 ){
|
||||
iTem.append(atof(vRssi[0].c_str())/float(255));
|
||||
iTem.append(atof(vRssi[1].c_str())/float(255));
|
||||
}
|
||||
|
||||
iTem.append(resend_feature);
|
||||
iTem.append(resend_z);
|
||||
jsBody.append(iTem);
|
||||
|
||||
}
|
||||
|
||||
1
main.cpp
1
main.cpp
@ -43,6 +43,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
zlog_info(zbt, " Firmware compile time:%s %s,version %s", __DATE__, __TIME__, GlobalConfig::Version.c_str());
|
||||
zlog_info(zbt, "####CIDNSOFT start####");
|
||||
GlobalConfig::Version += " " + std::string(__DATE__) ;
|
||||
|
||||
g_VecWaveDataX.reserve(1000);
|
||||
g_VecWaveDataY.reserve(1000);
|
||||
|
||||
@ -147,6 +147,13 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration, int &next
|
||||
// wrong time to come
|
||||
long available_ts = current_wave_start_ts_ + (nth_eigen_value_slice_ + 1) * eigen_value_send_interval_ + (id - 1) * eigen_value_send_duration_;
|
||||
next_duration = available_ts - current_ts_;
|
||||
if (next_duration < 0 || next_duration > eigen_value_send_interval_) {
|
||||
zlog_warn(zct, "[Nxt] exception duration: %d", next_duration);
|
||||
next_duration = eigen_value_send_interval_;
|
||||
}else if(next_duration < 15){
|
||||
zlog_warn(zct, "[Nxt] exception duration: %d", next_duration);
|
||||
next_duration = 15;
|
||||
}
|
||||
next_task_id = kScheduleEigenValue;
|
||||
zlog_warn(zct, "[%d:%x] wrong time in wave slice, next feature send utc time:[%s], duration:%d", id, short_addr, GetUTCTime(available_ts).c_str(), next_duration);
|
||||
return kScheduleResultNone;
|
||||
@ -312,9 +319,9 @@ int SensorScheduler::GetNextDuration(int short_addr, int &next_task_id) {
|
||||
if (duration < 0 || duration > eigen_value_send_interval_) {
|
||||
zlog_warn(zct, "[Nxt] exception duration: %d", duration);
|
||||
duration = eigen_value_send_interval_;
|
||||
}else if(duration < 9){
|
||||
}else if(duration < 15){
|
||||
zlog_warn(zct, "[Nxt] exception duration: %d", duration);
|
||||
duration = 10;
|
||||
duration = 15;
|
||||
}
|
||||
zlog_warn(zct, "[Nxt] [%d:%x] next duration: %d, taskid: %d", id, short_addr, duration, next_task_id);
|
||||
return duration;
|
||||
@ -421,16 +428,16 @@ int SensorScheduler::WaveError(uint16_t short_addr) {
|
||||
if (iter == failure_map_.end()) {
|
||||
failure_map_[short_addr] = 3; // 重试次数
|
||||
zlog_warn(zct, "[WaveError][%x] will try 3 times", short_addr);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
if (iter->second == 0) {
|
||||
zlog_warn(zct, "[WaveError][%x] no try times", short_addr);
|
||||
failure_map_.erase(short_addr);
|
||||
return -1;
|
||||
return 3;
|
||||
}
|
||||
iter->second = iter->second - 1;
|
||||
zlog_warn(zct, "[WaveError][%x] remain try %d times", short_addr, iter->second);
|
||||
return 0;
|
||||
return 3 - iter->second;
|
||||
}
|
||||
|
||||
bool SensorScheduler::RetransferWave(uint16_t short_addr) {
|
||||
@ -449,7 +456,7 @@ bool SensorScheduler::MissedWave(uint16_t short_addr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void SensorScheduler::WaveSuccess(uint16_t short_addr) {
|
||||
int SensorScheduler::WaveSuccess(uint16_t short_addr) {
|
||||
zlog_warn(zct, "[WaveSuccess][%x]", short_addr);
|
||||
success_set_.insert(short_addr);
|
||||
patch_set_.erase(short_addr);
|
||||
@ -457,12 +464,13 @@ void SensorScheduler::WaveSuccess(uint16_t short_addr) {
|
||||
if (iter != failure_map_.end()) {
|
||||
zlog_warn(zct, "[WaveSuccess][%x] try %d times success", short_addr, 4 - iter->second);
|
||||
failure_map_.erase(short_addr);
|
||||
return;
|
||||
return 4 - iter->second;
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SensorScheduler::ClearFailureSuccessMap() {
|
||||
zlog_warn(zct, "[ClearFailureSuccessMap]");
|
||||
failure_map_.clear();
|
||||
success_set_.clear();
|
||||
patch_set_.clear();
|
||||
|
||||
@ -43,7 +43,7 @@ public:
|
||||
// int GetNextDuration(int short_addr);
|
||||
|
||||
int WaveError(uint16_t short_addr);
|
||||
void WaveSuccess(uint16_t short_addr);
|
||||
int WaveSuccess(uint16_t short_addr);
|
||||
long GetBaseTimestamp(int id);
|
||||
long CalcNextTimestamp(int id, uint16_t short_addr, int& next_task_id);
|
||||
|
||||
|
||||
@ -189,6 +189,7 @@ void CheckThread() {
|
||||
sprintf(whereCon, " timestamp < '%ld' ", atol(localtimestamp) - 2592000); //删除1个月前的数据
|
||||
sqlite_db_ctrl::instance().DeleteTableData(" t_battery_history ", whereCon);
|
||||
sqlite_db_ctrl::instance().DeleteTableData(" receive_wave_status ", whereCon);
|
||||
sqlite_db_ctrl::instance().ClearExpireData();
|
||||
}
|
||||
#ifdef WIFI_MODULE
|
||||
if (wifi_reconnect_count == 600) { // 每 10分钟,重连WiFi网络
|
||||
|
||||
@ -403,7 +403,32 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
zlog_info(zct, " DealAskTask end" );
|
||||
return 0;
|
||||
}
|
||||
int Uart::DealAskTaskOld(uint16_t ushortAdd){
|
||||
char wherecon[50]={0};
|
||||
sprintf(wherecon, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||
int sensor_count = sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), wherecon);
|
||||
|
||||
if (sensor_count < 1) {
|
||||
zlog_warn(zct, "device info not found %02x%02x ", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||
return 1;
|
||||
}
|
||||
int next_duration = 0,next_task_id = 0;
|
||||
int taskID;
|
||||
ScheduleTask scheduleTask;
|
||||
taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration, next_task_id);
|
||||
zlog_info(zct, "DealAskTaskOld taskID = %d next_duration = %d next_task_id = %d", taskID, next_duration, next_task_id);
|
||||
if(next_task_id == kScheduleUpgrade){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.next_taskID = UPGRADE;
|
||||
TaskResp(scheduleTask);
|
||||
}
|
||||
if (taskID == kScheduleUpgrade){
|
||||
UpdateWirelessNode(ushortAdd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int Uart::DealException(const char* pData){
|
||||
return 0;
|
||||
}
|
||||
@ -613,9 +638,9 @@ void Uart::DealRecvData(const char *pData) {
|
||||
case DEVICE_INF2:
|
||||
DealDataNodeName(pData);
|
||||
break;
|
||||
// case ASK_TASK:
|
||||
// DealAskTask(ushortAdd);
|
||||
// break;
|
||||
case ASK_TASK:
|
||||
DealAskTaskOld(ushortAdd);
|
||||
break;
|
||||
case DEVICE_EXCEPTION:
|
||||
DealException(pData);
|
||||
break;
|
||||
@ -1220,7 +1245,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
||||
}
|
||||
|
||||
zlog_error(zct, "WaveError error ShortAddr :%s", strShortAddr.c_str());
|
||||
sprintf(insertSql, "'%s','%s','%s',%d,'%d','%s' ", strChannelID.c_str(),strShortAddr.c_str(),localtimestamp,bytesRead,0,error_msg.c_str());
|
||||
sprintf(insertSql, "'%s','%s','%s',%d,'%d','%s','' ", strChannelID.c_str(),strShortAddr.c_str(),localtimestamp,bytesRead,0,error_msg.c_str());
|
||||
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||
|
||||
|
||||
@ -1262,7 +1287,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
||||
}
|
||||
|
||||
zlog_error(zct, "WaveError error ShortAddr :%s", strShortAddr.c_str());
|
||||
sprintf(insertSql, "'%s','%s','%s',%d,'%d','%s' ", strChannelID.c_str(),strShortAddr.c_str(),localtimestamp,bytesRead,0,error_msg.c_str());
|
||||
sprintf(insertSql, "'%s','%s','%s',%d,'%d','%s','' ", strChannelID.c_str(),strShortAddr.c_str(),localtimestamp,bytesRead,0,error_msg.c_str());
|
||||
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||
|
||||
JsonData jd;
|
||||
@ -1280,9 +1305,9 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
||||
memcpy(RecvBuf, (char *)&UartRecvBuf[i], 100);
|
||||
DealDataNodeWave(RecvBuf, command);
|
||||
mPackgeIndex = (unsigned int)UartRecvBuf[i + 6];
|
||||
} else if (now_task != WAVE_CMD && ( command == DEVICE_INF || command == MEAS_EVAL || command == CONFIG || command == UPGRADE || command == DEVICE_INF2 || command == SIGNAL_STRENGTH || command == DEVICE_EXCEPTION || command == UPGRADE_ASK)) {
|
||||
} else if (now_task != WAVE_CMD && (command == ASK_TASK || command == DEVICE_INF || command == MEAS_EVAL || command == CONFIG || command == UPGRADE || command == DEVICE_INF2 || command == SIGNAL_STRENGTH || command == DEVICE_EXCEPTION || command == UPGRADE_ASK)) {
|
||||
char RecvBuf[100] = {0x00};
|
||||
if (command == UPGRADE_ASK)
|
||||
if (command == UPGRADE_ASK || command == ASK_TASK)
|
||||
{
|
||||
memcpy(RecvBuf, &UartRecvBuf[i], 8);
|
||||
if (!CheckCrc(RecvBuf, 7)) {
|
||||
|
||||
@ -175,6 +175,7 @@ public:
|
||||
int FindRecvPackage(int bytesRead, char* mUartRecvBuf, char* head);
|
||||
|
||||
int DealAskTask(uint16_t ushortAdd);
|
||||
int DealAskTaskOld(uint16_t ushortAdd);
|
||||
int DealFeatureValue(const char* pData, uint16_t ushortAdd);
|
||||
int DealException(const char* pData);
|
||||
int DealReviveDuration(uint16_t ushortAdd);
|
||||
|
||||
@ -47,8 +47,10 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
char whereCon[1024] = {0};
|
||||
char updateSql[1024] = {0};
|
||||
char buf[20] = {0x00};
|
||||
int nodeResend = 0, timing = 0;
|
||||
int timing = 0;
|
||||
long staticIndex = 0;
|
||||
uint8_t nodeResend = pData[6] & 0xFF;
|
||||
zlog_info(zct, "nodeResend = %d", nodeResend);
|
||||
sprintf(buf, "%02x%02x", pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]);
|
||||
if (flag == 1) {
|
||||
zlog_info(zct, "DealDataNodeFeature %02x%02x, %d", pRecvData->ShortAddr[0], pRecvData->ShortAddr[1], flag);
|
||||
@ -92,7 +94,6 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
strTimetamp = nowTimetamp;
|
||||
|
||||
int iTemp = 0;
|
||||
// unsigned char highbit = 0;
|
||||
unsigned int lowbit = 0;
|
||||
float n = 0;
|
||||
|
||||
@ -154,14 +155,18 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
sprintf(logInfo, "ShortAddr = %s,localtimestamp = %s,staticData = %d, data = %d", strShortAddr.c_str(), localtimestamp, count, count2);
|
||||
zlog_info(zct, logInfo);
|
||||
std::vector<uint8_t>& data_vec = map_send_data[u_short_addr];
|
||||
|
||||
const uint8_t* send_data = data_vec.data();
|
||||
WriteToUart((const char*)send_data, 100);
|
||||
mssleep(50000);
|
||||
WriteToUart((const char*)send_data, 100);
|
||||
mssleep(50000);
|
||||
WriteToUart((const char*)send_data, 100);
|
||||
if (send_data == nullptr || data_vec.size() < 100) {
|
||||
zlog_error(zct, "send_data is null or size is less than 100");
|
||||
return -3;
|
||||
}
|
||||
WriteToUart((const char*)send_data, 100);
|
||||
mssleep(50000);
|
||||
WriteToUart((const char*)send_data, 100);
|
||||
mssleep(50000);
|
||||
WriteToUart((const char*)send_data, 100);
|
||||
}
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(szTableNameData, "t_data_%s", strMeasurementID.c_str());
|
||||
///////////////////////////////////////////////////////////// for V2.0.3 upgrade to V3.0
|
||||
@ -311,7 +316,7 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
Amp1='%f',Amp2='%f',Amp3='%f',Amp4='%f',Amp5='%f',Phase1='%f',Phase2='%f',Phase3='%f',Phase4='%f',timeStamp='%s',StaticIndex = %ld,nodeResend = %d ",
|
||||
dataDymX.DiagnosisPk, dataDymX.IntegratPk, dataDymX.IntegratRMS, dataDymX.RmsValues, dataDymX.EnvelopEnergy, dataDymX.Amp1, dataDymX.Amp2, dataDymX.Amp3, dataDymX.Amp4, dataDymX.Amp5, dataDymX.Phase1, dataDymX.Phase2, dataDymX.Phase3, dataDymX.Phase4,
|
||||
nowTimetamp.c_str(), staticIndex, nodeResend);
|
||||
if ((Count * 3 < SAVE_COUNT && lTime < OneWeek) || strTime.size() == 0) { // 1 week
|
||||
if ((Count * 3 < SAVE_COUNT && lTime < OneWeek) || strTime.size() == 0 || nodeResend != 0) { // 1 week
|
||||
char insertSql[1024] = {0};
|
||||
memset(insertSql, 0x00, sizeof(insertSql));
|
||||
sprintf(insertSql, "'%s','%s','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f',%ld,'%s','1',%d", strMeasurementID.c_str(), (strMeasurementID + "-X").c_str(), dataDymX.DiagnosisPk, dataDymX.IntegratPk, dataDymX.IntegratRMS, dataDymX.RmsValues,
|
||||
@ -324,7 +329,7 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
sqlite_db_ctrl::instance().UpdateTableData(T_DATA_INFO(TNAME), updateSql, whereCon);
|
||||
} else {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "channelID='%s' and timeStamp = '%s'", (strMeasurementID + "-X").c_str(), strTime.c_str());
|
||||
sprintf(whereCon, "channelID='%s' and timeStamp = '%s' and nodeResend = 0", (strMeasurementID + "-X").c_str(), strTime.c_str());
|
||||
|
||||
sqlite_db_ctrl::instance().UpdateTableData(szTableName, updateSql, whereCon);
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
@ -417,7 +422,7 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
sqlite_db_ctrl::instance().UpdateTableData(T_DATA_INFO(TNAME), updateSql, whereCon);
|
||||
} else {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "channelID='%s' and timeStamp = '%s'", (strMeasurementID + "-Y").c_str(), strTime.c_str());
|
||||
sprintf(whereCon, "channelID='%s' and timeStamp = '%s' and nodeResend = 0", (strMeasurementID + "-Y").c_str(), strTime.c_str());
|
||||
sqlite_db_ctrl::instance().UpdateTableData(szTableName, updateSql, whereCon);
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "channelID='%s' ", (strMeasurementID + "-Y").c_str());
|
||||
@ -499,7 +504,7 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
Amp1='%f',Amp2='%f',Amp3='%f',Amp4='%f',Amp5='%f',Phase1='%f',Phase2='%f',Phase3='%f',Phase4='%f',timeStamp='%s',StaticIndex = %ld,nodeResend = %d ",
|
||||
dataDymZ.DiagnosisPk, dataDymZ.IntegratPk, dataDymZ.IntegratRMS, dataDymZ.RmsValues, dataDymZ.EnvelopEnergy, dataDymZ.Amp1, dataDymZ.Amp2, dataDymZ.Amp3, dataDymZ.Amp4, dataDymZ.Amp5, dataDymZ.Phase1, dataDymZ.Phase2, dataDymZ.Phase3, dataDymZ.Phase4,
|
||||
nowTimetamp.c_str(), staticIndex, nodeResend);
|
||||
if (/*0 == sqlite_db_ctrl::instance().GetTableRows(T_DATA_INFO(TNAME), whereCon)*/ Count * 3 < SAVE_COUNT && (lTime < OneWeek || strTime.size() == 0)) {
|
||||
if (/*0 == sqlite_db_ctrl::instance().GetTableRows(T_DATA_INFO(TNAME), whereCon)*/ (Count * 3 < SAVE_COUNT && lTime < OneWeek) || strTime.size() == 0 ) {
|
||||
char insertSql[1024] = {0};
|
||||
memset(insertSql, 0x00, sizeof(insertSql));
|
||||
sprintf(insertSql, "'%s','%s','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f',%ld,'%s','1',%d", strMeasurementID.c_str(), (strMeasurementID + "-Z").c_str(), dataDymZ.DiagnosisPk, dataDymZ.IntegratPk, dataDymZ.IntegratRMS, dataDymZ.RmsValues,
|
||||
@ -512,7 +517,7 @@ int Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
sqlite_db_ctrl::instance().UpdateTableData(T_DATA_INFO(TNAME), updateSql, whereCon);
|
||||
} else {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "channelID='%s' and timeStamp = '%s'", (strMeasurementID + "-Z").c_str(), strTime.c_str());
|
||||
sprintf(whereCon, "channelID='%s' and timeStamp = '%s' and nodeResend = 0", (strMeasurementID + "-Z").c_str(), strTime.c_str());
|
||||
sqlite_db_ctrl::instance().UpdateTableData(szTableName, updateSql, whereCon);
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "channelID='%s' ", (strMeasurementID + "-Z").c_str());
|
||||
@ -843,17 +848,17 @@ void Uart::DealWave() {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
if (vecDataX.size() > 0)
|
||||
{
|
||||
sprintf(insertSql, "'%s-X','%02x%02x','%s',0,'1','%s' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
|
||||
sprintf(insertSql, "'%s-X','%02x%02x','%s',0,'1','%s','' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
|
||||
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||
}
|
||||
if (vecDataY.size() > 0)
|
||||
{
|
||||
sprintf(insertSql, "'%s-Y','%02x%02x','%s',0,'1','%s' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
|
||||
sprintf(insertSql, "'%s-Y','%02x%02x','%s',0,'1','%s','' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
|
||||
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||
}
|
||||
if (vecDataZ.size() > 0)
|
||||
{
|
||||
sprintf(insertSql, "'%s-Z','%02x%02x','%s',0,'1','%s' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
|
||||
sprintf(insertSql, "'%s-Z','%02x%02x','%s',0,'1','%s','' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
|
||||
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||
}
|
||||
zlog_warn(zct,"waveCountX = %d, waveCountY = %d, waveCountZ = %d", vecDataX.size() , vecDataY.size(), vecDataZ.size());
|
||||
@ -862,17 +867,38 @@ void Uart::DealWave() {
|
||||
(vecDataY.size() <= 0 && g_mapCompress[strShortAddr].CountY > 0) ||
|
||||
(vecDataZ.size() <= 0 && g_mapCompress[strShortAddr].CountZ > 0))
|
||||
{
|
||||
scheduler::instance().WaveError(wave_shortAddr);
|
||||
int iRet = scheduler::instance().WaveError(wave_shortAddr);
|
||||
if (iRet != 0) {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
char updateSql[1024] = { 0 };
|
||||
sprintf(updateSql, "resend = '%d'", iRet);
|
||||
sprintf(whereCon, "short_addr='%02x%02x' and timestamp = '%s'", (wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp);
|
||||
sqlite_db_ctrl::instance().UpdateTableData(" receive_wave_status ", updateSql, whereCon);
|
||||
}
|
||||
}else if ((vecDataX.size() > 0 && g_mapCompress[strShortAddr].CountX > 0) ||
|
||||
(vecDataY.size() > 0 && g_mapCompress[strShortAddr].CountY > 0) ||
|
||||
(vecDataZ.size() > 0 && g_mapCompress[strShortAddr].CountZ > 0))
|
||||
{
|
||||
scheduler::instance().WaveSuccess(wave_shortAddr);
|
||||
int iRet = scheduler::instance().WaveSuccess(wave_shortAddr);
|
||||
if (iRet != 0) {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
char updateSql[1024] = { 0 };
|
||||
sprintf(updateSql, "resend = '%d'", iRet);
|
||||
sprintf(whereCon, "short_addr='%02x%02x' and timestamp = '%s'", (wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp);
|
||||
sqlite_db_ctrl::instance().UpdateTableData(" receive_wave_status ", updateSql, whereCon);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_mapCompress[strShortAddr].CountX <= 0 && g_mapCompress[strShortAddr].CountY <= 0 && g_mapCompress[strShortAddr].CountZ <= 0)
|
||||
{
|
||||
scheduler::instance().WaveError(wave_shortAddr);
|
||||
int iRet = scheduler::instance().WaveError(wave_shortAddr);
|
||||
if (iRet != 0) {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
char updateSql[1024] = { 0 };
|
||||
sprintf(updateSql, "resend = '%d'", iRet);
|
||||
sprintf(whereCon, "short_addr='%02x%02x' and timestamp = '%s'", (wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp);
|
||||
sqlite_db_ctrl::instance().UpdateTableData(" receive_wave_status ", updateSql, whereCon);
|
||||
}
|
||||
}
|
||||
|
||||
g_mapCompress[strShortAddr].CountX = 0;
|
||||
@ -1029,7 +1055,7 @@ void Uart::WriteDatFile(int sampleRate, std::string &strMeasurementID, int iChan
|
||||
Json::FastWriter WaveValue;
|
||||
std::string WaveData = WaveValue.write(valWaveData);
|
||||
|
||||
char selectCon[128] = {0},whereCon[128] = {0};
|
||||
char selectCon[128] = {0},whereCon[1024] = {0};
|
||||
sprintf(selectCon, "channelID='%s' ORDER BY timeStamp ASC LIMIT 0,1", strChannelID.c_str());
|
||||
std::string strTime = sqlite_db_ctrl::instance().GetData("t_data_waveSend", "timeStamp", selectCon);
|
||||
long lTime = atol(nowTimetamp.c_str()) - atol(strTime.c_str());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user