downloadJson(): continue update-process even when downloading of some JSON file fails.
This commit is contained in:
parent
a7d5a8f5cd
commit
9d9865e3c7
@ -394,7 +394,6 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
int templateIdx,
|
||||
QString jsFileToSendToDC) const {
|
||||
|
||||
bool ret = false;
|
||||
if (m_hw) {
|
||||
m_hw->dc_autoRequest(true); // downloading Json needs the AutoEmission flag
|
||||
qDebug() << "SET AUTO-REQUEST=TRUE";
|
||||
@ -417,18 +416,21 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
}
|
||||
}
|
||||
|
||||
QString msg;
|
||||
lst.clear();
|
||||
if (ready) {
|
||||
QString msg;
|
||||
QFile file(jsFileToSendToDC);
|
||||
QFileInfo fi(jsFileToSendToDC); // max. size of template file is 800 bytes
|
||||
if (file.exists()) {
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
if (fi.size() > 0 && fi.size() <= 800) {
|
||||
QByteArray ba = file.readAll();
|
||||
|
||||
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
|
||||
// nrOfTemplate=1...32 if kindOfFile==6
|
||||
// content = content of the Json file, max 800byte ascii signs
|
||||
|
||||
// type == kindOfFile
|
||||
if (m_hw->sys_sendJsonFileToDc((uint8_t)(type),
|
||||
templateIdx,
|
||||
(uint8_t *)ba.data())) {
|
||||
@ -461,10 +463,15 @@ 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));
|
||||
}
|
||||
|
||||
ret = true;
|
||||
} else {
|
||||
msg = QString("ERROR SEND JSON-FILE %1 TO DC").arg(file.fileName());
|
||||
Utils::printCriticalErrorMsg(msg);
|
||||
@ -510,7 +517,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
QThread::sleep(1); // make sure the auto-request flag is acknowledged
|
||||
}
|
||||
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Update::updatePrinterTemplate(int templateIdx, QString jsFile) const {
|
||||
|
Loading…
Reference in New Issue
Block a user