Merge remote-tracking branch 'origin/korneuburg-improvements'
This commit is contained in:
commit
6c472b542e
@ -92,8 +92,18 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# Changes:
|
||||
# (1) the ini-File now uses the libCAmaster.so.
|
||||
# 1.3._25_: Again special version for szeged, using interface.h, version 4.4.
|
||||
VERSION="1.3._25_"
|
||||
|
||||
# 1.4.0 : Start with version at 1.4.0 (mainly to see a difference with Szeged)
|
||||
# Set hash-value in EVENT-objects. Set location (project), version
|
||||
# and info in send-last-version.
|
||||
# If the customer repository does not exist, then do not check the
|
||||
# ISMAS trigger, but proceed with the update procedure. Otherwise,
|
||||
# check the ISMAS update-trigger as first step.
|
||||
# If the current time is between 0.00 - 4.00 o'clock, then a wrong
|
||||
# trigger-value will result in an UPDATE_STEP_NOT_NECESSARY.
|
||||
# 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"
|
||||
# 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
|
||||
@ -179,7 +189,7 @@ DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
||||
# keep comments, as /* fall through */
|
||||
QMAKE_CXXFLAGS += -C
|
||||
QMAKE_CXXFLAGS += -g
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy -O
|
||||
|
||||
contains( CONFIG, PTU5 ) {
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||
|
48
update.cpp
48
update.cpp
@ -122,18 +122,18 @@ Update::Update(Worker *worker,
|
||||
, m_dryRun(dryRun)
|
||||
, m_sys_areDCdataValid(false) {
|
||||
|
||||
//int tries = 20;
|
||||
//while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||
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);
|
||||
//}
|
||||
if (--tries < 0) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
break;
|
||||
}
|
||||
m_hw->dc_autoRequest(true);
|
||||
QThread::msleep(500);
|
||||
}
|
||||
|
||||
//qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||
qCritical() << __PRETTY_FUNCTION__ << "m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||
|
||||
//qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
||||
//qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
||||
@ -592,10 +592,10 @@ bool Update::checkDownloadedJsonVersions(QStringList const& jsonFileNames) {
|
||||
}
|
||||
|
||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
//if (m_sys_areDCdataValid == false) {
|
||||
// qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
// return false;
|
||||
//}
|
||||
if (m_sys_areDCdataValid == false) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = false;
|
||||
QList<QString>::const_iterator it;
|
||||
@ -609,19 +609,19 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
|
||||
// CONSOLE()
|
||||
|
||||
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
|
||||
|
||||
|
76
utils.cpp
76
utils.cpp
@ -30,6 +30,82 @@ int Utils::read1stLineOfFile(QString fileName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString Utils::getLocation(QString fileName) {
|
||||
QString location("N/A");
|
||||
QFile f(fileName);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
QString const &line = in.readLine();
|
||||
if (line.indexOf("Project", Qt::CaseInsensitive) != -1) {
|
||||
int const c = line.indexOf(":");
|
||||
if (c != -1) {
|
||||
location = line.mid(c+1);
|
||||
if (!location.isEmpty()) {
|
||||
return location.replace(QChar('"'), QString("")).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
QString Utils::getTariffVersion(QString fileName) {
|
||||
QString version("N/A");
|
||||
QFile f(fileName);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
QString const &line = in.readLine();
|
||||
if (line.indexOf("Version", Qt::CaseInsensitive) != -1) {
|
||||
int const c = line.indexOf(":");
|
||||
if (c != -1) {
|
||||
version = line.mid(c+1);
|
||||
if (!version.isEmpty()) {
|
||||
return version.replace(QChar('"'), QString("")).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
QString Utils::getTariffInfo(QString fileName) {
|
||||
QString info("N/A");
|
||||
QFile f(fileName);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
QString const &line = in.readLine();
|
||||
if (line.indexOf("Info", Qt::CaseInsensitive) != -1) {
|
||||
int const c = line.indexOf(":");
|
||||
if (c != -1) {
|
||||
info = line.mid(c+1);
|
||||
if (!info.isEmpty()) {
|
||||
return info.replace(QChar('"'), QString("")).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
QString Utils::zoneName(quint8 i) {
|
||||
static constexpr char const *zName[] = {
|
||||
"",
|
||||
|
3
utils.h
3
utils.h
@ -12,6 +12,9 @@
|
||||
|
||||
namespace Utils {
|
||||
int read1stLineOfFile(QString fileName);
|
||||
QString getLocation(QString fileName);
|
||||
QString getTariffVersion(QString fileName);
|
||||
QString getTariffInfo(QString fileName);
|
||||
QString zoneName(quint8 i);
|
||||
void printCriticalErrorMsg(QString const &errorMsg, bool upper=false, bool lower=false);
|
||||
void printCriticalErrorMsg(QStringList const &errorMsg);
|
||||
|
320
worker.cpp
320
worker.cpp
@ -96,12 +96,15 @@ const QMap<UPDATE_STEP, const char*> Worker::smap (
|
||||
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS),
|
||||
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE),
|
||||
INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION),
|
||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FINALIZE),
|
||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED),
|
||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_NOT_NECESSARY),
|
||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_ACTIVATED),
|
||||
INSERT_ELEMENT(UPDATE_STEP::FINISHED),
|
||||
INSERT_ELEMENT(UPDATE_STEP::DEBUG),
|
||||
INSERT_ELEMENT(UPDATE_STEP::ERROR)
|
||||
INSERT_ELEMENT(UPDATE_STEP::ERROR),
|
||||
INSERT_ELEMENT(UPDATE_STEP::NONE)
|
||||
#undef INSERT_ELEMENT
|
||||
});
|
||||
|
||||
@ -140,6 +143,7 @@ Worker::Worker(int customerNr,
|
||||
, m_serialInterface(serialInterface)
|
||||
, m_baudrate(baudrate)
|
||||
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
|
||||
, m_versionInfo(QStringList())
|
||||
, m_osVersion(getOsVersion())
|
||||
, m_atbqtVersion(getATBQTVersion())
|
||||
, m_atbUpdateToolVersion(getATBUpdateToolVersion())
|
||||
@ -162,6 +166,8 @@ Worker::Worker(int customerNr,
|
||||
// TODO: turn object into singleton
|
||||
instance = this;
|
||||
|
||||
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||
|
||||
this->setObjectName("worker-object");
|
||||
QDir::setCurrent(m_workingDirectory);
|
||||
|
||||
@ -254,11 +260,62 @@ void Worker::privateUpdate() {
|
||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::STARTED));
|
||||
|
||||
QScopedPointer<UpdateProcessRunning> upr(new UpdateProcessRunning(this));
|
||||
QStringList lst;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHECK UPDATE TRIGGER
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// NOTE: make sure that nothing is sent to ISMAS during updateTriggerSet
|
||||
ISMAS() << UPDATE_STEP::CHECK_ISMAS_TRIGGER;
|
||||
m_ismasTriggerActive = false;
|
||||
m_updateNotNecessary = false;
|
||||
|
||||
if (QDir(m_customerRepository).exists()) { // ignore a possibly corrupted repository
|
||||
m_ismasTriggerActive = updateTriggerSet();
|
||||
if (m_ismasTriggerActive == false) {
|
||||
QDateTime const ¤t = QDateTime::currentDateTime();
|
||||
m_automaticUpdate = (current.time().hour() < 4);
|
||||
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
|
||||
qCritical() << "***";
|
||||
qCritical() << "privateUpdate ............. m_versionInfo:" << m_versionInfo;
|
||||
qCritical() << "privateUpdate ......... m_automaticUpdate:" << m_automaticUpdate;
|
||||
|
||||
if (m_automaticUpdate) { // update has been triggered within [00:00:00, 00:03:59]
|
||||
m_updateNotNecessary = true;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
|
||||
|
||||
qCritical() << "privateUpdate m_ismasTriggerStatusMessage:" << QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
|
||||
qCritical() << "***";
|
||||
|
||||
// the customer-repository does exist, but the ISMAS-trigger is
|
||||
// *NOT* "WAIT", but from 00:00:00 - 00:03:59 this counts as an
|
||||
// automatic update
|
||||
|
||||
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
qCritical() << "***";
|
||||
|
||||
// the customer-repository does exist, but the ISMAS-trigger is
|
||||
// *NOT* "WAIT", so STOP the update procedure
|
||||
return;
|
||||
}
|
||||
// the customer-repository does exist, and the ISMAS-trigger is "WAIT",
|
||||
// so continue the update procedure
|
||||
} else {
|
||||
// the customer-repository does not exist, so PROCEED with the
|
||||
// update procedure, even if ISMAS-trigger is not correctly set ("WAIT")
|
||||
}
|
||||
|
||||
emit this->disableExit();
|
||||
|
||||
QDir customerRepository(m_customerRepository);
|
||||
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
||||
|
||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY;
|
||||
CONSOLE() << (ISMAS() << UPDATE_STEP::CHECK_SANITY);
|
||||
|
||||
m_clone = false;
|
||||
m_repairClone = false;
|
||||
@ -281,26 +338,29 @@ void Worker::privateUpdate() {
|
||||
|
||||
if (isRepositoryCorrupted()) { // a not-existing repository is not meant
|
||||
// to be corrupted
|
||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY_FAILURE;
|
||||
CONSOLE() << (ISMAS() << UPDATE_STEP::CHECK_SANITY_FAILURE);
|
||||
if ((continueUpdate = repairCorruptedRepository()) == true) {
|
||||
m_repairClone = true;
|
||||
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS;
|
||||
CONSOLE() << (ISMAS() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS);
|
||||
} else {
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY_SUCCESS;
|
||||
CONSOLE() << (ISMAS() << UPDATE_STEP::CHECK_SANITY_SUCCESS);
|
||||
|
||||
if (continueUpdate) {
|
||||
if ((continueUpdate = customerRepository.exists()) == false) {
|
||||
m_initialClone = (m_repairClone == false);
|
||||
GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY);
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY));
|
||||
for (int i = 0; i < 5; ++i) { // try to checkout git repository
|
||||
setProgress(i); // and switch to branch
|
||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||
if (!isRepositoryCorrupted()) {
|
||||
if (m_versionInfo.size() == 0) {
|
||||
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
}
|
||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
|
||||
continueUpdate = true;
|
||||
m_clone = true;
|
||||
@ -311,7 +371,7 @@ void Worker::privateUpdate() {
|
||||
}
|
||||
|
||||
if (continueUpdate == false) {
|
||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_FAILURE));
|
||||
GUI() << (ISMAS() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CLONE_REPOSITORY_FAILURE)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -325,23 +385,21 @@ void Worker::privateUpdate() {
|
||||
|
||||
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
|
||||
if (isRepositoryCorrupted()) {
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_FAILURE));
|
||||
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_REPOSITORY_FAILURE)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_versionInfo.size() == 0) {
|
||||
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
}
|
||||
|
||||
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
|
||||
setProgress(_CHECKOUT_REPOSITORY_SUCCESS);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHECK UPDATE TRIGGER
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
m_ismasTriggerActive = false;
|
||||
if (m_clone == false) {
|
||||
if ((continueUpdate = updateTriggerSet()) == false) {
|
||||
if (m_ismasTriggerActive == false) {
|
||||
return;
|
||||
} else {
|
||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
||||
@ -374,7 +432,8 @@ void Worker::privateUpdate() {
|
||||
if ((continueUpdate = customerEnvironment()) == false) {
|
||||
return;
|
||||
}
|
||||
CONSOLE() << UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS;
|
||||
lst = QStringList(QString(smap[UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS]));
|
||||
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH);
|
||||
setProgress(_CHECKOUT_BRANCH_SUCCESS);
|
||||
|
||||
|
||||
@ -386,7 +445,8 @@ void Worker::privateUpdate() {
|
||||
if ((continueUpdate = filesToUpdate()) == false) {
|
||||
return;
|
||||
}
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS));
|
||||
lst = QStringList(QString(smap[UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS]));
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY));
|
||||
setProgress(_UPDATE_REPOSITORY_SUCCESS);
|
||||
|
||||
|
||||
@ -398,7 +458,8 @@ void Worker::privateUpdate() {
|
||||
if ((continueUpdate = execOpkgCommands()) == false) {
|
||||
return;
|
||||
}
|
||||
GUI() << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS);
|
||||
lst = QStringList(QString(smap[UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS]));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::EXEC_OPKG_COMMANDS);
|
||||
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||
|
||||
|
||||
@ -410,7 +471,8 @@ void Worker::privateUpdate() {
|
||||
if ((continueUpdate = downloadFilesToPSAHardware()) == false) {
|
||||
return;
|
||||
}
|
||||
GUI() << (CONSOLE() << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
||||
lst = QStringList(QString(smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS]));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
|
||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
||||
|
||||
|
||||
@ -422,10 +484,10 @@ void Worker::privateUpdate() {
|
||||
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
|
||||
return;
|
||||
}
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
||||
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
|
||||
@ -437,28 +499,8 @@ void Worker::privateUpdate() {
|
||||
// ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SAVE_LOGS_SUCCESS));
|
||||
setProgress(_SAVE_LOGS_SUCCESS);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FINAL MESSAGES (PART 1)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_SUCCEEDED));
|
||||
setProgress(_UPDATE_SUCCEEDED);
|
||||
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_ACTIVATED));
|
||||
setProgress(_UPDATE_ACTIVATED);
|
||||
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::FINISHED));
|
||||
setProgress(_FINISHED);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FINAL MESSAGES (PART 2): SEND-LAST-VERSION
|
||||
// (destructor of struct UpdateProcessRunning)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// final messages: see destructor of UpdateProcessRunning subclass
|
||||
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||
}
|
||||
|
||||
bool Worker::updateTriggerSet() {
|
||||
@ -466,11 +508,13 @@ bool Worker::updateTriggerSet() {
|
||||
// (WAIT-button) is activated even in case of initial checkout
|
||||
static const QString func = "UPDATE-TRIGGER-SET";
|
||||
|
||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||
return true;
|
||||
}
|
||||
// if (m_withoutIsmasDirectPort) { // useful for testing
|
||||
// return true;
|
||||
//}
|
||||
|
||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
||||
m_ismasTriggerStatusMessage.clear();
|
||||
|
||||
GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER);
|
||||
|
||||
QString triggerValue("NOT CHECKED YET");
|
||||
static constexpr int const repeats = 15;
|
||||
@ -480,10 +524,10 @@ bool Worker::updateTriggerSet() {
|
||||
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
||||
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
|
||||
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
||||
CONSOLE(QStringList(func) << s) << UPDATE_STEP::DEBUG;
|
||||
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << s));
|
||||
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||
} else {
|
||||
QStringList lst = (QStringList(func) << QString("-> REPEAT=%1 (%2)").arg(repeat).arg(repeats-repeat));
|
||||
// GUI(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER;
|
||||
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << QString("-> REPEAT=%1 (%2)").arg(repeat).arg(repeats-repeat)));
|
||||
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||
}
|
||||
|
||||
@ -492,7 +536,8 @@ bool Worker::updateTriggerSet() {
|
||||
Command c("systemctl restart apism");
|
||||
if (c.execute("/tmp")) {
|
||||
QThread::sleep(20); // give APISM some time to reconnect
|
||||
CONSOLE(QStringList(func) << "RESTART APISM DONE") << UPDATE_STEP::DEBUG;
|
||||
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << "RESTART APISM DONE"));
|
||||
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,31 +546,35 @@ bool Worker::updateTriggerSet() {
|
||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||
|
||||
QString const &msg = QString("APISM RESPONSE(%1)=(").arg(repeat) + result.value() + ")";
|
||||
CONSOLE(QStringList(func) << msg) << UPDATE_STEP::DEBUG;
|
||||
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << msg));
|
||||
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(result.value().toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
QStringList lst(QString("INVALID JSON MSG: PARSING FAILED (json=<START>%1<END> error=[%2] str=[%3] offset=[%4])")
|
||||
.arg(msg)
|
||||
.arg(parseError.error)
|
||||
.arg(parseError.errorString())
|
||||
.arg(parseError.offset));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("INVALID JSON MSG: PARSING FAILED (json=<START>%1<END> error=[%2] str=[%3] offset=[%4])")
|
||||
.arg(msg)
|
||||
.arg(parseError.error)
|
||||
.arg(parseError.errorString())
|
||||
.arg(parseError.offset));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
if (!document.isObject()) {
|
||||
QStringList lst(QString("not a json-object %1").arg(result.value()));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("not a json-object %1").arg(result.value()));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
|
||||
QJsonObject obj = document.object();
|
||||
|
||||
// always look for an 'error' first
|
||||
if (obj.contains("error")) {
|
||||
QStringList lst(obj.value("error").toString());
|
||||
CONSOLE(QStringList(lst)) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE;
|
||||
m_ismasTriggerStatusMessage = QStringList(obj.value("error").toString());
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
CONSOLE(QStringList(lst)) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
QThread::sleep(6);
|
||||
continue;
|
||||
}
|
||||
@ -540,31 +589,35 @@ bool Worker::updateTriggerSet() {
|
||||
int const customerNr = obj.value("Custom_ID").toInt(-1);
|
||||
int const machineNr = obj.value("Device_ID").toInt(-1);
|
||||
if (customerNr != m_customerNr) {
|
||||
QStringList lst(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
||||
.arg(customerNr).arg(m_customerNr));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
||||
.arg(customerNr).arg(m_customerNr));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
if (machineNr != m_machineNr) {
|
||||
QStringList lst(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
||||
.arg(machineNr).arg(m_machineNr));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
||||
.arg(machineNr).arg(m_machineNr));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
QStringList lst(QString("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID (LINE=%1)").arg(__LINE__));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst("Dev_ID KEY NOT A JSON-OBJECT");
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT A JSON-OBJECT (LINE=%1)").arg(__LINE__));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst("Dev_ID KEY NOT AVAILABLE");
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT AVAILABLE (LINE=%1)").arg(__LINE__));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj.contains("Fileupload")) {
|
||||
@ -573,56 +626,68 @@ bool Worker::updateTriggerSet() {
|
||||
obj = v.toObject();
|
||||
if (obj.contains("TRG")) {
|
||||
if ((triggerValue = obj.value("TRG").toString()) == "WAIT") {
|
||||
m_ismasTriggerStatusMessage = QStringList("ISMAS_UPDATE-TRIGGER SET TO WAIT");
|
||||
m_ismasTriggerActive = true;
|
||||
return m_ismasTriggerActive;
|
||||
} else
|
||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||
QStringList lst(QString("%1 empty update trigger (%2)").arg(repeat).arg(repeats-repeat));
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("%1 EMPTY UPDATE TRIGGER (%2)").arg(repeat).arg(repeats-repeat));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
if (m_clone) {
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)));
|
||||
// if the customer repository has just been cloned
|
||||
break; // it is OK the ISMAS trigger might not be 'WAIT'
|
||||
return false; // it is OK the ISMAS trigger might not be 'WAIT'
|
||||
} else {
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
}
|
||||
QThread::sleep(6);
|
||||
continue;
|
||||
} else {
|
||||
// if the download-button once has the wrong value, it will never recover
|
||||
// if the download-button once has a wrong value, it will never recover
|
||||
if (m_clone) {
|
||||
GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE='%1' != 'WAIT'").arg(triggerValue));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)));
|
||||
} else {
|
||||
QStringList lst(QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE='%1' != 'WAIT'").arg(triggerValue));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
}
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst("TRG key not available");
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("TRG key not available (LINE=%1)").arg(__LINE__));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst("Fileupload not a json-object");
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not a json-object (LINE=%1)").arg(__LINE__));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst(QString("Fileupload not available"));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
break;
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not available (LINE=%1)").arg(__LINE__));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QStringList lst = QStringList(QString("no ISMAS response"));
|
||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("no ISMAS response (LINE=%1)").arg(__LINE__));
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
QThread::sleep(6);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_initialClone == false) {
|
||||
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
|
||||
QStringList lst(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")");
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
|
||||
m_ismasTriggerStatusMessage = QStringList(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")");
|
||||
QStringList lst = m_ismasTriggerStatusMessage;
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -640,11 +705,11 @@ bool Worker::customerEnvironment() {
|
||||
return true;
|
||||
} else {
|
||||
QStringList lst(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH_FAILURE));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)));
|
||||
}
|
||||
} else {// cannot happen
|
||||
QStringList lst(QString(m_customerRepository + " DOES NOT EXIST"));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH_FAILURE));
|
||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -699,7 +764,7 @@ bool Worker::filesToUpdate() {
|
||||
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
|
||||
setProgress(_FILES_TO_UPDATE);
|
||||
} else {
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_FAILURE));
|
||||
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::UPDATE_REPOSITORY_FAILURE)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -807,7 +872,7 @@ bool Worker::execOpkgCommands() {
|
||||
}
|
||||
} else {
|
||||
m_displayIndex = 1;
|
||||
ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE));
|
||||
ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE)));
|
||||
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
|
||||
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
|
||||
return false;
|
||||
@ -827,8 +892,9 @@ bool Worker::downloadFilesToPSAHardware() {
|
||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
||||
|
||||
if (m_noUpdatePsaHardware == false) {
|
||||
if (computeFilesToDownload()) {
|
||||
CONSOLE(m_filesToDownload) << UPDATE_STEP::FILES_TO_DOWNLOAD;
|
||||
if (computeFilesToDownload() > 0) {
|
||||
QStringList lst = m_filesToDownload;
|
||||
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
|
||||
|
||||
Update update(this,
|
||||
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
||||
@ -847,10 +913,11 @@ bool Worker::downloadFilesToPSAHardware() {
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE;
|
||||
|
||||
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << (m_lastFailedUpdateStep = UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -930,14 +997,14 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
||||
QDir dir1(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_tariff"));
|
||||
QDir dir2("/etc/psa_tariff");
|
||||
if (Utils::sameFilesInDirs(dir1, dir2)) {
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
||||
CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS;
|
||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE));
|
||||
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE)));
|
||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
||||
return false;
|
||||
}
|
||||
@ -1118,15 +1185,14 @@ PSAInstalled Worker::getPSAInstalled() {
|
||||
QString absPathName;
|
||||
QString absPathNameRepository;
|
||||
|
||||
psaInstalled.versionInfo.lastCommit = "";
|
||||
psaInstalled.versionInfo.reason = "";
|
||||
psaInstalled.versionInfo.created = "";
|
||||
psaInstalled.versionInfo.lastCommit = "N/A";
|
||||
psaInstalled.versionInfo.reason = "N/A";
|
||||
psaInstalled.versionInfo.created = "N/A";
|
||||
|
||||
QStringList versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
if (versionInfo.size() == 3) {
|
||||
psaInstalled.versionInfo.lastCommit = versionInfo.at(0);
|
||||
psaInstalled.versionInfo.reason = versionInfo.at(1);
|
||||
psaInstalled.versionInfo.created = versionInfo.at(2);
|
||||
if (m_versionInfo.size() == 3) {
|
||||
psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0);
|
||||
psaInstalled.versionInfo.reason = m_versionInfo.at(1);
|
||||
psaInstalled.versionInfo.created = m_versionInfo.at(2);
|
||||
}
|
||||
|
||||
if (m_zoneNr != 0) {
|
||||
@ -1139,10 +1205,10 @@ PSAInstalled Worker::getPSAInstalled() {
|
||||
psaInstalled.tariff.size = getFileSize(absPathName);
|
||||
psaInstalled.tariff.zone = m_zoneNr;
|
||||
psaInstalled.tariff.loadTime = Utils::getTariffLoadTime(absPathName);
|
||||
psaInstalled.tariff.project = Utils::getLocation(absPathName);
|
||||
psaInstalled.tariff.version = Utils::getTariffVersion(absPathName);
|
||||
psaInstalled.tariff.info = Utils::getTariffInfo(absPathName);
|
||||
}
|
||||
psaInstalled.tariff.project = "Szeged";
|
||||
psaInstalled.tariff.info = "N/A";
|
||||
psaInstalled.tariff.version = "N/A";
|
||||
|
||||
psaInstalled.hw.linuxVersion = getOsVersion();
|
||||
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
||||
|
349
worker.h
349
worker.h
@ -33,37 +33,37 @@
|
||||
#define _ISMAS_RESET_WAIT "ISMAS" // reset WAIT-button to "WAIT"
|
||||
|
||||
#define _STARTED (1)
|
||||
#define _CHECK_SANITY (2)
|
||||
#define _CHECK_SANITY_FAILURE (3)
|
||||
#define _CHECK_SANITY_SUCCESS (4)
|
||||
#define _REPOSITORY_RECOVERED_FAILURE (5)
|
||||
#define _REPOSITORY_RECOVERED_SUCCESS (6)
|
||||
#define _CHECK_REPOSITORY (7)
|
||||
#define _CHECK_REPOSITORY_FAILURE (8)
|
||||
#define _CHECK_REPOSITORY_SUCCESS (9)
|
||||
#define _CLONE_REPOSITORY (10)
|
||||
#define _CLONE_REPOSITORY_FAILURE (11)
|
||||
#define _CLONE_REPOSITORY_SUCCESS (12)
|
||||
#define _CHECKOUT_REPOSITORY (13)
|
||||
#define _CHECKOUT_REPOSITORY_FAILURE (14)
|
||||
#define _CHECKOUT_REPOSITORY_SUCCESS (15)
|
||||
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (16)
|
||||
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (17)
|
||||
#define _CHECK_ISMAS_TRIGGER (19)
|
||||
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (20)
|
||||
#define _CHECK_ISMAS_TRIGGER_SUCCESS (21)
|
||||
#define _CHECK_ISMAS_TRIGGER_FAILURE (22)
|
||||
#define _CHECKOUT_BRANCH (23)
|
||||
#define _CHECKOUT_BRANCH_FAILURE (24)
|
||||
#define _CHECKOUT_BRANCH_SUCCESS (25)
|
||||
#define _UPDATE_REPOSITORY (26)
|
||||
#define _UPDATE_REPOSITORY_FAILURE (28)
|
||||
#define _UPDATE_REPOSITORY_SUCCESS (29)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES (30)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (36)
|
||||
#define _FILES_TO_UPDATE (37)
|
||||
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (38)
|
||||
#define _FILES_TO_DOWNLOAD (39)
|
||||
#define _CHECK_ISMAS_TRIGGER (2)
|
||||
#define _CHECK_SANITY (3)
|
||||
#define _CHECK_SANITY_FAILURE (4)
|
||||
#define _CHECK_SANITY_SUCCESS (5)
|
||||
#define _REPOSITORY_RECOVERED_FAILURE (6)
|
||||
#define _REPOSITORY_RECOVERED_SUCCESS (7)
|
||||
#define _CHECK_REPOSITORY (8)
|
||||
#define _CHECK_REPOSITORY_FAILURE (9)
|
||||
#define _CHECK_REPOSITORY_SUCCESS (10)
|
||||
#define _CLONE_REPOSITORY (11)
|
||||
#define _CLONE_REPOSITORY_FAILURE (12)
|
||||
#define _CLONE_REPOSITORY_SUCCESS (13)
|
||||
#define _CHECKOUT_REPOSITORY (14)
|
||||
#define _CHECKOUT_REPOSITORY_FAILURE (15)
|
||||
#define _CHECKOUT_REPOSITORY_SUCCESS (16)
|
||||
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (17)
|
||||
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (18)
|
||||
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (19)
|
||||
#define _CHECK_ISMAS_TRIGGER_SUCCESS (20)
|
||||
#define _CHECK_ISMAS_TRIGGER_FAILURE (21)
|
||||
#define _CHECKOUT_BRANCH (22)
|
||||
#define _CHECKOUT_BRANCH_FAILURE (23)
|
||||
#define _CHECKOUT_BRANCH_SUCCESS (24)
|
||||
#define _UPDATE_REPOSITORY (25)
|
||||
#define _UPDATE_REPOSITORY_FAILURE (26)
|
||||
#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 _EXEC_OPKG_COMMANDS (41)
|
||||
#define _EXEC_OPKG_COMMAND_1 (42)
|
||||
#define _EXEC_OPKG_COMMAND_2 (43)
|
||||
@ -82,28 +82,32 @@
|
||||
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (56)
|
||||
#define _DOWNLOAD_CONFIG_FILE_FAILURE (57)
|
||||
#define _DOWNLOAD_DEVICE_CONTROLLER (65)
|
||||
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (86)
|
||||
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (87)
|
||||
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (88)
|
||||
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (89)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY (90)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (91)
|
||||
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (92)
|
||||
#define _SAVE_LOGS (93)
|
||||
#define _SAVE_LOGS_FAILURE (94)
|
||||
#define _SAVE_LOGS_SUCCESS (95)
|
||||
#define _SEND_LAST_VERSION (96)
|
||||
#define _UPDATE_SUCCEEDED (97)
|
||||
#define _UPDATE_FAILED (98)
|
||||
#define _UPDATE_ACTIVATED (99)
|
||||
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (85)
|
||||
#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)
|
||||
#define _SEND_LAST_VERSION (95)
|
||||
#define _UPDATE_FINALIZE (95)
|
||||
#define _UPDATE_SUCCEEDED (96)
|
||||
#define _UPDATE_FAILED (97)
|
||||
#define _UPDATE_ACTIVATED (98)
|
||||
#define _UPDATE_NOT_NECESSARY (99)
|
||||
#define _FINISHED (100)
|
||||
#define _DEBUG (1000)
|
||||
#define _ERROR (1001)
|
||||
#define _NONE (1002)
|
||||
|
||||
#define _SEND_LAST_VERSION_CORRECTION (4)
|
||||
#define _UPDATE_SUCCEEDED_CORRECTION (3)
|
||||
#define _UPDATE_FAILED_CORRECTION (2)
|
||||
#define _UPDATE_ACTIVATED_CORRECTION (1)
|
||||
#define _SEND_LAST_VERSION_CORRECTION (5)
|
||||
#define _UPDATE_SUCCEEDED_CORRECTION (4)
|
||||
#define _UPDATE_FAILED_CORRECTION (3)
|
||||
#define _UPDATE_ACTIVATED_CORRECTION (2)
|
||||
#define _UPDATE_NOT_NECESSARY_CORRECTION (1)
|
||||
|
||||
#define ISMAS_UPDATE_REQUESTS (10)
|
||||
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
||||
@ -132,6 +136,7 @@ class Worker : public QThread{
|
||||
QString const m_baudrate;
|
||||
IsmasClient m_ismasClient;
|
||||
GitClient m_gc;
|
||||
QStringList m_versionInfo;
|
||||
QString const m_osVersion;
|
||||
QString const m_atbqtVersion;
|
||||
QString const m_atbUpdateToolVersion;
|
||||
@ -155,6 +160,9 @@ class Worker : public QThread{
|
||||
bool m_initialClone = false;
|
||||
bool m_repairClone = false;
|
||||
bool m_ismasTriggerActive = false;
|
||||
bool m_updateNotNecessary = false;
|
||||
bool m_automaticUpdate = false;
|
||||
QStringList m_ismasTriggerStatusMessage;
|
||||
|
||||
MainWindow *m_mainWindow;
|
||||
bool m_withoutIsmasDirectPort;
|
||||
@ -198,8 +206,48 @@ class Worker : public QThread{
|
||||
}
|
||||
|
||||
virtual ~UpdateProcessRunning() {
|
||||
m_worker->ISMAS() << (m_worker->GUI() << (m_worker->CONSOLE()
|
||||
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||
|
||||
if (m_worker->m_lastFailedUpdateStep == UPDATE_STEP::NONE) {
|
||||
if (m_worker->m_updateNotNecessary) {
|
||||
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
|
||||
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_NOT_NECESSARY));
|
||||
} else {
|
||||
QStringList lst(QString(m_worker->smap[UPDATE_STEP::UPDATE_SUCCEEDED]));
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << UPDATE_STEP::UPDATE_SUCCEEDED));
|
||||
m_worker->setProgress(_UPDATE_SUCCEEDED);
|
||||
|
||||
lst = QStringList(QString(m_worker->smap[UPDATE_STEP::UPDATE_ACTIVATED]));
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << UPDATE_STEP::UPDATE_ACTIVATED));
|
||||
m_worker->setProgress(_UPDATE_ACTIVATED);
|
||||
|
||||
lst = QStringList(QString(m_worker->smap[UPDATE_STEP::FINISHED]));
|
||||
m_worker->CONSOLE(lst) << UPDATE_STEP::FINISHED;
|
||||
m_worker->setProgress(_FINISHED);
|
||||
}
|
||||
} else {
|
||||
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
|
||||
UPDATE_STEP last = m_worker->m_lastFailedUpdateStep;
|
||||
if (m_worker->smap.contains(last)) {
|
||||
lst << QString(" (last failed step: %1)").arg(m_worker->smap[last]);
|
||||
} else {
|
||||
lst << QString(" (last failed step unknown: %1)").arg((int)(last));
|
||||
}
|
||||
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_FAILED));
|
||||
}
|
||||
|
||||
if (m_worker->m_automaticUpdate) {
|
||||
QStringList lst(QString(m_worker->smap[UPDATE_STEP::SEND_LAST_VERSION]));
|
||||
lst << "AUTOMATIC UPDATE";
|
||||
if (m_worker->m_updateNotNecessary) {
|
||||
lst << "UPDATE NOT NECESSARY";
|
||||
}
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
|
||||
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||
} else {
|
||||
QStringList lst(QString(m_worker->smap[UPDATE_STEP::SEND_LAST_VERSION]));
|
||||
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
|
||||
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||
}
|
||||
m_worker->stopProgressLoop();
|
||||
|
||||
m_worker->m_updateProcessRunning = false;
|
||||
@ -273,12 +321,15 @@ public:
|
||||
SAVE_LOGS_SUCCESS = _SAVE_LOGS_SUCCESS,
|
||||
SAVE_LOGS_FAILURE = _SAVE_LOGS_FAILURE,
|
||||
SEND_LAST_VERSION = _SEND_LAST_VERSION,
|
||||
UPDATE_FINALIZE = _UPDATE_FINALIZE,
|
||||
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
||||
UPDATE_ACTIVATED = _UPDATE_ACTIVATED,
|
||||
UPDATE_NOT_NECESSARY = _UPDATE_NOT_NECESSARY,
|
||||
UPDATE_FAILED = _UPDATE_FAILED,
|
||||
FINISHED = _FINISHED,
|
||||
DEBUG = _DEBUG,
|
||||
ERROR = _ERROR
|
||||
ERROR = _ERROR,
|
||||
NONE = _NONE
|
||||
};
|
||||
|
||||
private:
|
||||
@ -289,6 +340,8 @@ private:
|
||||
static Worker *instance;
|
||||
QStringList m_opkgCommands;
|
||||
Update *m_update = nullptr;
|
||||
hwinf *m_hw = nullptr;
|
||||
UPDATE_STEP m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||
|
||||
protected:
|
||||
virtual void run();
|
||||
@ -346,6 +399,8 @@ public:
|
||||
void displayProgressInMainWindow(int progress);
|
||||
void startProgressLoop();
|
||||
void stopProgressLoop();
|
||||
void setHW(hwinf *hw) { m_hw = hw; }
|
||||
hwinf *getHW() { return m_hw; }
|
||||
|
||||
IsmasClient &getIsmasClient() { return m_ismasClient; }
|
||||
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
||||
@ -405,6 +460,8 @@ private:
|
||||
QStringList lst = QStringList(smap[step]);
|
||||
|
||||
switch (step) {
|
||||
case UPDATE_STEP::NONE: {
|
||||
} break;
|
||||
case UPDATE_STEP::STARTED: {
|
||||
Utils::printUpdateStatusMsg(
|
||||
debug,
|
||||
@ -612,6 +669,10 @@ private:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_FAILED:
|
||||
break;
|
||||
case UPDATE_STEP::FINISHED:
|
||||
@ -645,28 +706,86 @@ private:
|
||||
QStringList lst = QStringList(smap[step]);
|
||||
|
||||
switch (step) {
|
||||
case UPDATE_STEP::NONE: {
|
||||
} break;
|
||||
case UPDATE_STEP::STARTED: {
|
||||
ismasClient.setProgressInPercent(_STARTED);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_SANITY:
|
||||
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS: {
|
||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0010",
|
||||
_CHECKOUT_REPOSITORY_SUCCESS,
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[UPDATE_STEP::CHECK_REPOSITORY],
|
||||
QString("REPOSITORY %1 AND BRANCH %2 OK")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE: {
|
||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0010",
|
||||
_CHECKOUT_REPOSITORY_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
|
||||
QString("REPOSITORY %1 and BRANCH %2 ***NOT OK***")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECK_SANITY: {
|
||||
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
||||
} break;
|
||||
case UPDATE_STEP::CHECK_SANITY_SUCCESS: {
|
||||
ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0010",
|
||||
_CHECK_SANITY_SUCCESS,
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[UPDATE_STEP::CHECK_SANITY],
|
||||
QString("SANITY OF %1 (BRANCH %2) OK")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECK_SANITY_FAILURE: {
|
||||
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
||||
break;
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0010",
|
||||
_CHECK_SANITY_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[UPDATE_STEP::CHECK_SANITY],
|
||||
QString("SANITY OF %1 and BRANCH %2 ***NOT*** OK")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
||||
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS);
|
||||
break;
|
||||
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
||||
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_FAILURE);
|
||||
break;
|
||||
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
||||
@ -679,11 +798,11 @@ private:
|
||||
"U0010",
|
||||
_CLONE_REPOSITORY_SUCCESS,
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::CLONE_REPOSITORY],
|
||||
QString("CLONED REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
ismasUpdateNews);
|
||||
} break;
|
||||
@ -695,11 +814,11 @@ private:
|
||||
"U0003",
|
||||
_CLONE_REPOSITORY_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
|
||||
QString("CLONING REPOSITORY %1 OR CHECKING OUT BRANCH %2 FAILED")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -713,7 +832,8 @@ private:
|
||||
ismasClient.cloneAndCheckoutCustomerRepository(
|
||||
QString("CHECKED OUT REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName())));
|
||||
.arg(instance->m_gc.branchName()),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
||||
@ -725,7 +845,8 @@ private:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateTriggerSet("ISMAS TRIGGER SET", ""));
|
||||
ismasClient.updateTriggerSet("ISMAS TRIGGER SET",
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||
@ -738,9 +859,9 @@ private:
|
||||
"U0003",
|
||||
_CHECK_ISMAS_TRIGGER_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::CHECK_ISMAS_TRIGGER],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -750,9 +871,20 @@ private:
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
||||
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER);
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH:
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH: {
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH);
|
||||
break;
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0010",
|
||||
_CHECKOUT_BRANCH_SUCCESS,
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS: {
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_SUCCESS);
|
||||
QString const &ismasUpdateNews =
|
||||
@ -761,9 +893,9 @@ private:
|
||||
"U0010",
|
||||
_CHECKOUT_BRANCH_SUCCESS,
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -775,9 +907,9 @@ private:
|
||||
"U0003",
|
||||
_CHECKOUT_BRANCH_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -911,12 +1043,23 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
_ISMAS_CONTINUE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[UPDATE_STEP::EXEC_OPKG_COMMANDS],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_FAILURE);
|
||||
@ -928,7 +1071,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -952,9 +1095,9 @@ private:
|
||||
_ISMAS_CONTINUE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -969,9 +1112,9 @@ private:
|
||||
_ISMAS_CONTINUE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -989,9 +1132,9 @@ private:
|
||||
_ISMAS_CONTINUE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1011,7 +1154,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1029,12 +1172,12 @@ private:
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0001", // WAIT-button set to 100%
|
||||
_ISMAS_DONE, // WAIT-button set to 100%
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1043,12 +1186,26 @@ private:
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0002", // reset WAIT-button to "" (empty string)
|
||||
_ISMAS_SET_WAIT_OK,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::UPDATE_NOT_NECESSARY: {
|
||||
ismasClient.setProgressInPercent(_UPDATE_NOT_NECESSARY + _UPDATE_NOT_NECESSARY_CORRECTION);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
_ISMAS_SET_WAIT_OK,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1057,12 +1214,12 @@ private:
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0003",
|
||||
_ISMAS_FAILURE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1089,6 +1246,8 @@ private:
|
||||
Worker::instance->m_currentStep = step;
|
||||
|
||||
switch (step) {
|
||||
case UPDATE_STEP::NONE: {
|
||||
} break;
|
||||
case UPDATE_STEP::STARTED:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||
@ -1263,6 +1422,8 @@ private:
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_ACTIVATED:
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_FAILED:
|
||||
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user