downLoadJson(): add more debug-output (visible in ISMAS as well)

to see what actuelly went wrong when downloading json-Files.
This commit is contained in:
Gerhard Hoffmann 2024-04-09 14:51:54 +02:00
parent 31bc2d0fa2
commit 8d18ae10fe

View File

@ -400,17 +400,26 @@ bool Update::downloadJson(enum FileTypeJson type,
qDebug() << "SET AUTO-REQUEST=TRUE"; qDebug() << "SET AUTO-REQUEST=TRUE";
QThread::sleep(1); // make sure the auto-request flag is acknowledged QThread::sleep(1); // make sure the auto-request flag is acknowledged
QStringList lst;
bool ready = false; bool ready = false;
int nTry = 25; int nTry = 25;
while ((ready = m_hw->sys_ready4sending()) == false) { while ((ready = m_hw->sys_ready4sending()) == false) {
QThread::msleep(200); QThread::msleep(200);
if (--nTry <= 0) { if (--nTry <= 0) {
Utils::printCriticalErrorMsg("SYS NOT READY FOR SENDING AFTER 5 SECONDS"); QString msg("SYS NOT READY FOR SENDING AFTER 5 SECONDS");
Utils::printCriticalErrorMsg(msg);
lst << msg;
if (m_worker) {
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
}
break; break;
} }
} }
bool ret = false; bool ret = false;
QString msg;
lst.clear();
if (ready) { if (ready) {
QFile file(jsFileToSendToDC); QFile file(jsFileToSendToDC);
QFileInfo fi(jsFileToSendToDC); // max. size of template file is 800 bytes QFileInfo fi(jsFileToSendToDC); // max. size of template file is 800 bytes
@ -452,20 +461,48 @@ bool Update::downloadJson(enum FileTypeJson type,
qCritical() << length << "MACHINE ID =" << ba.toHex(':'); qCritical() << length << "MACHINE ID =" << ba.toHex(':');
*/ */
if (m_worker) {
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
}
ret = true; ret = true;
} else {
msg = QString("ERROR SEND JSON-FILE %1 TO DC").arg(file.fileName());
Utils::printCriticalErrorMsg(msg);
lst << msg;
if (m_worker) {
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
<< Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
}
} }
} else { } else {
Utils::printCriticalErrorMsg( msg = QString("SIZE OF %1 TOO BIG (%2 BYTES)").arg(jsFileToSendToDC).arg(fi.size());
QString("SIZE OF %1 TOO BIG (%2 BYTES)") Utils::printCriticalErrorMsg(msg);
.arg(jsFileToSendToDC).arg(fi.size())); lst << msg;
if (m_worker) {
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
<< Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
}
} }
} else { } else {
Utils::printCriticalErrorMsg( msg = QString("CAN NOT OPEN ") + jsFileToSendToDC + " FOR READING";
QString("CAN NOT OPEN ") + jsFileToSendToDC + " FOR READING"); Utils::printCriticalErrorMsg(msg);
lst << msg;
if (m_worker) {
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
<< Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
}
} }
} else { } else {
Utils::printCriticalErrorMsg( msg = QString(jsFileToSendToDC) + " DOES NOT EXIST";
QString(jsFileToSendToDC) + " DOES NOT EXIST"); Utils::printCriticalErrorMsg(msg);
lst << msg;
if (m_worker) {
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
<< Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
}
} }
} }