sicherung der aenderungen
This commit is contained in:
parent
9b0f741b9b
commit
5efac2619b
@ -155,7 +155,9 @@ MainWindow::MainWindow(hwinf *hw, Worker *worker, Update *update, QWidget *paren
|
|||||||
connect(m_worker, SIGNAL(appendText(QString,QString)),this,SLOT(onAppendText(QString,QString)));
|
connect(m_worker, SIGNAL(appendText(QString,QString)),this,SLOT(onAppendText(QString,QString)));
|
||||||
connect(m_worker, SIGNAL(showErrorMessage(QString,QString)),this, SLOT(onShowErrorMessage(QString,QString)));
|
connect(m_worker, SIGNAL(showErrorMessage(QString,QString)),this, SLOT(onShowErrorMessage(QString,QString)));
|
||||||
connect(m_worker, SIGNAL(showStatusMessage(QString,QString)),this, SLOT(onShowStatusMessage(QString,QString)));
|
connect(m_worker, SIGNAL(showStatusMessage(QString,QString)),this, SLOT(onShowStatusMessage(QString,QString)));
|
||||||
connect(m_worker, SIGNAL(replaceLast(QString,QString)),this,SLOT(onReplaceLast(QString,QString)));
|
connect(m_worker, SIGNAL(showErrorMessage(QStringList)),this, SLOT(onShowErrorMessage(QStringList)));
|
||||||
|
connect(m_worker, SIGNAL(showStatusMessage(QString,QString)),this, SLOT(onShowStatusMessage(QString,QString)));
|
||||||
|
connect(m_worker, SIGNAL(replaceLast(QStringList)),this,SLOT(onReplaceLast(QStringList)));
|
||||||
connect(m_worker, SIGNAL(replaceLast(QStringList,QString)),this, SLOT(onReplaceLast(QStringList,QString)));
|
connect(m_worker, SIGNAL(replaceLast(QStringList,QString)),this, SLOT(onReplaceLast(QStringList,QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,3 +450,21 @@ void MainWindow::onShowErrorMessage(QString title, QString text) {
|
|||||||
void MainWindow::onShowStatusMessage(QString title, QString text) {
|
void MainWindow::onShowStatusMessage(QString title, QString text) {
|
||||||
onShowMessage(title, text);
|
onShowMessage(title, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowErrorMessage(QStringList lst) {
|
||||||
|
if (lst.size() >= 2) {
|
||||||
|
onShowMessage(lst.at(0), lst.at(1));
|
||||||
|
}
|
||||||
|
if (lst.size() == 1) {
|
||||||
|
onShowMessage(lst.at(0), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowStatusMessage(QStringList lst) {
|
||||||
|
if (lst.size() >= 2) {
|
||||||
|
onShowMessage(lst.at(0), lst.at(1));
|
||||||
|
}
|
||||||
|
if (lst.size() == 1) {
|
||||||
|
onShowMessage(lst.at(0), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,6 +48,8 @@ public slots:
|
|||||||
void onReplaceLast(QString, QString suffix = "");
|
void onReplaceLast(QString, QString suffix = "");
|
||||||
void onShowErrorMessage(QString, QString);
|
void onShowErrorMessage(QString, QString);
|
||||||
void onShowStatusMessage(QString, QString);
|
void onShowStatusMessage(QString, QString);
|
||||||
|
void onShowErrorMessage(QStringList);
|
||||||
|
void onShowStatusMessage(QStringList);
|
||||||
void onStopStartTimer();
|
void onStopStartTimer();
|
||||||
void onRestartExitTimer();
|
void onRestartExitTimer();
|
||||||
void onEnableExit();
|
void onEnableExit();
|
||||||
|
10
utils.cpp
10
utils.cpp
@ -86,6 +86,16 @@ void Utils::printUpdateStatusMsg(QString const &updateMsg, bool upper, bool lowe
|
|||||||
if (lower) qCritical() << QString(80, 'U');
|
if (lower) qCritical() << QString(80, 'U');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Utils::printUpdateStatusMsg(QDebug &debug, QString const &updateMsg,
|
||||||
|
bool upper, bool lower) {
|
||||||
|
if (upper) debug << QString(80, 'U');
|
||||||
|
|
||||||
|
debug << updateMsg;
|
||||||
|
|
||||||
|
if (lower) debug << QString(80, 'U');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Utils::printInfoMsg(QString const &infoMsg, bool upper, bool lower) {
|
void Utils::printInfoMsg(QString const &infoMsg, bool upper, bool lower) {
|
||||||
if (upper) qCritical() << QString(80, 'I');
|
if (upper) qCritical() << QString(80, 'I');
|
||||||
|
|
||||||
|
1
utils.h
1
utils.h
@ -20,6 +20,7 @@ namespace Utils {
|
|||||||
void printUpdateStatusMsg(QDebug &debug, QStringList const &updateMsg);
|
void printUpdateStatusMsg(QDebug &debug, QStringList const &updateMsg);
|
||||||
void printUpdateStatusMsg(QStringList const &updateMsg);
|
void printUpdateStatusMsg(QStringList const &updateMsg);
|
||||||
void printUpdateStatusMsg(QString const &updateMsg, bool upper=false, bool lower=false);
|
void printUpdateStatusMsg(QString const &updateMsg, bool upper=false, bool lower=false);
|
||||||
|
void printUpdateStatusMsg(QDebug &debug, QString const &updateMsg, bool upper=false, bool lower=false);
|
||||||
void printLineEditInfo(QStringList const &lines);
|
void printLineEditInfo(QStringList const &lines);
|
||||||
QString getTariffLoadTime(QString fileName);
|
QString getTariffLoadTime(QString fileName);
|
||||||
QString rstrip(QString const &str);
|
QString rstrip(QString const &str);
|
||||||
|
720
worker.cpp
720
worker.cpp
@ -25,16 +25,66 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
#define CONSOLE() qDebug()
|
#define FUNC_NAME QString(__func__).toUpper()
|
||||||
#define ISMAS() m_ismasClient
|
|
||||||
#define GUI() m_mainWindow
|
|
||||||
|
|
||||||
QString const Worker::UPDATE_STEP_OK(" [ ok]");
|
QString const Worker::UPDATE_STEP_OK(" [ ok]");
|
||||||
QString const Worker::UPDATE_STEP_DONE(" [done]");
|
QString const Worker::UPDATE_STEP_DONE(" [done]");
|
||||||
QString const Worker::UPDATE_STEP_FAIL(" [FAIL]");
|
QString const Worker::UPDATE_STEP_FAIL(" [FAIL]");
|
||||||
QString const Worker::UPDATE_STEP_SUCCESS(" [SUCCESS]");
|
QString const Worker::UPDATE_STEP_SUCCESS(" [SUCCESS]");
|
||||||
|
|
||||||
Worker const *Worker::instance = nullptr;
|
using UPDATE_STEP = Worker::UPDATE_STEP;
|
||||||
|
const QMap<UPDATE_STEP, const char*> Worker::smap (
|
||||||
|
std::initializer_list<std::pair<UPDATE_STEP, const char*>>{
|
||||||
|
#define INSERT_ELEMENT(p) std::pair(p, #p)
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::STARTED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECKOUT_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS),
|
||||||
|
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_SUCCEEDED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::FINISHED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DEBUG),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::ERROR)
|
||||||
|
#undef INSERT_ELEMENT
|
||||||
|
});
|
||||||
|
|
||||||
|
Worker *Worker::instance = nullptr;
|
||||||
|
|
||||||
Worker::Worker(int customerNr,
|
Worker::Worker(int customerNr,
|
||||||
int machineNr,
|
int machineNr,
|
||||||
@ -318,69 +368,6 @@ int Worker::sendFinalResult() {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
void Worker::printProgress(UPDATE_STEP step) {
|
|
||||||
switch(step) {
|
|
||||||
case UPDATE_STEP::SANITY_CHECK:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 1: CHECKED SANITY OF CUSTOMER REPOSITORY %1 DONE")
|
|
||||||
.arg(m_customerRepository)
|
|
||||||
<< QString("STEP 2: FETCH CUSTOMER REPOSITORY %1...")
|
|
||||||
.arg(m_customerRepository));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::FETCH_REPOSITORY:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
|
||||||
.arg(m_customerRepository)
|
|
||||||
<< QString("STEP 3: CHECK ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS..."));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 3: CHECKED ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS. SUCCESS.")
|
|
||||||
<< QString("STEP 4: CHECK-OUT BRANCH %1...").arg(m_gc.branchName()));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::CHECKED_OUT_BRANCH:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 4: CHECKED-OUT BRANCH %1 DONE")
|
|
||||||
.arg(m_gc.branchName())
|
|
||||||
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE..."));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::COMPUTE_FILES_TO_UPDATE:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE %1 DONE")
|
|
||||||
.arg(m_filesToUpdate.join(','))
|
|
||||||
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS...")
|
|
||||||
.arg(m_filesToDownload.join(',')));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_UPDATE:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS DONE")
|
|
||||||
.arg(m_filesToDownload.join(','))
|
|
||||||
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM...")
|
|
||||||
.arg(m_customerRepository));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM DONE")
|
|
||||||
.arg(m_customerRepository)
|
|
||||||
<< QString("STEP 8: SEND-LAST-VERSION TO ISMAS..."));
|
|
||||||
break;
|
|
||||||
case UPDATE_STEP::UPDATE_SUCCESS:
|
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 9: SAVE-LOG-FILES (FUTURE USE) DONE")
|
|
||||||
<< QString("STEP 10: MARK UPDATE AS SUCCESSFUL AND ACTIVE..."));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Worker::privateUpdate() {
|
void Worker::privateUpdate() {
|
||||||
if (!m_mainWindow) {
|
if (!m_mainWindow) {
|
||||||
@ -396,14 +383,12 @@ void Worker::privateUpdate() {
|
|||||||
emit disableExit();
|
emit disableExit();
|
||||||
|
|
||||||
m_returnCode = -1;
|
m_returnCode = -1;
|
||||||
|
startProgressLoop();
|
||||||
|
|
||||||
QDir customerRepository(m_customerRepository);
|
QDir customerRepository(m_customerRepository);
|
||||||
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
||||||
|
|
||||||
Utils::printUpdateStatusMsg(
|
CONSOLE() << UPDATE_STEP::CHECK_SANITY;
|
||||||
QStringList()
|
|
||||||
<< QString("STEP 1: CHECK SANITY OF CUSTOMER REPOSITORY %1...")
|
|
||||||
.arg(m_customerRepository));
|
|
||||||
|
|
||||||
bool initialClone = false; // the customer repository is cloned without
|
bool initialClone = false; // the customer repository is cloned without
|
||||||
// checking the ISMAS-trigger (WAIT-)button.
|
// checking the ISMAS-trigger (WAIT-)button.
|
||||||
@ -415,54 +400,53 @@ void Worker::privateUpdate() {
|
|||||||
// resulting in a corrupted git-repository, which
|
// resulting in a corrupted git-repository, which
|
||||||
// does not contain an ./etc-directory
|
// does not contain an ./etc-directory
|
||||||
if (isRepositoryCorrupted()) {
|
if (isRepositoryCorrupted()) {
|
||||||
QString s("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...");
|
CONSOLE() << UPDATE_STEP::CHECK_SANITY_FAILURE;
|
||||||
if ((continueUpdate = repairCorruptedRepository()) == true) {
|
if ((continueUpdate = repairCorruptedRepository()) == true) {
|
||||||
Utils::printUpdateStatusMsg(
|
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS;
|
||||||
QStringList() << s <<
|
|
||||||
QString("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...DONE"));
|
|
||||||
} else {
|
} else {
|
||||||
Utils::printUpdateStatusMsg(
|
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE;
|
||||||
QStringList() << s <<
|
|
||||||
QString("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...FAIL"));
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
CONSOLE() << UPDATE_STEP::CHECK_SANITY_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (continueUpdate) {
|
if (continueUpdate) {
|
||||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY;
|
|
||||||
if ((continueUpdate = customerRepository.exists()) == false) {
|
if ((continueUpdate = customerRepository.exists()) == false) {
|
||||||
emit appendText("\nInitializing customer environment ...");
|
GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY);
|
||||||
startProgressLoop();
|
for (int i = 0; i < 5; ++i) { // try to checkout git repository
|
||||||
for (int i = 0; i < 5; ++i) { // try to checkout git repository
|
setProgress(i); // and switch to branch
|
||||||
setProgress(i); // and switch to branch
|
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
if (!isRepositoryCorrupted()) {
|
||||||
if (!isRepositoryCorrupted()) {
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
|
||||||
m_returnCode = sendCloneAndCheckoutSuccess();
|
|
||||||
continueUpdate = true;
|
continueUpdate = true;
|
||||||
initialClone = true;
|
initialClone = true;
|
||||||
Utils::printInfoMsg("INITIAL CLONE DONE");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QThread::sleep(1); // maybe git needs more time
|
QThread::sleep(1); // maybe git needs more time
|
||||||
}
|
}
|
||||||
if (continueUpdate == false) {
|
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
if (continueUpdate == false) {
|
||||||
m_returnCode = sendCloneAndCheckoutFailure();
|
GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!initialClone) {
|
|
||||||
// qDebug() << UPDATE_STEP::FETCH_REPOSITORY;
|
|
||||||
} else {
|
} else {
|
||||||
Utils::printUpdateStatusMsg(
|
|
||||||
QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
|
||||||
.arg(m_customerRepository));
|
if (isRepositoryCorrupted()) {
|
||||||
} // repository is neither not existent nor
|
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_FAILURE;
|
||||||
} // corrupted. check now if the ISMAS-trigger
|
continueUpdate = false;
|
||||||
if (continueUpdate) { // (WAIT-BUTTON) is activated even in case of
|
} else {
|
||||||
// initial checkout
|
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
|
||||||
if ((continueUpdate = updateTriggerSet(10)) == false) {
|
}
|
||||||
|
}
|
||||||
|
} // repository is existent and not corrupted.
|
||||||
|
// check now if the ISMAS-trigger (WAIT-button)
|
||||||
|
if (continueUpdate) { // is activated even in case of initial checkout
|
||||||
|
if ((continueUpdate = updateTriggerSet()) == false) {
|
||||||
|
// if (initialClone) {
|
||||||
|
//
|
||||||
|
//}
|
||||||
m_returnCode = sendIsmasTriggerFailure();
|
m_returnCode = sendIsmasTriggerFailure();
|
||||||
}
|
}
|
||||||
if (continueUpdate) { // configure customer environment -> checkout
|
if (continueUpdate) { // configure customer environment -> checkout
|
||||||
@ -526,6 +510,8 @@ void Worker::privateUpdate() {
|
|||||||
sendIsmasLastVersionNotification(100);
|
sendIsmasLastVersionNotification(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopProgressLoop();
|
||||||
|
|
||||||
m_updateProcessRunning = false;
|
m_updateProcessRunning = false;
|
||||||
emit enableExit();
|
emit enableExit();
|
||||||
emit restartExitTimer();
|
emit restartExitTimer();
|
||||||
@ -589,94 +575,66 @@ std::optional<QString> Worker::getApismVersion() {
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
bool Worker::updateTriggerSet() {
|
||||||
|
|
||||||
bool Worker::updateTriggerSet(int progress) {
|
|
||||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
||||||
|
|
||||||
QString triggerValue("");
|
QString triggerValue("");
|
||||||
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
|
||||||
|
|
||||||
for (int repeat = 1; repeat <= 100; ++repeat) {
|
for (int repeat = 1; repeat <= 100; ++repeat) {
|
||||||
|
CONSOLE(QStringList(FUNC_NAME) << QString("-> REPEAT=%1").arg(repeat)) << UPDATE_STEP::DEBUG;
|
||||||
qInfo() << "UPDATE TRIGGER SET -> REPEAT" << repeat;
|
|
||||||
|
|
||||||
if (repeat > 1) {
|
if (repeat > 1) {
|
||||||
|
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
||||||
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
|
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
|
||||||
QString const &msg = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
||||||
qInfo() << "REPEAT" << msg;
|
CONSOLE(QStringList(FUNC_NAME) << s) << UPDATE_STEP::DEBUG;
|
||||||
emit showErrorMessage("check update trigger", msg);
|
|
||||||
} else {
|
} else {
|
||||||
emit showErrorMessage("check update trigger", "");
|
CONSOLE(QStringList(FUNC_NAME)) << UPDATE_STEP::DEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((repeat % 10) == 0) {
|
if ((repeat % 10) == 0) {
|
||||||
qInfo() << "CHECK UPDATE TRIGGER. RESTART APISM ...";
|
CONSOLE(QStringList(FUNC_NAME) << "RESTART APISM") << UPDATE_STEP::DEBUG;
|
||||||
Command c("systemctl restart apism");
|
Command c("systemctl restart apism");
|
||||||
if (c.execute("/tmp")) {
|
if (c.execute("/tmp")) {
|
||||||
QThread::sleep(20); // give APISM some time to reconnect
|
QThread::sleep(20); // give APISM some time to reconnect
|
||||||
qInfo() << "CHECK UPDATE TRIGGER. RESTARTING APISM DONE";
|
CONSOLE(QStringList(FUNC_NAME) << "RESTART APISM DONE") << UPDATE_STEP::DEBUG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startProgressLoop();
|
|
||||||
if (std::optional<QString> result
|
if (std::optional<QString> result
|
||||||
= IsmasClient::sendRequestReceiveResponse(
|
= IsmasClient::sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||||
stopProgressLoop();
|
|
||||||
// setProgress(m_mainWindow->progressValue()/10 + 11);
|
|
||||||
|
|
||||||
QString msg = result.value();
|
QString const &msg = QString("APISM RESPONSE(%1)=(").arg(repeat) + result.value() + ")";
|
||||||
|
CONSOLE(QStringList(FUNC_NAME) << msg) << UPDATE_STEP::DEBUG;
|
||||||
qInfo() << "REPEAT" << repeat << "APISM RESPONSE (" << msg << ")";
|
|
||||||
|
|
||||||
QJsonParseError parseError;
|
QJsonParseError parseError;
|
||||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||||
if (parseError.error != QJsonParseError::NoError) {
|
if (parseError.error != QJsonParseError::NoError) {
|
||||||
qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):"
|
QStringList const &lst
|
||||||
<< parseError.error << parseError.errorString();
|
= QStringList(QString("check update trigger")) << QString("invalid json ")
|
||||||
//setProgress(100);
|
+ QString("INVALID JSON MSG: PARSING FAILED (msg=%1 %2 %3)")
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::JSON_PARSE_FAILURE,
|
.arg(msg).arg(parseError.error).arg(parseError.errorString()).mid(0, 20);
|
||||||
QString("(2) INVALID JSON %1 %2 %3")
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
.arg(msg)
|
break;
|
||||||
.arg(parseError.error)
|
|
||||||
.arg(parseError.errorString()));
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.jsonParseFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger",
|
|
||||||
QString("invalid json ") + msg.mid(0, 20));
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (!document.isObject()) {
|
if (!document.isObject()) {
|
||||||
qCritical() << "FILE IS NOT A JSON OBJECT!";
|
QStringList const &lst =
|
||||||
//setProgress(100);
|
QStringList(QString("check update trigger")) << QString("not a json-object ") + msg;
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::JSON_PARSE_FAILURE,
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QString("NOT A JSON-OBJECT %1").arg(msg));
|
break;
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.jsonParseFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", QString("not a json object") + msg);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
// setProgress(m_mainWindow->progressValue()/10 + 11);
|
|
||||||
|
|
||||||
QJsonObject obj = document.object();
|
QJsonObject obj = document.object();
|
||||||
|
|
||||||
// always look for an 'error' first
|
// always look for an 'error' first
|
||||||
if (obj.contains("error")) {
|
if (obj.contains("error")) {
|
||||||
// setProgress(m_mainWindow->progressValue()/10 + 11);
|
CONSOLE(QStringList(obj.value("error").toString())) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE;
|
||||||
QString value = obj.value("error").toString();
|
|
||||||
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
|
||||||
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
|
||||||
<< value << ">";
|
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -688,175 +646,96 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
if (v.isObject()) {
|
if (v.isObject()) {
|
||||||
QJsonObject obj = v.toObject();
|
QJsonObject obj = v.toObject();
|
||||||
if (obj.contains("Custom_ID") && obj.contains("Device_ID")) {
|
if (obj.contains("Custom_ID") && obj.contains("Device_ID")) {
|
||||||
QJsonValue const c = obj.value("Custom_ID");
|
int const customerNr = obj.value("Custom_ID").toInt(-1);
|
||||||
QJsonValue const m = obj.value("Device_ID");
|
int const machineNr = obj.value("Device_ID").toInt(-1);
|
||||||
int customerNr = c.toInt(-1);
|
|
||||||
int machineNr = m.toInt(-1);
|
|
||||||
if (customerNr != m_customerNr) {
|
if (customerNr != m_customerNr) {
|
||||||
//setProgress(100);
|
QStringList const &lst =
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList(QString("check update trigger"))
|
||||||
QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
<< QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
||||||
.arg(customerNr).arg(m_customerNr));
|
.arg(customerNr).arg(m_customerNr);
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
break;
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (machineNr != m_machineNr) {
|
if (machineNr != m_machineNr) {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const &lst =
|
||||||
QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
QStringList(QString("check update trigger"))
|
||||||
.arg(machineNr).arg(m_machineNr));
|
<< QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
.arg(machineNr).arg(m_machineNr);
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
break;
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qInfo() << "MACHINE-AND-CUSTOMER-CHECK" << m_updateStatus.m_statusDescription;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const lst("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
|
||||||
"Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
break;
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const lst("Dev_ID KEY NOT A JSON-OBJECT");
|
||||||
"Dev_ID KEY NOT A JSON-OBJECT");
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
break;
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const lst("Dev_ID KEY NOT AVAILABLE");
|
||||||
"Dev_ID KEY NOT AVAILABLE");
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
break;
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
// setProgress(m_mainWindow->progressValue()/10 + 11);
|
|
||||||
|
|
||||||
if (obj.contains("Fileupload")) {
|
if (obj.contains("Fileupload")) {
|
||||||
QJsonValue v = obj.value("Fileupload");
|
QJsonValue v = obj.value("Fileupload");
|
||||||
if (v.isObject()) {
|
if (v.isObject()) {
|
||||||
obj = v.toObject();
|
obj = v.toObject();
|
||||||
if (obj.contains("TRG")) {
|
if (obj.contains("TRG")) {
|
||||||
triggerValue = obj.value("TRG").toString();
|
if ((triggerValue = obj.value("TRG").toString()) == "WAIT") {
|
||||||
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
||||||
qInfo() << "REPEAT" << repeat
|
|
||||||
<< "In updateTriggerSet() TRG value=<"
|
|
||||||
<< triggerValue << ">";
|
|
||||||
|
|
||||||
if (triggerValue == "WAIT") {
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
|
||||||
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
|
||||||
.arg(m_machineNr).arg(m_customerNr));
|
|
||||||
|
|
||||||
m_ismasClient.setProgressInPercent(progress);
|
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
|
|
||||||
progress += 5;
|
|
||||||
m_ismasClient.setProgressInPercent(progress);
|
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
|
||||||
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
||||||
m_ismasClient.updateTriggerSet(m_updateStatus.m_statusDescription, ""));
|
|
||||||
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_DONE);
|
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
stopProgressLoop();
|
QStringList const &lst =
|
||||||
// setProgress(m_mainWindow->progressValue()/10 + 11);
|
QStringList(QString("check update trigger")) << QString("empty update trigger");
|
||||||
emit showErrorMessage("check update trigger", "empty update-trigger");
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// if the download-button once has the wrong value, it will never recover
|
// if the download-button once has the wrong value, it will never recover
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const &lst =
|
||||||
QString("TRIGGER-VALUE=<") + triggerValue + "> NOT 'WAIT'");
|
QStringList(QString("check update trigger"))
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
<< QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue);
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
break;
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const &lst =
|
||||||
"TRG KEY NOT AVAILABLE");
|
QStringList(QString("check update trigger")) << QString("TRG key not available");
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
break;
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const &lst =
|
||||||
"Fileupload NOT A JSON-OBJECT");
|
QStringList(QString("check update trigger")) << QString("Fileupload not a json-object");
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
break;
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
QStringList const &lst =
|
||||||
"Fileupload KEY NOT AVAILABLE");
|
QStringList(QString("check update trigger")) << QString("Fileupload not available");
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
break;
|
||||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
||||||
m_updateStatus.m_statusDescription));
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
QStringList const &lst =
|
||||||
//setProgress(m_mainWindow->progressValue()/10 + 11);
|
QStringList(QString("check update trigger")) << QString("no ISMAS response");
|
||||||
emit showErrorMessage("check update trigger", "no ISMAS response");
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG,
|
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
|
||||||
QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") +
|
QStringList const &lst =
|
||||||
triggerValue + ")");
|
QStringList(QString("check update trigger"))
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
<< QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")";
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
|
||||||
m_ismasClient.errorUpdateTrigger(m_updateStatus.m_statusDescription, ""));
|
}
|
||||||
|
|
||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1359,262 +1238,3 @@ hwinf *Worker::getPlugin() {
|
|||||||
hwinf const *Worker::getPlugin() const {
|
hwinf const *Worker::getPlugin() const {
|
||||||
return m_mainWindow ? m_mainWindow->getPlugin() : nullptr;
|
return m_mainWindow ? m_mainWindow->getPlugin() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************************
|
|
||||||
* operators
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
QDebug operator<< (QDebug debug, UpdateStatus status) {
|
|
||||||
switch(status.m_updateStatus) {
|
|
||||||
case UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::SAVE_LOG_FILES_FAILED:
|
|
||||||
debug << QString("UPDATE_STATUS::SAVE_LOG_FILES_FAILED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::PSA_UPDATE_FILES_FAILED:
|
|
||||||
debug << QString("UPDATE_STATUS::PSA_UPDATE_FILES_FAILED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::RSYNC_UPDATES_SUCCESS:
|
|
||||||
debug << QString("UPDATE_STATUS::RSYNC_UPDATES_SUCCESS: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::RSYNC_UPDATES_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::RSYNC_UPDATES_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::EXEC_OPKG_COMMAND:
|
|
||||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMAND: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::NOT_DEFINED:
|
|
||||||
debug << QString("UPDATE_STATUS::NOT_DEFINED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::UPDATE_PROCESS_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::UPDATE_PROCESS_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_SANITY_CHECK_OK:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_SANITY_CHECK_OK: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::JSON_PARSE_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::JSON_PARSE_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::BACKEND_CHECK:
|
|
||||||
debug << QString("UPDATE_STATUS::BACKEND_CHECK: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::BACKEND_CHECK_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::BACKEND_CHECK_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::BACKEND_NOT_CONNECTED:
|
|
||||||
debug << QString("UPDATE_STATUS::BACKEND_NOT_CONNECTED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::UPDATE_PROCESS_SUCCESS:
|
|
||||||
debug << QString("UPDATE_STATUS::UPDATE_PROCESS_SUCCESS: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_PENDING:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_PENDING: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_FETCH_UPDATES:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE:
|
|
||||||
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED:
|
|
||||||
debug << QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::RSYNC_FILE_SUCCESS:
|
|
||||||
debug << QString("UPDATE_STATUS::RSYNC_FILE_SUCCESS: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS:
|
|
||||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::REMOVE_GIT_REPOSITORY_FAILED:
|
|
||||||
debug << QString("UPDATE_STATUS::REMOVE_GIT_REPOSITORY_FAILED: ")
|
|
||||||
<< status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
// default:;
|
|
||||||
}
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString& operator<< (QString& str, UpdateStatus status) {
|
|
||||||
switch(status.m_updateStatus) {
|
|
||||||
case UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_SEND_LAST_VERSION_FAILED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::SAVE_LOG_FILES_FAILED:
|
|
||||||
str = QString("UPDATE_STATUS::SAVE_LOG_FILES_FAILED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_CHECK_FILES_TO_UPDATE_SUCCESS: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::PSA_UPDATE_FILES_FAILED:
|
|
||||||
str = QString("UPDATE_STATUS::PSA_UPDATE_FILES_FAILED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::RSYNC_UPDATES_SUCCESS:
|
|
||||||
str = QString("UPDATE_STATUS::RSYNC_UPDATES_SUCCESS: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::RSYNC_UPDATES_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::RSYNC_UPDATES_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::EXEC_OPKG_COMMAND:
|
|
||||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMAND: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::NOT_DEFINED:
|
|
||||||
str = QString("UPDATE_STATUS::NOT_DEFINED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::UPDATE_PROCESS_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::UPDATE_PROCESS_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_CHECKOUT_BRANCH:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_CHECKOUT_BRANCH: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_SANITY_CHECK_OK:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_SANITY_CHECK_OK: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::JSON_PARSE_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::JSON_PARSE_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::BACKEND_CHECK:
|
|
||||||
str = QString("UPDATE_STATUS::BACKEND_CHECK: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::BACKEND_CHECK_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::BACKEND_CHECK_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::BACKEND_NOT_CONNECTED:
|
|
||||||
str = QString("UPDATE_STATUS::BACKEND_NOT_CONNECTED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::UPDATE_PROCESS_SUCCESS:
|
|
||||||
str = QString("UPDATE_STATUS::UPDATE_PROCESS_SUCCESS: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_PENDING:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_PENDING: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_FETCH_UPDATES:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE:
|
|
||||||
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED:
|
|
||||||
str = QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS:
|
|
||||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::RSYNC_FILE_SUCCESS:
|
|
||||||
str = QString("UPDATE_STATUS::RSYNC_FILE_SUCCESS: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
case UPDATE_STATUS::REMOVE_GIT_REPOSITORY_FAILED:
|
|
||||||
str = QString("UPDATE_STATUS::REMOVE_GIT_REPOSITORY_FAILED: ");
|
|
||||||
str += status.m_statusDescription;
|
|
||||||
break;
|
|
||||||
//default:;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
443
worker.h
443
worker.h
@ -27,17 +27,21 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _STARTED (1)
|
#define _STARTED (1)
|
||||||
#define _CHECK_REPOSITORY (2)
|
#define _CHECK_SANITY (2)
|
||||||
#define _CHECK_SANITY (3)
|
#define _CHECK_SANITY_SUCCESS (3)
|
||||||
#define _CHECK_SANITY_SUCCESS (4)
|
#define _CHECK_SANITY_FAILURE (4)
|
||||||
#define _CHECK_SANITY_FAILURE (5)
|
#define _REPOSITORY_RECOVERED_SUCCESS (5)
|
||||||
#define _CLONE_REPOSITORY (6)
|
#define _REPOSITORY_RECOVERED_FAILURE (6)
|
||||||
#define _CLONE_REPOSITORY_SUCCESS (7)
|
#define _CHECK_REPOSITORY (7)
|
||||||
#define _CLONE_REPOSITORY_FAILURE (8)
|
#define _CHECK_REPOSITORY_SUCCESS (8)
|
||||||
#define _SWITCH_BRANCH (12)
|
#define _CHECK_REPOSITORY_FAILURE (9)
|
||||||
#define _SWITCH_BRANCH_SUCCESS (13)
|
#define _CLONE_REPOSITORY (10)
|
||||||
#define _SWITCH_BRANCH_FAILURE (14)
|
#define _CLONE_REPOSITORY_SUCCESS (11)
|
||||||
#define _CHECK_ISMAS_TRIGGER (15)
|
#define _CLONE_REPOSITORY_FAILURE (12)
|
||||||
|
#define _CHECKOUT_REPOSITORY (13)
|
||||||
|
#define _CHECKOUT_REPOSITORY_SUCCESS (14)
|
||||||
|
#define _CHECKOUT_REPOSITORY_FAILURE (15)
|
||||||
|
#define _CHECK_ISMAS_TRIGGER (19)
|
||||||
#define _CHECK_ISMAS_TRIGGER_SUCCESS (23)
|
#define _CHECK_ISMAS_TRIGGER_SUCCESS (23)
|
||||||
#define _CHECK_ISMAS_TRIGGER_FAILURE (24)
|
#define _CHECK_ISMAS_TRIGGER_FAILURE (24)
|
||||||
#define _UPDATE_REPOSITORY (25)
|
#define _UPDATE_REPOSITORY (25)
|
||||||
@ -65,6 +69,8 @@
|
|||||||
#define _UPDATE_SUCCEEDED (98)
|
#define _UPDATE_SUCCEEDED (98)
|
||||||
#define _UPDATE_FAILED (99)
|
#define _UPDATE_FAILED (99)
|
||||||
#define _FINISHED (100)
|
#define _FINISHED (100)
|
||||||
|
#define _DEBUG (1000)
|
||||||
|
#define _ERROR (1001)
|
||||||
|
|
||||||
enum class UPDATE_STATUS : quint8 {
|
enum class UPDATE_STATUS : quint8 {
|
||||||
NOT_DEFINED,
|
NOT_DEFINED,
|
||||||
@ -110,6 +116,7 @@ struct UpdateStatus {
|
|||||||
|
|
||||||
|
|
||||||
#define ISMAS_UPDATE_REQUESTS (10)
|
#define ISMAS_UPDATE_REQUESTS (10)
|
||||||
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class hwinf;
|
class hwinf;
|
||||||
@ -186,6 +193,7 @@ class Worker : public QObject {
|
|||||||
int sendUpdateSucceededAndActivated();
|
int sendUpdateSucceededAndActivated();
|
||||||
int sendFinalResult();
|
int sendFinalResult();
|
||||||
|
|
||||||
|
|
||||||
static constexpr const int UPDATE_SUCCESS_AND_ACTIVATED = 0;
|
static constexpr const int UPDATE_SUCCESS_AND_ACTIVATED = 0;
|
||||||
static constexpr const int CLONE_AND_CHECKOUT_SUCCESS = 0;
|
static constexpr const int CLONE_AND_CHECKOUT_SUCCESS = 0;
|
||||||
static constexpr const int CLONE_AND_CHECKOUT_FAILURE = -3;
|
static constexpr const int CLONE_AND_CHECKOUT_FAILURE = -3;
|
||||||
@ -197,18 +205,23 @@ class Worker : public QObject {
|
|||||||
static constexpr const int SEND_LAST_VERSION_FAILURE = -10;
|
static constexpr const int SEND_LAST_VERSION_FAILURE = -10;
|
||||||
static constexpr const int SAVE_LOG_FILES_FAILURE = -11;
|
static constexpr const int SAVE_LOG_FILES_FAILURE = -11;
|
||||||
|
|
||||||
|
public:
|
||||||
enum class UPDATE_STEP {
|
enum class UPDATE_STEP {
|
||||||
STARTED = _STARTED,
|
STARTED = _STARTED,
|
||||||
CHECK_REPOSITORY = _CHECK_REPOSITORY,
|
CHECK_REPOSITORY = _CHECK_REPOSITORY,
|
||||||
|
CHECK_REPOSITORY_SUCCESS = _CHECK_REPOSITORY_SUCCESS,
|
||||||
|
CHECK_REPOSITORY_FAILURE = _CHECK_REPOSITORY_FAILURE,
|
||||||
CHECK_SANITY = _CHECK_SANITY,
|
CHECK_SANITY = _CHECK_SANITY,
|
||||||
CHECK_SANITY_SUCCESS = _CHECK_SANITY_SUCCESS,
|
CHECK_SANITY_SUCCESS = _CHECK_SANITY_SUCCESS,
|
||||||
CHECK_SANITY_FAILURE = _CHECK_SANITY_FAILURE,
|
CHECK_SANITY_FAILURE = _CHECK_SANITY_FAILURE,
|
||||||
|
REPOSITORY_RECOVERED_SUCCESS = _REPOSITORY_RECOVERED_SUCCESS,
|
||||||
|
REPOSITORY_RECOVERED_FAILURE = _REPOSITORY_RECOVERED_FAILURE,
|
||||||
CLONE_REPOSITORY = _CLONE_REPOSITORY,
|
CLONE_REPOSITORY = _CLONE_REPOSITORY,
|
||||||
CLONE_REPOSITORY_SUCCESS = _CLONE_REPOSITORY_SUCCESS,
|
CLONE_REPOSITORY_SUCCESS = _CLONE_REPOSITORY_SUCCESS,
|
||||||
CLONE_REPOSITORY_FAILURE = _CLONE_REPOSITORY_FAILURE,
|
CLONE_REPOSITORY_FAILURE = _CLONE_REPOSITORY_FAILURE,
|
||||||
SWITCH_BRANCH = _SWITCH_BRANCH,
|
CHECKOUT_REPOSITORY = _CHECKOUT_REPOSITORY,
|
||||||
SWITCH_BRANCH_SUCCESS = _SWITCH_BRANCH_SUCCESS,
|
CHECKOUT_REPOSITORY_SUCCESS = _CHECKOUT_REPOSITORY_SUCCESS,
|
||||||
SWITCH_BRANCH_FAILURE = _SWITCH_BRANCH_FAILURE,
|
CHECKOUT_REPOSITORY_FAILURE = _CHECKOUT_REPOSITORY_FAILURE,
|
||||||
CHECK_ISMAS_TRIGGER = _CHECK_ISMAS_TRIGGER,
|
CHECK_ISMAS_TRIGGER = _CHECK_ISMAS_TRIGGER,
|
||||||
CHECK_ISMAS_TRIGGER_SUCCESS = _CHECK_ISMAS_TRIGGER_SUCCESS,
|
CHECK_ISMAS_TRIGGER_SUCCESS = _CHECK_ISMAS_TRIGGER_SUCCESS,
|
||||||
CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE,
|
CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE,
|
||||||
@ -236,10 +249,32 @@ class Worker : public QObject {
|
|||||||
SEND_LAST_VERSION = _SEND_LAST_VERSION,
|
SEND_LAST_VERSION = _SEND_LAST_VERSION,
|
||||||
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
||||||
UPDATE_FAILED = _UPDATE_FAILED,
|
UPDATE_FAILED = _UPDATE_FAILED,
|
||||||
FINISHED = _FINISHED
|
FINISHED = _FINISHED,
|
||||||
|
DEBUG = _DEBUG,
|
||||||
|
ERROR = _ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
static Worker const *instance;
|
private:
|
||||||
|
QStringList m_debugMsg;
|
||||||
|
QStringList m_guiMsg;
|
||||||
|
QStringList m_ismasMsg;
|
||||||
|
UPDATE_STEP m_currentStep;
|
||||||
|
static Worker *instance;
|
||||||
|
|
||||||
|
QDebug CONSOLE(QStringList const &lst = QStringList()) {
|
||||||
|
m_debugMsg = lst;
|
||||||
|
return qDebug();
|
||||||
|
}
|
||||||
|
|
||||||
|
IsmasClient &ISMAS(QStringList const &lst = QStringList()) {
|
||||||
|
m_ismasMsg = lst;
|
||||||
|
return m_ismasClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
Worker *GUI(QStringList const &lst = QStringList()) {
|
||||||
|
m_guiMsg = lst;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString getATBUpdateToolYoctoVersion();
|
static QString getATBUpdateToolYoctoVersion();
|
||||||
@ -291,6 +326,8 @@ signals:
|
|||||||
void replaceLast(QStringList, QString);
|
void replaceLast(QStringList, QString);
|
||||||
void showErrorMessage(QString title, QString description);
|
void showErrorMessage(QString title, QString description);
|
||||||
void showStatusMessage(QString title, QString description);
|
void showStatusMessage(QString title, QString description);
|
||||||
|
void showErrorMessage(QStringList titleAndDesc);
|
||||||
|
void showStatusMessage(QStringList titleAndDesc);
|
||||||
void stopStartTimer();
|
void stopStartTimer();
|
||||||
void restartExitTimer();
|
void restartExitTimer();
|
||||||
void enableExit();
|
void enableExit();
|
||||||
@ -300,7 +337,7 @@ public slots:
|
|||||||
void update();
|
void update();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
bool updateTriggerSet(int progress);
|
bool updateTriggerSet();
|
||||||
bool customerEnvironment(int progress);
|
bool customerEnvironment(int progress);
|
||||||
bool filesToUpdate(int progress);
|
bool filesToUpdate(int progress);
|
||||||
bool updateFiles(int percent);
|
bool updateFiles(int percent);
|
||||||
@ -316,55 +353,13 @@ private:
|
|||||||
|
|
||||||
static const QMap<UPDATE_STEP, const char*> smap;
|
static const QMap<UPDATE_STEP, const char*> smap;
|
||||||
|
|
||||||
|
// CONSOLE()
|
||||||
friend UPDATE_STEP operator<<(QDebug debug, UPDATE_STEP step) {
|
friend UPDATE_STEP operator<<(QDebug debug, UPDATE_STEP step) {
|
||||||
if (!Worker::instance) {
|
if (!Worker::instance) {
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QMap<UPDATE_STEP, const char*> smap (
|
Worker::instance->m_currentStep = step;
|
||||||
std::initializer_list<std::pair<UPDATE_STEP, const char*>>{
|
|
||||||
#define INSERT_ELEMENT(p) std::pair(p, #p)
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::STARTED),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS),
|
|
||||||
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_SUCCEEDED),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::FINISHED)
|
|
||||||
#undef INSERT_ELEMENT
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case UPDATE_STEP::STARTED: {
|
case UPDATE_STEP::STARTED: {
|
||||||
@ -390,10 +385,43 @@ private:
|
|||||||
case UPDATE_STEP::CHECK_REPOSITORY:
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_SANITY:
|
case UPDATE_STEP::CHECK_SANITY:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug,
|
||||||
|
QStringList(smap[step])
|
||||||
|
<< QString("CHECK SANITY OF CUSTOMER REPOSITORY %1")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug,
|
||||||
|
QStringList(smap[step])
|
||||||
|
<< QString("SANITY OF CUSTOMER REPOSITORY %1 OK")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug,
|
||||||
|
QStringList(smap[step])
|
||||||
|
<< QString("CORRUPTED CUSTOMER REPOSITORY %1. REPAIRING...")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug,
|
||||||
|
QStringList(smap[step])
|
||||||
|
<< QString("CORRUPTED CUSTOMER REPOSITORY %1. REPAIRING DONE")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug,
|
||||||
|
QStringList(smap[step])
|
||||||
|
<< QString("CORRUPTED CUSTOMER REPOSITORY %1. REPAIRING FAILED")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CLONE_REPOSITORY:
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||||
break;
|
break;
|
||||||
@ -401,13 +429,17 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SWITCH_BRANCH:
|
case UPDATE_STEP::CHECKOUT_REPOSITORY:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SWITCH_BRANCH_SUCCESS:
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SWITCH_BRANCH_FAILURE:
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug,
|
||||||
|
QStringList(smap[step])
|
||||||
|
<< QString("CHECK ISMAS-TRIGGER-STATUS..."));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||||
break;
|
break;
|
||||||
@ -463,6 +495,14 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::FINISHED:
|
case UPDATE_STEP::FINISHED:
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::DEBUG:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
debug, QStringList(smap[step]) << instance->m_debugMsg);
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::ERROR:
|
||||||
|
//Utils::printUpdateStatusMsg(
|
||||||
|
// debug, QStringList(smap[step]) << instance->m_errorMsg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
@ -474,51 +514,6 @@ private:
|
|||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QMap<UPDATE_STEP, const char*> smap (
|
|
||||||
std::initializer_list<std::pair<UPDATE_STEP, const char*>>{
|
|
||||||
#define INSERT_ELEMENT(p) std::pair(p, #p)
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::STARTED),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS),
|
|
||||||
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_SUCCEEDED),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
|
||||||
INSERT_ELEMENT(UPDATE_STEP::FINISHED)
|
|
||||||
#undef INSERT_ELEMENT
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case UPDATE_STEP::STARTED: {
|
case UPDATE_STEP::STARTED: {
|
||||||
ismasClient.setProgressInPercent(_STARTED);
|
ismasClient.setProgressInPercent(_STARTED);
|
||||||
@ -526,6 +521,10 @@ private:
|
|||||||
case UPDATE_STEP::CHECK_REPOSITORY:
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
||||||
|
break;
|
||||||
case UPDATE_STEP::CHECK_SANITY:
|
case UPDATE_STEP::CHECK_SANITY:
|
||||||
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
||||||
break;
|
break;
|
||||||
@ -535,32 +534,75 @@ private:
|
|||||||
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
||||||
|
break;
|
||||||
case UPDATE_STEP::CLONE_REPOSITORY:
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||||
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS:
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_SUCCESS);
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_SUCCESS);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0010",
|
||||||
|
_CLONE_REPOSITORY_SUCCESS,
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[step],
|
||||||
|
QString("CLONED REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
|
"");
|
||||||
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
|
ismasUpdateNews);
|
||||||
|
} break;
|
||||||
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE: {
|
||||||
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_FAILURE);
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_FAILURE);
|
||||||
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0003",
|
||||||
|
_CLONE_REPOSITORY_FAILURE,
|
||||||
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
|
smap[step],
|
||||||
|
QString("CLONING REPOSITORY %1 OR CHECKING OUT BRANCH %2 FAILED")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
|
"");
|
||||||
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
|
ismasUpdateNews);
|
||||||
|
} break;
|
||||||
|
case UPDATE_STEP::CHECKOUT_REPOSITORY:
|
||||||
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SWITCH_BRANCH:
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS:
|
||||||
ismasClient.setProgressInPercent(_SWITCH_BRANCH);
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_SUCCESS);
|
||||||
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.cloneAndCheckoutCustomerRepository(
|
||||||
|
QString("CHECKED OUT REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName())));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SWITCH_BRANCH_SUCCESS:
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_SWITCH_BRANCH_SUCCESS);
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SWITCH_BRANCH_FAILURE:
|
|
||||||
ismasClient.setProgressInPercent(_SWITCH_BRANCH_FAILURE);
|
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER);
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||||
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateTriggerSet("ISMAS TRIGGER SET", ""));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_FAILURE);
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.errorUpdateTrigger(instance->m_ismasMsg.join(' '), ""));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::UPDATE_REPOSITORY:
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
||||||
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY);
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY);
|
||||||
@ -637,77 +679,118 @@ private:
|
|||||||
case UPDATE_STEP::FINISHED:
|
case UPDATE_STEP::FINISHED:
|
||||||
ismasClient.setProgressInPercent(_FINISHED);
|
ismasClient.setProgressInPercent(_FINISHED);
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::DEBUG:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::ERROR:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
friend UPDATE_STEP operator<<(Worker *worker, UPDATE_STEP step) {
|
||||||
|
switch (step) {
|
||||||
|
case UPDATE_STEP::STARTED:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||||
|
emit worker->appendText("\nInitializing customer environment ...");
|
||||||
|
break;
|
||||||
case UPDATE_STEP::CHECK_SANITY:
|
case UPDATE_STEP::CHECK_SANITY:
|
||||||
Utils::printUpdateStatusMsg(
|
break;
|
||||||
QStringList()
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
||||||
<< QString("STEP 1: CHECKED SANITY OF CUSTOMER REPOSITORY %1 DONE")
|
break;
|
||||||
.arg(instance->m_customerRepository)
|
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
||||||
<< QString("STEP 2: FETCH CUSTOMER REPOSITORY %1...")
|
break;
|
||||||
.arg(instance->m_customerRepository));
|
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
||||||
break;
|
break;
|
||||||
//case UPDATE_STEP::FETCH_REPOSITORY:
|
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
||||||
// Utils::printUpdateStatusMsg(
|
break;
|
||||||
// QStringList()
|
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
||||||
// << QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
break;
|
||||||
// .arg(instance->m_customerRepository)
|
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
||||||
// << QString("STEP 3: CHECK ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS..."));
|
break;
|
||||||
// break;
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||||
|
emit worker->appendText("\nInitializing customer environment ...");
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS:
|
||||||
|
emit worker->replaceLast("Initializing customer environment",
|
||||||
|
Worker::UPDATE_STEP_DONE);
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
||||||
|
emit worker->replaceLast("Initializing customer environment",
|
||||||
|
Worker::UPDATE_STEP_FAIL);
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECKOUT_REPOSITORY:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||||
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
Utils::printUpdateStatusMsg(
|
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
||||||
QStringList()
|
break;
|
||||||
<< QString("STEP 3: CHECKED ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS. SUCCESS.")
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||||
<< QString("STEP 4: CHECK-OUT BRANCH %1...").arg(instance->m_gc.branchName()));
|
break;
|
||||||
break;
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||||
case UPDATE_STEP::CHECKED_OUT_BRANCH:
|
emit worker->showErrorMessage(worker->m_guiMsg);
|
||||||
Utils::printUpdateStatusMsg(
|
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
QStringList()
|
break;
|
||||||
<< QString("STEP 4: CHECKED-OUT BRANCH %1 DONE")
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
||||||
.arg(instance->m_gc.branchName())
|
break;
|
||||||
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE..."));
|
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::COMPUTE_FILES_TO_UPDATE:
|
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
||||||
Utils::printUpdateStatusMsg(
|
break;
|
||||||
QStringList()
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES:
|
||||||
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE %1 DONE")
|
break;
|
||||||
.arg(instance->m_filesToUpdate.join(','))
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS:
|
||||||
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS...")
|
break;
|
||||||
.arg(instance->m_filesToDownload.join(',')));
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_UPDATE:
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES:
|
||||||
Utils::printUpdateStatusMsg(
|
break;
|
||||||
QStringList()
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||||
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS DONE")
|
break;
|
||||||
.arg(instance->m_filesToDownload.join(','))
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
||||||
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM...")
|
break;
|
||||||
.arg(instance->m_customerRepository));
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE:
|
||||||
|
break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
||||||
Utils::printUpdateStatusMsg(
|
break;
|
||||||
QStringList()
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
||||||
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM DONE")
|
break;
|
||||||
.arg(instance->m_customerRepository)
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
||||||
<< QString("STEP 8: SEND-LAST-VERSION TO ISMAS..."));
|
break;
|
||||||
break;
|
case UPDATE_STEP::SAVE_LOGS:
|
||||||
case UPDATE_STEP::UPDATE_SUCCESS:
|
break;
|
||||||
Utils::printUpdateStatusMsg(
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
||||||
QStringList()
|
break;
|
||||||
<< QString("STEP 9: SAVE-LOG-FILES (FUTURE USE) DONE")
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||||
<< QString("STEP 10: MARK UPDATE AS SUCCESSFUL AND ACTIVE..."));
|
break;
|
||||||
break;
|
case UPDATE_STEP::SEND_LAST_VERSION:
|
||||||
}
|
break;
|
||||||
#endif
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
||||||
|
break;
|
||||||
friend UPDATE_STEP operator<<(MainWindow *mainWindow, UPDATE_STEP step) {
|
case UPDATE_STEP::UPDATE_FAILED:
|
||||||
|
break;
|
||||||
if (!Worker::instance) {
|
case UPDATE_STEP::FINISHED:
|
||||||
return step;
|
break;
|
||||||
|
case UPDATE_STEP::DEBUG:
|
||||||
|
emit worker->showStatusMessage(worker->m_guiMsg);
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::ERROR:
|
||||||
|
emit worker->showErrorMessage(worker->m_guiMsg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
|
Loading…
Reference in New Issue
Block a user