Files
StarPilot/selfdrive/ui/qt/request_repeater.cc
T
Dean Lee ee9280d9d3 HttpRequest: passing references in signals (#20782)
old-commit-hash: ad57cd37595919c84c7c8315222a1141d10993fa
2021-04-30 23:58:12 -07:00

14 lines
515 B
C++

#include "request_repeater.hpp"
RequestRepeater::RequestRepeater(QObject *parent, const 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);
}