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