Compare commits
3 Commits
v1.3.21
...
2f9b1e93c8
Author | SHA1 | Date | |
---|---|---|---|
2f9b1e93c8 | |||
0b090c618d | |||
18590ed54b |
@@ -64,8 +64,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# given in ATBUpdateTool.ini can be overwritten on the command-line.
|
||||
# 1.3.18: Bug fixes found during testing.
|
||||
# 1.3.19: Bug fixes found during testing.
|
||||
VERSION="1.3.20"
|
||||
# 1.3.20: Bug fixes found during testing.
|
||||
VERSION="1.3.21"
|
||||
|
||||
# PLANNED TODOS:
|
||||
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
||||
@@ -96,9 +96,6 @@ VERSION="1.3.21"
|
||||
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
||||
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
||||
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
|
||||
# 10: Bei einer Neuinstallation (Neuhauser) immer JSON files runterladen,
|
||||
# Tariff-Files syncen (d.h. nur wenn noch kein Repo vorhanden ist), und
|
||||
# zwar auch ohne WAIT-Button.
|
||||
|
||||
|
||||
win32 {
|
||||
|
52
interfaces.h
52
interfaces.h
@@ -2,6 +2,7 @@
|
||||
#define INTERFACE_H
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QString>
|
||||
|
||||
|
||||
|
||||
@@ -397,6 +398,7 @@ struct T_bna
|
||||
|
||||
};
|
||||
|
||||
class hwapi;
|
||||
class hwinf
|
||||
{
|
||||
|
||||
@@ -2273,35 +2275,36 @@ 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; }
|
||||
|
||||
signals:
|
||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||
|
||||
virtual void hwapi_coinCollectionJustStarted(void) const=0;
|
||||
virtual void hwapi_coinCollectionAborted(void) const=0;
|
||||
|
||||
virtual void hwapi_gotNewCoin(void) const=0;
|
||||
virtual void hwapi_payStopByMax(void) const=0;
|
||||
virtual void hwapi_payStopByPushbutton(void) const=0;
|
||||
|
||||
virtual void hwapi_payStopByEscrow(void) const=0;
|
||||
virtual void hwapi_payStopByError(void) const=0;
|
||||
virtual void hwapi_payStopByTimeout(void) const=0;
|
||||
virtual void hwapi_payCancelled(void) const=0;
|
||||
virtual void hwapi_coinProcessJustStopped(void) const=0;
|
||||
|
||||
virtual void hwapi_doorServiceDoorOpened(void) const=0;
|
||||
virtual void hwapi_doorVaultDoorOpened(void) const=0;
|
||||
virtual void hwapi_doorCoinBoxRemoved(void) const=0;
|
||||
virtual void hwapi_doorCoinBoxInserted(void) const=0;
|
||||
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
|
||||
virtual void hwapi_doorAllDoorsClosed(void) const=0;
|
||||
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;
|
||||
|
||||
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
||||
/* GH Version, bringt Fehler
|
||||
void hwapi_templatePrintFinished_OK() const;
|
||||
void hwapi_templatePrintFinished_Err() const;
|
||||
|
||||
@@ -2324,7 +2327,6 @@ signals:
|
||||
void hwapi_doorCoinBoxInserted() const;
|
||||
void hwapi_doorCBinAndAllDoorsClosed() const;
|
||||
void hwapi_doorAllDoorsClosed() 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
|
||||
|
@@ -727,7 +727,7 @@ bool Worker::execOpkgCommands() {
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QTextStream in(&f);
|
||||
m_opkgCommands.clear();
|
||||
QStringList opkgErrorLst;
|
||||
bool executeOpkgCommandFailed = false;
|
||||
while (!in.atEnd()) {
|
||||
QString line = in.readLine();
|
||||
static const QRegularExpression comment("^\\s*#.*$");
|
||||
@@ -735,7 +735,7 @@ bool Worker::execOpkgCommands() {
|
||||
// found opkg command
|
||||
QString opkgCommand = line.trimmed();
|
||||
if (!executeOpkgCommand(opkgCommand)) {
|
||||
opkgErrorLst << opkgCommand;
|
||||
executeOpkgCommandFailed = true;
|
||||
} else {
|
||||
QString cmd = "\n " + opkgCommand;
|
||||
emit appendText(cmd);
|
||||
@@ -789,15 +789,14 @@ bool Worker::execOpkgCommands() {
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
if (opkgErrorLst.size() == 0) {
|
||||
if (!executeOpkgCommandFailed) {
|
||||
if (m_opkgCommands.size() > 0) {
|
||||
m_displayIndex = 1;
|
||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS));
|
||||
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS;
|
||||
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||
}
|
||||
} else {
|
||||
m_displayIndex = 1;
|
||||
ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE));
|
||||
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
|
||||
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
|
||||
return false;
|
||||
|
6
worker.h
6
worker.h
@@ -557,10 +557,8 @@ private:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
} break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||
break;
|
||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
||||
|
Reference in New Issue
Block a user