add interface.
This commit is contained in:
parent
fb313da3b0
commit
86da196047
@ -47,7 +47,7 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
|||||||
zlog_warn(zct, "[%d:%x] ts:%ld, current utc:%s, nth eigen_value slice:%d, seconds in eigen slice:%d, eigen slice:%d",
|
zlog_warn(zct, "[%d:%x] ts:%ld, current utc:%s, nth eigen_value slice:%d, seconds in eigen slice:%d, eigen slice:%d",
|
||||||
id, short_addr, current_ts_, GetUTCTime(current_ts_).c_str(), nth_eigen_value_slice_+1, seconds_in_current_eigen_slice_, ts_in_eigen_slice_);
|
id, short_addr, current_ts_, GetUTCTime(current_ts_).c_str(), nth_eigen_value_slice_+1, seconds_in_current_eigen_slice_, ts_in_eigen_slice_);
|
||||||
if (ts_in_eigen_slice_) {
|
if (ts_in_eigen_slice_) {
|
||||||
if (id == nth_eigen_slice_ + 1) {
|
// if (id == nth_eigen_slice_ + 1) {
|
||||||
// 传感器需要执行上送特征值任务, 如果有配置需要下发的话,下发配置
|
// 传感器需要执行上送特征值任务, 如果有配置需要下发的话,下发配置
|
||||||
if (update_.count(id)) {
|
if (update_.count(id)) {
|
||||||
// execute config
|
// execute config
|
||||||
@ -67,20 +67,20 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
|||||||
return kScheduleWrongTime;
|
return kScheduleWrongTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
// } else {
|
||||||
zlog_warn(zct, "[%d:%x] Invalid request, revive in %d eigen slice", id, short_addr, nth_eigen_slice_ + 1);
|
// zlog_warn(zct, "[%d:%x] Invalid request, revive in %d eigen slice", id, short_addr, nth_eigen_slice_ + 1);
|
||||||
if (id < nth_eigen_slice_ + 1) {
|
// if (id < nth_eigen_slice_ + 1) {
|
||||||
// 不正确的请求
|
// // 不正确的请求
|
||||||
long available_ts = current_wave_start_ts_ + (nth_eigen_value_slice_ + 1) * eigen_value_send_interval_ + (id - 1) * eigen_value_send_duration_;
|
// 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_;
|
// next_duration = available_ts - current_ts_;
|
||||||
zlog_warn(zct, "[%d:%x] wrong time in eigen slice, next feature in next interval send utc time:[%s], duration:%d", id, short_addr, GetUTCTime(available_ts).c_str(), next_duration);
|
// zlog_warn(zct, "[%d:%x] wrong time in eigen slice, next feature in next interval send utc time:[%s], duration:%d", id, short_addr, GetUTCTime(available_ts).c_str(), next_duration);
|
||||||
} else {
|
// } else {
|
||||||
long available_ts = current_wave_start_ts_ + nth_eigen_value_slice_ * eigen_value_send_interval_ + (id - 1) * eigen_value_send_duration_;
|
// long available_ts = current_wave_start_ts_ + nth_eigen_value_slice_ * eigen_value_send_interval_ + (id - 1) * eigen_value_send_duration_;
|
||||||
next_duration = available_ts - current_ts_;
|
// next_duration = available_ts - current_ts_;
|
||||||
zlog_warn(zct, "[%d:%x] wrong time in eigen slice, next feature in current interval send utc time:[%s], duration:%d", id, short_addr, GetUTCTime(available_ts).c_str(), next_duration);
|
// zlog_warn(zct, "[%d:%x] wrong time in eigen slice, next feature in current interval send utc time:[%s], duration:%d", id, short_addr, GetUTCTime(available_ts).c_str(), next_duration);
|
||||||
}
|
// }
|
||||||
return kScheduleWrongTime;
|
// return kScheduleWrongTime;
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
int nth_wave_slice = nth_eigen_value_slice_ * wave_slice_num_per_eigen_interval_ + nth_wave_slice_ + 1;
|
int nth_wave_slice = nth_eigen_value_slice_ * wave_slice_num_per_eigen_interval_ + nth_wave_slice_ + 1;
|
||||||
auto wave_slice_iter = sensor_id_nth_slice_.find(id);
|
auto wave_slice_iter = sensor_id_nth_slice_.find(id);
|
||||||
@ -103,12 +103,12 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_.count(id)) {
|
// if (update_.count(id)) {
|
||||||
// execute config
|
// // execute config
|
||||||
zlog_warn(zct, "[%d:%x] in wave slice to update config", id, short_addr);
|
// zlog_warn(zct, "[%d:%x] in wave slice to update config", id, short_addr);
|
||||||
current_request_ = kScheduleConfigSensor;
|
// current_request_ = kScheduleConfigSensor;
|
||||||
return kScheduleConfigSensor;
|
// return kScheduleConfigSensor;
|
||||||
}
|
// }
|
||||||
wave_feature_set_inst::instance().GetWaveCfg(short_addr, g_x, g_y, g_z);
|
wave_feature_set_inst::instance().GetWaveCfg(short_addr, g_x, g_y, g_z);
|
||||||
if (g_x || g_y || g_z) {
|
if (g_x || g_y || g_z) {
|
||||||
zlog_warn(zct, "[%d:%x] it is wave time", id, short_addr);
|
zlog_warn(zct, "[%d:%x] it is wave time", id, short_addr);
|
||||||
@ -135,12 +135,15 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_.count(id)) {
|
// if (retransfer_wave) {
|
||||||
// execute config
|
|
||||||
zlog_warn(zct, "[%d:%x] in idle time to update config", id, short_addr);
|
// }
|
||||||
current_request_ = kScheduleConfigSensor;
|
// if (update_.count(id)) {
|
||||||
return kScheduleConfigSensor;
|
// // execute config
|
||||||
}
|
// zlog_warn(zct, "[%d:%x] in idle time to update config", id, short_addr);
|
||||||
|
// current_request_ = kScheduleConfigSensor;
|
||||||
|
// return kScheduleConfigSensor;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
// wrong time to come
|
// 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_;
|
long available_ts = current_wave_start_ts_ + (nth_eigen_value_slice_ + 1) * eigen_value_send_interval_ + (id - 1) * eigen_value_send_duration_;
|
||||||
@ -326,6 +329,11 @@ SensorScheduler::SensorScheduler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SensorScheduler::WaveError(int short_addr) {
|
void SensorScheduler::WaveError(int short_addr) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SensorScheduler::WaveSuccess(int short_addr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,7 @@ public:
|
|||||||
int GetNextDuration(int short_addr);
|
int GetNextDuration(int short_addr);
|
||||||
|
|
||||||
void WaveError(int short_addr);
|
void WaveError(int short_addr);
|
||||||
|
void WaveSuccess(int 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);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user