replay: support old, pre-pandaStates routes (#22525)

* replay: support old, pre-pandaStates routes

* cleanup
old-commit-hash: f1fcf17c4c
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent 02afe84c53
commit 6472b5b6c9
  1. 14
      selfdrive/ui/replay/replay.cc

@ -236,6 +236,15 @@ void Replay::stream() {
} }
setCurrentSegment(current_ts / 60); setCurrentSegment(current_ts / 60);
// migration for pandaState -> pandaStates to keep UI working for old segments
if (cur_which == cereal::Event::Which::PANDA_STATE_D_E_P_R_E_C_A_T_E_D) {
MessageBuilder msg;
auto ps = msg.initEvent().initPandaStates(1);
ps[0].setIgnitionLine(true);
ps[0].setPandaType(cereal::PandaState::PandaType::DOS);
pm->send(sockets_[cereal::Event::Which::PANDA_STATES], msg);
}
if (cur_which < sockets_.size() && sockets_[cur_which] != nullptr) { if (cur_which < sockets_.size() && sockets_[cur_which] != nullptr) {
// keep time // keep time
long etime = cur_mono_time_ - evt_start_ts; long etime = cur_mono_time_ - evt_start_ts;
@ -251,8 +260,9 @@ void Replay::stream() {
// publish msg // publish msg
if (sm == nullptr) { if (sm == nullptr) {
auto bytes = evt->bytes(); auto bytes = evt->bytes();
if (-1 == pm->send(sockets_[cur_which], (capnp::byte *)bytes.begin(), bytes.size())) { int ret = pm->send(sockets_[cur_which], (capnp::byte *)bytes.begin(), bytes.size());
qDebug() << "stop publish" << sockets_[cur_which] << "due to multiple publishers error"; if (ret == -1) {
qDebug() << "stop publishing" << sockets_[cur_which] << "due to multiple publishers error";
sockets_[cur_which] = nullptr; sockets_[cur_which] = nullptr;
} }
} else { } else {

Loading…
Cancel
Save