Compare commits
3 Commits
v1.3.20
...
2f9b1e93c8
Author | SHA1 | Date | |
---|---|---|---|
2f9b1e93c8 | |||
0b090c618d | |||
18590ed54b |
33
interfaces.h
33
interfaces.h
@@ -2,6 +2,7 @@
|
||||
#define INTERFACE_H
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QString>
|
||||
|
||||
|
||||
|
||||
@@ -397,6 +398,7 @@ struct T_bna
|
||||
|
||||
};
|
||||
|
||||
class hwapi;
|
||||
class hwinf
|
||||
{
|
||||
|
||||
@@ -1834,6 +1836,9 @@ public:
|
||||
virtual uint8_t prn_getPrintResult() const {
|
||||
return 0;
|
||||
}
|
||||
// return: 0: just printing, wait
|
||||
// 1: OK - last print was succesful
|
||||
// 2: error - not printed
|
||||
|
||||
|
||||
|
||||
@@ -2270,9 +2275,35 @@ public:
|
||||
// countOfBills[1] for 10€ and so on
|
||||
|
||||
|
||||
// download device controller
|
||||
virtual void dcDownloadStart() {}
|
||||
virtual void dcDownloadRequest(QString const &fileToDownload) {
|
||||
Q_UNUSED(fileToDownload);
|
||||
}
|
||||
virtual bool dcDownloadRequested() const { return false; }
|
||||
virtual void dcDownloadResetRequest() {}
|
||||
virtual QString dcDownloadFileName() const { return ""; }
|
||||
virtual void dcDownloadReportStart() {}
|
||||
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; }
|
||||
|
||||
virtual hwapi *getAPI() { return nullptr; }
|
||||
|
||||
signals: // for download
|
||||
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.
|
||||
void hwapi_templatePrintFinished_OK() const;
|
||||
void hwapi_templatePrintFinished_Err() const;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define INTERFACE_H
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QString>
|
||||
|
||||
|
||||
|
||||
@@ -397,6 +398,7 @@ struct T_bna
|
||||
|
||||
};
|
||||
|
||||
class hwapi;
|
||||
class hwinf
|
||||
{
|
||||
|
||||
@@ -1834,6 +1836,9 @@ public:
|
||||
virtual uint8_t prn_getPrintResult() const {
|
||||
return 0;
|
||||
}
|
||||
// return: 0: just printing, wait
|
||||
// 1: OK - last print was succesful
|
||||
// 2: error - not printed
|
||||
|
||||
|
||||
|
||||
@@ -2270,9 +2275,35 @@ public:
|
||||
// countOfBills[1] for 10€ and so on
|
||||
|
||||
|
||||
// download device controller
|
||||
virtual void dcDownloadStart() {}
|
||||
virtual void dcDownloadRequest(QString const &fileToDownload) {
|
||||
Q_UNUSED(fileToDownload);
|
||||
}
|
||||
virtual bool dcDownloadRequested() const { return false; }
|
||||
virtual void dcDownloadResetRequest() {}
|
||||
virtual QString dcDownloadFileName() const { return ""; }
|
||||
virtual void dcDownloadReportStart() {}
|
||||
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; }
|
||||
|
||||
virtual hwapi *getAPI() { return nullptr; }
|
||||
|
||||
signals: // for download
|
||||
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.
|
||||
void hwapi_templatePrintFinished_OK() const;
|
||||
void hwapi_templatePrintFinished_Err() const;
|
||||
|
48
update.cpp
48
update.cpp
@@ -3,6 +3,7 @@
|
||||
#include "utils.h"
|
||||
#include "update_dc_event.h"
|
||||
#include "mainwindow.h"
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
@@ -18,8 +19,6 @@
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
#include <QSharedMemory>
|
||||
#include <QScopedPointer>
|
||||
#include <QDir>
|
||||
@@ -94,6 +93,7 @@ bool Update::unloadDCPlugin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
class hwapi;
|
||||
Update::Update(Worker *worker,
|
||||
QString customerRepository,
|
||||
QString customerNrStr,
|
||||
@@ -118,6 +118,7 @@ Update::Update(Worker *worker,
|
||||
, m_dryRun(dryRun)
|
||||
, m_sys_areDCdataValid(false) {
|
||||
|
||||
#if 0
|
||||
int tries = 20;
|
||||
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||
// must deliver 'true', only then are all data from hwapi valid
|
||||
@@ -127,6 +128,21 @@ Update::Update(Worker *worker,
|
||||
m_hw->dc_autoRequest(true);
|
||||
QThread::msleep(500);
|
||||
}
|
||||
#endif
|
||||
|
||||
QObject const *obj = (QObject const *)(m_hw->getAPI());
|
||||
|
||||
if (connect(obj,
|
||||
SIGNAL(hwapi_reportDCDownloadStatus(QString const&)), this,
|
||||
SLOT(onReportDCDownloadStatus(QString const &)))) {
|
||||
qCritical() << "connect ok";
|
||||
}
|
||||
connect(obj,
|
||||
SIGNAL(hwapi_reportDCDownloadSuccess(QString const&)), this,
|
||||
SLOT(onReportDCDownloadSuccess(QString const &)));
|
||||
connect(obj,
|
||||
SIGNAL(hwapi_reportDCDownloadFailure(QString const &)), this,
|
||||
SLOT(onReportDCDownloadFailure(QString const &)));
|
||||
|
||||
qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||
|
||||
@@ -142,6 +158,19 @@ Update::Update(Worker *worker,
|
||||
Update::~Update() {
|
||||
}
|
||||
|
||||
void Update::onReportDCDownloadStatus(QString const &status) {
|
||||
qCritical() << "status" << status;
|
||||
//emit m_worker->showStatusMessage("", status);
|
||||
}
|
||||
|
||||
void Update::onReportDCDownloadSuccess(QString const &msg) {
|
||||
qCritical() << "msg" << msg;
|
||||
}
|
||||
|
||||
void Update::onReportDCDownloadFailure(QString const &errorMsg) {
|
||||
qCritical() << "msg" << errorMsg;
|
||||
}
|
||||
|
||||
// br is a index into a table, used for historical reasons.
|
||||
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
||||
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
||||
@@ -495,18 +524,23 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
||||
}
|
||||
|
||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
if (m_sys_areDCdataValid == false) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
return false;
|
||||
}
|
||||
//if (m_sys_areDCdataValid == false) {
|
||||
// qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
// return false;
|
||||
//}
|
||||
|
||||
bool res = false;
|
||||
QList<QString>::const_iterator it;
|
||||
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
||||
m_worker->startProgressLoop();
|
||||
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
||||
QString const &fToWorkOn = QDir::cleanPath(QString("/tmp") + QDir::separator() + it->trimmed());
|
||||
//QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
||||
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
||||
if (fToWorkOn.contains(version)) {
|
||||
m_hw->dcDownloadRequest(fToWorkOn);
|
||||
m_hw->dcDownloadReportStart(); // start reporting thread
|
||||
|
||||
|
||||
bool updateBinaryRes = true;
|
||||
|
||||
// CONSOLE()
|
||||
|
3
update.h
3
update.h
@@ -92,6 +92,9 @@ private slots:
|
||||
void readyReadStandardOutput();
|
||||
void readyReadStandardError();
|
||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void onReportDCDownloadStatus(QString const &status);
|
||||
void onReportDCDownloadSuccess(QString const &msg);
|
||||
void onReportDCDownloadFailure(QString const &errorMsg);
|
||||
|
||||
};
|
||||
#endif // UPDATE_H_INCLUDED
|
||||
|
Reference in New Issue
Block a user