Files
StarPilot/selfdrive/ui/qt/request_repeater.cc
T
Adeeb Shihadeh b263a8d934 UI: refactor GLWindow (#20764)
old-commit-hash: 140e6248e26cfa370ccdb13fda8edc4fae0321ca
2021-04-29 11:18:59 -07:00

14 lines
508 B
C++

#include "request_repeater.hpp"
RequestRepeater::RequestRepeater(QObject *parent, QString requestURL, const QString &cacheKey,
int period) : HttpRequest(parent, requestURL, cacheKey) {
timer = new QTimer(this);
timer->setTimerType(Qt::VeryCoarseTimer);
QObject::connect(timer, &QTimer::timeout, [=](){
if (!QUIState::ui_state.scene.started && QUIState::ui_state.awake && reply == NULL) {
sendRequest(requestURL);
}
});
timer->start(period * 1000);
}