Save development files.

This commit is contained in:
2023-12-01 14:28:07 +01:00
parent 78700e7bea
commit ee26eef50f
11 changed files with 239 additions and 5 deletions

25
include/download_thread.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef DOWNLOAD_THREAD_H_INCLUDED
#define DOWNLOAD_THREAD_H_INCLUDED
#include <QThread>
#include <QString>
class hwinf;
class DownloadThread : public QThread {
Q_OBJECT
public:
DownloadThread(hwinf *hw, QString const &fileToDownload);
~DownloadThread();
protected:
// download thread does not have a running event queue, and therefore
// no slots. signals work the usual way.
void run() override;
private:
hwinf *m_hw;
QString m_fileToDownload;
};
#endif // DOWNLOAD_THREAD_H_INCLUDED

View File

@@ -40,7 +40,8 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
#include "interfaces.h"
#include "shared_mem_buffer.h"
#include "runProc.h"
#include "download_thread.h"
#include "reporting_thread.h"
/*
* select Plugin Type here
@@ -1304,6 +1305,22 @@ public:
// countOfBills[1] for 10€ and so on
// download device controller
void dcDownloadInit(QString const &fileToDownload) override;
void dcDownloadStart(QString const &fileToDownload) override;
void dcDownloadReportStart(QString const &fileToDownload) override;
bool dcDownloadStarted() const override;
bool dcDownloadRunning() const override;
bool dcDownloadFinished() const override;
void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) override;
void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) override;
uint16_t dcDownloadGetTotalBlockNumber() const override;
uint16_t dcDownloadGetCurrentBlockNumber() const override;
signals: // for download
void hwapi_reportDCDownloadStatus(QString const &status);
void hwapi_reportDCDownloadSuccess(QString const &msg);
void hwapi_reportDCDownloadFailure(QString const &errorMsg);
signals:
// already declared in interfaces.h

View File

@@ -2273,7 +2273,33 @@ public:
// countOfBills[1] for 10€ and so on
// download device controller
virtual void dcDownloadInit(QString const &fileToDownload) {
Q_UNUSED(fileToDownload);
}
virtual void dcDownloadStart(QString const &fileToDownload) {
Q_UNUSED(fileToDownload);
}
virtual void dcDownloadReportStart(QString const &fileToDownload) {
Q_UNUSED(fileToDownload);
}
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
Q_UNUSED(totalBlockNumber);
}
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
Q_UNUSED(currentBlockNumber);
}
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
virtual bool dcDownloadStarted() const { return false; }
virtual bool dcDownloadRunning() const { return false; }
virtual bool dcDownloadFinished() const { return false; }
signals: // for download
void hwapi_reportDCDownloadStatus(QString const &status);
void hwapi_reportDCDownloadSuccess(QString const &msg);
void hwapi_reportDCDownloadFailure(QString const &errorMsg);
signals:
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.

View File

@@ -0,0 +1,25 @@
#ifndef REPORTING_THREAD_H_INCLUDED
#define REPORTING_THREAD_H_INCLUDED
#include <QThread>
#include <QString>
class hwinf;
class ReportingThread : public QThread {
Q_OBJECT
public:
ReportingThread(hwinf *hw, QString const &fileToDownload);
~ReportingThread();
protected:
// reporting thread does not have a running event queue, and therefore
// no slots. signals work the usual way.
void run() override;
private:
hwinf *m_hw;
QString m_fileToDownload;
};
#endif // REPORTING_THREAD_H_INCLUDED

View File

@@ -301,8 +301,15 @@ struct SharedMem
uint8_t p_nextFDcmdsInQueue;
// download of device controller and json files
struct DCDownload {
char m_filename[512];
uint16_t m_totalBlocks;
uint16_t m_currentblockNumber;
bool m_running;
bool m_started;
bool m_finished;
} m_downLoadDC;
static QSharedMemory *getShm(std::size_t s = 0);