sensor online bugs
This commit is contained in:
parent
6795be5515
commit
7e6c525181
@ -581,6 +581,7 @@ void Uart::DealDataNodeName(const char *pData) {
|
||||
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
||||
zlog_info(zct, "whereCon = %s", whereCon);
|
||||
array_t vecRes = sqlite_db_ctrl::instance().GetDataMultiLine(T_SENSOR_INFO(TNAME), " dataNodeNo, MeasurementID,hardVersion,softVersion", whereCon);
|
||||
zlog_info(zct, "vecRes = %d", vecRes.size());
|
||||
if (vecRes.size() > 1) {
|
||||
for (size_t i = 0; i < vecRes.size(); i++) {
|
||||
if (vecRes[i][1] != "") {
|
||||
@ -591,7 +592,6 @@ void Uart::DealDataNodeName(const char *pData) {
|
||||
sprintf(whereCon, "%s= '%s'", T_SENSOR_INFO(DATANODENO), vecRes[i][1].c_str());
|
||||
sqlite_db_ctrl::instance().DeleteTableData(T_DATA_INFO(TNAME), whereCon);
|
||||
sqlite_db_ctrl::instance().DeleteTableData(T_DATASTATIC_INFO(TNAME), whereCon);
|
||||
sqlite_db_ctrl::instance().DeleteTableData(T_DATANODE_TIME(TNAME), whereCon);
|
||||
sqlite_db_ctrl::instance().DeleteTableData(T_BATTERY_INFO(TNAME), whereCon);
|
||||
sqlite_db_ctrl::instance().DeleteTableData(" t_battery_history ", whereCon);
|
||||
memset(whereCon,0,sizeof(whereCon));
|
||||
@ -603,16 +603,23 @@ void Uart::DealDataNodeName(const char *pData) {
|
||||
memset(szTableName, 0x00, sizeof(szTableName));
|
||||
sprintf(szTableName, "DROP TABLE t_dataStatic_%s", vecRes[i][1].c_str());
|
||||
sqlite_db_ctrl::instance().CreateTable(szTableName);
|
||||
scheduler::instance().ClearScheduleCfg(atoi(szShortAdd));
|
||||
uint16_t short_addr;
|
||||
char *end_ptr = NULL;
|
||||
short_addr = strtol(szShortAdd, &end_ptr, 16);
|
||||
scheduler::instance().ClearScheduleCfg(short_addr);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
zlog_info(zct, "vecRes22 = %d", vecRes.size());
|
||||
zlog_info(zct, "hardVersion = %s,softVersion = %s", vecRes[0][2].c_str(),vecRes[0][3].c_str());
|
||||
std::string hardVersion = vecRes[0][2];
|
||||
std::string softVersion = vecRes[0][3];
|
||||
if ((hardVersion == "3.0" && compareVersions(softVersion, "3.6") == -1) || (hardVersion == "4.0" && compareVersions(softVersion, "4.6") == -1)|| (hardVersion == "1.0" && compareVersions(softVersion,"1.2") == -1)) {
|
||||
memcpy(MeasurementID, vecRes[0][0].c_str(), sizeof(MeasurementID));
|
||||
}
|
||||
memset(whereCon,0,sizeof(whereCon));
|
||||
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
||||
std::string strNodeName(NodeName);
|
||||
zlog_info(zct, "strNodeName = %s", strNodeName.c_str());
|
||||
solve(gbkNodeName, NodeName);
|
||||
|
||||
@ -50,7 +50,7 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) {
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
char insertSql[100] = {0};
|
||||
char wherecon[50] = {0};
|
||||
sprintf(wherecon," short_Addr = '%02x%02x' order by start_timestamp DESC",UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd));
|
||||
sprintf(wherecon," short_Addr = '%02x%02x' and status = 3 order by start_timestamp DESC",UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd));
|
||||
std::string spend_count = sqlite_db_ctrl::instance().GetData(" firmware_upgrade ","spend_count",wherecon);
|
||||
if (atoi(spend_count.c_str()) >= 10){
|
||||
zlog_warn(zbt, "UpdateWirelessNode spend_count %d,shortAddr = %02x%02x", atoi(spend_count.c_str()), UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user