2023-06-16 16:47:13 +02:00
|
|
|
#ifndef WORKER_H_INCLUDED
|
|
|
|
#define WORKER_H_INCLUDED
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
2023-07-14 13:32:00 +02:00
|
|
|
#include <QStringList>
|
2023-06-16 16:47:13 +02:00
|
|
|
#include <QTimer>
|
2023-07-11 16:58:49 +02:00
|
|
|
#include <QFile>
|
|
|
|
#include <QJsonObject>
|
2023-07-14 13:32:00 +02:00
|
|
|
#include <QHash>
|
2023-10-20 13:55:18 +02:00
|
|
|
#include <QMap>
|
|
|
|
#include <QDebug>
|
2023-11-07 09:04:05 +01:00
|
|
|
#include <QThread>
|
2023-06-16 16:47:13 +02:00
|
|
|
|
2023-08-30 11:46:55 +02:00
|
|
|
#include <optional>
|
2023-10-20 13:55:18 +02:00
|
|
|
#include <initializer_list>
|
2023-08-30 11:46:55 +02:00
|
|
|
|
2023-07-11 16:58:49 +02:00
|
|
|
#include "update.h"
|
|
|
|
#include "git/git_client.h"
|
|
|
|
#include "ismas/ismas_client.h"
|
2023-10-20 13:55:18 +02:00
|
|
|
#include "utils.h"
|
2023-06-16 16:47:13 +02:00
|
|
|
|
2023-07-11 16:58:49 +02:00
|
|
|
#ifdef PTU5
|
|
|
|
#define SERIAL_PORT "ttymxc2"
|
|
|
|
#else
|
|
|
|
#define SERIAL_PORT "ttyUSB0"
|
|
|
|
#endif
|
|
|
|
|
2023-10-30 15:07:28 +01:00
|
|
|
#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)
|
2024-01-19 13:06:11 +01:00
|
|
|
#define _CHECK_ISMAS_TRIGGER (2)
|
|
|
|
#define _CHECK_SANITY (3)
|
|
|
|
#define _CHECK_SANITY_FAILURE (4)
|
|
|
|
#define _CHECK_SANITY_SUCCESS (5)
|
|
|
|
#define _REPOSITORY_RECOVERED_FAILURE (6)
|
|
|
|
#define _REPOSITORY_RECOVERED_SUCCESS (7)
|
|
|
|
#define _CHECK_REPOSITORY (8)
|
|
|
|
#define _CHECK_REPOSITORY_FAILURE (9)
|
|
|
|
#define _CHECK_REPOSITORY_SUCCESS (10)
|
|
|
|
#define _CLONE_REPOSITORY (11)
|
|
|
|
#define _CLONE_REPOSITORY_FAILURE (12)
|
|
|
|
#define _CLONE_REPOSITORY_SUCCESS (13)
|
|
|
|
#define _CHECKOUT_REPOSITORY (14)
|
|
|
|
#define _CHECKOUT_REPOSITORY_FAILURE (15)
|
|
|
|
#define _CHECKOUT_REPOSITORY_SUCCESS (16)
|
|
|
|
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (17)
|
|
|
|
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (18)
|
|
|
|
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (19)
|
|
|
|
#define _CHECK_ISMAS_TRIGGER_SUCCESS (20)
|
|
|
|
#define _CHECK_ISMAS_TRIGGER_FAILURE (21)
|
|
|
|
#define _CHECKOUT_BRANCH (22)
|
|
|
|
#define _CHECKOUT_BRANCH_FAILURE (23)
|
|
|
|
#define _CHECKOUT_BRANCH_SUCCESS (24)
|
|
|
|
#define _UPDATE_REPOSITORY (25)
|
|
|
|
#define _UPDATE_REPOSITORY_FAILURE (26)
|
|
|
|
#define _UPDATE_REPOSITORY_SUCCESS (27)
|
|
|
|
#define _CHECK_FOR_REPOSITORY_CHANGES (28)
|
|
|
|
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (29)
|
|
|
|
#define _FILES_TO_UPDATE (30)
|
|
|
|
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (31)
|
|
|
|
#define _FILES_TO_DOWNLOAD (32)
|
2023-10-30 15:07:28 +01:00
|
|
|
#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)
|
2023-11-07 09:04:05 +01:00
|
|
|
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE (54)
|
|
|
|
#define _DOWNLOAD_CONFIG_FILE (55)
|
|
|
|
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (56)
|
|
|
|
#define _DOWNLOAD_CONFIG_FILE_FAILURE (57)
|
2023-10-30 15:07:28 +01:00
|
|
|
#define _DOWNLOAD_DEVICE_CONTROLLER (65)
|
2024-01-19 08:22:03 +01:00
|
|
|
#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)
|
2024-01-23 15:29:19 +01:00
|
|
|
#define _UPDATE_FINALIZE (95)
|
2024-01-19 08:22:03 +01:00
|
|
|
#define _UPDATE_SUCCEEDED (96)
|
|
|
|
#define _UPDATE_FAILED (97)
|
|
|
|
#define _UPDATE_ACTIVATED (98)
|
|
|
|
#define _UPDATE_NOT_NECESSARY (99)
|
2023-10-30 15:07:28 +01:00
|
|
|
#define _FINISHED (100)
|
|
|
|
#define _DEBUG (1000)
|
|
|
|
#define _ERROR (1001)
|
2024-01-19 08:22:03 +01:00
|
|
|
#define _NONE (1002)
|
2023-10-30 15:07:28 +01:00
|
|
|
|
2024-01-19 08:22:03 +01:00
|
|
|
#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)
|
2023-10-30 15:07:28 +01:00
|
|
|
|
|
|
|
#define ISMAS_UPDATE_REQUESTS (10)
|
|
|
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
2023-07-17 16:38:53 +02:00
|
|
|
|
2023-08-05 18:50:50 +02:00
|
|
|
class MainWindow;
|
2023-07-11 16:58:49 +02:00
|
|
|
class hwinf;
|
2023-11-07 09:04:05 +01:00
|
|
|
class Worker : public QThread{
|
2023-06-16 16:47:13 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2023-07-17 16:38:53 +02:00
|
|
|
int const m_customerNr;
|
|
|
|
QString const m_customerNrStr;
|
|
|
|
int const m_machineNr;
|
|
|
|
int const m_zoneNr;
|
2023-11-07 09:04:05 +01:00
|
|
|
QString const m_pluginDir;
|
2023-09-06 09:04:43 +02:00
|
|
|
QString const m_pluginName;
|
2023-07-14 13:32:00 +02:00
|
|
|
QString const m_workingDirectory;
|
|
|
|
QString const m_branchName;
|
2023-07-19 16:35:48 +02:00
|
|
|
QString const m_customerRepositoryPath;
|
2023-07-14 13:32:00 +02:00
|
|
|
QString const m_customerRepository;
|
2023-11-07 09:04:05 +01:00
|
|
|
bool const m_noUpdatePsaHardware;
|
2023-11-21 09:53:28 +01:00
|
|
|
bool const m_alwaysDownloadConfig;
|
|
|
|
bool const m_alwaysDownloadDC;
|
2023-09-06 09:04:43 +02:00
|
|
|
bool const m_dryRun;
|
|
|
|
QObject *m_parent;
|
|
|
|
QString const m_serialInterface;
|
|
|
|
QString const m_baudrate;
|
2023-08-02 15:50:04 +02:00
|
|
|
IsmasClient m_ismasClient;
|
2023-07-17 16:38:53 +02:00
|
|
|
GitClient m_gc;
|
2024-01-17 15:25:35 +01:00
|
|
|
QStringList m_versionInfo;
|
2023-07-17 16:38:53 +02:00
|
|
|
QString const m_osVersion;
|
2023-07-19 16:35:48 +02:00
|
|
|
QString const m_atbqtVersion;
|
2023-10-12 12:10:24 +02:00
|
|
|
QString const m_atbUpdateToolVersion;
|
2023-07-19 16:35:48 +02:00
|
|
|
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;
|
|
|
|
|
2023-07-14 13:32:00 +02:00
|
|
|
int m_ismasUpdateRequests;
|
|
|
|
QTimer m_waitForNewUpdates;
|
|
|
|
|
2023-08-02 15:50:04 +02:00
|
|
|
QStringList m_filesToUpdate;
|
2023-10-20 13:55:18 +02:00
|
|
|
QStringList m_filesToDownload;
|
2023-08-02 15:50:04 +02:00
|
|
|
bool m_updateProcessRunning;
|
|
|
|
int m_displayIndex;
|
2023-10-30 15:09:33 +01:00
|
|
|
bool m_clone = false;
|
|
|
|
bool m_initialClone = false;
|
|
|
|
bool m_repairClone = false;
|
|
|
|
bool m_ismasTriggerActive = false;
|
2024-01-19 13:05:46 +01:00
|
|
|
bool m_updateNotNecessary = false;
|
2024-01-19 13:40:24 +01:00
|
|
|
bool m_automaticUpdate = false;
|
2024-01-19 13:05:46 +01:00
|
|
|
QStringList m_ismasTriggerStatusMessage;
|
2023-07-14 13:32:00 +02:00
|
|
|
|
2023-08-05 18:50:50 +02:00
|
|
|
MainWindow *m_mainWindow;
|
2023-08-09 15:06:20 +02:00
|
|
|
bool m_withoutIsmasDirectPort;
|
2023-08-30 11:46:55 +02:00
|
|
|
QString m_apismVersion;
|
2023-08-05 18:50:50 +02:00
|
|
|
|
2023-08-02 15:50:04 +02:00
|
|
|
bool executeOpkgCommand(QString opkgCommand);
|
2023-07-17 16:38:53 +02:00
|
|
|
QString getOsVersion() const;
|
2023-07-19 16:35:48 +02:00
|
|
|
QString getATBQTVersion() const;
|
2023-10-12 12:10:24 +02:00
|
|
|
QString getATBUpdateToolVersion() const;
|
2023-07-19 16:35:48 +02:00
|
|
|
QString getCPUSerial() const;
|
|
|
|
QString getRaucVersion() const;
|
|
|
|
QString getOpkgVersion() const;
|
|
|
|
QString getPluginVersion(QString const &pluginFileName) const;
|
|
|
|
QStringList getDCVersion() const;
|
|
|
|
|
|
|
|
qint64 getFileSize(QString const &fileName) const;
|
2023-10-19 13:38:16 +02:00
|
|
|
bool isRepositoryCorrupted();
|
|
|
|
bool repairCorruptedRepository();
|
|
|
|
|
|
|
|
int sendCloneAndCheckoutSuccess();
|
|
|
|
int sendCloneAndCheckoutFailure();
|
|
|
|
int sendIsmasTriggerFailure();
|
2023-10-20 13:55:18 +02:00
|
|
|
int sendPullFailure();
|
|
|
|
int sendFileUpdateFailure();
|
|
|
|
int sendRsyncFailure();
|
|
|
|
int sendLastVersionFailure();
|
|
|
|
int sendSaveLogFilesFailure();
|
|
|
|
int sendCustomerEnvironmentConfigurationFailed();
|
|
|
|
int sendFoundFilesToUpdateSuccess();
|
|
|
|
int sendUpdateSucceededAndActivated();
|
|
|
|
int sendFinalResult();
|
|
|
|
|
2023-10-30 15:05:30 +01:00
|
|
|
struct UpdateProcessRunning {
|
|
|
|
Worker *m_worker;
|
|
|
|
|
|
|
|
explicit UpdateProcessRunning(Worker *worker) : m_worker(worker) {
|
|
|
|
m_worker->m_updateProcessRunning = true;
|
2023-11-03 13:45:54 +01:00
|
|
|
// emit m_worker->disableExit();
|
|
|
|
emit m_worker->enableExit();
|
2023-10-30 15:05:30 +01:00
|
|
|
m_worker->startProgressLoop();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~UpdateProcessRunning() {
|
2024-01-19 13:06:58 +01:00
|
|
|
|
|
|
|
if (m_worker->m_lastFailedUpdateStep == UPDATE_STEP::NONE) {
|
|
|
|
if (m_worker->m_updateNotNecessary) {
|
|
|
|
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
|
|
|
|
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_NOT_NECESSARY));
|
|
|
|
} else {
|
2024-01-23 15:30:31 +01:00
|
|
|
QStringList lst(QString(m_worker->smap[UPDATE_STEP::UPDATE_SUCCEEDED]));
|
|
|
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << UPDATE_STEP::UPDATE_SUCCEEDED));
|
2024-01-19 13:06:58 +01:00
|
|
|
m_worker->setProgress(_UPDATE_SUCCEEDED);
|
|
|
|
|
2024-01-23 15:30:31 +01:00
|
|
|
lst = QStringList(QString(m_worker->smap[UPDATE_STEP::UPDATE_ACTIVATED]));
|
|
|
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << UPDATE_STEP::UPDATE_ACTIVATED));
|
2024-01-19 13:06:58 +01:00
|
|
|
m_worker->setProgress(_UPDATE_ACTIVATED);
|
|
|
|
|
2024-01-23 15:30:31 +01:00
|
|
|
lst = QStringList(QString(m_worker->smap[UPDATE_STEP::FINISHED]));
|
|
|
|
m_worker->CONSOLE(lst) << UPDATE_STEP::FINISHED;
|
2024-01-19 13:06:58 +01:00
|
|
|
m_worker->setProgress(_FINISHED);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
|
|
|
|
UPDATE_STEP last = m_worker->m_lastFailedUpdateStep;
|
|
|
|
if (m_worker->smap.contains(last)) {
|
2024-01-23 12:07:42 +01:00
|
|
|
lst << QString(" (last failed step: %1)").arg(m_worker->smap[last]);
|
|
|
|
} else {
|
2024-01-23 12:18:10 +01:00
|
|
|
lst << QString(" (last failed step unknown: %1)").arg((int)(last));
|
2024-01-19 13:06:58 +01:00
|
|
|
}
|
|
|
|
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_FAILED));
|
|
|
|
}
|
|
|
|
|
2024-01-19 13:40:24 +01:00
|
|
|
if (m_worker->m_automaticUpdate) {
|
2024-01-23 15:30:31 +01:00
|
|
|
QStringList lst(QString(m_worker->smap[UPDATE_STEP::SEND_LAST_VERSION]));
|
|
|
|
lst << "AUTOMATIC UPDATE";
|
2024-01-19 13:40:24 +01:00
|
|
|
if (m_worker->m_updateNotNecessary) {
|
|
|
|
lst << "UPDATE NOT NECESSARY";
|
|
|
|
}
|
|
|
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
|
|
|
|
<< UPDATE_STEP::SEND_LAST_VERSION));
|
|
|
|
} else {
|
2024-01-23 15:30:31 +01:00
|
|
|
QStringList lst(QString(m_worker->smap[UPDATE_STEP::SEND_LAST_VERSION]));
|
|
|
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
|
|
|
|
<< UPDATE_STEP::SEND_LAST_VERSION));
|
2024-01-19 13:40:24 +01:00
|
|
|
}
|
2023-10-30 15:05:30 +01:00
|
|
|
m_worker->stopProgressLoop();
|
|
|
|
m_worker->m_updateProcessRunning = false;
|
|
|
|
emit m_worker->enableExit();
|
|
|
|
emit m_worker->restartExitTimer();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
friend struct UpdateProcessRunning;
|
2023-10-20 13:55:18 +02:00
|
|
|
|
2023-10-23 16:16:11 +02:00
|
|
|
public:
|
2023-10-20 13:55:18 +02:00
|
|
|
enum class UPDATE_STEP {
|
2023-10-22 19:44:45 +02:00
|
|
|
STARTED = _STARTED,
|
|
|
|
CHECK_REPOSITORY = _CHECK_REPOSITORY,
|
2023-10-23 16:16:11 +02:00
|
|
|
CHECK_REPOSITORY_SUCCESS = _CHECK_REPOSITORY_SUCCESS,
|
|
|
|
CHECK_REPOSITORY_FAILURE = _CHECK_REPOSITORY_FAILURE,
|
2023-10-22 19:44:45 +02:00
|
|
|
CHECK_SANITY = _CHECK_SANITY,
|
|
|
|
CHECK_SANITY_SUCCESS = _CHECK_SANITY_SUCCESS,
|
|
|
|
CHECK_SANITY_FAILURE = _CHECK_SANITY_FAILURE,
|
2023-10-23 16:16:11 +02:00
|
|
|
REPOSITORY_RECOVERED_SUCCESS = _REPOSITORY_RECOVERED_SUCCESS,
|
|
|
|
REPOSITORY_RECOVERED_FAILURE = _REPOSITORY_RECOVERED_FAILURE,
|
2023-10-22 19:44:45 +02:00
|
|
|
CLONE_REPOSITORY = _CLONE_REPOSITORY,
|
|
|
|
CLONE_REPOSITORY_SUCCESS = _CLONE_REPOSITORY_SUCCESS,
|
|
|
|
CLONE_REPOSITORY_FAILURE = _CLONE_REPOSITORY_FAILURE,
|
2023-10-23 16:16:11 +02:00
|
|
|
CHECKOUT_REPOSITORY = _CHECKOUT_REPOSITORY,
|
|
|
|
CHECKOUT_REPOSITORY_SUCCESS = _CHECKOUT_REPOSITORY_SUCCESS,
|
|
|
|
CHECKOUT_REPOSITORY_FAILURE = _CHECKOUT_REPOSITORY_FAILURE,
|
2023-10-22 19:44:45 +02:00
|
|
|
CHECK_ISMAS_TRIGGER = _CHECK_ISMAS_TRIGGER,
|
2023-10-30 15:07:28 +01:00
|
|
|
CHECK_ISMAS_TRIGGER_WRONG_VALUE = _CHECK_ISMAS_TRIGGER_WRONG_VALUE,
|
2023-10-22 19:44:45 +02:00
|
|
|
CHECK_ISMAS_TRIGGER_SUCCESS = _CHECK_ISMAS_TRIGGER_SUCCESS,
|
|
|
|
CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE,
|
2023-10-30 15:07:28 +01:00
|
|
|
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,
|
2023-10-22 19:44:45 +02:00
|
|
|
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,
|
2023-10-30 15:07:28 +01:00
|
|
|
FILES_TO_UPDATE = _FILES_TO_UPDATE,
|
2023-11-07 09:04:05 +01:00
|
|
|
DOWNLOAD_FILES_TO_PSA_HARDWARE = _DOWNLOAD_FILES_TO_PSA_HARDWARE,
|
2023-10-30 15:07:28 +01:00
|
|
|
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,
|
2023-10-22 19:44:45 +02:00
|
|
|
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,
|
2023-11-07 09:04:05 +01:00
|
|
|
DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS = _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS,
|
|
|
|
DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE = _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE,
|
2023-10-22 19:44:45 +02:00
|
|
|
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,
|
2024-01-23 15:29:19 +01:00
|
|
|
UPDATE_FINALIZE = _UPDATE_FINALIZE,
|
2023-10-22 19:44:45 +02:00
|
|
|
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
2023-10-30 15:07:28 +01:00
|
|
|
UPDATE_ACTIVATED = _UPDATE_ACTIVATED,
|
2024-01-19 08:22:03 +01:00
|
|
|
UPDATE_NOT_NECESSARY = _UPDATE_NOT_NECESSARY,
|
2023-10-22 19:44:45 +02:00
|
|
|
UPDATE_FAILED = _UPDATE_FAILED,
|
2023-10-23 16:16:11 +02:00
|
|
|
FINISHED = _FINISHED,
|
|
|
|
DEBUG = _DEBUG,
|
2024-01-19 08:22:03 +01:00
|
|
|
ERROR = _ERROR,
|
|
|
|
NONE = _NONE
|
2023-10-20 13:55:18 +02:00
|
|
|
};
|
|
|
|
|
2023-10-23 16:16:11 +02:00
|
|
|
private:
|
|
|
|
QStringList m_debugMsg;
|
|
|
|
QStringList m_guiMsg;
|
|
|
|
QStringList m_ismasMsg;
|
|
|
|
UPDATE_STEP m_currentStep;
|
|
|
|
static Worker *instance;
|
2023-10-30 15:09:33 +01:00
|
|
|
QStringList m_opkgCommands;
|
2023-11-07 09:04:05 +01:00
|
|
|
Update *m_update = nullptr;
|
2024-01-19 08:20:21 +01:00
|
|
|
hwinf *m_hw = nullptr;
|
|
|
|
UPDATE_STEP m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
2023-11-07 09:04:05 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void run();
|
2023-10-23 16:16:11 +02:00
|
|
|
|
2023-10-30 15:09:33 +01:00
|
|
|
public:
|
2023-10-23 16:16:11 +02:00
|
|
|
QDebug CONSOLE(QStringList const &lst = QStringList()) {
|
|
|
|
m_debugMsg = lst;
|
2023-11-03 13:45:54 +01:00
|
|
|
return QDebug(QtMsgType::QtInfoMsg);
|
2023-10-23 16:16:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IsmasClient &ISMAS(QStringList const &lst = QStringList()) {
|
|
|
|
m_ismasMsg = lst;
|
|
|
|
return m_ismasClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
Worker *GUI(QStringList const &lst = QStringList()) {
|
|
|
|
m_guiMsg = lst;
|
|
|
|
return this;
|
|
|
|
}
|
2023-07-11 16:58:49 +02:00
|
|
|
|
2023-10-30 15:07:28 +01:00
|
|
|
static QMap<UPDATE_STEP, const char*> const &getSmap() {
|
|
|
|
return smap;
|
|
|
|
}
|
|
|
|
|
2023-10-18 11:30:12 +02:00
|
|
|
static QString getATBUpdateToolYoctoVersion();
|
|
|
|
static QString getATBUpdateToolYoctoInstallationStatus();
|
2023-10-30 15:11:06 +01:00
|
|
|
static QString getAPISMYoctoVersion();
|
|
|
|
static QString getAPISMYoctoInstallationStatus();
|
2023-10-18 11:30:12 +02:00
|
|
|
|
2023-08-02 15:50:04 +02:00
|
|
|
static const QString UPDATE_STEP_OK;
|
|
|
|
static const QString UPDATE_STEP_DONE;
|
|
|
|
static const QString UPDATE_STEP_FAIL;
|
2023-10-30 15:13:04 +01:00
|
|
|
static const QString UPDATE_STEP_WRONG;
|
2023-08-02 15:50:04 +02:00
|
|
|
static const QString UPDATE_STEP_SUCCESS;
|
|
|
|
|
2023-09-06 09:04:43 +02:00
|
|
|
explicit Worker(int customerNr, // 281
|
2023-07-17 16:38:53 +02:00
|
|
|
int machineNr,
|
|
|
|
int zoneNr,
|
2023-11-16 14:14:48 +01:00
|
|
|
QString repositoryUrl,
|
2023-07-14 13:32:00 +02:00
|
|
|
QString branchName,
|
2023-11-07 09:04:05 +01:00
|
|
|
QString pluginDir,
|
2023-09-06 09:04:43 +02:00
|
|
|
QString pluginName,
|
2023-07-11 16:58:49 +02:00
|
|
|
QString workingDir = ".",
|
2023-11-07 09:04:05 +01:00
|
|
|
bool noUpdatePsaHardware = false,
|
2023-11-21 09:53:28 +01:00
|
|
|
bool alwaysDownloadConfig = false,
|
|
|
|
bool alwaysDownloadDC = false,
|
2023-07-11 16:58:49 +02:00
|
|
|
bool dryRun = false,
|
|
|
|
QObject *parent = nullptr,
|
|
|
|
char const *serialInterface = SERIAL_PORT,
|
|
|
|
char const *baudrate = "115200");
|
2023-06-16 16:47:13 +02:00
|
|
|
~Worker();
|
|
|
|
|
2023-08-05 18:50:50 +02:00
|
|
|
void setMainWindow(MainWindow *mainWindow) { m_mainWindow = mainWindow; }
|
2023-08-06 20:44:26 +02:00
|
|
|
void setProgress(int progress);
|
2023-10-20 13:55:18 +02:00
|
|
|
void displayProgressInMainWindow(int progress);
|
2023-08-09 15:06:20 +02:00
|
|
|
void startProgressLoop();
|
|
|
|
void stopProgressLoop();
|
2024-01-19 08:20:21 +01:00
|
|
|
void setHW(hwinf *hw) { m_hw = hw; }
|
|
|
|
hwinf *getHW() { return m_hw; }
|
2023-08-05 18:50:50 +02:00
|
|
|
|
2023-08-02 15:50:04 +02:00
|
|
|
IsmasClient &getIsmasClient() { return m_ismasClient; }
|
|
|
|
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
|
|
|
|
|
|
|
bool updateProcessRunning() const { return m_updateProcessRunning; }
|
2023-10-30 15:14:19 +01:00
|
|
|
UPDATE_STEP currentStep() const { return m_currentStep; }
|
2023-08-02 15:50:04 +02:00
|
|
|
|
|
|
|
int machineNr() const { return m_machineNr; }
|
|
|
|
int customerNr() const { return m_customerNr; }
|
|
|
|
int zoneNr() const { return m_zoneNr; }
|
2023-08-30 11:46:55 +02:00
|
|
|
QString apismVersion() const { return m_apismVersion; }
|
2023-10-12 12:10:24 +02:00
|
|
|
QString atbUpdateToolVersion() const { return m_atbUpdateToolVersion; }
|
2023-07-17 16:38:53 +02:00
|
|
|
|
2023-09-09 14:38:53 +02:00
|
|
|
MainWindow *mainWindow() { return m_mainWindow; }
|
|
|
|
MainWindow const *mainWindow() const { return m_mainWindow; }
|
|
|
|
|
2023-11-07 09:04:05 +01:00
|
|
|
Update *update() { return m_update; }
|
|
|
|
Update const *update() const { return m_update; }
|
|
|
|
|
2023-06-16 16:47:13 +02:00
|
|
|
signals:
|
2023-08-06 14:14:47 +02:00
|
|
|
void appendText(QString, QString suffix = "");
|
|
|
|
void replaceLast(QString, QString);
|
2023-08-18 11:51:27 +02:00
|
|
|
void replaceLast(QStringList, QString);
|
2023-08-02 15:50:04 +02:00
|
|
|
void showErrorMessage(QString title, QString description);
|
2023-09-09 14:38:53 +02:00
|
|
|
void showStatusMessage(QString title, QString description);
|
2023-10-23 16:16:11 +02:00
|
|
|
void showErrorMessage(QStringList titleAndDesc);
|
|
|
|
void showStatusMessage(QStringList titleAndDesc);
|
2023-08-02 15:50:04 +02:00
|
|
|
void stopStartTimer();
|
|
|
|
void restartExitTimer();
|
2023-08-02 17:51:35 +02:00
|
|
|
void enableExit();
|
|
|
|
void disableExit();
|
2023-06-16 16:47:13 +02:00
|
|
|
|
2023-07-11 16:58:49 +02:00
|
|
|
private slots:
|
2023-10-23 16:16:11 +02:00
|
|
|
bool updateTriggerSet();
|
2023-10-30 15:14:19 +01:00
|
|
|
bool customerEnvironment();
|
|
|
|
bool filesToUpdate();
|
2023-11-07 09:04:05 +01:00
|
|
|
bool downloadFilesToPSAHardware();
|
2023-10-30 15:14:19 +01:00
|
|
|
bool syncCustomerRepositoryAndFS();
|
|
|
|
// bool sendIsmasLastVersionNotification(int progress);
|
|
|
|
bool saveLogFile();
|
2023-08-02 15:50:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
PSAInstalled getPSAInstalled();
|
|
|
|
void privateUpdate();
|
2023-11-07 09:04:05 +01:00
|
|
|
bool computeFilesToDownload();
|
|
|
|
bool execOpkgCommands();
|
2023-10-20 13:55:18 +02:00
|
|
|
|
2023-10-22 19:44:45 +02:00
|
|
|
static const QMap<UPDATE_STEP, const char*> smap;
|
|
|
|
|
2023-10-23 16:16:11 +02:00
|
|
|
// CONSOLE()
|
2023-10-22 19:44:45 +02:00
|
|
|
friend UPDATE_STEP operator<<(QDebug debug, UPDATE_STEP step) {
|
2023-10-20 13:55:18 +02:00
|
|
|
if (!Worker::instance) {
|
2023-10-22 19:44:45 +02:00
|
|
|
return step;
|
2023-10-20 13:55:18 +02:00
|
|
|
}
|
|
|
|
|
2023-10-23 16:16:11 +02:00
|
|
|
Worker::instance->m_currentStep = step;
|
2023-10-30 15:15:30 +01:00
|
|
|
QStringList lst = QStringList(smap[step]);
|
2023-10-20 13:55:18 +02:00
|
|
|
|
|
|
|
switch (step) {
|
2024-01-19 08:22:03 +01:00
|
|
|
case UPDATE_STEP::NONE: {
|
|
|
|
} break;
|
2023-10-22 19:44:45 +02:00
|
|
|
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:
|
2023-10-23 16:16:11 +02:00
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
debug,
|
|
|
|
QStringList(smap[step])
|
|
|
|
<< QString("CHECK SANITY OF CUSTOMER REPOSITORY %1")
|
|
|
|
.arg(instance->m_customerRepository));
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
2023-10-23 16:16:11 +02:00
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
debug,
|
|
|
|
QStringList(smap[step])
|
|
|
|
<< QString("SANITY OF CUSTOMER REPOSITORY %1 OK")
|
|
|
|
.arg(instance->m_customerRepository));
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
2023-10-23 16:16:11 +02:00
|
|
|
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:
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::CHECKOUT_REPOSITORY:
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_SUCCESS:
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
2023-10-30 15:15:30 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
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);
|
2023-10-22 19:44:45 +02:00
|
|
|
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;
|
2023-11-29 11:37:08 +01:00
|
|
|
case UPDATE_STEP::FILES_TO_UPDATE: {
|
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
|
|
} break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
|
2023-10-30 15:15:30 +01:00
|
|
|
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;
|
2023-12-13 10:03:37 +01:00
|
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
|
|
} break;
|
2023-10-22 19:44:45 +02:00
|
|
|
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:
|
2023-11-03 13:45:54 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS:
|
2023-11-03 13:45:54 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
2023-11-03 13:45:54 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
2023-11-21 15:23:28 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
2023-11-21 15:23:28 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
2023-11-21 15:23:28 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SEND_LAST_VERSION:
|
2023-10-30 15:15:30 +01:00
|
|
|
// SEND_LAST_VERSION_CORRECTION
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
2023-11-21 15:23:28 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
case UPDATE_STEP::UPDATE_ACTIVATED:
|
2023-11-21 15:23:28 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-30 15:15:30 +01:00
|
|
|
break;
|
2024-01-19 08:22:03 +01:00
|
|
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
|
|
break;
|
2023-10-22 19:44:45 +02:00
|
|
|
case UPDATE_STEP::UPDATE_FAILED:
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-22 19:44:45 +02:00
|
|
|
case UPDATE_STEP::FINISHED:
|
2023-11-21 15:23:28 +01:00
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
2023-10-22 19:44:45 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
case UPDATE_STEP::DEBUG: {
|
|
|
|
lst << instance->m_debugMsg;
|
|
|
|
qCritical() << __LINE__ << lst;
|
|
|
|
Utils::printUpdateStatusMsg(debug, lst);
|
|
|
|
} break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::ERROR:
|
|
|
|
//Utils::printUpdateStatusMsg(
|
|
|
|
// debug, QStringList(smap[step]) << instance->m_errorMsg);
|
|
|
|
break;
|
2023-10-22 19:44:45 +02:00
|
|
|
}
|
|
|
|
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_debugMsg.clear();
|
|
|
|
|
2023-10-22 19:44:45 +02:00
|
|
|
return step;
|
|
|
|
}
|
|
|
|
|
2023-10-30 15:15:30 +01:00
|
|
|
// ISMAS()
|
2023-10-22 19:44:45 +02:00
|
|
|
friend UPDATE_STEP operator<<(IsmasClient &ismasClient, UPDATE_STEP step) {
|
|
|
|
|
|
|
|
if (!Worker::instance) {
|
|
|
|
return step;
|
|
|
|
}
|
|
|
|
|
2023-10-30 15:15:30 +01:00
|
|
|
Worker::instance->m_currentStep = step;
|
|
|
|
QStringList lst = QStringList(smap[step]);
|
|
|
|
|
2023-10-22 19:44:45 +02:00
|
|
|
switch (step) {
|
2024-01-19 08:22:03 +01:00
|
|
|
case UPDATE_STEP::NONE: {
|
|
|
|
} break;
|
2023-10-22 19:44:45 +02:00
|
|
|
case UPDATE_STEP::STARTED: {
|
|
|
|
ismasClient.setProgressInPercent(_STARTED);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2024-01-23 16:09:15 +01:00
|
|
|
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS: {
|
2024-01-17 15:26:14 +01:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS);
|
2024-01-23 16:09:15 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0010",
|
|
|
|
_CHECKOUT_REPOSITORY_SUCCESS,
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
|
|
smap[UPDATE_STEP::CHECK_REPOSITORY],
|
|
|
|
QString("REPOSITORY %1 AND BRANCH %2 OK")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
|
|
|
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE: {
|
2024-01-17 15:26:14 +01:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE);
|
2024-01-23 16:09:15 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0010",
|
|
|
|
_CHECKOUT_REPOSITORY_FAILURE,
|
|
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
|
|
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
|
|
|
|
QString("REPOSITORY %1 and BRANCH %2 ***NOT OK***")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
2024-01-23 16:09:15 +01:00
|
|
|
} break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS);
|
2024-01-23 16:09:15 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0010",
|
|
|
|
_CHECK_SANITY_SUCCESS,
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
|
|
smap[UPDATE_STEP::CHECK_SANITY],
|
|
|
|
QString("SANITY OF %1 (BRANCH %2) OK")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY_FAILURE: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
2024-01-23 16:09:15 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0010",
|
|
|
|
_CHECK_SANITY_FAILURE,
|
|
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
|
|
|
smap[UPDATE_STEP::CHECK_SANITY],
|
|
|
|
QString("SANITY OF %1 and BRANCH %2 ***NOT*** OK")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
2024-01-17 15:26:14 +01:00
|
|
|
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS);
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
2024-01-17 15:26:14 +01:00
|
|
|
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_FAILURE);
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_SUCCESS);
|
2023-10-23 16:16:11 +02:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0010",
|
|
|
|
_CLONE_REPOSITORY_SUCCESS,
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::CLONE_REPOSITORY],
|
2023-10-23 16:16:11 +02:00
|
|
|
QString("CLONED REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-23 16:16:11 +02:00
|
|
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
|
|
ismasUpdateNews);
|
|
|
|
} break;
|
|
|
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY_FAILURE);
|
2023-10-23 16:16:11 +02:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0003",
|
|
|
|
_CLONE_REPOSITORY_FAILURE,
|
|
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
|
2023-10-23 16:16:11 +02:00
|
|
|
QString("CLONING REPOSITORY %1 OR CHECKING OUT BRANCH %2 FAILED")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
2023-10-23 16:16:11 +02:00
|
|
|
} 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)
|
2024-01-17 15:26:53 +01:00
|
|
|
.arg(instance->m_gc.branchName()),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
|
|
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
2023-10-23 16:16:11 +02:00
|
|
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
2024-01-17 15:26:53 +01:00
|
|
|
ismasClient.updateTriggerSet("ISMAS TRIGGER SET",
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
|
|
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_FAILURE);
|
2023-10-30 15:15:30 +01:00
|
|
|
QString const &ismasUpdateNews =
|
2023-10-23 16:16:11 +02:00
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0003",
|
|
|
|
_CHECK_ISMAS_TRIGGER_FAILURE,
|
|
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::CHECK_ISMAS_TRIGGER],
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
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;
|
2024-01-23 15:30:31 +01:00
|
|
|
case UPDATE_STEP::CHECKOUT_BRANCH: {
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH);
|
2024-01-23 15:30:31 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
"U0010",
|
|
|
|
_CHECKOUT_BRANCH_SUCCESS,
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
|
|
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-30 15:15:30 +01:00
|
|
|
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,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
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,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY_SUCCESS);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES_SUCCESS);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
case UPDATE_STEP::FILES_TO_UPDATE:
|
|
|
|
ismasClient.setProgressInPercent(_FILES_TO_UPDATE);
|
|
|
|
break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE:
|
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
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(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
|
|
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
|
|
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_SUCCESS);
|
2024-01-23 15:30:31 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
_ISMAS_CONTINUE,
|
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
|
|
|
smap[UPDATE_STEP::EXEC_OPKG_COMMANDS],
|
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
2023-10-30 15:15:30 +01:00
|
|
|
} 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(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_SUCCESS);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-11-21 15:23:28 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_SUCCESS);
|
2023-11-21 15:23:28 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
_ISMAS_CONTINUE,
|
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER],
|
2023-11-21 15:23:28 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-11-21 15:23:28 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-11-21 15:23:28 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS: {
|
2023-11-07 09:04:05 +01:00
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
2023-11-21 15:23:28 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
_ISMAS_CONTINUE,
|
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE],
|
2023-11-21 15:23:28 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-11-21 15:23:28 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
|
|
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-11-21 15:23:28 +01:00
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
2023-11-21 15:23:28 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
|
|
|
_ISMAS_CONTINUE,
|
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:30:31 +01:00
|
|
|
smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY],
|
2023-11-21 15:23:28 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-11-21 15:23:28 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_SAVE_LOGS);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-11-21 15:23:28 +01:00
|
|
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_SAVE_LOGS_SUCCESS);
|
2023-11-21 15:23:28 +01:00
|
|
|
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(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-11-21 15:23:28 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_SAVE_LOGS_FAILURE);
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
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(
|
2024-01-23 15:29:19 +01:00
|
|
|
_ISMAS_DONE, // WAIT-button set to 100%
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:29:19 +01:00
|
|
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
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(
|
2024-01-23 15:29:19 +01:00
|
|
|
_ISMAS_SET_WAIT_OK,
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:29:19 +01:00
|
|
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2024-01-19 08:22:03 +01:00
|
|
|
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(
|
2024-01-23 15:29:19 +01:00
|
|
|
_ISMAS_SET_WAIT_OK,
|
2024-01-19 08:22:03 +01:00
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::SUCCESS,
|
2024-01-23 15:29:19 +01:00
|
|
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
2024-01-19 08:22:03 +01:00
|
|
|
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;
|
2023-10-30 15:15:30 +01:00
|
|
|
case UPDATE_STEP::UPDATE_FAILED: {
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_UPDATE_FAILED);
|
2023-10-30 15:15:30 +01:00
|
|
|
QString const &ismasUpdateNews =
|
|
|
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
|
|
|
ismasClient.updateNewsToIsmas(
|
2024-01-23 15:29:19 +01:00
|
|
|
_ISMAS_FAILURE,
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.getProgressInPercent(),
|
|
|
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
2024-01-23 15:29:19 +01:00
|
|
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
2024-01-17 15:26:53 +01:00
|
|
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
2023-10-30 15:15:30 +01:00
|
|
|
ismasClient.sendRequestReceiveResponse(
|
|
|
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
|
|
|
} break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::FINISHED:
|
2023-10-22 19:44:45 +02:00
|
|
|
ismasClient.setProgressInPercent(_FINISHED);
|
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::DEBUG:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::ERROR:
|
2023-10-20 13:55:18 +02:00
|
|
|
break;
|
|
|
|
}
|
2023-10-22 19:44:45 +02:00
|
|
|
|
2023-10-30 15:15:30 +01:00
|
|
|
instance->m_ismasMsg.clear();
|
|
|
|
|
2023-10-22 19:44:45 +02:00
|
|
|
return step;
|
|
|
|
}
|
|
|
|
|
2023-10-30 15:15:30 +01:00
|
|
|
// GUI()
|
2023-10-23 16:16:11 +02:00
|
|
|
friend UPDATE_STEP operator<<(Worker *worker, UPDATE_STEP step) {
|
2023-10-30 15:15:30 +01:00
|
|
|
if (!Worker::instance) {
|
|
|
|
return step;
|
|
|
|
}
|
|
|
|
|
|
|
|
Worker::instance->m_currentStep = step;
|
|
|
|
|
2023-10-23 16:16:11 +02:00
|
|
|
switch (step) {
|
2024-01-19 08:22:03 +01:00
|
|
|
case UPDATE_STEP::NONE: {
|
|
|
|
} break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::STARTED:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
|
|
|
emit worker->appendText("\nInitializing customer environment ...");
|
|
|
|
break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::CHECK_SANITY:
|
2023-10-23 16:16:11 +02:00
|
|
|
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;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
2023-10-23 16:16:11 +02:00
|
|
|
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
2023-12-13 13:41:06 +01:00
|
|
|
if (worker->m_guiMsg.size() > 0) {
|
|
|
|
emit worker->showStatusMessage(worker->m_guiMsg);
|
|
|
|
}
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
|
|
|
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_WRONG);
|
2023-10-23 16:16:11 +02:00
|
|
|
emit worker->showErrorMessage(worker->m_guiMsg);
|
2023-10-30 15:15:30 +01:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
2023-10-23 16:16:11 +02:00
|
|
|
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
2023-10-30 15:15:30 +01:00
|
|
|
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);
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->appendText("\nUpdate repository...");
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->replaceLast(QString("Update repository ..."), UPDATE_STEP_DONE);
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->replaceLast(QString("Update repository ..."), UPDATE_STEP_FAIL);
|
2023-10-23 16:16:11 +02:00
|
|
|
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;
|
2023-10-30 15:15:30 +01:00
|
|
|
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));
|
|
|
|
}
|
2023-11-29 12:05:09 +01:00
|
|
|
}
|
|
|
|
if (size == 1) {
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
|
|
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
|
|
|
}
|
|
|
|
} break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE:
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
2023-10-30 15:15:30 +01:00
|
|
|
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;
|
2023-10-23 16:16:11 +02:00
|
|
|
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;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
2023-11-07 09:04:05 +01:00
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
2023-10-20 13:55:18 +02:00
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->appendText("\nSync customer environment with filesystem ...");
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_DONE);
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_FAIL);
|
2023-10-23 16:16:11 +02:00
|
|
|
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:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->appendText(QString("Send last version info "), UPDATE_STEP_DONE);
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_ACTIVATED:
|
2023-10-23 16:16:11 +02:00
|
|
|
break;
|
2024-01-19 08:22:03 +01:00
|
|
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
|
|
|
break;
|
2023-10-23 16:16:11 +02:00
|
|
|
case UPDATE_STEP::UPDATE_FAILED:
|
2023-10-30 15:15:30 +01:00
|
|
|
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
2023-10-23 16:16:11 +02:00
|
|
|
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;
|
2023-10-22 19:44:45 +02:00
|
|
|
}
|
|
|
|
|
2023-10-30 15:15:30 +01:00
|
|
|
worker->m_guiMsg.clear();
|
|
|
|
|
2023-10-22 19:44:45 +02:00
|
|
|
return step;
|
2023-10-20 13:55:18 +02:00
|
|
|
}
|
2023-06-16 16:47:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WORKER_H_INCLUDED
|