sicherung der aenderungen

This commit is contained in:
Gerhard Hoffmann 2023-10-23 16:16:11 +02:00
parent 9b0f741b9b
commit 5efac2619b
6 changed files with 467 additions and 731 deletions

View File

@ -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(showErrorMessage(QString,QString)),this, SLOT(onShowErrorMessage(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)));
}
@ -448,3 +450,21 @@ void MainWindow::onShowErrorMessage(QString title, QString text) {
void MainWindow::onShowStatusMessage(QString title, QString 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), "");
}
}

View File

@ -48,6 +48,8 @@ public slots:
void onReplaceLast(QString, QString suffix = "");
void onShowErrorMessage(QString, QString);
void onShowStatusMessage(QString, QString);
void onShowErrorMessage(QStringList);
void onShowStatusMessage(QStringList);
void onStopStartTimer();
void onRestartExitTimer();
void onEnableExit();

View File

@ -86,6 +86,16 @@ void Utils::printUpdateStatusMsg(QString const &updateMsg, bool upper, bool lowe
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) {
if (upper) qCritical() << QString(80, 'I');

View File

@ -20,6 +20,7 @@ namespace Utils {
void printUpdateStatusMsg(QDebug &debug, QStringList const &updateMsg);
void printUpdateStatusMsg(QStringList const &updateMsg);
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);
QString getTariffLoadTime(QString fileName);
QString rstrip(QString const &str);

View File

@ -25,16 +25,66 @@
#include "utils.h"
#define CONSOLE() qDebug()
#define ISMAS() m_ismasClient
#define GUI() m_mainWindow
#define FUNC_NAME QString(__func__).toUpper()
QString const Worker::UPDATE_STEP_OK(" [ ok]");
QString const Worker::UPDATE_STEP_DONE(" [done]");
QString const Worker::UPDATE_STEP_FAIL(" [FAIL]");
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,
int machineNr,
@ -318,69 +368,6 @@ int Worker::sendFinalResult() {
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() {
if (!m_mainWindow) {
@ -396,14 +383,12 @@ void Worker::privateUpdate() {
emit disableExit();
m_returnCode = -1;
startProgressLoop();
QDir customerRepository(m_customerRepository);
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
Utils::printUpdateStatusMsg(
QStringList()
<< QString("STEP 1: CHECK SANITY OF CUSTOMER REPOSITORY %1...")
.arg(m_customerRepository));
CONSOLE() << UPDATE_STEP::CHECK_SANITY;
bool initialClone = false; // the customer repository is cloned without
// checking the ISMAS-trigger (WAIT-)button.
@ -415,54 +400,53 @@ void Worker::privateUpdate() {
// resulting in a corrupted git-repository, which
// does not contain an ./etc-directory
if (isRepositoryCorrupted()) {
QString s("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...");
CONSOLE() << UPDATE_STEP::CHECK_SANITY_FAILURE;
if ((continueUpdate = repairCorruptedRepository()) == true) {
Utils::printUpdateStatusMsg(
QStringList() << s <<
QString("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...DONE"));
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS;
} else {
Utils::printUpdateStatusMsg(
QStringList() << s <<
QString("CORRUPTED CUSTOMER REPOSITORY. REPAIRING...FAIL"));
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE;
}
} else {
CONSOLE() << UPDATE_STEP::CHECK_SANITY_SUCCESS;
}
if (continueUpdate) {
CONSOLE() << UPDATE_STEP::CHECK_SANITY;
if ((continueUpdate = customerRepository.exists()) == false) {
emit appendText("\nInitializing customer environment ...");
startProgressLoop();
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()) {
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
m_returnCode = sendCloneAndCheckoutSuccess();
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
continueUpdate = true;
initialClone = true;
Utils::printInfoMsg("INITIAL CLONE DONE");
break;
}
}
QThread::sleep(1); // maybe git needs more time
}
if (continueUpdate == false) {
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
m_returnCode = sendCloneAndCheckoutFailure();
}
GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_FAILURE);
}
if (!initialClone) {
// qDebug() << UPDATE_STEP::FETCH_REPOSITORY;
} else {
Utils::printUpdateStatusMsg(
QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
.arg(m_customerRepository));
} // repository is neither not existent nor
} // corrupted. check now if the ISMAS-trigger
if (continueUpdate) { // (WAIT-BUTTON) is activated even in case of
// initial checkout
if ((continueUpdate = updateTriggerSet(10)) == false) {
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
if (isRepositoryCorrupted()) {
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_FAILURE;
continueUpdate = false;
} else {
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
}
}
} // 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();
}
if (continueUpdate) { // configure customer environment -> checkout
@ -526,6 +510,8 @@ void Worker::privateUpdate() {
sendIsmasLastVersionNotification(100);
}
stopProgressLoop();
m_updateProcessRunning = false;
emit enableExit();
emit restartExitTimer();
@ -589,94 +575,66 @@ std::optional<QString> Worker::getApismVersion() {
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
return true;
}
emit appendText("\n" CHECK_UPDATE_TRIGGER_SET);
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
QString triggerValue("");
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
for (int repeat = 1; repeat <= 100; ++repeat) {
qInfo() << "UPDATE TRIGGER SET -> REPEAT" << repeat;
CONSOLE(QStringList(FUNC_NAME) << QString("-> REPEAT=%1").arg(repeat)) << UPDATE_STEP::DEBUG;
if (repeat > 1) {
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
QString const &msg = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
qInfo() << "REPEAT" << msg;
emit showErrorMessage("check update trigger", msg);
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
CONSOLE(QStringList(FUNC_NAME) << s) << UPDATE_STEP::DEBUG;
} else {
emit showErrorMessage("check update trigger", "");
CONSOLE(QStringList(FUNC_NAME)) << UPDATE_STEP::DEBUG;
}
if ((repeat % 10) == 0) {
qInfo() << "CHECK UPDATE TRIGGER. RESTART APISM ...";
CONSOLE(QStringList(FUNC_NAME) << "RESTART APISM") << UPDATE_STEP::DEBUG;
Command c("systemctl restart apism");
if (c.execute("/tmp")) {
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
= IsmasClient::sendRequestReceiveResponse(
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
stopProgressLoop();
// setProgress(m_mainWindow->progressValue()/10 + 11);
QString msg = result.value();
qInfo() << "REPEAT" << repeat << "APISM RESPONSE (" << msg << ")";
QString const &msg = QString("APISM RESPONSE(%1)=(").arg(repeat) + result.value() + ")";
CONSOLE(QStringList(FUNC_NAME) << msg) << UPDATE_STEP::DEBUG;
QJsonParseError parseError;
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
if (parseError.error != QJsonParseError::NoError) {
qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):"
<< parseError.error << parseError.errorString();
//setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::JSON_PARSE_FAILURE,
QString("(2) INVALID JSON %1 %2 %3")
.arg(msg)
.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;
QStringList const &lst
= QStringList(QString("check update trigger")) << QString("invalid json ")
+ QString("INVALID JSON MSG: PARSING FAILED (msg=%1 %2 %3)")
.arg(msg).arg(parseError.error).arg(parseError.errorString()).mid(0, 20);
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
if (!document.isObject()) {
qCritical() << "FILE IS NOT A JSON OBJECT!";
//setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::JSON_PARSE_FAILURE,
QString("NOT A JSON-OBJECT %1").arg(msg));
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;
QStringList const &lst =
QStringList(QString("check update trigger")) << QString("not a json-object ") + msg;
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
// setProgress(m_mainWindow->progressValue()/10 + 11);
QJsonObject obj = document.object();
// always look for an 'error' first
if (obj.contains("error")) {
// setProgress(m_mainWindow->progressValue()/10 + 11);
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 << ">";
CONSOLE(QStringList(obj.value("error").toString())) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE;
QThread::sleep(6);
continue;
}
@ -688,175 +646,96 @@ bool Worker::updateTriggerSet(int progress) {
if (v.isObject()) {
QJsonObject obj = v.toObject();
if (obj.contains("Custom_ID") && obj.contains("Device_ID")) {
QJsonValue const c = obj.value("Custom_ID");
QJsonValue const m = obj.value("Device_ID");
int customerNr = c.toInt(-1);
int machineNr = m.toInt(-1);
int const customerNr = obj.value("Custom_ID").toInt(-1);
int const machineNr = obj.value("Device_ID").toInt(-1);
if (customerNr != m_customerNr) {
//setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
.arg(customerNr).arg(m_customerNr));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
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;
QStringList const &lst =
QStringList(QString("check update trigger"))
<< QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
.arg(customerNr).arg(m_customerNr);
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
if (machineNr != m_machineNr) {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
.arg(machineNr).arg(m_machineNr));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
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;
}
qInfo() << "MACHINE-AND-CUSTOMER-CHECK" << m_updateStatus.m_statusDescription;
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
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;
QStringList const &lst =
QStringList(QString("check update trigger"))
<< QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
.arg(machineNr).arg(m_machineNr);
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Dev_ID KEY NOT A JSON-OBJECT");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
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;
QStringList const lst("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Dev_ID KEY NOT AVAILABLE");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
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;
QStringList const lst("Dev_ID KEY NOT A JSON-OBJECT");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
QStringList const lst("Dev_ID KEY NOT AVAILABLE");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
// setProgress(m_mainWindow->progressValue()/10 + 11);
if (obj.contains("Fileupload")) {
QJsonValue v = obj.value("Fileupload");
if (v.isObject()) {
obj = v.toObject();
if (obj.contains("TRG")) {
triggerValue = obj.value("TRG").toString();
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);
if ((triggerValue = obj.value("TRG").toString()) == "WAIT") {
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
return true;
} else
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
stopProgressLoop();
// setProgress(m_mainWindow->progressValue()/10 + 11);
emit showErrorMessage("check update trigger", "empty update-trigger");
QStringList const &lst =
QStringList(QString("check update trigger")) << QString("empty update trigger");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
QThread::sleep(6);
continue;
} else {
// if the download-button once has the wrong value, it will never recover
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
QString("TRIGGER-VALUE=<") + triggerValue + "> NOT 'WAIT'");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
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;
QStringList const &lst =
QStringList(QString("check update trigger"))
<< QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue);
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"TRG KEY NOT AVAILABLE");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
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;
QStringList const &lst =
QStringList(QString("check update trigger")) << QString("TRG key not available");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Fileupload NOT A JSON-OBJECT");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
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;
QStringList const &lst =
QStringList(QString("check update trigger")) << QString("Fileupload not a json-object");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Fileupload KEY NOT AVAILABLE");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
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;
QStringList const &lst =
QStringList(QString("check update trigger")) << QString("Fileupload not available");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
break;
}
} else {
stopProgressLoop();
//setProgress(m_mainWindow->progressValue()/10 + 11);
emit showErrorMessage("check update trigger", "no ISMAS response");
QStringList const &lst =
QStringList(QString("check update trigger")) << QString("no ISMAS response");
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
QThread::sleep(6);
}
}
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG,
QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") +
triggerValue + ")");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.errorUpdateTrigger(m_updateStatus.m_statusDescription, ""));
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
QStringList const &lst =
QStringList(QString("check update trigger"))
<< QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")";
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
}
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
return false;
}
@ -1359,262 +1238,3 @@ hwinf *Worker::getPlugin() {
hwinf const *Worker::getPlugin() const {
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

429
worker.h
View File

@ -27,17 +27,21 @@
#endif
#define _STARTED (1)
#define _CHECK_REPOSITORY (2)
#define _CHECK_SANITY (3)
#define _CHECK_SANITY_SUCCESS (4)
#define _CHECK_SANITY_FAILURE (5)
#define _CLONE_REPOSITORY (6)
#define _CLONE_REPOSITORY_SUCCESS (7)
#define _CLONE_REPOSITORY_FAILURE (8)
#define _SWITCH_BRANCH (12)
#define _SWITCH_BRANCH_SUCCESS (13)
#define _SWITCH_BRANCH_FAILURE (14)
#define _CHECK_ISMAS_TRIGGER (15)
#define _CHECK_SANITY (2)
#define _CHECK_SANITY_SUCCESS (3)
#define _CHECK_SANITY_FAILURE (4)
#define _REPOSITORY_RECOVERED_SUCCESS (5)
#define _REPOSITORY_RECOVERED_FAILURE (6)
#define _CHECK_REPOSITORY (7)
#define _CHECK_REPOSITORY_SUCCESS (8)
#define _CHECK_REPOSITORY_FAILURE (9)
#define _CLONE_REPOSITORY (10)
#define _CLONE_REPOSITORY_SUCCESS (11)
#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_FAILURE (24)
#define _UPDATE_REPOSITORY (25)
@ -65,6 +69,8 @@
#define _UPDATE_SUCCEEDED (98)
#define _UPDATE_FAILED (99)
#define _FINISHED (100)
#define _DEBUG (1000)
#define _ERROR (1001)
enum class UPDATE_STATUS : quint8 {
NOT_DEFINED,
@ -110,6 +116,7 @@ struct UpdateStatus {
#define ISMAS_UPDATE_REQUESTS (10)
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
class MainWindow;
class hwinf;
@ -186,6 +193,7 @@ class Worker : public QObject {
int sendUpdateSucceededAndActivated();
int sendFinalResult();
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_FAILURE = -3;
@ -197,18 +205,23 @@ class Worker : public QObject {
static constexpr const int SEND_LAST_VERSION_FAILURE = -10;
static constexpr const int SAVE_LOG_FILES_FAILURE = -11;
public:
enum class UPDATE_STEP {
STARTED = _STARTED,
CHECK_REPOSITORY = _CHECK_REPOSITORY,
CHECK_REPOSITORY_SUCCESS = _CHECK_REPOSITORY_SUCCESS,
CHECK_REPOSITORY_FAILURE = _CHECK_REPOSITORY_FAILURE,
CHECK_SANITY = _CHECK_SANITY,
CHECK_SANITY_SUCCESS = _CHECK_SANITY_SUCCESS,
CHECK_SANITY_FAILURE = _CHECK_SANITY_FAILURE,
REPOSITORY_RECOVERED_SUCCESS = _REPOSITORY_RECOVERED_SUCCESS,
REPOSITORY_RECOVERED_FAILURE = _REPOSITORY_RECOVERED_FAILURE,
CLONE_REPOSITORY = _CLONE_REPOSITORY,
CLONE_REPOSITORY_SUCCESS = _CLONE_REPOSITORY_SUCCESS,
CLONE_REPOSITORY_FAILURE = _CLONE_REPOSITORY_FAILURE,
SWITCH_BRANCH = _SWITCH_BRANCH,
SWITCH_BRANCH_SUCCESS = _SWITCH_BRANCH_SUCCESS,
SWITCH_BRANCH_FAILURE = _SWITCH_BRANCH_FAILURE,
CHECKOUT_REPOSITORY = _CHECKOUT_REPOSITORY,
CHECKOUT_REPOSITORY_SUCCESS = _CHECKOUT_REPOSITORY_SUCCESS,
CHECKOUT_REPOSITORY_FAILURE = _CHECKOUT_REPOSITORY_FAILURE,
CHECK_ISMAS_TRIGGER = _CHECK_ISMAS_TRIGGER,
CHECK_ISMAS_TRIGGER_SUCCESS = _CHECK_ISMAS_TRIGGER_SUCCESS,
CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE,
@ -236,10 +249,32 @@ class Worker : public QObject {
SEND_LAST_VERSION = _SEND_LAST_VERSION,
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
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:
static QString getATBUpdateToolYoctoVersion();
@ -291,6 +326,8 @@ signals:
void replaceLast(QStringList, QString);
void showErrorMessage(QString title, QString description);
void showStatusMessage(QString title, QString description);
void showErrorMessage(QStringList titleAndDesc);
void showStatusMessage(QStringList titleAndDesc);
void stopStartTimer();
void restartExitTimer();
void enableExit();
@ -300,7 +337,7 @@ public slots:
void update();
private slots:
bool updateTriggerSet(int progress);
bool updateTriggerSet();
bool customerEnvironment(int progress);
bool filesToUpdate(int progress);
bool updateFiles(int percent);
@ -316,55 +353,13 @@ private:
static const QMap<UPDATE_STEP, const char*> smap;
// CONSOLE()
friend UPDATE_STEP operator<<(QDebug debug, UPDATE_STEP step) {
if (!Worker::instance) {
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
});
Worker::instance->m_currentStep = step;
switch (step) {
case UPDATE_STEP::STARTED: {
@ -390,10 +385,43 @@ private:
case UPDATE_STEP::CHECK_REPOSITORY:
break;
case UPDATE_STEP::CHECK_SANITY:
Utils::printUpdateStatusMsg(
debug,
QStringList(smap[step])
<< QString("CHECK SANITY OF CUSTOMER REPOSITORY %1")
.arg(instance->m_customerRepository));
break;
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
Utils::printUpdateStatusMsg(
debug,
QStringList(smap[step])
<< QString("SANITY OF CUSTOMER REPOSITORY %1 OK")
.arg(instance->m_customerRepository));
break;
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;
case UPDATE_STEP::CLONE_REPOSITORY:
break;
@ -401,13 +429,17 @@ private:
break;
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
break;
case UPDATE_STEP::SWITCH_BRANCH:
case UPDATE_STEP::CHECKOUT_REPOSITORY:
break;
case UPDATE_STEP::SWITCH_BRANCH_SUCCESS:
case UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS:
break;
case UPDATE_STEP::SWITCH_BRANCH_FAILURE:
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
break;
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
Utils::printUpdateStatusMsg(
debug,
QStringList(smap[step])
<< QString("CHECK ISMAS-TRIGGER-STATUS..."));
break;
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
break;
@ -463,6 +495,14 @@ private:
break;
case UPDATE_STEP::FINISHED:
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;
@ -474,51 +514,6 @@ private:
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) {
case UPDATE_STEP::STARTED: {
ismasClient.setProgressInPercent(_STARTED);
@ -526,6 +521,10 @@ private:
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:
ismasClient.setProgressInPercent(_CHECK_SANITY);
break;
@ -535,32 +534,75 @@ private:
case UPDATE_STEP::CHECK_SANITY_FAILURE:
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
break;
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
break;
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
break;
case UPDATE_STEP::CLONE_REPOSITORY:
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
break;
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS:
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS: {
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_SUCCESS);
break;
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
QString const &ismasUpdateNews =
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);
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;
case UPDATE_STEP::SWITCH_BRANCH:
ismasClient.setProgressInPercent(_SWITCH_BRANCH);
case UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS:
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;
case UPDATE_STEP::SWITCH_BRANCH_SUCCESS:
ismasClient.setProgressInPercent(_SWITCH_BRANCH_SUCCESS);
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
break;
case UPDATE_STEP::SWITCH_BRANCH_FAILURE:
ismasClient.setProgressInPercent(_SWITCH_BRANCH_FAILURE);
break;
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER);
break;
case UPDATE_STEP::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;
case UPDATE_STEP::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;
case UPDATE_STEP::UPDATE_REPOSITORY:
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY);
@ -637,77 +679,118 @@ private:
case UPDATE_STEP::FINISHED:
ismasClient.setProgressInPercent(_FINISHED);
break;
case UPDATE_STEP::DEBUG:
break;
case UPDATE_STEP::ERROR:
break;
}
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:
Utils::printUpdateStatusMsg(
QStringList()
<< QString("STEP 1: CHECKED SANITY OF CUSTOMER REPOSITORY %1 DONE")
.arg(instance->m_customerRepository)
<< QString("STEP 2: FETCH CUSTOMER REPOSITORY %1...")
.arg(instance->m_customerRepository));
break;
//case UPDATE_STEP::FETCH_REPOSITORY:
// Utils::printUpdateStatusMsg(
// QStringList()
// << QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
// .arg(instance->m_customerRepository)
// << QString("STEP 3: CHECK ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS..."));
// break;
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
break;
case UPDATE_STEP::CHECK_SANITY_FAILURE:
break;
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
break;
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
break;
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
break;
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
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:
Utils::printUpdateStatusMsg(
QStringList()
<< QString("STEP 3: CHECKED ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS. SUCCESS.")
<< QString("STEP 4: CHECK-OUT BRANCH %1...").arg(instance->m_gc.branchName()));
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
break;
case UPDATE_STEP::CHECKED_OUT_BRANCH:
Utils::printUpdateStatusMsg(
QStringList()
<< QString("STEP 4: CHECKED-OUT BRANCH %1 DONE")
.arg(instance->m_gc.branchName())
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE..."));
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
break;
case UPDATE_STEP::COMPUTE_FILES_TO_UPDATE:
Utils::printUpdateStatusMsg(
QStringList()
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE %1 DONE")
.arg(instance->m_filesToUpdate.join(','))
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS...")
.arg(instance->m_filesToDownload.join(',')));
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
emit worker->showErrorMessage(worker->m_guiMsg);
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
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(instance->m_filesToDownload.join(','))
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM...")
.arg(instance->m_customerRepository));
case UPDATE_STEP::UPDATE_REPOSITORY:
break;
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
break;
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
break;
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES:
break;
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS:
break;
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
break;
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES:
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
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:
Utils::printUpdateStatusMsg(
QStringList()
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM DONE")
.arg(instance->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..."));
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
break;
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
break;
case UPDATE_STEP::SAVE_LOGS:
break;
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
break;
case UPDATE_STEP::SAVE_LOGS_FAILURE:
break;
case UPDATE_STEP::SEND_LAST_VERSION:
break;
case UPDATE_STEP::UPDATE_SUCCEEDED:
break;
case UPDATE_STEP::UPDATE_FAILED:
break;
case UPDATE_STEP::FINISHED:
break;
case UPDATE_STEP::DEBUG:
emit worker->showStatusMessage(worker->m_guiMsg);
break;
case UPDATE_STEP::ERROR:
emit worker->showErrorMessage(worker->m_guiMsg);
break;
}
#endif
friend UPDATE_STEP operator<<(MainWindow *mainWindow, UPDATE_STEP step) {
if (!Worker::instance) {
return step;
}
return step;