Add new macro-values to improve output sent to ISMAS:

DOWNLOAD_CASH_FILE
DOWNLOAD_CASH_FILE_FAILURE
DOWNLOAD_CASH_FILE_SUCCESS
DOWNLOAD_DEVICE_FILE
DOWNLOAD_DEVICE_FILE_FAILURE
DOWNLOAD_DEVICE_FILE_SUCCESS
DOWNLOAD_JSON_FILE
DOWNLOAD_JSON_FILE_FAILURE
DOWNLOAD_JSON_FILE_SUCCESS

Adapt percent-counters to show progress of update process.
This commit is contained in:
Gerhard Hoffmann 2024-05-17 08:43:37 +02:00
parent bd785e7df1
commit 2b68242d04

View File

@ -79,7 +79,6 @@
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (35)
#define _FILES_TO_UPDATE (36)
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (37)
#define _FILES_TO_DOWNLOAD (38)
#define _EXEC_OPKG_COMMANDS (39)
#define _EXEC_OPKG_COMMAND_1 (40)
#define _EXEC_OPKG_COMMAND_2 (41)
@ -93,13 +92,23 @@
#define _EXEC_OPKG_COMMAND_LAST (49)
#define _EXEC_OPKG_COMMAND_FAILURE (50)
#define _EXEC_OPKG_COMMAND_SUCCESS (51)
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE (60)
#define _DOWNLOAD_CONFIG_FILE (61)
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (62)
#define _DOWNLOAD_CONFIG_FILE_FAILURE (63)
#define _DOWNLOAD_DEVICE_CONTROLLER (64)
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (85)
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86)
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE (59)
#define _FILES_TO_DOWNLOAD (60)
#define _DOWNLOAD_CASH_FILE (61)
#define _DOWNLOAD_CASH_FILE_FAILURE (62)
#define _DOWNLOAD_CASH_FILE_SUCCESS (63)
#define _DOWNLOAD_CONFIG_FILE (64)
#define _DOWNLOAD_CONFIG_FILE_FAILURE (65)
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (66)
#define _DOWNLOAD_DEVICE_FILE (67)
#define _DOWNLOAD_DEVICE_FILE_FAILURE (68)
#define _DOWNLOAD_DEVICE_FILE_SUCCESS (69)
#define _DOWNLOAD_JSON_FILE (70)
#define _DOWNLOAD_JSON_FILE_FAILURE (71)
#define _DOWNLOAD_JSON_FILE_SUCCESS (72)
#define _DOWNLOAD_DEVICE_CONTROLLER (84)
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (85)
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (86)
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87)
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (88)
#define _SAVE_LOGS (92)
@ -326,6 +335,15 @@ public:
DOWNLOAD_CONFIG_FILE = _DOWNLOAD_CONFIG_FILE,
DOWNLOAD_CONFIG_FILE_SUCCESS = _DOWNLOAD_CONFIG_FILE_SUCCESS,
DOWNLOAD_CONFIG_FILE_FAILURE = _DOWNLOAD_CONFIG_FILE_FAILURE,
DOWNLOAD_CASH_FILE = _DOWNLOAD_CASH_FILE,
DOWNLOAD_CASH_FILE_FAILURE = _DOWNLOAD_CASH_FILE_FAILURE,
DOWNLOAD_CASH_FILE_SUCCESS = _DOWNLOAD_CASH_FILE_SUCCESS,
DOWNLOAD_DEVICE_FILE = _DOWNLOAD_DEVICE_FILE,
DOWNLOAD_DEVICE_FILE_FAILURE = _DOWNLOAD_DEVICE_FILE_FAILURE,
DOWNLOAD_DEVICE_FILE_SUCCESS = _DOWNLOAD_DEVICE_FILE_SUCCESS,
DOWNLOAD_JSON_FILE = _DOWNLOAD_JSON_FILE,
DOWNLOAD_JSON_FILE_FAILURE = _DOWNLOAD_JSON_FILE_FAILURE,
DOWNLOAD_JSON_FILE_SUCCESS = _DOWNLOAD_JSON_FILE_SUCCESS,
DOWNLOAD_DEVICE_CONTROLLER = _DOWNLOAD_DEVICE_CONTROLLER,
DOWNLOAD_DEVICE_CONTROLLER_SUCCESS = _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS,
DOWNLOAD_DEVICE_CONTROLLER_FAILURE = _DOWNLOAD_DEVICE_CONTROLLER_FAILURE,
@ -655,6 +673,24 @@ private:
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE: {
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE_FAILURE: {
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE_SUCCESS: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE_FAILURE: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE_SUCCESS: {
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE: {
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE: {
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE_SUCCESS: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
lst << instance->m_debugMsg;
Utils::printUpdateStatusMsg(debug, lst);
@ -1088,12 +1124,34 @@ private:
case UPDATE_STEP::FILES_TO_UPDATE:
ismasClient.setProgressInPercent(_FILES_TO_UPDATE);
break;
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE:
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
break;
case UPDATE_STEP::FILES_TO_DOWNLOAD:
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::FILES_TO_DOWNLOAD: {
ismasClient.setProgressInPercent(_FILES_TO_DOWNLOAD);
break;
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMANDS);
break;
@ -1229,15 +1287,180 @@ private:
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE);
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_SUCCESS);
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE: {
//ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE);
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_CONFIG_FILE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS: {
//ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_SUCCESS);
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE: {
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE_FAILURE);
break;
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::JSON_FILES_DOWNLOAD_ERROR,
smap[UPDATE_STEP::DOWNLOAD_CASH_FILE_FAILURE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE: {
//ismasClient.setProgressInPercent(_DOWNLOAD_CASH_FILE);
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_CASH_FILE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE_FAILURE: {
ismasClient.setProgressInPercent(_DOWNLOAD_CASH_FILE_FAILURE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::JSON_FILES_DOWNLOAD_ERROR,
smap[UPDATE_STEP::DOWNLOAD_CASH_FILE_FAILURE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE_SUCCESS: {
//ismasClient.setProgressInPercent(_DOWNLOAD_CASH_FILE_SUCCESS);
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_CASH_FILE_SUCCESS],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE: {
//ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_FILE);
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_DEVICE_FILE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE_FAILURE: {
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_FILE_FAILURE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::JSON_FILES_DOWNLOAD_ERROR,
smap[UPDATE_STEP::DOWNLOAD_DEVICE_FILE_FAILURE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE_SUCCESS: {
//ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_FILE_SUCCESS);
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_DEVICE_FILE_SUCCESS],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE: {
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_JSON_FILE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE: {
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE_FAILURE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::JSON_FILES_DOWNLOAD_ERROR,
smap[UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE_SUCCESS: {
ismasClient.setProgressInPercent(_DOWNLOAD_JSON_FILE);
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::DOWNLOAD_JSON_FILE_SUCCESS],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER);
break;
@ -1275,9 +1498,20 @@ private:
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
break;
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY: {
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY);
break;
QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS: {
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
QString const &ismasUpdateNews =
@ -1286,7 +1520,7 @@ private:
_ISMAS_CONTINUE,
ismasClient.getProgressInPercent(),
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY],
smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS],
instance->m_ismasMsg.join(' ').toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
@ -1552,6 +1786,24 @@ private:
break;
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE: {
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE_FAILURE: {
} break;
case UPDATE_STEP::DOWNLOAD_CASH_FILE_SUCCESS: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE_FAILURE: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_FILE_SUCCESS: {
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE: {
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE_FAILURE: {
} break;
case UPDATE_STEP::DOWNLOAD_JSON_FILE_SUCCESS: {
} break;
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
break;
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS: