Compare commits
2 Commits
dc-downloa
...
master
Author | SHA1 | Date | |
---|---|---|---|
a240711946 | |||
75fdca95d9 |
@ -103,8 +103,9 @@ 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).
|
||||
# 2.0.0 Download device-controller using reporting-/download-thread.
|
||||
VERSION="2.0.0"
|
||||
# 1.4.1 : Sync files in the customer repository (under ./etc) as the very
|
||||
# first step
|
||||
VERSION="1.4.1"
|
||||
# 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
|
||||
@ -118,7 +119,6 @@ VERSION="2.0.0"
|
||||
# ISMAS eine entsprechende Meldung anzeigen als Teil von SEND-LAST-VERSION.
|
||||
# Wenn der WAIT-button aktiv ist, dann werden zumindest die opkg-commands
|
||||
# ausgefuehrt.
|
||||
# 4: rsync: immer alle Dateien soiegeln (bis auf opkg-commands)
|
||||
# 5: Falls das Tool mal abstuerzt, dann einen Signal-Handler (fuer TERM)
|
||||
# installieren, sodass zumnidest SEND-LAST-VERSION mit rausgeht.
|
||||
# 6: rsync: explizites Binary, nicht das in busybox enthaltene.
|
||||
@ -134,9 +134,6 @@ VERSION="2.0.0"
|
||||
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
||||
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
||||
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
|
||||
# 10: Bei einer Neuinstallation (Neuhauser) immer JSON files runterladen,
|
||||
# Tariff-Files syncen (d.h. nur wenn noch kein Repo vorhanden ist), und
|
||||
# zwar auch ohne WAIT-Button.
|
||||
# 11: Das Edit-Fenster teilen um die Anzeige zu verbessern.
|
||||
# 12: Bei einem Update muss immer ersichtlich sein, warum es ueberhaupt
|
||||
# angestossen wurde. Steht kein "WAIT" im ISMAS-Trigger, dann kann man
|
||||
@ -177,10 +174,7 @@ GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
||||
|
||||
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||
|
||||
!contains(CONFIG, INCLUDEINTERFACES) {
|
||||
INCLUDEINTERFACES=/opt/ptu5/opt/DCLibraries/include
|
||||
}
|
||||
INCLUDEPATH += plugins $${INCLUDEINTERFACES}
|
||||
INCLUDEPATH += plugins
|
||||
|
||||
CONFIG += c++17
|
||||
# CONFIG -= app_bundle
|
||||
@ -253,7 +247,9 @@ HEADERS += \
|
||||
process/command.h \
|
||||
message_handler.h \
|
||||
worker.h \
|
||||
commandline_parser.h
|
||||
interfaces.h \
|
||||
commandline_parser.h \
|
||||
plugins/interfaces.h
|
||||
|
||||
OTHER_FILES += \
|
||||
ATBUpdateTool.ini
|
||||
|
267
update.cpp
267
update.cpp
@ -98,7 +98,6 @@ bool Update::unloadDCPlugin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
class hwapi;
|
||||
Update::Update(Worker *worker,
|
||||
QString customerRepository,
|
||||
QString customerNrStr,
|
||||
@ -123,70 +122,31 @@ Update::Update(Worker *worker,
|
||||
, m_dryRun(dryRun)
|
||||
, m_sys_areDCdataValid(false) {
|
||||
|
||||
if (!m_hw) {
|
||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_hw == nullptr -> ca-slave plugin loaded ???";
|
||||
} else {
|
||||
int tries = 20;
|
||||
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||
// must deliver 'true', only then are all data from hwapi valid
|
||||
if (--tries < 0) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
break;
|
||||
}
|
||||
m_hw->dc_autoRequest(true);
|
||||
QThread::msleep(500);
|
||||
int tries = 20;
|
||||
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||
// must deliver 'true', only then are all data from hwapi valid
|
||||
if (--tries < 0) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
break;
|
||||
}
|
||||
|
||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_sys_areDCDataValid ..."
|
||||
<< m_sys_areDCdataValid;
|
||||
|
||||
QObject const *obj = m_hw->getAPI();
|
||||
Q_ASSERT(obj != nullptr);
|
||||
|
||||
QDebug critical = qCritical();
|
||||
critical << "connect() to onReportDCDownloadStatus() ...";
|
||||
if (!connect(obj,
|
||||
SIGNAL(hwapi_reportDCDownloadStatus(QString const&)),
|
||||
this,
|
||||
SLOT(onReportDCDownloadStatus(QString const &)))) {
|
||||
critical << "FAILED";
|
||||
} else critical << "DONE";
|
||||
|
||||
critical = qCritical();
|
||||
critical << "connect() to onReportDCDownloadSuccess() ...";
|
||||
if (!connect(obj,
|
||||
SIGNAL(hwapi_reportDCDownloadSuccess(QString const&)), this,
|
||||
SLOT(onReportDCDownloadSuccess(QString const &)))) {
|
||||
critical << "FAILED";
|
||||
} else critical << "DONE";
|
||||
|
||||
critical = qCritical();
|
||||
critical << "connect() to onReportDCDownloadFailure() ...";
|
||||
if (!connect(obj,
|
||||
SIGNAL(hwapi_reportDCDownloadFailure(QString const &)), this,
|
||||
SLOT(onReportDCDownloadFailure(QString const &)))) {
|
||||
critical << "FAILED";
|
||||
} else critical << "DONE";
|
||||
m_hw->dc_autoRequest(true);
|
||||
QThread::msleep(500);
|
||||
}
|
||||
|
||||
qCritical() << __PRETTY_FUNCTION__ << "m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||
|
||||
//qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
||||
//qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
||||
//qInfo() << "UPDATE: m_customerRepository ..." << m_customerRepository;
|
||||
//qInfo() << "UPDATE: m_customerNr ..........." << m_customerNrStr;
|
||||
//qInfo() << "UPDATE: m_branchName ..........." << m_branchName;
|
||||
//qInfo() << "UPDATE: m_pluginName ..........." << m_pluginName;
|
||||
//qInfo() << "UPDATE: m_workingDirectory ....." << m_workingDir;
|
||||
}
|
||||
|
||||
Update::~Update() {
|
||||
}
|
||||
|
||||
void Update::onReportDCDownloadStatus(QString const &status) {
|
||||
emit m_worker->showStatusMessage("DL", status);
|
||||
}
|
||||
|
||||
void Update::onReportDCDownloadSuccess(QString const &msg) {
|
||||
qCritical() << "msg" << msg;
|
||||
}
|
||||
|
||||
void Update::onReportDCDownloadFailure(QString const &errorMsg) {
|
||||
qCritical() << "msg" << errorMsg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// br is a index into a table, used for historical reasons.
|
||||
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
||||
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
||||
@ -414,7 +374,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() > 0 && fi.size() <= 800) {
|
||||
if (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
|
||||
@ -630,6 +590,7 @@ bool Update::checkDownloadedJsonVersions(QStringList const& jsonFileNames) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
if (m_sys_areDCdataValid == false) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
@ -637,96 +598,30 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
}
|
||||
|
||||
bool res = false;
|
||||
bool dcDownloadPossible = true;
|
||||
|
||||
QList<QString>::const_iterator it;
|
||||
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
||||
m_worker->startProgressLoop();
|
||||
|
||||
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
||||
if (fToWorkOn.endsWith("/dc2c.bin") && dcDownloadPossible) {
|
||||
// download for dc possible only once
|
||||
// download of device-controller should always be the last step
|
||||
dcDownloadPossible = false;
|
||||
|
||||
if (!m_hw->dcDownloadRequest(fToWorkOn)) { // initiate download process
|
||||
qCritical() << "DOWNLOAD-REQUEST-ERROR FOR" << fToWorkOn;
|
||||
continue;
|
||||
}
|
||||
|
||||
QThread::sleep(2);
|
||||
|
||||
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";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
|
||||
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED";
|
||||
|
||||
QThread::sleep(2);
|
||||
|
||||
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(1000);
|
||||
if (--tries < 0) {
|
||||
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
|
||||
<< "(" << __func__ << ":" << __LINE__
|
||||
<< ") DOWNLOAD REPORT STILL RUNNING AFTER 20mins";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fToWorkOn.contains("dc2c.bin")) {
|
||||
bool updateBinaryRes = true;
|
||||
|
||||
// CONSOLE()
|
||||
#if 0
|
||||
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||
QThread::sleep(1); // wait to be sure that there are no more
|
||||
// commands sent to dc-hardware
|
||||
|
||||
if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
|
||||
// m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||
// QThread::sleep(1); // wait to be sure that there are no more
|
||||
// // commands sent to dc-hardware
|
||||
|
||||
// if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
|
||||
//
|
||||
// qCritical() << "downloaded binary" << fToWorkOn;
|
||||
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
// ++displayIndex;
|
||||
// emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
||||
// + QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
// Worker::UPDATE_STEP_DONE);
|
||||
//}
|
||||
|
||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||
|
||||
@ -742,65 +637,65 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
res = updateBinaryRes;
|
||||
|
||||
} else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||
} else {
|
||||
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
||||
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
||||
if ((templateIdx < 1) || (templateIdx > 32)) {
|
||||
qCritical() << "WRONG TEMPLATE INDEX" << templateIdx;
|
||||
res = false;
|
||||
} else {
|
||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||
Utils::printInfoMsg(
|
||||
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||
.arg(fToWorkOn)
|
||||
.arg(templateIdx));
|
||||
res = true;
|
||||
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
||||
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
||||
if ((templateIdx < 1) || (templateIdx > 32)) {
|
||||
qCritical() << "WRONG TEMPLATE INDEX" << templateIdx;
|
||||
res = false;
|
||||
} else {
|
||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||
Utils::printInfoMsg(
|
||||
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||
.arg(fToWorkOn)
|
||||
.arg(templateIdx));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res = updateCashConf(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res= updateConfig(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED CONFIG TEMPLATE %1").arg(fToWorkOn));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res = updateDeviceConf(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED DEVICE TEMPLATE %1").arg(fToWorkOn));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
} else {
|
||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||
res = false;
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res = updateCashConf(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res= updateConfig(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED CONFIG TEMPLATE %1").arg(fToWorkOn));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
if ((res = updateDeviceConf(fToWorkOn))) {
|
||||
Utils::printInfoMsg(QString("DOWNLOADED DEVICE TEMPLATE %1").arg(fToWorkOn));
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
} else {
|
||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||
res = false;
|
||||
}
|
||||
// m_worker->stopProgressLoop();
|
||||
// m_worker->setProgress(100);
|
||||
|
||||
if (res == false) {
|
||||
break;
|
||||
|
4
update.h
4
update.h
@ -94,8 +94,6 @@ private slots:
|
||||
void readyReadStandardOutput();
|
||||
void readyReadStandardError();
|
||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void onReportDCDownloadStatus(QString const &status);
|
||||
void onReportDCDownloadSuccess(QString const &msg);
|
||||
void onReportDCDownloadFailure(QString const &errorMsg);
|
||||
|
||||
};
|
||||
#endif // UPDATE_H_INCLUDED
|
||||
|
64
worker.cpp
64
worker.cpp
@ -165,14 +165,8 @@ Worker::Worker(int customerNr,
|
||||
|
||||
// TODO: turn object into singleton
|
||||
instance = this;
|
||||
|
||||
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||
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");
|
||||
QDir::setCurrent(m_workingDirectory);
|
||||
@ -181,10 +175,6 @@ Worker::Worker(int customerNr,
|
||||
}
|
||||
|
||||
Worker::~Worker() {
|
||||
if (m_update != nullptr) {
|
||||
delete m_update;
|
||||
m_update = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::displayProgressInMainWindow(int progress) {
|
||||
@ -439,6 +429,18 @@ void Worker::privateUpdate() {
|
||||
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH);
|
||||
setProgress(_CHECKOUT_BRANCH_SUCCESS);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (R)SYNC THE REPOSITORY WITH THE LOCAL FILEYSTEM
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
|
||||
return;
|
||||
}
|
||||
lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// COMPUTE CHANGED FILES OF CUSTOMER REPOSITORY
|
||||
@ -478,19 +480,6 @@ void Worker::privateUpdate() {
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
|
||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (R)SYNC THE REPOSITORY WITH THE LOCAL FILEYSTEM
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
|
||||
return;
|
||||
}
|
||||
lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FUTURE: SAVE LOG FILES
|
||||
@ -762,7 +751,7 @@ bool Worker::filesToUpdate() {
|
||||
}
|
||||
m_filesToUpdate.removeDuplicates();
|
||||
|
||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") FILES-TO-UPDATE" << m_filesToUpdate;
|
||||
qCritical() << __PRETTY_FUNCTION__ << "FILES-TO-UPDATE" << m_filesToUpdate;
|
||||
|
||||
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
|
||||
setProgress(_FILES_TO_UPDATE);
|
||||
@ -899,7 +888,15 @@ bool Worker::downloadFilesToPSAHardware() {
|
||||
QStringList lst = m_filesToDownload;
|
||||
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
|
||||
|
||||
if (m_update && m_update->doUpdate(m_displayIndex, m_filesToDownload)) {
|
||||
Update update(this,
|
||||
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
||||
m_customerNrStr,
|
||||
m_branchName,
|
||||
m_pluginDir,
|
||||
m_pluginName,
|
||||
m_workingDirectory);
|
||||
|
||||
if (update.doUpdate(m_displayIndex, m_filesToDownload)) {
|
||||
// prepared for use: at the moment, the dc-library does not work
|
||||
// as expected.
|
||||
|
||||
@ -1063,17 +1060,6 @@ 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)");
|
||||
@ -1198,9 +1184,7 @@ PSAInstalled Worker::getPSAInstalled() {
|
||||
if (m_versionInfo.size() == 3) {
|
||||
qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__)
|
||||
<< "m_versionInfo" << m_versionInfo << "*****";
|
||||
psaInstalled.versionInfo.lastCommit = QString("%1-%2")
|
||||
.arg(QCoreApplication::applicationPid())
|
||||
.arg(m_versionInfo.at(0));
|
||||
psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0);
|
||||
psaInstalled.versionInfo.reason = m_versionInfo.at(1);
|
||||
psaInstalled.versionInfo.created = m_versionInfo.at(2);
|
||||
}
|
||||
|
14
worker.h
14
worker.h
@ -61,9 +61,12 @@
|
||||
#define _UPDATE_REPOSITORY_SUCCESS (27)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES (28)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (29)
|
||||
#define _FILES_TO_UPDATE (30)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (31)
|
||||
#define _FILES_TO_DOWNLOAD (32)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY (30)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (31)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (32)
|
||||
#define _FILES_TO_UPDATE (33)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (34)
|
||||
#define _FILES_TO_DOWNLOAD (35)
|
||||
#define _EXEC_OPKG_COMMANDS (41)
|
||||
#define _EXEC_OPKG_COMMAND_1 (42)
|
||||
#define _EXEC_OPKG_COMMAND_2 (43)
|
||||
@ -86,9 +89,6 @@
|
||||
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86)
|
||||
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87)
|
||||
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (88)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY (89)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (90)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (91)
|
||||
#define _SAVE_LOGS (92)
|
||||
#define _SAVE_LOGS_FAILURE (93)
|
||||
#define _SAVE_LOGS_SUCCESS (94)
|
||||
@ -249,6 +249,7 @@ class Worker : public QThread{
|
||||
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||
}
|
||||
m_worker->stopProgressLoop();
|
||||
|
||||
m_worker->m_updateProcessRunning = false;
|
||||
emit m_worker->enableExit();
|
||||
emit m_worker->restartExitTimer();
|
||||
@ -369,7 +370,6 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user