Adding UPDATE_STEP enum plus associated interger defines.

Adding QMap: Worker::smap, which contains names of UPDATE_STEP-members.
This commit is contained in:
Gerhard Hoffmann 2023-10-30 15:07:28 +01:00
parent d4ddbbee21
commit 99a99d95a1

155
worker.h
View File

@ -26,94 +26,84 @@
#define SERIAL_PORT "ttyUSB0"
#endif
#define _ISMAS_DONE "U0001" // 100%
#define _ISMAS_SET_WAIT_OK "U0002" // empty WAIT-button ("")
#define _ISMAS_FAILURE "U0003" // FAIL
#define _ISMAS_CONTINUE "U0010" // %-values
#define _ISMAS_RESET_WAIT "ISMAS" // reset WAIT-button to "WAIT"
#define _STARTED (1)
#define _CHECK_SANITY (2)
#define _CHECK_SANITY_SUCCESS (3)
#define _CHECK_SANITY_FAILURE (4)
#define _REPOSITORY_RECOVERED_SUCCESS (5)
#define _REPOSITORY_RECOVERED_FAILURE (6)
#define _CHECK_SANITY_FAILURE (3)
#define _CHECK_SANITY_SUCCESS (4)
#define _REPOSITORY_RECOVERED_FAILURE (5)
#define _REPOSITORY_RECOVERED_SUCCESS (6)
#define _CHECK_REPOSITORY (7)
#define _CHECK_REPOSITORY_SUCCESS (8)
#define _CHECK_REPOSITORY_FAILURE (9)
#define _CHECK_REPOSITORY_FAILURE (8)
#define _CHECK_REPOSITORY_SUCCESS (9)
#define _CLONE_REPOSITORY (10)
#define _CLONE_REPOSITORY_SUCCESS (11)
#define _CLONE_REPOSITORY_FAILURE (12)
#define _CLONE_REPOSITORY_FAILURE (11)
#define _CLONE_REPOSITORY_SUCCESS (12)
#define _CHECKOUT_REPOSITORY (13)
#define _CHECKOUT_REPOSITORY_SUCCESS (14)
#define _CHECKOUT_REPOSITORY_FAILURE (15)
#define _CHECKOUT_REPOSITORY_FAILURE (14)
#define _CHECKOUT_REPOSITORY_SUCCESS (15)
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (16)
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (17)
#define _CHECK_ISMAS_TRIGGER (19)
#define _CHECK_ISMAS_TRIGGER_SUCCESS (23)
#define _CHECK_ISMAS_TRIGGER_FAILURE (24)
#define _UPDATE_REPOSITORY (25)
#define _UPDATE_REPOSITORY_SUCCESS (28)
#define _UPDATE_REPOSITORY_FAILURE (29)
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (20)
#define _CHECK_ISMAS_TRIGGER_SUCCESS (21)
#define _CHECK_ISMAS_TRIGGER_FAILURE (22)
#define _CHECKOUT_BRANCH (23)
#define _CHECKOUT_BRANCH_FAILURE (24)
#define _CHECKOUT_BRANCH_SUCCESS (25)
#define _UPDATE_REPOSITORY (26)
#define _UPDATE_REPOSITORY_FAILURE (28)
#define _UPDATE_REPOSITORY_SUCCESS (29)
#define _CHECK_FOR_REPOSITORY_CHANGES (30)
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (38)
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (39)
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (36)
#define _FILES_TO_UPDATE (37)
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (38)
#define _FILES_TO_DOWNLOAD (39)
#define _APPLY_REPOSITORY_CHANGES (40)
#define _DOWNLOAD_CONFIG_FILE (41)
#define _EXEC_OPKG_COMMANDS (41)
#define _EXEC_OPKG_COMMAND_1 (42)
#define _EXEC_OPKG_COMMAND_2 (43)
#define _EXEC_OPKG_COMMAND_3 (44)
#define _EXEC_OPKG_COMMAND_4 (45)
#define _EXEC_OPKG_COMMAND_5 (46)
#define _EXEC_OPKG_COMMAND_6 (47)
#define _EXEC_OPKG_COMMAND_7 (48)
#define _EXEC_OPKG_COMMAND_8 (49)
#define _EXEC_OPKG_COMMAND_9 (50)
#define _EXEC_OPKG_COMMAND_LAST (51)
#define _EXEC_OPKG_COMMAND_FAILURE (52)
#define _EXEC_OPKG_COMMAND_SUCCESS (53)
#define _DOWNLOAD_CONFIG_FILE (54)
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (63)
#define _DOWNLOAD_CONFIG_FILE_FAILURE (64)
#define _DOWNLOAD_DEVICE_CONTROLLER (65)
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (86)
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (87)
#define _APPLY_REPOSITORY_CHANGES_SUCCESS (88)
#define _APPLY_REPOSITORY_CHANGES_FAILURE (89)
#define _APPLY_REPOSITORY_CHANGES_FAILURE (88)
#define _APPLY_REPOSITORY_CHANGES_SUCCESS (89)
#define _SYNC_CUSTOMER_REPOSITORY (90)
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (91)
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (92)
#define _SAVE_LOGS (94)
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (91)
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (92)
#define _SAVE_LOGS (93)
#define _SAVE_LOGS_FAILURE (94)
#define _SAVE_LOGS_SUCCESS (95)
#define _SAVE_LOGS_FAILURE (96)
#define _SEND_LAST_VERSION (97)
#define _UPDATE_SUCCEEDED (98)
#define _UPDATE_FAILED (99)
#define _SEND_LAST_VERSION (96)
#define _UPDATE_SUCCEEDED (97)
#define _UPDATE_FAILED (98)
#define _UPDATE_ACTIVATED (99)
#define _FINISHED (100)
#define _DEBUG (1000)
#define _ERROR (1001)
enum class UPDATE_STATUS : quint8 {
NOT_DEFINED,
ISMAS_WAIT_STATE_CHECK_PENDING,
ISMAS_WAIT_STATE_CHECK_FAILURE,
ISMAS_RESPONSE_RECEIVED,
BACKEND_CHECK,
BACKEND_CHECK_FAILURE,
BACKEND_NOT_CONNECTED,
ISMAS_UPDATE_TRIGGER_SET,
ISMAS_UPDATE_TRIGGER_NOT_SET_OR_WRONG,
GIT_CLONE_AND_CHECKOUT_SUCCESS,
GIT_CLONE_AND_CHECKOUT_FAILURE,
GIT_CHECKOUT_BRANCH,
GIT_CHECKOUT_BRANCH_FAILURE,
GIT_FETCH_UPDATES,
GIT_FETCH_UPDATES_REQUEST_FAILURE,
EXEC_OPKG_COMMAND,
EXEC_OPKG_COMMANDS,
RSYNC_UPDATES_FAILURE,
RSYNC_UPDATES_SUCCESS,
RSYNC_FILE_SUCCESS,
JSON_PARSE_FAILURE,
UPDATE_PROCESS_SUCCESS,
UPDATE_PROCESS_FAILURE,
ISMAS_SANITY_CHECK_OK,
ISMAS_UPDATE_TRIGGER_SET_FAILURE,
PSA_UPDATE_FILES_FAILED,
GIT_CHECK_FILES_TO_UPDATE_SUCCESS,
ISMAS_SEND_LAST_VERSION_FAILED,
SAVE_LOG_FILES_FAILED,
REMOVE_GIT_REPOSITORY_FAILED
};
struct UpdateStatus {
UPDATE_STATUS m_updateStatus;
QString m_statusDescription;
explicit UpdateStatus(UPDATE_STATUS s = UPDATE_STATUS::NOT_DEFINED,
QString const &d = QString(""))
: m_updateStatus(s), m_statusDescription(d) {}
};
#define _SEND_LAST_VERSION_CORRECTION (4)
#define _UPDATE_SUCCEEDED_CORRECTION (3)
#define _UPDATE_FAILED_CORRECTION (2)
#define _UPDATE_ACTIVATED_CORRECTION (1)
#define ISMAS_UPDATE_REQUESTS (10)
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
@ -233,15 +223,36 @@ public:
CHECKOUT_REPOSITORY_SUCCESS = _CHECKOUT_REPOSITORY_SUCCESS,
CHECKOUT_REPOSITORY_FAILURE = _CHECKOUT_REPOSITORY_FAILURE,
CHECK_ISMAS_TRIGGER = _CHECK_ISMAS_TRIGGER,
CHECK_ISMAS_TRIGGER_WRONG_VALUE = _CHECK_ISMAS_TRIGGER_WRONG_VALUE,
CHECK_ISMAS_TRIGGER_SUCCESS = _CHECK_ISMAS_TRIGGER_SUCCESS,
CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE,
INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER = _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER,
INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER = _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER,
CHECKOUT_BRANCH = _CHECKOUT_BRANCH,
CHECKOUT_BRANCH_SUCCESS = _CHECKOUT_BRANCH_SUCCESS,
CHECKOUT_BRANCH_FAILURE = _CHECKOUT_BRANCH_FAILURE,
UPDATE_REPOSITORY = _UPDATE_REPOSITORY,
UPDATE_REPOSITORY_SUCCESS = _UPDATE_REPOSITORY_SUCCESS,
UPDATE_REPOSITORY_FAILURE = _UPDATE_REPOSITORY_FAILURE,
CHECK_FOR_REPOSITORY_CHANGES = _CHECK_FOR_REPOSITORY_CHANGES,
CHECK_FOR_REPOSITORY_CHANGES_SUCCESS = _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS,
CHECK_FOR_REPOSITORY_CHANGES_FAILURE = _CHECK_FOR_REPOSITORY_CHANGES_FAILURE,
FILES_TO_UPDATE = _FILES_TO_UPDATE,
APPLY_REPOSITORY_CHANGES = _APPLY_REPOSITORY_CHANGES,
FILES_TO_DOWNLOAD = _FILES_TO_DOWNLOAD,
EXEC_OPKG_COMMANDS = _EXEC_OPKG_COMMANDS,
EXEC_OPKG_COMMAND_1 = _EXEC_OPKG_COMMAND_1,
EXEC_OPKG_COMMAND_2 = _EXEC_OPKG_COMMAND_2,
EXEC_OPKG_COMMAND_3 = _EXEC_OPKG_COMMAND_3,
EXEC_OPKG_COMMAND_4 = _EXEC_OPKG_COMMAND_4,
EXEC_OPKG_COMMAND_5 = _EXEC_OPKG_COMMAND_5,
EXEC_OPKG_COMMAND_6 = _EXEC_OPKG_COMMAND_6,
EXEC_OPKG_COMMAND_7 = _EXEC_OPKG_COMMAND_7,
EXEC_OPKG_COMMAND_8 = _EXEC_OPKG_COMMAND_8,
EXEC_OPKG_COMMAND_9 = _EXEC_OPKG_COMMAND_9,
EXEC_OPKG_COMMAND_LAST = _EXEC_OPKG_COMMAND_LAST,
EXEC_OPKG_COMMAND_SUCCESS = _EXEC_OPKG_COMMAND_SUCCESS,
EXEC_OPKG_COMMAND_FAILURE = _EXEC_OPKG_COMMAND_FAILURE,
DOWNLOAD_CONFIG_FILE = _DOWNLOAD_CONFIG_FILE,
DOWNLOAD_CONFIG_FILE_SUCCESS = _DOWNLOAD_CONFIG_FILE_SUCCESS,
DOWNLOAD_CONFIG_FILE_FAILURE = _DOWNLOAD_CONFIG_FILE_FAILURE,
@ -258,6 +269,7 @@ public:
SAVE_LOGS_FAILURE = _SAVE_LOGS_FAILURE,
SEND_LAST_VERSION = _SEND_LAST_VERSION,
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
UPDATE_ACTIVATED = _UPDATE_ACTIVATED,
UPDATE_FAILED = _UPDATE_FAILED,
FINISHED = _FINISHED,
DEBUG = _DEBUG,
@ -286,7 +298,10 @@ private:
return this;
}
public:
static QMap<UPDATE_STEP, const char*> const &getSmap() {
return smap;
}
static QString getATBUpdateToolYoctoVersion();
static QString getATBUpdateToolYoctoInstallationStatus();