diff --git a/UpdatePTUDevCtrl/update.cpp b/UpdatePTUDevCtrl/update.cpp index 298aa00..5215944 100644 --- a/UpdatePTUDevCtrl/update.cpp +++ b/UpdatePTUDevCtrl/update.cpp @@ -400,17 +400,26 @@ bool Update::downloadJson(enum FileTypeJson type, qDebug() << "SET AUTO-REQUEST=TRUE"; QThread::sleep(1); // make sure the auto-request flag is acknowledged + QStringList lst; bool ready = false; int nTry = 25; while ((ready = m_hw->sys_ready4sending()) == false) { QThread::msleep(200); 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; } } bool ret = false; + QString msg; + lst.clear(); if (ready) { QFile file(jsFileToSendToDC); 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(':'); */ + 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; + } 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 { - Utils::printCriticalErrorMsg( - QString("SIZE OF %1 TOO BIG (%2 BYTES)") - .arg(jsFileToSendToDC).arg(fi.size())); + msg = QString("SIZE OF %1 TOO BIG (%2 BYTES)").arg(jsFileToSendToDC).arg(fi.size()); + 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 { - Utils::printCriticalErrorMsg( - QString("CAN NOT OPEN ") + jsFileToSendToDC + " FOR READING"); + msg = 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 { - Utils::printCriticalErrorMsg( - QString(jsFileToSendToDC) + " DOES NOT EXIST"); + msg = 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)); + } } }