2023-07-14 13:28:41 +02:00
|
|
|
#ifndef ISMAS_CLIENT_H_INCLUDED
|
|
|
|
#define ISMAS_CLIENT_H_INCLUDED
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
|
2023-08-11 12:19:10 +02:00
|
|
|
#include <optional>
|
|
|
|
|
2023-07-19 16:48:42 +02:00
|
|
|
struct PSAInstalled {
|
2023-08-16 10:34:55 +02:00
|
|
|
struct VersionInfo {
|
|
|
|
QString created;
|
|
|
|
QString reason;
|
|
|
|
QString lastCommit;
|
|
|
|
} versionInfo;
|
|
|
|
|
2023-07-19 16:48:42 +02:00
|
|
|
struct Tariff {
|
2023-12-17 16:25:31 +01:00
|
|
|
// VersionInfo versionInfo;
|
2023-07-19 16:48:42 +02:00
|
|
|
QString name;
|
|
|
|
QString version;
|
|
|
|
QString project;
|
|
|
|
int zone;
|
|
|
|
int size;
|
|
|
|
QString blob;
|
2023-08-11 11:09:51 +02:00
|
|
|
QString lastCommit;
|
2023-07-19 16:48:42 +02:00
|
|
|
QString info;
|
|
|
|
QString loadTime;
|
|
|
|
} tariff;
|
|
|
|
|
|
|
|
struct HardWare {
|
|
|
|
QString linuxVersion;
|
|
|
|
QString cpuSerial;
|
|
|
|
} hw;
|
|
|
|
|
2023-08-22 13:47:57 +02:00
|
|
|
struct Opkg {
|
2023-12-17 16:25:31 +01:00
|
|
|
// VersionInfo versionInfo;
|
2023-08-22 13:47:57 +02:00
|
|
|
int size;
|
|
|
|
QString blob;
|
|
|
|
QString lastCommit;
|
|
|
|
QString loadTime;
|
|
|
|
} opkg;
|
|
|
|
|
2023-07-19 16:48:42 +02:00
|
|
|
struct DC {
|
2023-12-17 16:25:31 +01:00
|
|
|
// VersionInfo versionInfo;
|
2023-07-19 16:48:42 +02:00
|
|
|
QString versionHW;
|
|
|
|
QString versionSW;
|
|
|
|
QString gitBlob;
|
|
|
|
QString gitLastCommit;
|
|
|
|
int size;
|
|
|
|
} dc;
|
|
|
|
|
|
|
|
struct SoftWare {
|
2023-08-30 11:42:05 +02:00
|
|
|
QString apismVersion;
|
2023-07-19 16:48:42 +02:00
|
|
|
QString atbQTVersion;
|
2023-10-12 12:11:48 +02:00
|
|
|
QString atbUpdateToolVersion;
|
2023-07-19 16:48:42 +02:00
|
|
|
} sw;
|
|
|
|
|
|
|
|
struct PluginVersion {
|
|
|
|
QString deviceController;
|
|
|
|
QString ingenicoISelfCC;
|
|
|
|
QString mobilisisCalculatePrice;
|
|
|
|
QString mobilisisCalculatePriceConfigUi;
|
|
|
|
QString prmCalculatePrice;
|
|
|
|
QString prmCalculatePriceConfigUi;
|
|
|
|
QString tcpZVT;
|
|
|
|
} pluginVersion;
|
|
|
|
|
|
|
|
struct DC2C {
|
2023-12-17 16:25:31 +01:00
|
|
|
// VersionInfo versionInfo;
|
2023-07-19 16:48:42 +02:00
|
|
|
QString name;
|
|
|
|
QString blob;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
DC2C cash;
|
|
|
|
DC2C conf;
|
|
|
|
DC2C device;
|
|
|
|
|
|
|
|
DC2C print[32];
|
|
|
|
|
|
|
|
explicit PSAInstalled() {
|
|
|
|
tariff.name = "N/A";
|
|
|
|
tariff.version = "N/A";
|
|
|
|
tariff.project = "N/A";
|
|
|
|
tariff.zone = -1;
|
|
|
|
tariff.size = -1;
|
|
|
|
tariff.blob = "N/A";
|
|
|
|
tariff.info = "N/A";
|
|
|
|
tariff.loadTime = "N/A";
|
|
|
|
|
|
|
|
hw.linuxVersion = "N/A";
|
|
|
|
hw.cpuSerial = "N/A";
|
|
|
|
|
2023-08-22 13:47:57 +02:00
|
|
|
opkg.size = -1;
|
|
|
|
opkg.blob = "N/A";
|
|
|
|
opkg.lastCommit = "N/A";
|
|
|
|
opkg.loadTime = "N/A";
|
|
|
|
|
2023-07-19 16:48:42 +02:00
|
|
|
dc.versionHW = "N/A";
|
|
|
|
dc.versionSW = "N/A";
|
|
|
|
dc.gitBlob = "N/A";
|
|
|
|
dc.gitLastCommit = "N/A";
|
|
|
|
dc.size = -1;
|
|
|
|
|
2023-08-30 11:42:05 +02:00
|
|
|
sw.apismVersion = "N/A";
|
2023-07-19 16:48:42 +02:00
|
|
|
sw.atbQTVersion = "N/A";
|
2023-10-12 12:11:48 +02:00
|
|
|
sw.atbUpdateToolVersion = "N/A";
|
2023-07-19 16:48:42 +02:00
|
|
|
|
|
|
|
pluginVersion.deviceController = "N/A";
|
|
|
|
pluginVersion.ingenicoISelfCC = "N/A";
|
|
|
|
pluginVersion.mobilisisCalculatePrice = "N/A";
|
|
|
|
pluginVersion.mobilisisCalculatePriceConfigUi = "N/A";
|
|
|
|
pluginVersion.prmCalculatePrice = "N/A";
|
|
|
|
pluginVersion.prmCalculatePriceConfigUi = "N/A";
|
|
|
|
pluginVersion.tcpZVT = "N/A";
|
|
|
|
|
|
|
|
cash.name = "N/A";
|
|
|
|
cash.blob = "N/A";
|
|
|
|
cash.size = -1;
|
|
|
|
|
|
|
|
conf.name = "N/A";
|
|
|
|
conf.blob = "N/A";
|
|
|
|
conf.size = -1;
|
|
|
|
|
|
|
|
device.size = -1;
|
|
|
|
device.blob = "N/A";
|
|
|
|
device.size = -1;
|
|
|
|
|
|
|
|
for (int i=0; i < 32; ++i) {
|
|
|
|
print[i].size = -1;
|
|
|
|
print[i].blob = "N/A";
|
|
|
|
print[i].size = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-07-14 13:28:41 +02:00
|
|
|
class IsmasClient : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2023-08-02 15:13:05 +02:00
|
|
|
int m_progressInPercent;
|
2023-07-14 13:28:41 +02:00
|
|
|
public:
|
2023-08-02 15:13:05 +02:00
|
|
|
explicit IsmasClient() : m_progressInPercent(1) {}
|
|
|
|
|
|
|
|
enum APISM {
|
|
|
|
DB_PORT = 7777,
|
|
|
|
DIRECT_PORT = 7778
|
|
|
|
};
|
|
|
|
|
2023-09-04 11:45:30 +02:00
|
|
|
|
2023-08-02 15:13:05 +02:00
|
|
|
enum RESULT_CODE {
|
|
|
|
SUCCESS=0,
|
|
|
|
NO_UPDATE_NECESSARY=1,
|
|
|
|
BACKUP_FAILED=2,
|
|
|
|
WRONG_PACKAGE=3,
|
|
|
|
INSTALL_ERROR=4};
|
|
|
|
|
2023-09-04 11:45:30 +02:00
|
|
|
enum REASON {
|
|
|
|
TIME_TRIGGERED = 0,
|
|
|
|
SERVICE,
|
|
|
|
DEV_TEST,
|
|
|
|
ENTRIES
|
|
|
|
};
|
|
|
|
|
|
|
|
static char const *reason[REASON::ENTRIES];
|
|
|
|
|
2023-08-02 15:13:05 +02:00
|
|
|
static std::optional<QString>
|
|
|
|
sendRequestReceiveResponse(int port, QString const &request);
|
|
|
|
|
2023-09-04 11:45:30 +02:00
|
|
|
static QString getReasonForLastSendVersion();
|
|
|
|
|
2023-08-02 15:13:05 +02:00
|
|
|
int getProgressInPercent() const {return m_progressInPercent; }
|
|
|
|
void setProgressInPercent(int procent) { m_progressInPercent = procent; }
|
|
|
|
|
2023-07-14 13:28:41 +02:00
|
|
|
QString updateNewsToIsmas(char const *event,
|
|
|
|
int percent,
|
|
|
|
int resultCode,
|
|
|
|
char const *step,
|
|
|
|
char const *step_result,
|
|
|
|
char const *version);
|
|
|
|
|
2023-08-02 15:13:05 +02:00
|
|
|
QString updateOfPSAStarted(QString const &version = QString()); // start of update process
|
|
|
|
QString cloneAndCheckoutCustomerRepository(QString const &info, QString const &version = QString()); // clone and checkout customer repository
|
|
|
|
QString checkoutBranch(QString const &info, QString const &version = QString()); // checkout branch
|
|
|
|
QString errorBackendNotConnected(QString const &info, QString const &version = QString()); // checkout branch
|
2023-10-20 13:55:18 +02:00
|
|
|
QString errorGitClone(QString const &info, QString const &version = QString());
|
2023-08-02 15:13:05 +02:00
|
|
|
QString backendConnected(QString const &info, QString const &version = QString());
|
|
|
|
QString updateTriggerSet(QString const &info, QString const &version = QString());
|
|
|
|
QString errorUpdateTrigger(QString const &info, QString const &version = QString());
|
|
|
|
QString gitFetch(QString const &info, QString const &version = QString());
|
|
|
|
QString execOpkgCommand(QString const &info, QString const &version = QString());
|
2023-08-23 16:26:11 +02:00
|
|
|
QString rsyncFile(QString const &info, QString const &version = QString());
|
2023-08-02 15:13:05 +02:00
|
|
|
QString errorGitFetch(int resultCode, QString const &info, QString const &version = QString());
|
|
|
|
QString updateOfPSAActivated(QString const &version = QString());
|
|
|
|
// and update accepted
|
|
|
|
QString updateOfPSASucceeded(QString const &version = QString()); // update process succeeded
|
|
|
|
QString updateOfPSAContinues(QString currentStage, QString currentStageInfo, QString const &version = QString());
|
2023-08-11 11:09:51 +02:00
|
|
|
QString updateOfPSAFailed(int resultCode, QString step, QString reason, QString const &version = QString());
|
2023-08-02 15:13:05 +02:00
|
|
|
QString sanityCheckFailed(int resultCode, QString reason, QString const &version = QString());
|
2023-08-11 11:09:51 +02:00
|
|
|
QString jsonParseFailed(int resultCode, QString reason, QString const &version = QString());
|
2023-08-11 12:19:10 +02:00
|
|
|
std::optional<QString> finalResult(int resultCode, QString reason, QString const &version = QString());
|
2023-08-02 15:13:05 +02:00
|
|
|
|
2023-12-17 16:25:31 +01:00
|
|
|
// legacy
|
2023-07-19 16:48:42 +02:00
|
|
|
QString updateOfPSASendVersion(PSAInstalled const &psa);
|
2023-07-14 13:28:41 +02:00
|
|
|
|
2023-12-17 16:25:31 +01:00
|
|
|
#if 0
|
|
|
|
enum class UPDATE_COMPONENT {
|
|
|
|
TARIFF,
|
|
|
|
SOFTWARE_ATBQT,
|
|
|
|
SOFTWARE_APISM,
|
|
|
|
SOFTWARE_ATB_UPDATE_TOOL,
|
|
|
|
CONFIG_PTU5_CPU_SERIAL,
|
|
|
|
CONFIG_DEVICE_CONTROLLER,
|
|
|
|
CONFIG_PRINTER,
|
|
|
|
CONFIG_BNA,
|
|
|
|
PLUGIN_ATB_DEVICE_CONTROLLER,
|
|
|
|
PLUGIN_INGENICO_CC,
|
|
|
|
PLUGIN_MOBILISIS_CALC_PRICE,
|
|
|
|
PLUGIN_MOBILISIS_CALC_PRICE_UI,
|
|
|
|
PLUGIN_PRM_CALC_PRICE,
|
|
|
|
PLUGIN_PRM_CALC_PRICE_UI,
|
|
|
|
PLUGIN_TCP_ZVT_CC,
|
|
|
|
OPKG_COMMANDS,
|
|
|
|
HARDWARE_DEVICES,
|
|
|
|
OS,
|
|
|
|
DC2C_CASH_JSON,
|
|
|
|
DC2C_CONF_JSON,
|
|
|
|
DC2C_DEVICE_JSON,
|
|
|
|
DC2C_PRINT01_JSON,
|
|
|
|
DC2C_PRINT02_JSON,
|
|
|
|
DC2C_PRINT03_JSON,
|
|
|
|
DC2C_PRINT04_JSON,
|
|
|
|
DC2C_PRINT05_JSON,
|
|
|
|
DC2C_PRINT06_JSON,
|
|
|
|
DC2C_PRINT07_JSON,
|
|
|
|
DC2C_PRINT08_JSON,
|
|
|
|
DC2C_PRINT09_JSON,
|
|
|
|
DC2C_PRINT10_JSON,
|
|
|
|
DC2C_PRINT11_JSON,
|
|
|
|
DC2C_PRINT12_JSON,
|
|
|
|
DC2C_PRINT13_JSON,
|
|
|
|
DC2C_PRINT14_JSON,
|
|
|
|
DC2C_PRINT15_JSON,
|
|
|
|
DC2C_PRINT16_JSON,
|
|
|
|
DC2C_PRINT17_JSON,
|
|
|
|
DC2C_PRINT18_JSON,
|
|
|
|
DC2C_PRINT19_JSON,
|
|
|
|
DC2C_PRINT20_JSON,
|
|
|
|
DC2C_PRINT21_JSON,
|
|
|
|
DC2C_PRINT22_JSON,
|
|
|
|
DC2C_PRINT23_JSON,
|
|
|
|
DC2C_PRINT24_JSON,
|
|
|
|
DC2C_PRINT25_JSON,
|
|
|
|
DC2C_PRINT26_JSON,
|
|
|
|
DC2C_PRINT27_JSON,
|
|
|
|
DC2C_PRINT28_JSON,
|
|
|
|
DC2C_PRINT29_JSON,
|
|
|
|
DC2C_PRINT30_JSON,
|
|
|
|
DC2C_PRINT31_JSON,
|
|
|
|
DC2C_PRINT32_JSON,
|
|
|
|
};
|
|
|
|
QString sendLastVersion(UPDATE_COMPONENT comp, PSAInstalled const &psa);
|
|
|
|
#endif
|
|
|
|
|
2023-08-02 15:13:05 +02:00
|
|
|
private:
|
|
|
|
static void printDebugMessage(int port, QString const &clientIP, int clientPort,
|
|
|
|
QString const &message);
|
|
|
|
static void printInfoMessage(int port, QString const &clientIP, int clientPort,
|
|
|
|
QString const &message);
|
|
|
|
static void printErrorMessage(int port, QString const &clientIP, int clientPort,
|
|
|
|
QString const &message);
|
2023-07-14 13:28:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ISMAS_CLIENT_H_INCLUDED
|