doUpdate()/downloadJson(): send messages to ISMAS of the download
process of JSON files (DC2C_cash.json etc).
This commit is contained in:
parent
55c82eb509
commit
ee203e7672
@ -410,7 +410,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
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));
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -463,22 +463,20 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
*/
|
||||
|
||||
if (m_worker) {
|
||||
if (templateIdx >= 1 && templateIdx <= 32) {
|
||||
msg = QString("SUCCESSFULLY LOADED %1 (INDEX=%2) TO DC").arg(file.fileName()).arg(templateIdx);
|
||||
} else {
|
||||
msg = QString("SUCCESSFULLY LOADED %1 (KIND=%2) TO DC").arg(file.fileName()).arg((uint8_t)type);
|
||||
}
|
||||
lst.clear();
|
||||
lst << msg;
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
|
||||
if (templateIdx >= 1 && templateIdx <= 32) {
|
||||
lst << QString("LOADED %1 (%2) TO DC").arg(fi.fileName()).arg(templateIdx);
|
||||
} else {
|
||||
lst << QString("LOADED %1 (%2) TO DC").arg(fi.fileName()).arg((uint8_t)type);
|
||||
}
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE));
|
||||
}
|
||||
} 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));
|
||||
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -486,8 +484,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
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));
|
||||
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -496,8 +493,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
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));
|
||||
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -506,8 +502,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
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));
|
||||
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -956,46 +951,59 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
res = false;
|
||||
} else {
|
||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||
Utils::printInfoMsg(
|
||||
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||
.arg(fToWorkOn)
|
||||
.arg(templateIdx));
|
||||
if (m_worker) {
|
||||
QStringList lst(QString("DL:%1 (%2)").arg(QFileInfo(fToWorkOn).fileName()).arg(templateIdx));
|
||||
m_worker->ISMAS(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_JSON_FILE_SUCCESS);
|
||||
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res = updateCashConf(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
|
||||
if (m_worker) {
|
||||
QStringList lst(QString("DL:%1").arg(QFileInfo(fToWorkOn).fileName()));
|
||||
m_worker->ISMAS(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_CASH_FILE_SUCCESS);
|
||||
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res= updateConfig(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED CONFIG TEMPLATE %1").arg(fToWorkOn));
|
||||
if (m_worker) {
|
||||
QStringList lst(QString("DL:%1").arg(QFileInfo(fToWorkOn).fileName()));
|
||||
m_worker->ISMAS(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS);
|
||||
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res = updateDeviceConf(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED DEVICE TEMPLATE %1").arg(fToWorkOn));
|
||||
if (m_worker) {
|
||||
QStringList lst(QString("DL:%1").arg(QFileInfo(fToWorkOn).fileName()));
|
||||
m_worker->ISMAS(lst) << (m_worker->CONSOLE(lst) << Worker::UPDATE_STEP::DOWNLOAD_DEVICE_FILE_SUCCESS);
|
||||
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||
res = false;
|
||||
|
Loading…
Reference in New Issue
Block a user