add interface to clear sensor cfg.

This commit is contained in:
pandx 2024-11-08 14:39:09 +08:00
parent f0ade9888d
commit 3d732601df
2 changed files with 15 additions and 5 deletions

View File

@ -615,9 +615,19 @@ void SensorScheduler::ModifyScheduleTs(int diff_ts) {
out_file.close(); out_file.close();
} }
void SensorScheduler::ClearScheduleCfg() { void SensorScheduler::ClearScheduleCfg(int short_addr) {
zlog_warn(zbt, "[ClearScheduleCfg] clear all schedule config"); zlog_warn(zbt, "[ClearScheduleCfg] clear all schedule config");
if (short_addr == 0) {
update_.clear();
upgrade_.clear();
ShortAddrCfg::ClearCfg(); ShortAddrCfg::ClearCfg();
UpdateCfg::ClearCfg(); UpdateCfg::ClearCfg();
UpgradeCfg::ClearCfg(); UpgradeCfg::ClearCfg();
} else {
UpdateConfigResult(short_addr, 0);
UpgradeResult(short_addr, kUpgradeSuccess);
short_addr_map_.erase(short_addr);
ShortAddrCfg::WriteCfg(short_addr_map_);
}
} }

View File

@ -92,7 +92,7 @@ public:
void AdjustSupportModification(bool support_modification); void AdjustSupportModification(bool support_modification);
// ======schedule.json操作结束====== // ======schedule.json操作结束======
void ClearScheduleCfg(); void ClearScheduleCfg(int short_addr = 0);
long GetLocalTs(); long GetLocalTs();
long GetLocalWorldTime(std::string &world_time); long GetLocalWorldTime(std::string &world_time);