Minor: Add debug messages or change debug message format.

This commit is contained in:
Gerhard Hoffmann 2023-10-06 10:47:08 +02:00
parent 7083f3b4f8
commit 30603317c6

View File

@ -610,9 +610,12 @@ bool Update::downloadJson(enum FileTypeJson type,
int templateIdx, int templateIdx,
QString jsFileToSendToDC) const { QString jsFileToSendToDC) const {
qDebug() << "updating json-file:" << jsFileToSendToDC << "...";
qDebug() << " template-index:" << templateIdx; Utils::printInfoMsg(
qDebug() << " json-type:" << jsonType(type); QString("UPDATING JSON-FILE=%1, TEMPLATE-INDEX=%2, JSON-TYPE=%3")
.arg(jsFileToSendToDC)
.arg(templateIdx)
.arg(jsonType(type)));
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";
@ -623,7 +626,7 @@ bool Update::downloadJson(enum FileTypeJson type,
while ((ready = m_hw->sys_ready4sending()) == false) { while ((ready = m_hw->sys_ready4sending()) == false) {
QThread::msleep(200); QThread::msleep(200);
if (--nTry <= 0) { if (--nTry <= 0) {
qCritical() << "SYS NOT READY FOR SENDING AFTER 5 SECONDS"; Utils::printCriticalErrorMsg("SYS NOT READY FOR SENDING AFTER 5 SECONDS");
break; break;
} }
} }
@ -636,22 +639,27 @@ bool Update::downloadJson(enum FileTypeJson type,
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
if (fi.size() <= 800) { if (fi.size() <= 800) {
QByteArray ba = file.readAll(); 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
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())) {
QThread::sleep(1); QThread::sleep(1);
qDebug() << "SENT" << jsFileToSendToDC;
ret = true; ret = true;
} }
} else { } else {
qCritical() << "SIZE OF" << jsFileToSendToDC Utils::printCriticalErrorMsg(
<< "TOO BIG (" << fi.size() << "BYTES)"; QString("SIZE OF %1 TOO BIG (%2 BYTES)")
.arg(jsFileToSendToDC).arg(fi.size()));
} }
} else { } else {
qCritical() << "CANNOT OPEN" << jsFileToSendToDC << "FOR READING"; Utils::printCriticalErrorMsg(
QString("CAN NOT OPEN ") + jsFileToSendToDC + " FOR READING");
} }
} else { } else {
qCritical() << jsFileToSendToDC << "DOES NOT EXIST"; Utils::printCriticalErrorMsg(
QString(jsFileToSendToDC) + " DOES NOT EXIST");
} }
} }
@ -871,7 +879,7 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
res = true; res = true;
#if UPDATE_CASH_TEMPLATE == 1 #if UPDATE_CASH_TEMPLATE == 1
if ((res = updateCashConf(fToWorkOn))) { if ((res = updateCashConf(fToWorkOn))) {
qInfo() << "downloaded cash template"<< fToWorkOn; Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
++displayIndex; ++displayIndex;
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")") emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(), + QString(" Update ") + QFileInfo(fToWorkOn).fileName(),