7 Commits

4 changed files with 51 additions and 14 deletions

View File

@@ -103,7 +103,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
# Move final processing to subclass UpdateProcessRunning.
# Disable EXIT-button for the whole update-process, except for the
# checking of the ISMAS-trigger-button (aka WAIT-button).
VERSION="1.4.0"
# 2.0.0 Download device-controller using reporting-/download-thread.
VERSION="2.0.0"
# PLANNED TODOS:
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu

View File

@@ -414,7 +414,7 @@ bool Update::downloadJson(enum FileTypeJson type,
QFileInfo fi(jsFileToSendToDC); // max. size of template file is 800 bytes
if (file.exists()) {
if (file.open(QIODevice::ReadOnly)) {
if (fi.size() <= 800) {
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
@@ -655,18 +655,29 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
QThread::sleep(2);
if (!m_hw->dcDownloadRunning()) { // may take some time
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING";
int tries = 5;
while (!m_hw->dcDownloadRunning()) { // may take some time
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING";
break;
}
QThread::sleep(1);
continue;
}
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD RUNNING";
if (!m_hw->dcDownloadReportThreadStart()) { // may take some time
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
QThread::sleep(2);
tries = 5;
while (!m_hw->dcDownloadReportThreadStart()) { // may take some time
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
break;
}
continue;
}
@@ -674,18 +685,29 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED";
QThread::sleep(2);
if (!m_hw->dcDownloadReportRunning()) { // may take some time
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT NOT RUNNING";
tries = 5;
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;
}
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING";
tries = 1200;
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;

View File

@@ -1063,6 +1063,17 @@ QString Worker::getAPISMYoctoInstallationStatus() {
return "N/A";
}
QString Worker::getDCVersionPreparedForDownload(QString const &filename) {
if (QFile::exists(filename)) { // <customer-repo/etc/dc/dc2c.bin>
QString const cmd = QString("strings %1 | grep -e DC2[Cc]\\. | head -n1").arg(filename);
Command c("bash");
if (c.execute("/tmp", QStringList() << "-c" << cmd)) {
return c.getCommandResult(); // DC2c.04.42 14.09.2023
}
}
return "N/A";
}
QString Worker::getATBQTVersion() const {
QString const cmd = QString("echo -n $(/opt/app/ATBAPP/ATBQT -v | head -n 2 | cut -d':' -f2)");
@@ -1187,7 +1198,9 @@ PSAInstalled Worker::getPSAInstalled() {
if (m_versionInfo.size() == 3) {
qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__)
<< "m_versionInfo" << m_versionInfo << "*****";
psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0);
psaInstalled.versionInfo.lastCommit = QString("%1-%2")
.arg(QCoreApplication::applicationPid())
.arg(m_versionInfo.at(0));
psaInstalled.versionInfo.reason = m_versionInfo.at(1);
psaInstalled.versionInfo.created = m_versionInfo.at(2);
}

View File

@@ -369,6 +369,7 @@ public:
static QString getATBUpdateToolYoctoInstallationStatus();
static QString getAPISMYoctoVersion();
static QString getAPISMYoctoInstallationStatus();
static QString getDCVersionPreparedForDownload(QString const &filename);
static const QString UPDATE_STEP_OK;
static const QString UPDATE_STEP_DONE;