Use finalResult() to sent a final message to ISMAS about the result of the update process.
This commit is contained in:
		
							
								
								
									
										34
									
								
								worker.cpp
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								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<QString> 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<QString> 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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user