Added method getReasonForSendLastVersion()

This commit is contained in:
Gerhard Hoffmann 2023-09-04 11:45:30 +02:00
parent b14b296011
commit 981a2ea13a
2 changed files with 28 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include "ismas/ismas_client.h"
#include "utils.h"
#include <cstring>
#include <cstdio>
@ -886,3 +887,18 @@ QString IsmasClient::updateOfPSAFailed(int resultCode, QString step,
reason.toStdString().c_str(),
version.toStdString().c_str());
}
char const *IsmasClient::reason[REASON::ENTRIES] = {
"TIME-TRIGGERED", "SERVICE", "DEV-TEST"
};
QString IsmasClient::getReasonForLastSendVersion() {
QString const &parentName = Utils::getParentName();
if (parentName == "ATBQT") {
return reason[REASON::SERVICE];
}
if (parentName == "systemd") {
return reason[REASON::TIME_TRIGGERED];
}
return reason[REASON::DEV_TEST];
}

View File

@ -139,6 +139,7 @@ public:
DIRECT_PORT = 7778
};
enum RESULT_CODE {
SUCCESS=0,
NO_UPDATE_NECESSARY=1,
@ -146,9 +147,20 @@ public:
WRONG_PACKAGE=3,
INSTALL_ERROR=4};
enum REASON {
TIME_TRIGGERED = 0,
SERVICE,
DEV_TEST,
ENTRIES
};
static char const *reason[REASON::ENTRIES];
static std::optional<QString>
sendRequestReceiveResponse(int port, QString const &request);
static QString getReasonForLastSendVersion();
int getProgressInPercent() const {return m_progressInPercent; }
void setProgressInPercent(int procent) { m_progressInPercent = procent; }