59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
#ifndef WORKER_H_INCLUDED
|
|
#define WORKER_H_INCLUDED
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QTimer>
|
|
#include <QFile>
|
|
#include <QJsonObject>
|
|
|
|
#include "worker_thread.h"
|
|
#include "update.h"
|
|
#include "git/git_client.h"
|
|
#include "ismas/ismas_client.h"
|
|
#include "apism/apism_client.h"
|
|
|
|
#ifdef PTU5
|
|
#define SERIAL_PORT "ttymxc2"
|
|
#else
|
|
#define SERIAL_PORT "ttyUSB0"
|
|
#endif
|
|
|
|
|
|
class hwinf;
|
|
class Worker : public QObject {
|
|
Q_OBJECT
|
|
|
|
WorkerThread m_workerThread;
|
|
QTimer m_timer;
|
|
Update *m_update;
|
|
ApismClient m_apismClient;
|
|
GitClient m_gc;
|
|
|
|
public:
|
|
explicit Worker(hwinf *hw,
|
|
QString update_ctrl_file,
|
|
QString workingDir = ".",
|
|
bool maintenanceMode = false,
|
|
bool testMode = false,
|
|
bool executeScriptOnly = false,
|
|
bool dryRun = false,
|
|
QObject *parent = nullptr,
|
|
char const *serialInterface = SERIAL_PORT,
|
|
char const *baudrate = "115200");
|
|
~Worker();
|
|
void quit() { return m_workerThread.quit(); }
|
|
|
|
signals:
|
|
void executeOpkgCommands();
|
|
|
|
public slots:
|
|
void onIsmasResponseReceived(QJsonObject ismasResponse);
|
|
void onExecuteOpkgCommands();
|
|
|
|
private slots:
|
|
void runUpdate();
|
|
};
|
|
|
|
#endif // WORKER_H_INCLUDED
|