Extended UPDATE_STATUS enum.

Simplified interface.
Read machine_nr, cust_nr, zone_nr from file.
This commit is contained in:
Gerhard Hoffmann 2023-07-17 16:38:53 +02:00
parent 077eb803a1
commit 7054c18113

View File

@ -22,6 +22,43 @@
#endif #endif
enum class UPDATE_STATUS : quint8 {
ISMAS_EMULATE_DATA_AVAILABLE,
ISMAS_UPDATE_REQUEST_PENDING,
ISMAS_UPDATE_REQUEST_FAILURE,
ISMAS_UPDATE_REQUEST_TIMEOUT,
ISMAS_UPDATE_REQUEST_SUCCESS,
GIT_CHECKOUT_BRANCH_REQUEST,
GIT_CHECKOUT_BRANCH_REQUEST_FAILURE,
GIT_CHECKOUT_BRANCH_NOT_EXISTS,
GIT_CHECKOUT_BRANCH_CHECKOUT_ERROR,
GIT_FETCH_UPDATES_REQUEST,
GIT_FETCH_UPDATES_REQUEST_FAILURE,
GIT_FETCH_UPDATES_REQUEST_SSUCCESS,
EXEC_OPKG_COMMANDS_REQUEST,
EXEC_OPKG_COMMANDS_FAILURE,
EXEC_OPKG_COMMAND_FAILURE,
EXEC_OPKG_COMMAND_SUCCESS,
EXEC_OPKG_COMMANDS_SUCCESS,
RSYNC_UPDATES,
RSYNC_UPDATES_FAILURE,
RSYNC_UPDATES_SUCESS,
DEVICE_CONTROLLER_UPDATE,
DEVICE_CONTROLLER_UPDATE_FAILURE,
DEVICE_CONTROLLER_UPDATE_SUCCESS,
JSON_UPDATE,
JSON_UPDATE_FAILURE,
JSON_UPDATE_SUCCESS,
ISMAS_UPDATE_INFO_CONFIRM,
ISMAS_UPDATE_INFO_CONFIRM_FAILURE,
ISMAS_UPDATE_INFO_CONFIRM_SUCCESS,
ISMAS_CURRENT_PSA_STATUS_CONFIRM,
ISMAS_CURRENT_PSA_STATUS_CONFIRM_FAILURE,
ISMAS_CURRENT_PSA_STATUS_CONFIRM_SUCCESS
};
#define ISMAS_UPDATE_REQUESTS (6)
class hwinf; class hwinf;
class Worker : public QObject { class Worker : public QObject {
Q_OBJECT Q_OBJECT
@ -30,38 +67,35 @@ class Worker : public QObject {
QTimer m_startUpdateProcess; QTimer m_startUpdateProcess;
Update *m_update; Update *m_update;
ApismClient m_apismClient; ApismClient m_apismClient;
GitClient m_gc; int const m_customerNr;
QString const m_customerId; QString const m_customerNrStr;
int const m_machineNr;
int const m_zoneNr;
QString const m_workingDirectory; QString const m_workingDirectory;
QString const m_branchName; QString const m_branchName;
QString const m_customerRepository; QString const m_customerRepository;
GitClient m_gc;
bool m_maintenanceMode; bool m_maintenanceMode;
QString const m_osVersion;
int m_ismasUpdateRequests; int m_ismasUpdateRequests;
QTimer m_waitForNewUpdates; QTimer m_waitForNewUpdates;
IsmasClient m_ismasClient; IsmasClient m_ismasClient;
int m_machineNr; // setzen UPDATE_STATUS m_updateStatus;
int m_customerNr; QString m_statusDescription;
enum { ISMAS_UPDATE_REQUESTS = 6 }; void executeOpkgCommand(QString opkgCommand);
QString getOsVersion() const;
enum class UPDATE_STATUS : quint8 {
STARTED,
STOPPED,
ERROR_BACKEND
} m_updateStatus;
public: public:
explicit Worker(hwinf *hw, explicit Worker(hwinf *hw,
QString update_ctrl_file, int customerNr, // 281
QString repositoryPath, int machineNr,
QString customerId, int zoneNr,
QString branchName, QString branchName,
QString workingDir = ".", QString workingDir = ".",
bool maintenanceMode = false, bool maintenanceMode = false,
bool testMode = false,
bool executeScriptOnly = false,
bool dryRun = false, bool dryRun = false,
QObject *parent = nullptr, QObject *parent = nullptr,
char const *serialInterface = SERIAL_PORT, char const *serialInterface = SERIAL_PORT,
@ -69,9 +103,9 @@ public:
~Worker(); ~Worker();
void quit() { return m_workerThread.quit(); } void quit() { return m_workerThread.quit(); }
static int read1stLineOfFile(QString fileName);
signals: signals:
void executeOpkgCommands(QStringList);
void executeOpkgCommand(QString);
void handleChangedFiles(QStringList); void handleChangedFiles(QStringList);
void summarizeUpload(QStringList); void summarizeUpload(QStringList);
void summarizeRepositoryStatus(); void summarizeRepositoryStatus();
@ -81,8 +115,6 @@ signals:
public slots: public slots:
void onIsmasResponseReceived(QJsonObject ismasResponse); void onIsmasResponseReceived(QJsonObject ismasResponse);
void onExecuteOpkgCommands(QStringList opkgCommands);
void onExecuteOpkgCommand(QString opkgCommand);
private slots: private slots:
void askIsmasForNewData(); void askIsmasForNewData();