7 Commits

4 changed files with 41 additions and 27 deletions

View File

@@ -103,7 +103,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
# Move final processing to subclass UpdateProcessRunning. # Move final processing to subclass UpdateProcessRunning.
# Disable EXIT-button for the whole update-process, except for the # Disable EXIT-button for the whole update-process, except for the
# checking of the ISMAS-trigger-button (aka WAIT-button). # 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: # PLANNED TODOS:
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT. # 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu # 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu

View File

@@ -146,34 +146,33 @@ Update::Update(Worker *worker,
QDebug critical = qCritical(); QDebug critical = qCritical();
critical << "connect() to onReportDCDownloadStatus() ..."; critical << "connect() to onReportDCDownloadStatus() ...";
if (!connect(obj, if (!connect(obj,
SIGNAL(hwapi_reportDCDownloadStatus(QString const&)), this, SIGNAL(hwapi_reportDCDownloadStatus(QString const&)),
SLOT(onReportDCDownloadStatus(QString const &)))) { this,
SLOT(onReportDCDownloadStatus(QString const &)))) {
critical << "FAILED"; critical << "FAILED";
} } else critical << "DONE";
critical << "DONE";
critical = qCritical(); critical = qCritical();
critical << "connect() to onReportDCDownloadSuccess() ..."; critical << "connect() to onReportDCDownloadSuccess() ...";
if (!connect(obj, if (!connect(obj,
SIGNAL(hwapi_reportDCDownloadSuccess(QString const&)), this, SIGNAL(hwapi_reportDCDownloadSuccess(QString const&)), this,
SLOT(onReportDCDownloadSuccess(QString const &)))) { SLOT(onReportDCDownloadSuccess(QString const &)))) {
critical << "FAILED"; critical << "FAILED";
} } else critical << "DONE";
critical << "DONE";
critical = qCritical(); critical = qCritical();
critical << "connect() to onReportDCDownloadFailure() ..."; critical << "connect() to onReportDCDownloadFailure() ...";
if (!connect(obj, if (!connect(obj,
SIGNAL(hwapi_reportDCDownloadFailure(QString const &)), this, SIGNAL(hwapi_reportDCDownloadFailure(QString const &)), this,
SLOT(onReportDCDownloadFailure(QString const &)))) { SLOT(onReportDCDownloadFailure(QString const &)))) {
critical << "FAILED"; critical << "FAILED";
} } else critical << "DONE";
critical << "DONE";
} }
} }
Update::~Update() { Update::~Update() {
} }
void Update::onReportDCDownloadStatus(QString const &status) { void Update::onReportDCDownloadStatus(QString const &status) {
emit m_worker->showStatusMessage("DL", status); emit m_worker->showStatusMessage("DL", status);
} }
@@ -645,8 +644,8 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
m_worker->startProgressLoop(); m_worker->startProgressLoop();
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed()); QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
if (fToWorkOn.endsWith("/dc2c.bin") && dcDownloadPossible) { if (fToWorkOn.endsWith("/dc2c.bin") && dcDownloadPossible) {
qCritical() << "F-TO-WORK-ON" << fToWorkOn;
// download for dc possible only once // download for dc possible only once
// download of device-controller should always be the last step
dcDownloadPossible = false; dcDownloadPossible = false;
if (!m_hw->dcDownloadRequest(fToWorkOn)) { // initiate download process if (!m_hw->dcDownloadRequest(fToWorkOn)) { // initiate download process
@@ -665,6 +664,8 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD RUNNING"; << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD RUNNING";
QThread::sleep(2);
if (!m_hw->dcDownloadReportThreadStart()) { // may take some time if (!m_hw->dcDownloadReportThreadStart()) { // may take some time
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED"; << "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
@@ -684,11 +685,11 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate) qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING"; << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING";
while (m_hw->dcDownloadReportRunning()) { while (m_hw->dcDownloadReportRunning()) {
QThread::msleep(500); QThread::msleep(500);
} }
bool updateBinaryRes = true; bool updateBinaryRes = true;
// CONSOLE() // CONSOLE()

View File

@@ -166,7 +166,13 @@ Worker::Worker(int customerNr,
// TODO: turn object into singleton // TODO: turn object into singleton
instance = this; instance = this;
m_lastFailedUpdateStep = UPDATE_STEP::NONE; m_lastFailedUpdateStep = UPDATE_STEP::NONE;
m_update = nullptr; m_update = new Update(this,
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
m_customerNrStr,
m_branchName,
m_pluginDir,
m_pluginName,
m_workingDirectory);
this->setObjectName("worker-object"); this->setObjectName("worker-object");
QDir::setCurrent(m_workingDirectory); QDir::setCurrent(m_workingDirectory);
@@ -175,6 +181,10 @@ Worker::Worker(int customerNr,
} }
Worker::~Worker() { Worker::~Worker() {
if (m_update != nullptr) {
delete m_update;
m_update = nullptr;
}
} }
void Worker::displayProgressInMainWindow(int progress) { void Worker::displayProgressInMainWindow(int progress) {
@@ -889,15 +899,7 @@ bool Worker::downloadFilesToPSAHardware() {
QStringList lst = m_filesToDownload; QStringList lst = m_filesToDownload;
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD); ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
m_update = new Update(this, if (m_update && m_update->doUpdate(m_displayIndex, m_filesToDownload)) {
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
m_customerNrStr,
m_branchName,
m_pluginDir,
m_pluginName,
m_workingDirectory);
if (m_update->doUpdate(m_displayIndex, m_filesToDownload)) {
// prepared for use: at the moment, the dc-library does not work // prepared for use: at the moment, the dc-library does not work
// as expected. // as expected.
@@ -1061,6 +1063,17 @@ QString Worker::getAPISMYoctoInstallationStatus() {
return "N/A"; 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 Worker::getATBQTVersion() const {
QString const cmd = QString("echo -n $(/opt/app/ATBAPP/ATBQT -v | head -n 2 | cut -d':' -f2)"); QString const cmd = QString("echo -n $(/opt/app/ATBAPP/ATBQT -v | head -n 2 | cut -d':' -f2)");
@@ -1185,7 +1198,9 @@ PSAInstalled Worker::getPSAInstalled() {
if (m_versionInfo.size() == 3) { if (m_versionInfo.size() == 3) {
qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__) qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__)
<< "m_versionInfo" << m_versionInfo << "*****"; << "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.reason = m_versionInfo.at(1);
psaInstalled.versionInfo.created = m_versionInfo.at(2); psaInstalled.versionInfo.created = m_versionInfo.at(2);
} }

View File

@@ -249,10 +249,6 @@ class Worker : public QThread{
<< UPDATE_STEP::SEND_LAST_VERSION)); << UPDATE_STEP::SEND_LAST_VERSION));
} }
m_worker->stopProgressLoop(); m_worker->stopProgressLoop();
if (m_worker->m_update != nullptr) {
delete m_worker->m_update;
m_worker->m_update = nullptr;
}
m_worker->m_updateProcessRunning = false; m_worker->m_updateProcessRunning = false;
emit m_worker->enableExit(); emit m_worker->enableExit();
emit m_worker->restartExitTimer(); emit m_worker->restartExitTimer();
@@ -373,6 +369,7 @@ public:
static QString getATBUpdateToolYoctoInstallationStatus(); static QString getATBUpdateToolYoctoInstallationStatus();
static QString getAPISMYoctoVersion(); static QString getAPISMYoctoVersion();
static QString getAPISMYoctoInstallationStatus(); static QString getAPISMYoctoInstallationStatus();
static QString getDCVersionPreparedForDownload(QString const &filename);
static const QString UPDATE_STEP_OK; static const QString UPDATE_STEP_OK;
static const QString UPDATE_STEP_DONE; static const QString UPDATE_STEP_DONE;