1328 lines
58 KiB
C++
1328 lines
58 KiB
C++
#ifndef WORKER_H_INCLUDED
|
|
#define WORKER_H_INCLUDED
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QTimer>
|
|
#include <QFile>
|
|
#include <QJsonObject>
|
|
#include <QHash>
|
|
#include <QMap>
|
|
#include <QDebug>
|
|
#include <QThread>
|
|
|
|
#include <optional>
|
|
#include <initializer_list>
|
|
|
|
#include "update.h"
|
|
#include "git/git_client.h"
|
|
#include "ismas/ismas_client.h"
|
|
#include "utils.h"
|
|
|
|
#ifdef PTU5
|
|
#define SERIAL_PORT "ttymxc2"
|
|
#else
|
|
#define SERIAL_PORT "ttyUSB0"
|
|
#endif
|
|
|
|
#define _ISMAS_DONE "U0001" // 100%
|
|
#define _ISMAS_SET_WAIT_OK "U0002" // empty WAIT-button ("")
|
|
#define _ISMAS_FAILURE "U0003" // FAIL
|
|
#define _ISMAS_CONTINUE "U0010" // %-values
|
|
#define _ISMAS_RESET_WAIT "ISMAS" // reset WAIT-button to "WAIT"
|
|
|
|
#define _STARTED (1)
|
|
#define _CHECK_SANITY (2)
|
|
#define _CHECK_SANITY_FAILURE (3)
|
|
#define _CHECK_SANITY_SUCCESS (4)
|
|
#define _REPOSITORY_RECOVERED_FAILURE (5)
|
|
#define _REPOSITORY_RECOVERED_SUCCESS (6)
|
|
#define _CHECK_REPOSITORY (7)
|
|
#define _CHECK_REPOSITORY_FAILURE (8)
|
|
#define _CHECK_REPOSITORY_SUCCESS (9)
|
|
#define _CLONE_REPOSITORY (10)
|
|
#define _CLONE_REPOSITORY_FAILURE (11)
|
|
#define _CLONE_REPOSITORY_SUCCESS (12)
|
|
#define _CHECKOUT_REPOSITORY (13)
|
|
#define _CHECKOUT_REPOSITORY_FAILURE (14)
|
|
#define _CHECKOUT_REPOSITORY_SUCCESS (15)
|
|
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (16)
|
|
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (17)
|
|
#define _CHECK_ISMAS_TRIGGER (19)
|
|
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (20)
|
|
#define _CHECK_ISMAS_TRIGGER_SUCCESS (21)
|
|
#define _CHECK_ISMAS_TRIGGER_FAILURE (22)
|
|
#define _CHECKOUT_BRANCH (23)
|
|
#define _CHECKOUT_BRANCH_FAILURE (24)
|
|
#define _CHECKOUT_BRANCH_SUCCESS (25)
|
|
#define _UPDATE_REPOSITORY (26)
|
|
#define _UPDATE_REPOSITORY_FAILURE (28)
|
|
#define _UPDATE_REPOSITORY_SUCCESS (29)
|
|
#define _CHECK_FOR_REPOSITORY_CHANGES (30)
|
|
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (36)
|
|
#define _FILES_TO_UPDATE (37)
|
|
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (38)
|
|
#define _FILES_TO_DOWNLOAD (39)
|
|
#define _EXEC_OPKG_COMMANDS (41)
|
|
#define _EXEC_OPKG_COMMAND_1 (42)
|
|
#define _EXEC_OPKG_COMMAND_2 (43)
|
|
#define _EXEC_OPKG_COMMAND_3 (44)
|
|
#define _EXEC_OPKG_COMMAND_4 (45)
|
|
#define _EXEC_OPKG_COMMAND_5 (46)
|
|
#define _EXEC_OPKG_COMMAND_6 (47)
|
|
#define _EXEC_OPKG_COMMAND_7 (48)
|
|
#define _EXEC_OPKG_COMMAND_8 (49)
|
|
#define _EXEC_OPKG_COMMAND_9 (50)
|
|
#define _EXEC_OPKG_COMMAND_LAST (51)
|
|
#define _EXEC_OPKG_COMMAND_FAILURE (52)
|
|
#define _EXEC_OPKG_COMMAND_SUCCESS (53)
|
|
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE (54)
|
|
#define _DOWNLOAD_CONFIG_FILE (55)
|
|
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (56)
|
|
#define _DOWNLOAD_CONFIG_FILE_FAILURE (57)
|
|
#define _DOWNLOAD_DEVICE_CONTROLLER (65)
|
|
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (85)
|
|
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86)
|
|
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87)
|
|
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (88)
|
|
#define _SYNC_CUSTOMER_REPOSITORY (89)
|
|
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (90)
|
|
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (91)
|
|
#define _SAVE_LOGS (92)
|
|
#define _SAVE_LOGS_FAILURE (93)
|
|
#define _SAVE_LOGS_SUCCESS (94)
|
|
#define _SEND_LAST_VERSION (95)
|
|
#define _UPDATE_SUCCEEDED (96)
|
|
#define _UPDATE_FAILED (97)
|
|
#define _UPDATE_ACTIVATED (98)
|
|
#define _UPDATE_NOT_NECESSARY (99)
|
|
#define _FINISHED (100)
|
|
#define _DEBUG (1000)
|
|
#define _ERROR (1001)
|
|
#define _NONE (1002)
|
|
|
|
#define _SEND_LAST_VERSION_CORRECTION (5)
|
|
#define _UPDATE_SUCCEEDED_CORRECTION (4)
|
|
#define _UPDATE_FAILED_CORRECTION (3)
|
|
#define _UPDATE_ACTIVATED_CORRECTION (2)
|
|
#define _UPDATE_NOT_NECESSARY_CORRECTION (1)
|
|
|
|
#define ISMAS_UPDATE_REQUESTS (10)
|
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
|
|
|
class MainWindow;
|
|
class hwinf;
|
|
class Worker : public QThread{
|
|
Q_OBJECT
|
|
|
|
int const m_customerNr;
|
|
QString const m_customerNrStr;
|
|
int const m_machineNr;
|
|
int const m_zoneNr;
|
|
QString const m_pluginDir;
|
|
QString const m_pluginName;
|
|
QString const m_workingDirectory;
|
|
QString const m_branchName;
|
|
QString const m_customerRepositoryPath;
|
|
QString const m_customerRepository;
|
|
bool const m_noUpdatePsaHardware;
|
|
bool const m_alwaysDownloadConfig;
|
|
bool const m_alwaysDownloadDC;
|
|
bool const m_dryRun;
|
|
QObject *m_parent;
|
|
QString const m_serialInterface;
|
|
QString const m_baudrate;
|
|
IsmasClient m_ismasClient;
|
|
GitClient m_gc;
|
|
QStringList m_versionInfo;
|
|
QString const m_osVersion;
|
|
QString const m_atbqtVersion;
|
|
QString const m_atbUpdateToolVersion;
|
|
QString const m_cpuSerial;
|
|
QString const m_pluginVersionATBDeciceController;
|
|
QString const m_pluginVersionIngenicoISelf;
|
|
QString const m_pluginVersionMobilisisCalc;
|
|
QString const m_pluginVersionMobilisisCalcConfig;
|
|
QString const m_pluginVersionPrmCalc;
|
|
QString const m_pluginVersionPrmCalcConfig;
|
|
QString const m_pluginVersionTcpZvt;
|
|
|
|
int m_ismasUpdateRequests;
|
|
QTimer m_waitForNewUpdates;
|
|
|
|
QStringList m_filesToUpdate;
|
|
QStringList m_filesToDownload;
|
|
bool m_updateProcessRunning;
|
|
int m_displayIndex;
|
|
bool m_clone = false;
|
|
bool m_initialClone = false;
|
|
bool m_repairClone = false;
|
|
bool m_ismasTriggerActive = false;
|
|
|
|
MainWindow *m_mainWindow;
|
|
bool m_withoutIsmasDirectPort;
|
|
QString m_apismVersion;
|
|
|
|
bool executeOpkgCommand(QString opkgCommand);
|
|
QString getOsVersion() const;
|
|
QString getATBQTVersion() const;
|
|
QString getATBUpdateToolVersion() const;
|
|
QString getCPUSerial() const;
|
|
QString getRaucVersion() const;
|
|
QString getOpkgVersion() const;
|
|
QString getPluginVersion(QString const &pluginFileName) const;
|
|
QStringList getDCVersion() const;
|
|
|
|
qint64 getFileSize(QString const &fileName) const;
|
|
bool isRepositoryCorrupted();
|
|
bool repairCorruptedRepository();
|
|
|
|
int sendCloneAndCheckoutSuccess();
|
|
int sendCloneAndCheckoutFailure();
|
|
int sendIsmasTriggerFailure();
|
|
int sendPullFailure();
|
|
int sendFileUpdateFailure();
|
|
int sendRsyncFailure();
|
|
int sendLastVersionFailure();
|
|
int sendSaveLogFilesFailure();
|
|
int sendCustomerEnvironmentConfigurationFailed();
|
|
int sendFoundFilesToUpdateSuccess();
|
|
int sendUpdateSucceededAndActivated();
|
|
int sendFinalResult();
|
|
|
|
struct UpdateProcessRunning {
|
|
Worker *m_worker;
|
|
|
|
explicit UpdateProcessRunning(Worker *worker) : m_worker(worker) {
|
|
m_worker->m_updateProcessRunning = true;
|
|
// emit m_worker->disableExit();
|
|
emit m_worker->enableExit();
|
|
m_worker->startProgressLoop();
|
|
}
|
|
|
|
virtual ~UpdateProcessRunning() {
|
|
m_worker->ISMAS() << (m_worker->GUI() << (m_worker->CONSOLE()
|
|
<< UPDATE_STEP::SEND_LAST_VERSION));
|
|
m_worker->stopProgressLoop();
|
|
|
|
m_worker->m_updateProcessRunning = false;
|
|
emit m_worker->enableExit();
|
|
emit m_worker->restartExitTimer();
|
|
}
|
|
};
|
|
|
|
friend struct UpdateProcessRunning;
|
|
|
|
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,
|
|
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_WRONG_VALUE = _CHECK_ISMAS_TRIGGER_WRONG_VALUE,
|
|
CHECK_ISMAS_TRIGGER_SUCCESS = _CHECK_ISMAS_TRIGGER_SUCCESS,
|
|
CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE,
|
|
INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER = _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER,
|
|
INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER = _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER,
|
|
CHECKOUT_BRANCH = _CHECKOUT_BRANCH,
|
|
CHECKOUT_BRANCH_SUCCESS = _CHECKOUT_BRANCH_SUCCESS,
|
|
CHECKOUT_BRANCH_FAILURE = _CHECKOUT_BRANCH_FAILURE,
|
|
UPDATE_REPOSITORY = _UPDATE_REPOSITORY,
|
|
UPDATE_REPOSITORY_SUCCESS = _UPDATE_REPOSITORY_SUCCESS,
|
|
UPDATE_REPOSITORY_FAILURE = _UPDATE_REPOSITORY_FAILURE,
|
|
CHECK_FOR_REPOSITORY_CHANGES = _CHECK_FOR_REPOSITORY_CHANGES,
|
|
CHECK_FOR_REPOSITORY_CHANGES_SUCCESS = _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS,
|
|
CHECK_FOR_REPOSITORY_CHANGES_FAILURE = _CHECK_FOR_REPOSITORY_CHANGES_FAILURE,
|
|
FILES_TO_UPDATE = _FILES_TO_UPDATE,
|
|
DOWNLOAD_FILES_TO_PSA_HARDWARE = _DOWNLOAD_FILES_TO_PSA_HARDWARE,
|
|
FILES_TO_DOWNLOAD = _FILES_TO_DOWNLOAD,
|
|
EXEC_OPKG_COMMANDS = _EXEC_OPKG_COMMANDS,
|
|
EXEC_OPKG_COMMAND_1 = _EXEC_OPKG_COMMAND_1,
|
|
EXEC_OPKG_COMMAND_2 = _EXEC_OPKG_COMMAND_2,
|
|
EXEC_OPKG_COMMAND_3 = _EXEC_OPKG_COMMAND_3,
|
|
EXEC_OPKG_COMMAND_4 = _EXEC_OPKG_COMMAND_4,
|
|
EXEC_OPKG_COMMAND_5 = _EXEC_OPKG_COMMAND_5,
|
|
EXEC_OPKG_COMMAND_6 = _EXEC_OPKG_COMMAND_6,
|
|
EXEC_OPKG_COMMAND_7 = _EXEC_OPKG_COMMAND_7,
|
|
EXEC_OPKG_COMMAND_8 = _EXEC_OPKG_COMMAND_8,
|
|
EXEC_OPKG_COMMAND_9 = _EXEC_OPKG_COMMAND_9,
|
|
EXEC_OPKG_COMMAND_LAST = _EXEC_OPKG_COMMAND_LAST,
|
|
EXEC_OPKG_COMMAND_SUCCESS = _EXEC_OPKG_COMMAND_SUCCESS,
|
|
EXEC_OPKG_COMMAND_FAILURE = _EXEC_OPKG_COMMAND_FAILURE,
|
|
DOWNLOAD_CONFIG_FILE = _DOWNLOAD_CONFIG_FILE,
|
|
DOWNLOAD_CONFIG_FILE_SUCCESS = _DOWNLOAD_CONFIG_FILE_SUCCESS,
|
|
DOWNLOAD_CONFIG_FILE_FAILURE = _DOWNLOAD_CONFIG_FILE_FAILURE,
|
|
DOWNLOAD_DEVICE_CONTROLLER = _DOWNLOAD_DEVICE_CONTROLLER,
|
|
DOWNLOAD_DEVICE_CONTROLLER_SUCCESS = _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS,
|
|
DOWNLOAD_DEVICE_CONTROLLER_FAILURE = _DOWNLOAD_DEVICE_CONTROLLER_FAILURE,
|
|
DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS = _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS,
|
|
DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE = _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE,
|
|
SYNC_CUSTOMER_REPOSITORY = _SYNC_CUSTOMER_REPOSITORY,
|
|
SYNC_CUSTOMER_REPOSITORY_SUCCESS = _SYNC_CUSTOMER_REPOSITORY_SUCCESS,
|
|
SYNC_CUSTOMER_REPOSITORY_FAILURE = _SYNC_CUSTOMER_REPOSITORY_FAILURE,
|
|
SAVE_LOGS = _SAVE_LOGS,
|
|
SAVE_LOGS_SUCCESS = _SAVE_LOGS_SUCCESS,
|
|
SAVE_LOGS_FAILURE = _SAVE_LOGS_FAILURE,
|
|
SEND_LAST_VERSION = _SEND_LAST_VERSION,
|
|
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
|
UPDATE_ACTIVATED = _UPDATE_ACTIVATED,
|
|
UPDATE_NOT_NECESSARY = _UPDATE_NOT_NECESSARY,
|
|
UPDATE_FAILED = _UPDATE_FAILED,
|
|
FINISHED = _FINISHED,
|
|
DEBUG = _DEBUG,
|
|
ERROR = _ERROR,
|
|
NONE = _NONE
|
|
};
|
|
|
|
private:
|
|
QStringList m_debugMsg;
|
|
QStringList m_guiMsg;
|
|
QStringList m_ismasMsg;
|
|
UPDATE_STEP m_currentStep;
|
|
static Worker *instance;
|
|
QStringList m_opkgCommands;
|
|
Update *m_update = nullptr;
|
|
hwinf *m_hw = nullptr;
|
|
UPDATE_STEP m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
|
|
|
protected:
|
|
virtual void run();
|
|
|
|
public:
|
|
QDebug CONSOLE(QStringList const &lst = QStringList()) {
|
|
m_debugMsg = lst;
|
|
return QDebug(QtMsgType::QtInfoMsg);
|
|
}
|
|
|
|
IsmasClient &ISMAS(QStringList const &lst = QStringList()) {
|
|
m_ismasMsg = lst;
|
|
return m_ismasClient;
|
|
}
|
|
|
|
Worker *GUI(QStringList const &lst = QStringList()) {
|
|
m_guiMsg = lst;
|
|
return this;
|
|
}
|
|
|
|
static QMap<UPDATE_STEP, const char*> const &getSmap() {
|
|
return smap;
|
|
}
|
|
|
|
static QString getATBUpdateToolYoctoVersion();
|
|
static QString getATBUpdateToolYoctoInstallationStatus();
|
|
static QString getAPISMYoctoVersion();
|
|
static QString getAPISMYoctoInstallationStatus();
|
|
|
|
static const QString UPDATE_STEP_OK;
|
|
static const QString UPDATE_STEP_DONE;
|
|
static const QString UPDATE_STEP_FAIL;
|
|
static const QString UPDATE_STEP_WRONG;
|
|
static const QString UPDATE_STEP_SUCCESS;
|
|
|
|
explicit Worker(int customerNr, // 281
|
|
int machineNr,
|
|
int zoneNr,
|
|
QString repositoryUrl,
|
|
QString branchName,
|
|
QString pluginDir,
|
|
QString pluginName,
|
|
QString workingDir = ".",
|
|
bool noUpdatePsaHardware = false,
|
|
bool alwaysDownloadConfig = false,
|
|
bool alwaysDownloadDC = false,
|
|
bool dryRun = false,
|
|
QObject *parent = nullptr,
|
|
char const *serialInterface = SERIAL_PORT,
|
|
char const *baudrate = "115200");
|
|
~Worker();
|
|
|
|
void setMainWindow(MainWindow *mainWindow) { m_mainWindow = mainWindow; }
|
|
void setProgress(int progress);
|
|
void displayProgressInMainWindow(int progress);
|
|
void startProgressLoop();
|
|
void stopProgressLoop();
|
|
void setHW(hwinf *hw) { m_hw = hw; }
|
|
hwinf *getHW() { return m_hw; }
|
|
|
|
IsmasClient &getIsmasClient() { return m_ismasClient; }
|
|
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
|
|
|
bool updateProcessRunning() const { return m_updateProcessRunning; }
|
|
UPDATE_STEP currentStep() const { return m_currentStep; }
|
|
|
|
int machineNr() const { return m_machineNr; }
|
|
int customerNr() const { return m_customerNr; }
|
|
int zoneNr() const { return m_zoneNr; }
|
|
QString apismVersion() const { return m_apismVersion; }
|
|
QString atbUpdateToolVersion() const { return m_atbUpdateToolVersion; }
|
|
|
|
MainWindow *mainWindow() { return m_mainWindow; }
|
|
MainWindow const *mainWindow() const { return m_mainWindow; }
|
|
|
|
Update *update() { return m_update; }
|
|
Update const *update() const { return m_update; }
|
|
|
|
signals:
|
|
void appendText(QString, QString suffix = "");
|
|
void replaceLast(QString, QString);
|
|
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();
|
|
void disableExit();
|
|
|
|
private slots:
|
|
bool updateTriggerSet();
|
|
bool customerEnvironment();
|
|
bool filesToUpdate();
|
|
bool downloadFilesToPSAHardware();
|
|
bool syncCustomerRepositoryAndFS();
|
|
// bool sendIsmasLastVersionNotification(int progress);
|
|
bool saveLogFile();
|
|
|
|
private:
|
|
PSAInstalled getPSAInstalled();
|
|
void privateUpdate();
|
|
bool computeFilesToDownload();
|
|
bool execOpkgCommands();
|
|
|
|
static const QMap<UPDATE_STEP, const char*> smap;
|
|
|
|
// CONSOLE()
|
|
friend UPDATE_STEP operator<<(QDebug debug, UPDATE_STEP step) {
|
|
if (!Worker::instance) {
|
|
return step;
|
|
}
|
|
|
|
Worker::instance->m_currentStep = step;
|
|
QStringList lst = QStringList(smap[step]);
|
|
|
|
switch (step) {
|
|
case UPDATE_STEP::NONE: {
|
|
} break;
|
|
case UPDATE_STEP::STARTED: {
|
|
Utils::printUpdateStatusMsg(
|
|
debug,
|
|
QStringList(smap[step])
|
|
<< QString("CURRENT TIME ...............%1").arg(QDateTime::currentDateTime().toString(Qt::ISODate))
|
|
<< QString("OS VERSION .................%1").arg(instance->m_osVersion)
|
|
<< QString("ATBQT VERSION ..............%1").arg(instance->m_atbqtVersion)
|
|
<< QString("CPU SERIAL .................%1").arg(instance->m_cpuSerial)
|
|
<< QString("CUSTOMER_NR ................%1").arg(instance->m_customerNr)
|
|
<< QString("CUSTOMER_NR_STR ............%1").arg(instance->m_customerNrStr)
|
|
<< QString("CUSTOMER_REPOSITORY_PATH ...%1").arg(instance->m_customerRepositoryPath)
|
|
<< QString("CUSTOMER_REPOSITORY ........%1").arg(instance->m_customerRepository)
|
|
<< QString("MACHINE_NR .................%1").arg(instance->m_machineNr)
|
|
<< QString("ZONE_NR ....................%1").arg(instance->m_zoneNr)
|
|
<< QString("BRANCH_NAME ................%1").arg(instance->m_branchName)
|
|
<< QString("PLUGIN_NAME ................%1").arg(instance->m_pluginName)
|
|
<< QString("WORKING_DIRECTORY ..........%1").arg(instance->m_workingDirectory)
|
|
<< QString("APISM VERSION ..............%1").arg(instance->m_apismVersion)
|
|
<< QString("ATB UPDATE TOOL VERSION ....%1").arg(instance->m_atbUpdateToolVersion));
|
|
} break;
|
|
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;
|
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS:
|
|
break;
|
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
|
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:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE: {
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
} break;
|
|
case UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER:
|
|
break;
|
|
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH_FAILURE:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
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::FILES_TO_UPDATE: {
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
} break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
} break;
|
|
case UPDATE_STEP::FILES_TO_DOWNLOAD:
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1:
|
|
__attribute__((fallthrough));
|
|
// [[fallthrough]] -> c++17 -> unknown for clang
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_7:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_8:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_9:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_LAST:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
} 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:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
|
break;
|
|
case UPDATE_STEP::SAVE_LOGS:
|
|
break;
|
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
|
break;
|
|
case UPDATE_STEP::SEND_LAST_VERSION:
|
|
// SEND_LAST_VERSION_CORRECTION
|
|
break;
|
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_ACTIVATED:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_FAILED:
|
|
break;
|
|
case UPDATE_STEP::FINISHED:
|
|
lst << instance->m_debugMsg;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
break;
|
|
case UPDATE_STEP::DEBUG: {
|
|
lst << instance->m_debugMsg;
|
|
qCritical() << __LINE__ << lst;
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
} break;
|
|
case UPDATE_STEP::ERROR:
|
|
//Utils::printUpdateStatusMsg(
|
|
// debug, QStringList(smap[step]) << instance->m_errorMsg);
|
|
break;
|
|
}
|
|
|
|
instance->m_debugMsg.clear();
|
|
|
|
return step;
|
|
}
|
|
|
|
// ISMAS()
|
|
friend UPDATE_STEP operator<<(IsmasClient &ismasClient, UPDATE_STEP step) {
|
|
|
|
if (!Worker::instance) {
|
|
return step;
|
|
}
|
|
|
|
Worker::instance->m_currentStep = step;
|
|
QStringList lst = QStringList(smap[step]);
|
|
|
|
switch (step) {
|
|
case UPDATE_STEP::NONE: {
|
|
} break;
|
|
case UPDATE_STEP::STARTED: {
|
|
ismasClient.setProgressInPercent(_STARTED);
|
|
} break;
|
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
|
break;
|
|
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::CHECK_SANITY:
|
|
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
|
break;
|
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
|
ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
|
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
|
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
|
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
|
break;
|
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_SUCCESS);
|
|
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(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::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(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::CHECKOUT_REPOSITORY:
|
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY);
|
|
break;
|
|
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()),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
|
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",
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE: {
|
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_FAILURE);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0003",
|
|
_CHECK_ISMAS_TRIGGER_FAILURE,
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER:
|
|
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER);
|
|
break;
|
|
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
|
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER);
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH:
|
|
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH);
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_SUCCESS);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0010",
|
|
_CHECKOUT_BRANCH_SUCCESS,
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH_FAILURE: {
|
|
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_FAILURE);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0003",
|
|
_CHECKOUT_BRANCH_FAILURE,
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES:
|
|
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES);
|
|
break;
|
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS:
|
|
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
|
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::FILES_TO_UPDATE:
|
|
ismasClient.setProgressInPercent(_FILES_TO_UPDATE);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
|
break;
|
|
case UPDATE_STEP::FILES_TO_DOWNLOAD:
|
|
ismasClient.setProgressInPercent(_FILES_TO_DOWNLOAD);
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
|
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMANDS);
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1:
|
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_1);
|
|
__attribute__((fallthrough)); // [[fallthrough]]; -> c++17, unknown to clang
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_2);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_3);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_4);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_5);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_6);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_7);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_8: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_8);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_9: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_8: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_9);
|
|
} __attribute__((fallthrough));
|
|
}
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_LAST: {
|
|
switch(step) {
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_8: break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_9: break;
|
|
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_LAST);
|
|
}
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
_ISMAS_CONTINUE,
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_SUCCESS);
|
|
} break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_FAILURE);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
_ISMAS_FAILURE,
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_SUCCESS);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
_ISMAS_CONTINUE,
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
_ISMAS_CONTINUE,
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY);
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
_ISMAS_CONTINUE,
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::SAVE_LOGS:
|
|
ismasClient.setProgressInPercent(_SAVE_LOGS);
|
|
break;
|
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS: {
|
|
ismasClient.setProgressInPercent(_SAVE_LOGS_SUCCESS);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
_ISMAS_CONTINUE,
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
|
ismasClient.setProgressInPercent(_SAVE_LOGS_FAILURE);
|
|
break;
|
|
case UPDATE_STEP::SEND_LAST_VERSION: {
|
|
ismasClient.setProgressInPercent(_SEND_LAST_VERSION + _SEND_LAST_VERSION_CORRECTION);
|
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
QString("#M=APISM#C=CMD_SENDVERSION#J=") +
|
|
ismasClient.updateOfPSASendVersion(instance->getPSAInstalled()));
|
|
} break;
|
|
case UPDATE_STEP::UPDATE_SUCCEEDED: {
|
|
ismasClient.setProgressInPercent(_UPDATE_SUCCEEDED + _UPDATE_SUCCEEDED_CORRECTION);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0001", // WAIT-button set to 100%
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::UPDATE_ACTIVATED: {
|
|
ismasClient.setProgressInPercent(_UPDATE_ACTIVATED + _UPDATE_ACTIVATED_CORRECTION);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0002", // reset WAIT-button to "" (empty string)
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY: {
|
|
ismasClient.setProgressInPercent(_UPDATE_NOT_NECESSARY + _UPDATE_NOT_NECESSARY_CORRECTION);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0002", // reset WAIT-button to "" (empty string)
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::UPDATE_FAILED: {
|
|
ismasClient.setProgressInPercent(_UPDATE_FAILED);
|
|
QString const &ismasUpdateNews =
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
ismasClient.updateNewsToIsmas(
|
|
"U0003",
|
|
ismasClient.getProgressInPercent(),
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
smap[step],
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
ismasClient.sendRequestReceiveResponse(
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
} break;
|
|
case UPDATE_STEP::FINISHED:
|
|
ismasClient.setProgressInPercent(_FINISHED);
|
|
break;
|
|
case UPDATE_STEP::DEBUG:
|
|
break;
|
|
case UPDATE_STEP::ERROR:
|
|
break;
|
|
}
|
|
|
|
instance->m_ismasMsg.clear();
|
|
|
|
return step;
|
|
}
|
|
|
|
// GUI()
|
|
friend UPDATE_STEP operator<<(Worker *worker, UPDATE_STEP step) {
|
|
if (!Worker::instance) {
|
|
return step;
|
|
}
|
|
|
|
Worker::instance->m_currentStep = step;
|
|
|
|
switch (step) {
|
|
case UPDATE_STEP::NONE: {
|
|
} break;
|
|
case UPDATE_STEP::STARTED:
|
|
break;
|
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
|
emit worker->appendText("\nInitializing customer environment ...");
|
|
break;
|
|
case UPDATE_STEP::CHECK_SANITY:
|
|
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:
|
|
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
|
if (worker->m_guiMsg.size() > 0) {
|
|
emit worker->showStatusMessage(worker->m_guiMsg);
|
|
}
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
|
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_WRONG);
|
|
emit worker->showErrorMessage(worker->m_guiMsg);
|
|
break;
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
|
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
|
emit worker->showErrorMessage(worker->m_guiMsg);
|
|
break;
|
|
case UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER:
|
|
break;
|
|
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH:
|
|
emit worker->appendText("\nPrepare customer environment ...");
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS:
|
|
emit worker->replaceLast("Prepare customer environment ...", UPDATE_STEP_DONE);
|
|
break;
|
|
case UPDATE_STEP::CHECKOUT_BRANCH_FAILURE:
|
|
emit worker->replaceLast("Prepare customer environment ...", UPDATE_STEP_FAIL);
|
|
emit worker->showErrorMessage(worker->m_guiMsg);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
|
emit worker->appendText("\nUpdate repository...");
|
|
break;
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
|
emit worker->replaceLast(QString("Update repository ..."), UPDATE_STEP_DONE);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
|
emit worker->replaceLast(QString("Update repository ..."), UPDATE_STEP_FAIL);
|
|
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::FILES_TO_UPDATE: {
|
|
|
|
qCritical() << "FILES_TO_UPDATE" << worker->m_filesToUpdate;
|
|
|
|
int const size = worker->m_filesToUpdate.size();
|
|
if (size > 1) {
|
|
emit worker->appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
|
for (int i = 0; i < size; ++i) {
|
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(i));
|
|
}
|
|
}
|
|
if (size == 1) {
|
|
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
|
}
|
|
} break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE:
|
|
break;
|
|
case UPDATE_STEP::FILES_TO_DOWNLOAD:
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
|
|
emit worker->appendText("\n( ) Update opkg pakets ...");
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_1:
|
|
__attribute__((fallthrough));
|
|
// [[fallthrough]] -> c++17 -> unknown for clang
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_2:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_3:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_4:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_5:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_6:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_7:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_8:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_9:
|
|
__attribute__((fallthrough));
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_LAST:
|
|
break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
|
QString prepend = QString("(") + QString("%1").arg(worker->m_displayIndex).rightJustified(3, ' ') + QString(")")
|
|
+ QString(" Update opkg pakets ... ");
|
|
worker->m_opkgCommands.prepend(prepend);
|
|
emit worker->replaceLast(worker->m_opkgCommands, UPDATE_STEP_DONE);
|
|
} break;
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
|
emit worker->replaceLast(QString("(") + QString("%1").arg(worker->m_displayIndex).rightJustified(3, ' ') + QString(")")
|
|
+ QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
|
|
} 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::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
|
break;
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
emit worker->appendText("\nSync customer environment with filesystem ...");
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
|
emit worker->replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_DONE);
|
|
break;
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
|
emit worker->replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_FAIL);
|
|
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:
|
|
emit worker->appendText(QString("Send last version info "), UPDATE_STEP_DONE);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
|
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
|
break;
|
|
case UPDATE_STEP::UPDATE_ACTIVATED:
|
|
break;
|
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
|
break;
|
|
case UPDATE_STEP::UPDATE_FAILED:
|
|
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
|
break;
|
|
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;
|
|
}
|
|
|
|
worker->m_guiMsg.clear();
|
|
|
|
return step;
|
|
}
|
|
};
|
|
|
|
#endif // WORKER_H_INCLUDED
|