52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#ifndef ISMAS_CLIENT_H_INCLUDED
|
|
#define ISMAS_CLIENT_H_INCLUDED
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <optional>
|
|
|
|
class IsmasClient : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit IsmasClient() = default;
|
|
|
|
enum APISM {
|
|
DB_PORT = 7777,
|
|
DIRECT_PORT = 7778
|
|
};
|
|
|
|
enum RESULT_CODE {
|
|
SUCCESS=0,
|
|
// if between 00:00 - 04:00 Wait-button state not WAIT, then we assume
|
|
// that's an automatic nightly (not-necessary) update
|
|
NO_UPDATE_NECESSARY=1,
|
|
// if APISM reports the ISMAS is not available (15x, 6s delay each)
|
|
ISMAS_NO_CONNECTION_ERROR=2,
|
|
// if not within 00:00-04:00 and WAIT-button was not in state WAIT
|
|
ISMAS_TRIGGER_ERROR=3,
|
|
};
|
|
|
|
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);
|
|
|
|
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);
|
|
};
|
|
|
|
#endif // ISMAS_CLIENT_H_INCLUDED
|