Compare commits
4 Commits
fd58f41c87
...
6176285b89
Author | SHA1 | Date | |
---|---|---|---|
6176285b89 | |||
0344150950 | |||
68813a49c5 | |||
8e287e3163 |
@ -75,7 +75,8 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
|||||||
//for CAmaster:
|
//for CAmaster:
|
||||||
|
|
||||||
class QSharedMemory;
|
class QSharedMemory;
|
||||||
|
class ReportingThread;
|
||||||
|
class DownloadThread;
|
||||||
class hwapi : public QObject,
|
class hwapi : public QObject,
|
||||||
public hwinf
|
public hwinf
|
||||||
{
|
{
|
||||||
@ -87,7 +88,8 @@ private:
|
|||||||
void sub_storeSendingText(QByteArray *buf) const;
|
void sub_storeSendingText(QByteArray *buf) const;
|
||||||
QTimer *hwapi_TimerPayment;
|
QTimer *hwapi_TimerPayment;
|
||||||
QSharedMemory *m_sharedMem;
|
QSharedMemory *m_sharedMem;
|
||||||
//QTimer *hwapi_triggerBL;
|
ReportingThread *m_reportingThread;
|
||||||
|
DownloadThread *m_downloadThread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit hwapi(QWidget *parent = nullptr);
|
explicit hwapi(QWidget *parent = nullptr);
|
||||||
@ -1306,8 +1308,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// download device controller
|
// download device controller
|
||||||
void dcDownloadInit(QString const &fileToDownload) override;
|
|
||||||
void dcDownloadStart() override;
|
void dcDownloadStart() override;
|
||||||
|
void dcDownloadRequest(QString const &fileToDownload) override;
|
||||||
bool dcDownloadRequested() const override;
|
bool dcDownloadRequested() const override;
|
||||||
QString dcDownloadFileName() const override;
|
QString dcDownloadFileName() const override;
|
||||||
void dcDownloadResetRequest() override;
|
void dcDownloadResetRequest() override;
|
||||||
@ -1320,12 +1322,13 @@ public:
|
|||||||
void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) override;
|
void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) override;
|
||||||
uint16_t dcDownloadGetTotalBlockNumber() const override;
|
uint16_t dcDownloadGetTotalBlockNumber() const override;
|
||||||
uint16_t dcDownloadGetCurrentBlockNumber() 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:
|
virtual hwapi *getAPI() override;
|
||||||
|
|
||||||
|
signals: // for download
|
||||||
|
void hwapi_reportDCDownloadStatus(QString const &) const;
|
||||||
|
void hwapi_reportDCDownloadSuccess(QString const &) const;
|
||||||
|
void hwapi_reportDCDownloadFailure(QString const &) const;
|
||||||
// already declared in interfaces.h
|
// already declared in interfaces.h
|
||||||
void hwapi_templatePrintFinished_OK(void) const;
|
void hwapi_templatePrintFinished_OK(void) const;
|
||||||
void hwapi_templatePrintFinished_Err(void) const;
|
void hwapi_templatePrintFinished_Err(void) const;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define INTERFACE_H
|
#define INTERFACE_H
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -397,6 +398,7 @@ struct T_bna
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class hwapi;
|
||||||
class hwinf
|
class hwinf
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2274,10 +2276,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// download device controller
|
// download device controller
|
||||||
virtual void dcDownloadInit(QString const &fileToDownload) {
|
virtual void dcDownloadStart() {}
|
||||||
|
virtual void dcDownloadRequest(QString const &fileToDownload) {
|
||||||
Q_UNUSED(fileToDownload);
|
Q_UNUSED(fileToDownload);
|
||||||
}
|
}
|
||||||
virtual void dcDownloadStart() {}
|
|
||||||
virtual bool dcDownloadRequested() const { return false; }
|
virtual bool dcDownloadRequested() const { return false; }
|
||||||
virtual void dcDownloadResetRequest() {}
|
virtual void dcDownloadResetRequest() {}
|
||||||
virtual QString dcDownloadFileName() const { return ""; }
|
virtual QString dcDownloadFileName() const { return ""; }
|
||||||
@ -2295,12 +2297,13 @@ public:
|
|||||||
virtual bool dcDownloadRunning() const { return false; }
|
virtual bool dcDownloadRunning() const { return false; }
|
||||||
virtual bool dcDownloadFinished() const { return false; }
|
virtual bool dcDownloadFinished() const { return false; }
|
||||||
|
|
||||||
signals: // for download
|
virtual hwapi *getAPI() { return nullptr; }
|
||||||
void hwapi_reportDCDownloadStatus(QString const &status);
|
|
||||||
void hwapi_reportDCDownloadSuccess(QString const &msg);
|
signals: // for download
|
||||||
void hwapi_reportDCDownloadFailure(QString const &errorMsg);
|
void hwapi_reportDCDownloadStatus(QString const &) const;
|
||||||
|
void hwapi_reportDCDownloadSuccess(QString const &) const;
|
||||||
|
void hwapi_reportDCDownloadFailure(QString const &) const;
|
||||||
|
|
||||||
signals:
|
|
||||||
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
||||||
void hwapi_templatePrintFinished_OK() const;
|
void hwapi_templatePrintFinished_OK() const;
|
||||||
void hwapi_templatePrintFinished_Err() const;
|
void hwapi_templatePrintFinished_Err() const;
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hwapi.h"
|
#include "hwapi.h"
|
||||||
|
#include "reporting_thread.h"
|
||||||
|
#include "download_thread.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -4373,7 +4376,11 @@ uint16_t hwapi::bna_getStackerLevel(uint32_t *amountInStacker, uint16_t *countOf
|
|||||||
return anzahl;
|
return anzahl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::dcDownloadInit(QString const &dcFileToDownload) {
|
hwapi *hwapi::getAPI() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void hwapi::dcDownloadRequest(QString const &dcFileToDownload) {
|
||||||
char *fNameBuffer = SharedMem::getData()->m_downLoadDC.m_filename;
|
char *fNameBuffer = SharedMem::getData()->m_downLoadDC.m_filename;
|
||||||
size_t const size = sizeof(SharedMem::getData()->m_downLoadDC.m_filename);
|
size_t const size = sizeof(SharedMem::getData()->m_downLoadDC.m_filename);
|
||||||
|
|
||||||
@ -4392,7 +4399,11 @@ void hwapi::dcDownloadStart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::dcDownloadReportStart() {
|
void hwapi::dcDownloadReportStart() {
|
||||||
|
if (SharedMem::getDataConst()->m_downLoadDC.m_started ||
|
||||||
|
SharedMem::getDataConst()->m_downLoadDC.m_running) {
|
||||||
|
m_reportingThread = new ReportingThread(this);
|
||||||
|
m_reportingThread->start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hwapi::dcDownloadRequested() const {
|
bool hwapi::dcDownloadRequested() const {
|
||||||
|
@ -13,7 +13,13 @@ ReportingThread::~ReportingThread() {
|
|||||||
// download thread running in ca-slave sends reports download process to
|
// download thread running in ca-slave sends reports download process to
|
||||||
// update tool
|
// update tool
|
||||||
void ReportingThread::run() {
|
void ReportingThread::run() {
|
||||||
|
hwapi *hw = m_hw->getAPI();
|
||||||
|
emit hw->hwapi_reportDCDownloadStatus("test");
|
||||||
|
|
||||||
|
qCritical() << "nach emit";
|
||||||
|
QThread::sleep(4);
|
||||||
|
|
||||||
|
#if 0
|
||||||
int cnt = 10;
|
int cnt = 10;
|
||||||
while (!m_hw->dcDownloadRunning()) {
|
while (!m_hw->dcDownloadRunning()) {
|
||||||
if (--cnt > 0) {
|
if (--cnt > 0) {
|
||||||
@ -52,4 +58,5 @@ void ReportingThread::run() {
|
|||||||
QString("ERROR DOWNLOADING %1 (total blocks=%2, sent blocks=%3)")
|
QString("ERROR DOWNLOADING %1 (total blocks=%2, sent blocks=%3)")
|
||||||
.arg(m_fileToDownload).arg(tnr).arg(cnr));
|
.arg(m_fileToDownload).arg(tnr).arg(cnr));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user