diff --git a/ismas/ismas_client.cpp b/ismas/ismas_client.cpp index 0f08d87..0e5ba65 100644 --- a/ismas/ismas_client.cpp +++ b/ismas/ismas_client.cpp @@ -1,4 +1,5 @@ #include "ismas/ismas_client.h" +#include "utils.h" #include #include @@ -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]; +} diff --git a/ismas/ismas_client.h b/ismas/ismas_client.h index 71beffc..a43fe1f 100644 --- a/ismas/ismas_client.h +++ b/ismas/ismas_client.h @@ -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 sendRequestReceiveResponse(int port, QString const &request); + static QString getReasonForLastSendVersion(); + int getProgressInPercent() const {return m_progressInPercent; } void setProgressInPercent(int procent) { m_progressInPercent = procent; }