Add headers for download/reporting thread
This commit is contained in:
parent
760f4018b5
commit
3c9cd16144
37
include/download_thread.h
Normal file
37
include/download_thread.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#ifndef DOWNLOAD_THREAD_H_INCLUDED
|
||||||
|
#define DOWNLOAD_THREAD_H_INCLUDED
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
#include <QString>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
class hwinf;
|
||||||
|
class DownloadThread : public QThread {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
||||||
|
|
||||||
|
DownloadThread(hwinf *hw);
|
||||||
|
~DownloadThread();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// download thread does not have a running event queue, and therefore
|
||||||
|
// no slots. signals work the usual way.
|
||||||
|
void run() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DownloadResult sendStatus(int ret) const;
|
||||||
|
DownloadResult sendNextAddress(int bNum) const;
|
||||||
|
DownloadResult sendNextDataBlock(QByteArray const &binary, int bNum) const;
|
||||||
|
bool startBootloader() const;
|
||||||
|
bool stopBootloader() const;
|
||||||
|
QByteArray loadBinaryDCFile(QString dcFileName) const;
|
||||||
|
bool resetDeviceController() const;
|
||||||
|
DownloadResult dcDownloadBinary(QByteArray const &b) const;
|
||||||
|
|
||||||
|
hwinf *m_hw;
|
||||||
|
QString m_fileToDownload;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DOWNLOAD_THREAD_H_INCLUDED
|
25
include/reporting_thread.h
Normal file
25
include/reporting_thread.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef REPORTING_THREAD_H_INCLUDED
|
||||||
|
#define REPORTING_THREAD_H_INCLUDED
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class hwapi;
|
||||||
|
class ReportingThread : public QThread {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ReportingThread(hwapi *hw);
|
||||||
|
~ReportingThread();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// reporting thread does not have a running event queue, and therefore
|
||||||
|
// no slots. signals work the usual way.
|
||||||
|
void run() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
hwapi *m_hw;
|
||||||
|
QString m_fileToDownload;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // REPORTING_THREAD_H_INCLUDED
|
Loading…
Reference in New Issue
Block a user