UpdatePTUDevCtrl/worker.h

59 lines
1.3 KiB
C
Raw Normal View History

2023-06-16 16:47:13 +02:00
#ifndef WORKER_H_INCLUDED
#define WORKER_H_INCLUDED
#include <QObject>
#include <QString>
#include <QTimer>
#include <QFile>
#include <QJsonObject>
2023-06-16 16:47:13 +02:00
#include "worker_thread.h"
#include "update.h"
#include "git/git_client.h"
#include "ismas/ismas_client.h"
#include "apism/apism_client.h"
2023-06-16 16:47:13 +02:00
#ifdef PTU5
#define SERIAL_PORT "ttymxc2"
#else
#define SERIAL_PORT "ttyUSB0"
#endif
class hwinf;
2023-06-16 16:47:13 +02:00
class Worker : public QObject {
Q_OBJECT
WorkerThread m_workerThread;
QTimer m_timer;
Update *m_update;
ApismClient m_apismClient;
GitClient m_gc;
2023-06-16 16:47:13 +02:00
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");
2023-06-16 16:47:13 +02:00
~Worker();
void quit() { return m_workerThread.quit(); }
signals:
void executeOpkgCommands();
2023-06-16 16:47:13 +02:00
public slots:
void onIsmasResponseReceived(QJsonObject ismasResponse);
void onExecuteOpkgCommands();
private slots:
void runUpdate();
2023-06-16 16:47:13 +02:00
};
#endif // WORKER_H_INCLUDED