diff --git a/worker.cpp b/worker.cpp index 95cedbc..ddd17eb 100644 --- a/worker.cpp +++ b/worker.cpp @@ -327,20 +327,38 @@ void Worker::privateUpdate() { } m_ismasClient.setProgressInPercent(100); + setProgress(100); + + if (m_returnCode != 0) { + stopProgressLoop(); + emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL); + + m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE, + QString("Update process failed")); + if (std::optional s = m_ismasClient.finalResult(IsmasClient::RESULT_CODE::INSTALL_ERROR, + "FINAL-UPDATE-RESULT", + m_updateStatus.m_statusDescription)) { + IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT, + QString("#M=APISM#C=CMD_EVENT#J=") + s.value()); + } + } else { + emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS); + + m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_SUCCESS, + QString("Update process succeeded")); + if (std::optional s = m_ismasClient.finalResult(IsmasClient::RESULT_CODE::SUCCESS, + "FINAL-UPDATE-RESULT", + m_updateStatus.m_statusDescription)) { + IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT, + QString("#M=APISM#C=CMD_EVENT#J=") + s.value()); + } + } if (!sentIsmasLastVersionNotification) { // try even if the backend is not connected sendIsmasLastVersionNotification(); } - if (m_returnCode != 0) { - stopProgressLoop(); - emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL); - } else { - emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS); - } - - setProgress(100); m_updateProcessRunning = false; emit enableExit(); emit restartExitTimer();