mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
OTA check working!
This commit is contained in:
parent
86dffbec3e
commit
1f539e6bf3
1 changed files with 14 additions and 14 deletions
|
@ -14,41 +14,41 @@ otaManager::otaManager(QWidget *parent) :
|
||||||
qDebug() << "Checking for available OTA update ...";
|
qDebug() << "Checking for available OTA update ...";
|
||||||
if(global::otaUpdate::downloadOta != true) {
|
if(global::otaUpdate::downloadOta != true) {
|
||||||
string_writeconfig("/opt/ibxd", "ota_update_check\n");
|
string_writeconfig("/opt/ibxd", "ota_update_check\n");
|
||||||
while(true) {
|
QTimer * otaCheckTimer = new QTimer(this);
|
||||||
|
otaCheckTimer->setInterval(100);
|
||||||
|
connect(otaCheckTimer, &QTimer::timeout, [&]() {
|
||||||
if(QFile::exists("/run/can_ota_update") == true) {
|
if(QFile::exists("/run/can_ota_update") == true) {
|
||||||
if(checkconfig("/run/can_ota_update") == true) {
|
if(checkconfig("/run/can_ota_update") == true) {
|
||||||
emit canOtaUpdate(true);
|
|
||||||
qDebug() << "OTA update is available!";
|
qDebug() << "OTA update is available!";
|
||||||
break;
|
emit canOtaUpdate(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
emit canOtaUpdate(false);
|
|
||||||
qDebug() << "No OTA update available.";
|
qDebug() << "No OTA update available.";
|
||||||
break;
|
emit canOtaUpdate(false);
|
||||||
}
|
}
|
||||||
|
otaManager::close();
|
||||||
}
|
}
|
||||||
}
|
} );
|
||||||
QThread::msleep(500);
|
otaCheckTimer->start();
|
||||||
otaManager::close();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string_writeconfig("/opt/ibxd", "ota_update_download\n");
|
string_writeconfig("/opt/ibxd", "ota_update_download\n");
|
||||||
while(true) {
|
QTimer * otaDownloadTimer = new QTimer(this);
|
||||||
|
otaDownloadTimer->setInterval(500);
|
||||||
|
connect(otaDownloadTimer, &QTimer::timeout, [&]() {
|
||||||
if(QFile::exists("/run/can_install_ota_update") == true) {
|
if(QFile::exists("/run/can_install_ota_update") == true) {
|
||||||
if(checkconfig("/run/can_install_ota_update") == true) {
|
if(checkconfig("/run/can_install_ota_update") == true) {
|
||||||
emit downloadedOta(true);
|
emit downloadedOta(true);
|
||||||
global::otaUpdate::downloadOta = false;
|
global::otaUpdate::downloadOta = false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
emit downloadedOta(false);
|
emit downloadedOta(false);
|
||||||
global::otaUpdate::downloadOta = false;
|
global::otaUpdate::downloadOta = false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
otaManager::close();
|
||||||
}
|
}
|
||||||
}
|
} );
|
||||||
QThread::msleep(500);
|
otaDownloadTimer->start();
|
||||||
otaManager::close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue