2 Commits

View File

@@ -414,7 +414,7 @@ bool Update::downloadJson(enum FileTypeJson type,
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() <= 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
@@ -655,9 +655,14 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
QThread::sleep(2); QThread::sleep(2);
if (!m_hw->dcDownloadRunning()) { // may take some time int tries = 5;
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) while (!m_hw->dcDownloadRunning()) { // may take some time
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING"; if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING";
break;
}
QThread::sleep(1);
continue; continue;
} }
@@ -666,9 +671,13 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
QThread::sleep(2); QThread::sleep(2);
if (!m_hw->dcDownloadReportThreadStart()) { // may take some time tries = 5;
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) while (!m_hw->dcDownloadReportThreadStart()) { // may take some time
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED"; if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
break;
}
continue; continue;
} }
@@ -676,18 +685,29 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED"; << "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED";
QThread::sleep(2); QThread::sleep(2);
if (!m_hw->dcDownloadReportRunning()) { // may take some time
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) tries = 5;
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT NOT RUNNING"; while (!m_hw->dcDownloadReportRunning()) { // may take some time
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT NOT RUNNING";
break;
}
continue; continue;
} }
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING"; << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING";
tries = 1200;
while (m_hw->dcDownloadReportRunning()) { while (m_hw->dcDownloadReportRunning()) {
QThread::msleep(500); QThread::msleep(1000);
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__
<< ") DOWNLOAD REPORT STILL RUNNING AFTER 20mins";
break;
}
} }
bool updateBinaryRes = true; bool updateBinaryRes = true;