Merge branch 'dg101_refine_schedule' of http://192.168.0.10:3000/pandx/WLG into dg101_refine_schedule
This commit is contained in:
commit
bb5db3ba21
@ -5,7 +5,7 @@
|
|||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1102353172776392420" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1289772839912558009" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1102351351620288196" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1289773380490434009" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|||||||
@ -57,8 +57,8 @@ public :
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define SAVE_COUNT 4800*4
|
#define SAVE_COUNT 6048
|
||||||
#define OneWeek 604800*7
|
#define OneWeek 86400 * 7
|
||||||
|
|
||||||
|
|
||||||
//按8 取整
|
//按8 取整
|
||||||
|
|||||||
@ -338,12 +338,13 @@ struct Param_61 {
|
|||||||
Param_61() : mMode(0),MeasurementID(""),straxis(""),mPackageFlag(0){};
|
Param_61() : mMode(0),MeasurementID(""),straxis(""),mPackageFlag(0){};
|
||||||
};
|
};
|
||||||
struct Param_62 {
|
struct Param_62 {
|
||||||
|
int mMode;
|
||||||
std::string MeasurementID;
|
std::string MeasurementID;
|
||||||
std::string straxis;
|
std::string straxis;
|
||||||
std::string timeStart;
|
std::string timeStart;
|
||||||
std::string timeEnd;
|
std::string timeEnd;
|
||||||
int mPackageFlag;
|
int mPackageFlag;
|
||||||
Param_62() : MeasurementID(""),straxis(""),timeStart(""),timeEnd(""),mPackageFlag(0){};
|
Param_62() : mMode(0),MeasurementID(""),straxis(""),timeStart(""),timeEnd(""),mPackageFlag(0){};
|
||||||
};
|
};
|
||||||
struct Param_63 {
|
struct Param_63 {
|
||||||
|
|
||||||
|
|||||||
@ -897,14 +897,29 @@ std::string JsonData::JsonCmd_Cgi_62(Param_62 ¶m){
|
|||||||
vec_t vetRes = sqlite_db_ctrl::instance().GetDataMultiLineOfOneColumn(T_SENSOR_INFO(TNAME), T_SENSOR_INFO(DATANODENO), NULL);
|
vec_t vetRes = sqlite_db_ctrl::instance().GetDataMultiLineOfOneColumn(T_SENSOR_INFO(TNAME), T_SENSOR_INFO(DATANODENO), NULL);
|
||||||
int nSize = vetRes.size();
|
int nSize = vetRes.size();
|
||||||
if (nSize > 0) {
|
if (nSize > 0) {
|
||||||
char szTableName[100] = {0x00}, whereCon[256] = {0x00};
|
char szTableName[100] = {0x00}, whereCon[256] = {0x00},selectCon[100] = {0x00};
|
||||||
sprintf(szTableName, " receive_wave_status ");
|
if (param.mMode == 1){
|
||||||
|
sprintf(selectCon," dataNodeNo,channelID,timeStamp,sendMsg,nodeResend ");
|
||||||
|
sprintf(szTableName,"t_data_%s",param.MeasurementID.c_str());
|
||||||
|
}else{
|
||||||
|
sprintf(selectCon," * ");
|
||||||
|
sprintf(szTableName, " receive_wave_status ");
|
||||||
|
}
|
||||||
|
|
||||||
if(param.straxis == "")
|
if(param.straxis == ""){
|
||||||
sprintf(whereCon, " data_nodeno like '%%%s%%' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
if (param.mMode == 1){
|
||||||
else
|
sprintf(whereCon, " channelID like '%%%s%%' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(), param.timeEnd.c_str(), param.timeStart.c_str());
|
||||||
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());
|
}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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (param.mMode == 1){
|
||||||
|
sprintf(whereCon, " channelID = '%s-%s' and timeStamp < '%s' and timeStamp > '%s' ", param.MeasurementID.c_str(),param.straxis.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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int rows = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
int rows = sqlite_db_ctrl::instance().GetTableRows(szTableName, whereCon);
|
||||||
int packgeNo = param.mPackageFlag;
|
int packgeNo = param.mPackageFlag;
|
||||||
@ -935,13 +950,21 @@ std::string JsonData::JsonCmd_Cgi_62(Param_62 ¶m){
|
|||||||
memset(whereCon, 0x00, sizeof(whereCon));
|
memset(whereCon, 0x00, sizeof(whereCon));
|
||||||
if(param.straxis == "")
|
if(param.straxis == "")
|
||||||
{
|
{
|
||||||
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);
|
if (param.mMode == 1){
|
||||||
|
sprintf(whereCon, " channelID 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);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
}else{
|
}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);
|
if (param.mMode == 1){
|
||||||
|
sprintf(whereCon, " channelID = '%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);
|
||||||
|
}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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
array_t vecRes;
|
array_t vecRes;
|
||||||
|
|
||||||
vecRes = sqlite_db_ctrl::instance().GetDataMultiLine(szTableName, "*", whereCon);
|
vecRes = sqlite_db_ctrl::instance().GetDataMultiLine(szTableName, selectCon, whereCon);
|
||||||
zlog_info(zct, "vecRes = %d", vecRes.size());
|
zlog_info(zct, "vecRes = %d", vecRes.size());
|
||||||
if (vecRes.size() > 0) {
|
if (vecRes.size() > 0) {
|
||||||
Json::Value jsStaticData;
|
Json::Value jsStaticData;
|
||||||
|
|||||||
@ -431,6 +431,7 @@ std::string LocalServer::HandleCgi_cmd(std::string &pData) {
|
|||||||
case kWaveReceive:{
|
case kWaveReceive:{
|
||||||
JsonData jd;
|
JsonData jd;
|
||||||
Param_62 param;
|
Param_62 param;
|
||||||
|
param.mMode = recvBody["type"].asInt();
|
||||||
param.mPackageFlag = recvBody["package"].asInt();
|
param.mPackageFlag = recvBody["package"].asInt();
|
||||||
param.timeStart = recvBody["timeStart"].asString();
|
param.timeStart = recvBody["timeStart"].asString();
|
||||||
param.timeEnd = recvBody["timeEnd"].asString();
|
param.timeEnd = recvBody["timeEnd"].asString();
|
||||||
|
|||||||
@ -14,7 +14,7 @@ int GlobalConfig::LinkStatus_G = 0;
|
|||||||
int GlobalConfig::LinkCount = 0;
|
int GlobalConfig::LinkCount = 0;
|
||||||
int GlobalConfig::net0Status = 1;
|
int GlobalConfig::net0Status = 1;
|
||||||
|
|
||||||
std::string GlobalConfig::Version = "5.3";
|
std::string GlobalConfig::Version = "5.4";
|
||||||
std::string GlobalConfig::MacAddr_G = "";
|
std::string GlobalConfig::MacAddr_G = "";
|
||||||
std::string GlobalConfig::MacAddr_G2 = "";
|
std::string GlobalConfig::MacAddr_G2 = "";
|
||||||
std::string GlobalConfig::IpAddr_G = "";
|
std::string GlobalConfig::IpAddr_G = "";
|
||||||
|
|||||||
@ -394,7 +394,7 @@ SensorScheduler::SensorScheduler() {
|
|||||||
UpdateCfg::ReadCfg(update_);
|
UpdateCfg::ReadCfg(update_);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SensorScheduler::WaveError(int short_addr) {
|
int SensorScheduler::WaveError(uint16_t short_addr) {
|
||||||
auto iter = failure_map_.find(short_addr);
|
auto iter = failure_map_.find(short_addr);
|
||||||
if (iter == failure_map_.end()) {
|
if (iter == failure_map_.end()) {
|
||||||
failure_map_[short_addr] = 3; // 重试次数
|
failure_map_[short_addr] = 3; // 重试次数
|
||||||
@ -427,7 +427,7 @@ bool SensorScheduler::MissedWave(uint16_t short_addr) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SensorScheduler::WaveSuccess(int short_addr) {
|
void SensorScheduler::WaveSuccess(uint16_t short_addr) {
|
||||||
success_set_.insert(short_addr);
|
success_set_.insert(short_addr);
|
||||||
auto iter = failure_map_.find(short_addr);
|
auto iter = failure_map_.find(short_addr);
|
||||||
if (iter != failure_map_.end()) {
|
if (iter != failure_map_.end()) {
|
||||||
|
|||||||
@ -41,8 +41,8 @@ public:
|
|||||||
int StartSchedule(int short_addr, int &next_duration);
|
int StartSchedule(int short_addr, int &next_duration);
|
||||||
int GetNextDuration(int short_addr);
|
int GetNextDuration(int short_addr);
|
||||||
|
|
||||||
int WaveError(int short_addr);
|
int WaveError(uint16_t short_addr);
|
||||||
void WaveSuccess(int short_addr);
|
void WaveSuccess(uint16_t short_addr);
|
||||||
long GetBaseTimestamp(int id);
|
long GetBaseTimestamp(int id);
|
||||||
long CalcNextTimestamp(int id, uint16_t short_addr);
|
long CalcNextTimestamp(int id, uint16_t short_addr);
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
|||||||
ret = read_data(fd, buff, BUF_LENGTH, 10);
|
ret = read_data(fd, buff, BUF_LENGTH, 10);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
timeoutflag++;
|
timeoutflag++;
|
||||||
if (timeoutflag > 300) {
|
if (timeoutflag > 500) {
|
||||||
DealReviveDuration(wave_shortAddr);
|
DealReviveDuration(wave_shortAddr);
|
||||||
zlog_warn(zct, "===============0x9999 timeout= %d offSize = %d===============shortAddr = %02x%02x", timeoutflag, offSize,UINT16_HIGH(wave_shortAddr),UINT16_LOW(wave_shortAddr));
|
zlog_warn(zct, "===============0x9999 timeout= %d offSize = %d===============shortAddr = %02x%02x", timeoutflag, offSize,UINT16_HIGH(wave_shortAddr),UINT16_LOW(wave_shortAddr));
|
||||||
zlog_warn(zct, "0x9999 timeout %d===============Size = %d", timeoutflag, offSize);
|
zlog_warn(zct, "0x9999 timeout %d===============Size = %d", timeoutflag, offSize);
|
||||||
@ -59,13 +59,12 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
|||||||
mssleep(10000);
|
mssleep(10000);
|
||||||
wave_trans_ = true;
|
wave_trans_ = true;
|
||||||
memset(mUartRecvTmpBuf, 0, BUF_LENGTH);
|
memset(mUartRecvTmpBuf, 0, BUF_LENGTH);
|
||||||
zlog_warn(zct, "wave end");
|
zlog_warn(zct, "wave end,now_task = %d", now_task);
|
||||||
}
|
}
|
||||||
mssleep(10000);
|
mssleep(10000);
|
||||||
} else if (ret > 0) {
|
} else if (ret > 0) {
|
||||||
maxSize += ret;
|
maxSize += ret;
|
||||||
timeoutflag = 0;
|
timeoutflag = 0;
|
||||||
m_TimeStamp = 0;
|
|
||||||
memcpy(mUartRecvTmpBuf + offSize, buff, ret);
|
memcpy(mUartRecvTmpBuf + offSize, buff, ret);
|
||||||
offSize = offSize + ret;
|
offSize = offSize + ret;
|
||||||
if (offSize > BUF_LENGTH * 15) {
|
if (offSize > BUF_LENGTH * 15) {
|
||||||
@ -99,7 +98,6 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
|||||||
|
|
||||||
Uart::Uart() : mUart(mIoSev), mStrand(mIoSev) {
|
Uart::Uart() : mUart(mIoSev), mStrand(mIoSev) {
|
||||||
mRdLength = 0;
|
mRdLength = 0;
|
||||||
m_TimeStamp = 0;
|
|
||||||
mlastSize = 0;
|
mlastSize = 0;
|
||||||
fd = 0;
|
fd = 0;
|
||||||
waittime = 0;
|
waittime = 0;
|
||||||
@ -1021,8 +1019,11 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
|||||||
memset(mUartRecvTmpBuf, 0x00, sizeof(mUartRecvTmpBuf));
|
memset(mUartRecvTmpBuf, 0x00, sizeof(mUartRecvTmpBuf));
|
||||||
}
|
}
|
||||||
memcpy(UartRecvBuf + mlastSize, mUartRecvBuf, bytesRead);
|
memcpy(UartRecvBuf + mlastSize, mUartRecvBuf, bytesRead);
|
||||||
|
bool wave_error_x = false;
|
||||||
|
bool wave_error_y = false;
|
||||||
|
bool wave_error_z = false;
|
||||||
bytesRead = bytesRead + mlastSize;
|
bytesRead = bytesRead + mlastSize;
|
||||||
|
|
||||||
for (int i = 0; i < bytesRead; i++) {
|
for (int i = 0; i < bytesRead; i++) {
|
||||||
if (UartRecvBuf[i] == head[0]) {
|
if (UartRecvBuf[i] == head[0]) {
|
||||||
char buf[12] = {0x00};
|
char buf[12] = {0x00};
|
||||||
@ -1035,18 +1036,33 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
|||||||
char buf[8] = {0x00};
|
char buf[8] = {0x00};
|
||||||
sprintf(buf, "%02d", UartRecvBuf[i + 5]);
|
sprintf(buf, "%02d", UartRecvBuf[i + 5]);
|
||||||
int command = atoi(buf);
|
int command = atoi(buf);
|
||||||
//zlog_info(zct, "command = %d ShortAddr :%s", command, strShortAddr.c_str());
|
if (wave_error_x && !wave_error_y && !wave_error_z && command == WAVE_X)
|
||||||
if ((mPackgeIndex == -1 || (unsigned int)UartRecvBuf[i + 6] == 0) && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z) ) {
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ((wave_error_x || wave_error_y) && !wave_error_z && command == WAVE_Y)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( wave_error_z && command == WAVE_Z)
|
||||||
|
{
|
||||||
|
m_waveCountX = 0;
|
||||||
|
m_waveCountY = 0;
|
||||||
|
m_waveCountZ = 0;
|
||||||
|
g_VecWaveDataX.clear();
|
||||||
|
g_VecWaveDataY.clear();
|
||||||
|
g_VecWaveDataZ.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((mPackgeIndex == -1 || (unsigned int)UartRecvBuf[i + 6] == 0) && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z) && now_task == WAVE_CMD) {
|
||||||
mPackgeIndex = UartRecvBuf[i + 6] & 0xFF;
|
mPackgeIndex = UartRecvBuf[i + 6] & 0xFF;
|
||||||
} else if ((unsigned int)mPackgeIndex == (unsigned int)UartRecvBuf[i + 6] && mPackgeIndex != -1 && command != 2 && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z)) {
|
} else if ((unsigned int)mPackgeIndex == (unsigned int)UartRecvBuf[i + 6] && mPackgeIndex != -1 && command != 2 && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z) && now_task == WAVE_CMD) {
|
||||||
zlog_warn(zct, "mPackgeIndex same index1:%d,index2:%02d ShortAddr :%s ", mPackgeIndex, UartRecvBuf[i + 6] & 0xff, strShortAddr.c_str());
|
zlog_warn(zct, "mPackgeIndex same index1:%d,index2:%02d ShortAddr :%s ", mPackgeIndex, UartRecvBuf[i + 6] & 0xff, strShortAddr.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if ((unsigned int)mPackgeIndex + 1 != (unsigned int)UartRecvBuf[i + 6] && mPackgeIndex != -1 && command != 2 && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z)) {
|
} else if ((unsigned int)mPackgeIndex + 1 != (unsigned int)UartRecvBuf[i + 6] && mPackgeIndex != -1 && command != 2 && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z) && now_task == WAVE_CMD) {
|
||||||
m_TimeStamp = 0;
|
|
||||||
|
|
||||||
zlog_warn(zct, "mPackgeIndex error index1:%d,index2:%02d ShortAddr :%s ", mPackgeIndex, UartRecvBuf[i + 6] & 0xff, strShortAddr.c_str());
|
zlog_warn(zct, "mPackgeIndex error index1:%d,index2:%02d ShortAddr :%s ,now_task = %d", mPackgeIndex, UartRecvBuf[i + 6] & 0xff, strShortAddr.c_str(),now_task);
|
||||||
mPackgeIndex = -1;
|
|
||||||
zlog_warn(zct, "mPackgeIndex error ShortAddr :%s", strShortAddr.c_str());
|
zlog_warn(zct, "mPackgeIndex error ShortAddr :%s", strShortAddr.c_str());
|
||||||
|
|
||||||
char tmp[10] = {0x00};
|
char tmp[10] = {0x00};
|
||||||
@ -1056,7 +1072,6 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
|||||||
strcat(tmp2, tmp);
|
strcat(tmp2, tmp);
|
||||||
}
|
}
|
||||||
zlog_warn(zct, "error str = %s", tmp2);
|
zlog_warn(zct, "error str = %s", tmp2);
|
||||||
|
|
||||||
char insertSql[100] = {0x00};
|
char insertSql[100] = {0x00};
|
||||||
char whereCon[50] = {0x00};
|
char whereCon[50] = {0x00};
|
||||||
std::string error_msg = "";
|
std::string error_msg = "";
|
||||||
@ -1067,26 +1082,29 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
|||||||
if (command == WAVE_X){
|
if (command == WAVE_X){
|
||||||
error_msg = "Index error,wave X";
|
error_msg = "Index error,wave X";
|
||||||
strChannelID = strMeasurementID + "-X";
|
strChannelID = strMeasurementID + "-X";
|
||||||
|
wave_error_x = true;
|
||||||
}else if (command == WAVE_Y){
|
}else if (command == WAVE_Y){
|
||||||
error_msg = "Index error,wave Y";
|
error_msg = "Index error,wave Y";
|
||||||
strChannelID = strMeasurementID + "-Y";
|
strChannelID = strMeasurementID + "-Y";
|
||||||
|
wave_error_y = true;
|
||||||
}else if (command == WAVE_Z){
|
}else if (command == WAVE_Z){
|
||||||
error_msg = "Index error,wave Z";
|
error_msg = "Index error,wave Z";
|
||||||
strChannelID = strMeasurementID + "-Z";
|
strChannelID = strMeasurementID + "-Z";
|
||||||
|
wave_error_z = true;
|
||||||
}
|
}
|
||||||
|
if(scheduler::instance().WaveError(wave_shortAddr) < 0){
|
||||||
sprintf(insertSql, "'%s','%s','%s',%d,'%d','%s' ", strChannelID.c_str(),strShortAddr.c_str(),localtimestamp,bytesRead,0,error_msg.c_str());
|
zlog_error(zct, "WaveError error ShortAddr :%s", strShortAddr.c_str());
|
||||||
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
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;
|
JsonData jd;
|
||||||
jd.JsonCmd_32(strMeasurementID,1,1,strChannelID,error_msg);
|
jd.JsonCmd_32(strMeasurementID,1,1,strChannelID,error_msg);
|
||||||
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (now_task == WAVE_CMD && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z)) {
|
if (now_task == WAVE_CMD && (command == WAVE_X || command == WAVE_Y || command == WAVE_Z)) {
|
||||||
if (!CheckCrc(&UartRecvBuf[i], 99)) {
|
if (!CheckCrc(&UartRecvBuf[i], 99)) {
|
||||||
m_TimeStamp = 0;
|
|
||||||
mPackgeIndex = -1;
|
|
||||||
zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d", strShortAddr.c_str(), command);
|
zlog_warn(zct, "CheckCrc error ShortAddr :%s command = %d", strShortAddr.c_str(), command);
|
||||||
char tmp[10] = {0x00};
|
char tmp[10] = {0x00};
|
||||||
char tmp2[10] = {0x00};
|
char tmp2[10] = {0x00};
|
||||||
@ -1095,12 +1113,7 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
|||||||
strcat(tmp2, tmp);
|
strcat(tmp2, tmp);
|
||||||
}
|
}
|
||||||
zlog_error(zct, "error str = %s", tmp2);
|
zlog_error(zct, "error str = %s", tmp2);
|
||||||
m_waveCountX = 0;
|
|
||||||
m_waveCountY = 0;
|
|
||||||
m_waveCountZ = 0;
|
|
||||||
g_VecWaveDataX.clear();
|
|
||||||
g_VecWaveDataY.clear();
|
|
||||||
g_VecWaveDataZ.clear();
|
|
||||||
char insertSql[100] = {0x00};
|
char insertSql[100] = {0x00};
|
||||||
char whereCon[50] = {0x00};
|
char whereCon[50] = {0x00};
|
||||||
std::string error_msg = "";
|
std::string error_msg = "";
|
||||||
@ -1111,19 +1124,24 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
|||||||
if (command == WAVE_X){
|
if (command == WAVE_X){
|
||||||
error_msg = "Crc error,wave X";
|
error_msg = "Crc error,wave X";
|
||||||
strChannelID = strMeasurementID + "-X";
|
strChannelID = strMeasurementID + "-X";
|
||||||
|
wave_error_x = true;
|
||||||
}else if (command == WAVE_Y){
|
}else if (command == WAVE_Y){
|
||||||
error_msg = "Crc error,wave Y";
|
error_msg = "Crc error,wave Y";
|
||||||
strChannelID = strMeasurementID + "-Y";
|
strChannelID = strMeasurementID + "-Y";
|
||||||
|
wave_error_y = true;
|
||||||
}else if (command == WAVE_Z){
|
}else if (command == WAVE_Z){
|
||||||
error_msg = "Crc error,wave Z";
|
error_msg = "Crc error,wave Z";
|
||||||
strChannelID = strMeasurementID + "-Z";
|
strChannelID = strMeasurementID + "-Z";
|
||||||
|
wave_error_z = true;
|
||||||
|
}
|
||||||
|
if(scheduler::instance().WaveError(wave_shortAddr) < 0){
|
||||||
|
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());
|
||||||
|
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||||
}
|
}
|
||||||
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;
|
JsonData jd;
|
||||||
jd.JsonCmd_32(strMeasurementID,1,1,strChannelID,error_msg);
|
jd.JsonCmd_32(strMeasurementID,1,1,strChannelID,error_msg);
|
||||||
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
mlastSize = 0;
|
mlastSize = 0;
|
||||||
lastSize = bytesRead - i;
|
lastSize = bytesRead - i;
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "mqttclient/mqtt_client.h"
|
#include "mqttclient/mqtt_client.h"
|
||||||
#include "minilzo/minilzo.h"
|
#include "minilzo/minilzo.h"
|
||||||
#include "jsonparse/communication_cmd.hpp"
|
#include "jsonparse/communication_cmd.hpp"
|
||||||
|
#include "scheduler/schedule.hpp"
|
||||||
|
|
||||||
extern zlog_category_t *zct;
|
extern zlog_category_t *zct;
|
||||||
extern zlog_category_t *zbt;
|
extern zlog_category_t *zbt;
|
||||||
@ -802,7 +803,11 @@ void Uart::DealWave() {
|
|||||||
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);
|
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
|
||||||
}
|
}
|
||||||
|
scheduler::instance().WaveSuccess(wave_shortAddr);
|
||||||
|
}else{
|
||||||
|
if(scheduler::instance().WaveError(wave_shortAddr) < 0){
|
||||||
|
zlog_error(zct, "wave size is 0,shortAddr %02x%02x", (wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ran = "";
|
std::string ran = "";
|
||||||
@ -847,8 +852,6 @@ void Uart::DealWave() {
|
|||||||
g_VecWaveDataZ.clear();
|
g_VecWaveDataZ.clear();
|
||||||
VecWaveDataZ.clear();
|
VecWaveDataZ.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wave_trans_ = false;
|
wave_trans_ = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user