Files
dragonpilot/selfdrive/ui/qt/request_repeater.cc
Dean Lee 81491dc57f c++ cleanup: standardize file extensions to .cc and .h (#20800)
* c++ cleanup: standardize file extensions to .cc and .h

* cleanup files_common
2021-05-03 11:53:11 +02:00

14 lines
513 B
C++

#include "request_repeater.h"
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);
}