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-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-06-16 16:47:13 +02:00
|
|
|
#include "worker_thread.h"
|
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-07-17 16:38:53 +02:00
|
|
|
enum class UPDATE_STATUS : quint8 {
|
2023-08-02 15:50:04 +02:00
|
|
|
NOT_DEFINED,
|
|
|
|
ISMAS_WAIT_STATE_CHECK_PENDING,
|
|
|
|
ISMAS_WAIT_STATE_CHECK_FAILURE,
|
2023-07-19 16:35:48 +02:00
|
|
|
ISMAS_RESPONSE_RECEIVED,
|
2023-08-11 10:49:34 +02:00
|
|
|
BACKEND_CHECK,
|
|
|
|
BACKEND_CHECK_FAILURE,
|
2023-08-02 15:50:04 +02:00
|
|
|
BACKEND_NOT_CONNECTED,
|
2023-08-16 12:41:42 +02:00
|
|
|
ISMAS_UPDATE_TRIGGER_SET,
|
|
|
|
ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG,
|
2023-08-02 15:50:04 +02:00
|
|
|
GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
|
|
|
GIT_CLONE_AND_CHECKOUT_FAILURE,
|
|
|
|
GIT_CHECKOUT_BRANCH,
|
2023-08-16 12:41:42 +02:00
|
|
|
GIT_CHECKOUT_BRANCH_FAILURE,
|
2023-08-02 15:50:04 +02:00
|
|
|
GIT_FETCH_UPDATES,
|
2023-07-17 16:38:53 +02:00
|
|
|
GIT_FETCH_UPDATES_REQUEST_FAILURE,
|
2023-08-02 15:50:04 +02:00
|
|
|
EXEC_OPKG_COMMAND,
|
2023-07-19 16:35:48 +02:00
|
|
|
EXEC_OPKG_COMMANDS,
|
2023-07-17 16:38:53 +02:00
|
|
|
RSYNC_UPDATES_FAILURE,
|
2023-08-16 12:41:42 +02:00
|
|
|
RSYNC_UPDATES_SUCCESS,
|
2023-08-23 16:26:55 +02:00
|
|
|
RSYNC_FILE_SUCCESS,
|
2023-08-11 10:49:34 +02:00
|
|
|
JSON_PARSE_FAILURE,
|
2023-08-02 15:50:04 +02:00
|
|
|
UPDATE_PROCESS_SUCCESS,
|
|
|
|
UPDATE_PROCESS_FAILURE,
|
2023-08-11 10:49:34 +02:00
|
|
|
ISMAS_SANITY_CHECK_OK,
|
|
|
|
ISMAS_UPDATE_TRIGGER_SET_FAILURE,
|
|
|
|
PSA_UPDATE_FILES_FAILED,
|
|
|
|
GIT_CHECK_FILES_TO_UPDATE_SUCCESS,
|
|
|
|
ISMAS_SEND_LAST_VERSION_FAILED,
|
2023-10-19 13:38:16 +02:00
|
|
|
SAVE_LOG_FILES_FAILED,
|
|
|
|
REMOVE_GIT_REPOSITORY_FAILED
|
2023-07-17 16:38:53 +02:00
|
|
|
};
|
|
|
|
|
2023-07-19 16:35:48 +02:00
|
|
|
struct UpdateStatus {
|
|
|
|
UPDATE_STATUS m_updateStatus;
|
|
|
|
QString m_statusDescription;
|
|
|
|
|
2023-08-02 15:50:04 +02:00
|
|
|
explicit UpdateStatus(UPDATE_STATUS s = UPDATE_STATUS::NOT_DEFINED,
|
|
|
|
QString const &d = QString(""))
|
2023-07-19 16:35:48 +02:00
|
|
|
: m_updateStatus(s), m_statusDescription(d) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define ISMAS_UPDATE_REQUESTS (10)
|
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-06-16 16:47:13 +02:00
|
|
|
class Worker : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
WorkerThread m_workerThread;
|
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-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-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;
|
|
|
|
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
|
|
|
UpdateStatus m_updateStatus;
|
|
|
|
|
|
|
|
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-08-03 09:06:50 +02:00
|
|
|
int m_returnCode;
|
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();
|
|
|
|
|
|
|
|
static constexpr const int UPDATE_SUCCESS_AND_ACTIVATED = 0;
|
2023-10-19 13:38:16 +02:00
|
|
|
static constexpr const int CLONE_AND_CHECKOUT_SUCCESS = 0;
|
|
|
|
static constexpr const int CLONE_AND_CHECKOUT_FAILURE = -3;
|
|
|
|
static constexpr const int ISMAS_TRIGGER_FAILURE = -5;
|
2023-10-20 13:55:18 +02:00
|
|
|
static constexpr const int ENVIRONMENT_CONFIG_FAILURE = -6;
|
|
|
|
static constexpr const int GIT_PULL_FAILURE = -7;
|
|
|
|
static constexpr const int UPDATE_FILES_FAILURE = -8;
|
|
|
|
static constexpr const int RSYNC_FAILURE = -9;
|
|
|
|
static constexpr const int SEND_LAST_VERSION_FAILURE = -10;
|
|
|
|
static constexpr const int SAVE_LOG_FILES_FAILURE = -11;
|
|
|
|
|
|
|
|
enum class UPDATE_STEP {
|
|
|
|
STARTED = 1,
|
|
|
|
CHECK_REPOSITORY = 2,
|
|
|
|
CHECK_SANITY = 3,
|
|
|
|
CHECK_SANITY_SUCCESS = 4,
|
|
|
|
CHECK_SANITY_FAILURE = 5,
|
|
|
|
CLONE_REPOSITORY = 6,
|
|
|
|
CLONE_REPOSITORY_SUCCESS = 7,
|
|
|
|
CLONE_REPOSITORY_FAILURE = 8,
|
|
|
|
SWITCH_BRANCH = 12,
|
|
|
|
SWITCH_BRANCH_SUCCESS = 13,
|
|
|
|
SWITCH_BRANCH_FAILURE = 14,
|
|
|
|
CHECK_ISMAS_TRIGGER = 15,
|
|
|
|
CHECK_ISMAS_TRIGGER_SUCCESS = 23,
|
|
|
|
CHECK_ISMAS_TRIGGER_FAILURE = 24,
|
|
|
|
UPDATE_REPOSITORY = 25,
|
|
|
|
UPDATE_REPOSITORY_SUCCESS = 28,
|
|
|
|
UPDATE_REPOSITORY_FAILURE = 29,
|
|
|
|
CHECK_FOR_REPOSITORY_CHANGES = 30,
|
|
|
|
CHECK_FOR_REPOSITORY_CHANGES_SUCCESS = 38,
|
|
|
|
CHECK_FOR_REPOSITORY_CHANGES_FAILURE = 39,
|
|
|
|
APPLY_REPOSITORY_CHANGES = 40,
|
|
|
|
DOWNLOAD_CONFIG_FILE = 41,
|
|
|
|
DOWNLOAD_CONFIG_FILE_SUCCESS = 63,
|
|
|
|
DOWNLOAD_CONFIG_FILE_FAILURE = 64,
|
|
|
|
DOWNLOAD_DEVICE_CONTROLLER = 65,
|
|
|
|
DOWNLOAD_DEVICE_CONTROLLER_SUCCESS = 86,
|
|
|
|
DOWNLOAD_DEVICE_CONTROLLER_FAILURE = 87,
|
|
|
|
APPLY_REPOSITORY_CHANGES_SUCCESS = 88,
|
|
|
|
APPLY_REPOSITORY_CHANGES_FAILURE = 89,
|
|
|
|
SYNC_CUSTOMER_REPOSITORY = 90,
|
|
|
|
SYNC_CUSTOMER_REPOSITORY_SUCCESS = 91,
|
|
|
|
SYNC_CUSTOMER_REPOSITORY_FAILURE = 92,
|
|
|
|
SAVE_LOGS = 94,
|
|
|
|
SAVE_LOGS_SUCCESS = 95,
|
|
|
|
SAVE_LOGS_FAILURE = 96,
|
|
|
|
SEND_LAST_VERSION = 97,
|
|
|
|
UPDATE_SUCCEEDED = 98,
|
|
|
|
UPDATE_FAILED = 99,
|
|
|
|
FINISHED = 100
|
|
|
|
};
|
|
|
|
|
|
|
|
static Worker const *instance;
|
2023-07-11 16:58:49 +02:00
|
|
|
|
2023-06-16 16:47:13 +02:00
|
|
|
public:
|
2023-10-18 11:30:12 +02:00
|
|
|
static QString getATBUpdateToolYoctoVersion();
|
|
|
|
static QString getATBUpdateToolYoctoInstallationStatus();
|
|
|
|
|
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;
|
|
|
|
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-07-14 13:32:00 +02:00
|
|
|
QString branchName,
|
2023-09-06 09:04:43 +02:00
|
|
|
QString pluginName,
|
2023-07-11 16:58:49 +02:00
|
|
|
QString workingDir = ".",
|
|
|
|
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-09-06 09:04:43 +02:00
|
|
|
hwinf *getPlugin();
|
|
|
|
hwinf const *getPlugin() const;
|
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();
|
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-08-04 13:38:33 +02:00
|
|
|
int returnCode() const { return m_returnCode; }
|
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-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-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
|
|
|
|
|
|
|
public slots:
|
2023-08-02 15:50:04 +02:00
|
|
|
void update();
|
2023-07-11 16:58:49 +02:00
|
|
|
|
|
|
|
private slots:
|
2023-09-28 12:01:55 +02:00
|
|
|
bool updateTriggerSet(int progress);
|
|
|
|
bool customerEnvironment(int progress);
|
2023-10-20 13:55:18 +02:00
|
|
|
bool filesToUpdate(int progress);
|
|
|
|
bool updateFiles(int percent);
|
|
|
|
bool syncCustomerRepositoryAndFS(int progress);
|
|
|
|
bool sendIsmasLastVersionNotification(int progress);
|
|
|
|
bool saveLogFile(int progress);
|
2023-08-02 15:50:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
PSAInstalled getPSAInstalled();
|
|
|
|
void privateUpdate();
|
2023-08-30 11:46:55 +02:00
|
|
|
std::optional<QString> getApismVersion();
|
2023-10-20 13:55:18 +02:00
|
|
|
void printProgress(UPDATE_STEP step);
|
|
|
|
|
|
|
|
friend QDebug operator<<(QDebug debug, UPDATE_STEP step) {
|
|
|
|
if (!Worker::instance) {
|
|
|
|
return debug;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const QMap<UPDATE_STEP, const char*> smap (
|
|
|
|
std::initializer_list<std::pair<UPDATE_STEP, const char*>>{
|
|
|
|
#define INSERT_ELEMENT(p) std::pair(p, #p)
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::STARTED),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
|
|
|
INSERT_ELEMENT(UPDATE_STEP::FINISHED)
|
|
|
|
#undef INSERT_ELEMENT
|
|
|
|
});
|
|
|
|
|
|
|
|
switch (step) {
|
|
|
|
case UPDATE_STEP::STARTED:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_SANITY_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::SWITCH_BRANCH:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SWITCH_BRANCH_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SWITCH_BRANCH_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
|
|
|
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::APPLY_REPOSITORY_CHANGES:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SEND_LAST_VERSION:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_FAILED:
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::FINISHED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
case UPDATE_STEP::CHECK_SANITY:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 1: CHECKED SANITY OF CUSTOMER REPOSITORY %1 DONE")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
<< QString("STEP 2: FETCH CUSTOMER REPOSITORY %1...")
|
|
|
|
.arg(instance->m_customerRepository));
|
|
|
|
break;
|
|
|
|
//case UPDATE_STEP::FETCH_REPOSITORY:
|
|
|
|
// Utils::printUpdateStatusMsg(
|
|
|
|
// QStringList()
|
|
|
|
// << QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
|
|
|
// .arg(instance->m_customerRepository)
|
|
|
|
// << QString("STEP 3: CHECK ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS..."));
|
|
|
|
// break;
|
|
|
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 3: CHECKED ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS. SUCCESS.")
|
|
|
|
<< QString("STEP 4: CHECK-OUT BRANCH %1...").arg(instance->m_gc.branchName()));
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::CHECKED_OUT_BRANCH:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 4: CHECKED-OUT BRANCH %1 DONE")
|
|
|
|
.arg(instance->m_gc.branchName())
|
|
|
|
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE..."));
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::COMPUTE_FILES_TO_UPDATE:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE %1 DONE")
|
|
|
|
.arg(instance->m_filesToUpdate.join(','))
|
|
|
|
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS...")
|
|
|
|
.arg(instance->m_filesToDownload.join(',')));
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_UPDATE:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS DONE")
|
|
|
|
.arg(instance->m_filesToDownload.join(','))
|
|
|
|
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM...")
|
|
|
|
.arg(instance->m_customerRepository));
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM DONE")
|
|
|
|
.arg(instance->m_customerRepository)
|
|
|
|
<< QString("STEP 8: SEND-LAST-VERSION TO ISMAS..."));
|
|
|
|
break;
|
|
|
|
case UPDATE_STEP::UPDATE_SUCCESS:
|
|
|
|
Utils::printUpdateStatusMsg(
|
|
|
|
QStringList()
|
|
|
|
<< QString("STEP 9: SAVE-LOG-FILES (FUTURE USE) DONE")
|
|
|
|
<< QString("STEP 10: MARK UPDATE AS SUCCESSFUL AND ACTIVE..."));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return debug;
|
|
|
|
}
|
2023-06-16 16:47:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WORKER_H_INCLUDED
|