Compare commits
3 Commits
v1.3.22
...
2f9b1e93c8
Author | SHA1 | Date | |
---|---|---|---|
2f9b1e93c8 | |||
0b090c618d | |||
18590ed54b |
@@ -64,20 +64,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# given in ATBUpdateTool.ini can be overwritten on the command-line.
|
# given in ATBUpdateTool.ini can be overwritten on the command-line.
|
||||||
# 1.3.18: Bug fixes found during testing.
|
# 1.3.18: Bug fixes found during testing.
|
||||||
# 1.3.19: 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.
|
# 1.3.20: Bug fixes found during testing.
|
||||||
# 1.3.21: Bug fixes found during testing:
|
|
||||||
# Fix directory of ATBUpdateTool.ini to be the working directory of
|
|
||||||
# the application rather than just ".".
|
|
||||||
# Check existance of etc-directory inside customer repository.
|
|
||||||
# Check for valid ISMAS trigger (button) 15x (=90s).
|
|
||||||
# NOTE: if the customer repository is cloned (or repaired and cloned
|
|
||||||
# again), and if the settings always-download-config=true and
|
|
||||||
# always-download-dc=true in the ATBUpdateTool.ini file, the download
|
|
||||||
# the printer-json files and the device controller file, even without
|
|
||||||
# an activated ISMAS trigger (button). The tariff-files are rsynced to
|
|
||||||
# the local filesystem for such clone.
|
|
||||||
# Set new filename for device controller: dc2c.bin.
|
|
||||||
VERSION="1.3.22"
|
|
||||||
|
|
||||||
# PLANNED TODOS:
|
# PLANNED TODOS:
|
||||||
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
||||||
@@ -108,9 +96,6 @@ VERSION="1.3.22"
|
|||||||
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
||||||
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
||||||
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
|
# 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 {
|
win32 {
|
||||||
|
@@ -87,7 +87,7 @@ void CommandLineParser::configure() {
|
|||||||
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
|
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
|
||||||
m_parser.addOption(m_repositoryUrlOption);
|
m_parser.addOption(m_repositoryUrlOption);
|
||||||
|
|
||||||
m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
|
m_iniFileDirectoryOption.setDefaultValue(".");
|
||||||
m_parser.addOption(m_iniFileDirectoryOption);
|
m_parser.addOption(m_iniFileDirectoryOption);
|
||||||
|
|
||||||
m_iniFileNameOption.setDefaultValue("ATBUpdateTool.ini");
|
m_iniFileNameOption.setDefaultValue("ATBUpdateTool.ini");
|
||||||
@@ -117,10 +117,10 @@ void CommandLineParser::configure() {
|
|||||||
m_extendedVersionOption.setDefaultValue("false");
|
m_extendedVersionOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_extendedVersionOption);
|
m_parser.addOption(m_extendedVersionOption);
|
||||||
|
|
||||||
m_yoctoVersionOption.setDefaultValue("false");
|
m_yoctoVersionOption .setDefaultValue("false");
|
||||||
m_parser.addOption(m_yoctoVersionOption);
|
m_parser.addOption(m_yoctoVersionOption);
|
||||||
|
|
||||||
m_yoctoInstallStatusOption.setDefaultValue("false");
|
m_yoctoInstallStatusOption .setDefaultValue("false");
|
||||||
m_parser.addOption(m_yoctoInstallStatusOption);
|
m_parser.addOption(m_yoctoInstallStatusOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,6 +128,7 @@ void CommandLineParser::readSettings() {
|
|||||||
QString const iniFileDir = m_parser.value(m_iniFileDirectoryOption);
|
QString const iniFileDir = m_parser.value(m_iniFileDirectoryOption);
|
||||||
QString const iniFileName = m_parser.value(m_iniFileNameOption);
|
QString const iniFileName = m_parser.value(m_iniFileNameOption);
|
||||||
m_iniFileName = QDir::cleanPath(iniFileDir + QDir::separator() + iniFileName);
|
m_iniFileName = QDir::cleanPath(iniFileDir + QDir::separator() + iniFileName);
|
||||||
|
|
||||||
if (!m_iniFileName.isEmpty()) {
|
if (!m_iniFileName.isEmpty()) {
|
||||||
if (QFile(m_iniFileName).exists()) {
|
if (QFile(m_iniFileName).exists()) {
|
||||||
QSettings settings(m_iniFileName, QSettings::IniFormat);
|
QSettings settings(m_iniFileName, QSettings::IniFormat);
|
||||||
|
52
interfaces.h
52
interfaces.h
@@ -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
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2273,35 +2275,36 @@ public:
|
|||||||
// countOfBills[1] for 10€ and so on
|
// 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 hwapi *getAPI() { return nullptr; }
|
||||||
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;
|
|
||||||
|
|
||||||
|
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.
|
// 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_OK() const;
|
||||||
void hwapi_templatePrintFinished_Err() const;
|
void hwapi_templatePrintFinished_Err() const;
|
||||||
|
|
||||||
@@ -2324,7 +2327,6 @@ signals:
|
|||||||
void hwapi_doorCoinBoxInserted() const;
|
void hwapi_doorCoinBoxInserted() const;
|
||||||
void hwapi_doorCBinAndAllDoorsClosed() const;
|
void hwapi_doorCBinAndAllDoorsClosed() const;
|
||||||
void hwapi_doorAllDoorsClosed() const;
|
void hwapi_doorAllDoorsClosed() const;
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ void MainWindow::onEnableExit() {
|
|||||||
|
|
||||||
void MainWindow::onRestartExitTimer() {
|
void MainWindow::onRestartExitTimer() {
|
||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
m_exitTimer->start(5 * 1000);
|
m_exitTimer->start(60 * 1000);
|
||||||
|
|
||||||
scrollDownTextEdit();
|
scrollDownTextEdit();
|
||||||
ui->updateStatus->setEnabled(false);
|
ui->updateStatus->setEnabled(false);
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1834,6 +1836,9 @@ public:
|
|||||||
virtual uint8_t prn_getPrintResult() const {
|
virtual uint8_t prn_getPrintResult() const {
|
||||||
return 0;
|
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
|
// 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.
|
// 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;
|
||||||
|
53
update.cpp
53
update.cpp
@@ -3,6 +3,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "update_dc_event.h"
|
#include "update_dc_event.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "plugins/interfaces.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -18,8 +19,6 @@
|
|||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "plugins/interfaces.h"
|
|
||||||
|
|
||||||
#include <QSharedMemory>
|
#include <QSharedMemory>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -94,6 +93,7 @@ bool Update::unloadDCPlugin() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class hwapi;
|
||||||
Update::Update(Worker *worker,
|
Update::Update(Worker *worker,
|
||||||
QString customerRepository,
|
QString customerRepository,
|
||||||
QString customerNrStr,
|
QString customerNrStr,
|
||||||
@@ -118,6 +118,7 @@ Update::Update(Worker *worker,
|
|||||||
, m_dryRun(dryRun)
|
, m_dryRun(dryRun)
|
||||||
, m_sys_areDCdataValid(false) {
|
, m_sys_areDCdataValid(false) {
|
||||||
|
|
||||||
|
#if 0
|
||||||
int tries = 20;
|
int tries = 20;
|
||||||
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||||
// must deliver 'true', only then are all data from hwapi valid
|
// must deliver 'true', only then are all data from hwapi valid
|
||||||
@@ -127,6 +128,21 @@ Update::Update(Worker *worker,
|
|||||||
m_hw->dc_autoRequest(true);
|
m_hw->dc_autoRequest(true);
|
||||||
QThread::msleep(500);
|
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;
|
qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||||
|
|
||||||
@@ -142,6 +158,19 @@ Update::Update(Worker *worker,
|
|||||||
Update::~Update() {
|
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.
|
// br is a index into a table, used for historical reasons.
|
||||||
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
||||||
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
||||||
@@ -495,17 +524,23 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||||
if (m_sys_areDCdataValid == false) {
|
//if (m_sys_areDCdataValid == false) {
|
||||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
// qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||||
return false;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
QList<QString>::const_iterator it;
|
QList<QString>::const_iterator it;
|
||||||
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
||||||
m_worker->startProgressLoop();
|
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());
|
||||||
if (fToWorkOn.contains("dc2c.bin")) {
|
//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;
|
bool updateBinaryRes = true;
|
||||||
|
|
||||||
// CONSOLE()
|
// CONSOLE()
|
||||||
@@ -595,6 +630,8 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
|
// m_worker->stopProgressLoop();
|
||||||
|
// m_worker->setProgress(100);
|
||||||
|
|
||||||
if (res == false) {
|
if (res == false) {
|
||||||
break;
|
break;
|
||||||
|
3
update.h
3
update.h
@@ -92,6 +92,9 @@ private slots:
|
|||||||
void readyReadStandardOutput();
|
void readyReadStandardOutput();
|
||||||
void readyReadStandardError();
|
void readyReadStandardError();
|
||||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
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
|
#endif // UPDATE_H_INCLUDED
|
||||||
|
73
worker.cpp
73
worker.cpp
@@ -214,12 +214,6 @@ bool Worker::isRepositoryCorrupted() {
|
|||||||
Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY .GIT DOES NOT EXIST");
|
Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY .GIT DOES NOT EXIST");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
|
||||||
if (!customerRepositoryEtc.exists()) {
|
|
||||||
// should never happen
|
|
||||||
Utils::printCriticalErrorMsg(QString("CORRUPTED CUSTOMER REPOSITORY %1/etc DOES NOT EXIST").arg(m_customerRepository));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -340,30 +334,21 @@ void Worker::privateUpdate() {
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
m_ismasTriggerActive = false;
|
m_ismasTriggerActive = false;
|
||||||
if (m_clone == false) {
|
if ((continueUpdate = updateTriggerSet()) == false) {
|
||||||
if ((continueUpdate = updateTriggerSet()) == false) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
|
||||||
setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (m_initialClone) {
|
if (m_initialClone) {
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER));
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER));
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "**** m_ismasTriggerActive:" << m_ismasTriggerActive;
|
|
||||||
qCritical() << "**** m_clone:" << m_clone;
|
|
||||||
|
|
||||||
if (m_ismasTriggerActive == false) {// make it explicit again: only if the
|
if (m_ismasTriggerActive == false) {// make it explicit again: only if the
|
||||||
// ismas trigger is active ('WAIT'),
|
// ismas trigger is active ('WAIT'),
|
||||||
// then proceed
|
// then proceed
|
||||||
|
return;
|
||||||
if (m_clone == false) { // if it is an (initial) clone, then
|
}
|
||||||
return; // run the whole update process:
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
||||||
} // sync tariff-files, download jsons,
|
setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||||
} // download device controller
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -473,8 +458,8 @@ bool Worker::updateTriggerSet() {
|
|||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
||||||
|
|
||||||
QString triggerValue("NOT CHECKED YET");
|
QString triggerValue("NOT CHECKED YET");
|
||||||
static constexpr int const repeats = 15;
|
|
||||||
for (int repeat = 1; repeat <= repeats; ++repeat) {
|
for (int repeat = 1; repeat <= 100; ++repeat) {
|
||||||
|
|
||||||
if (repeat > 1) {
|
if (repeat > 1) {
|
||||||
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
||||||
@@ -482,12 +467,10 @@ bool Worker::updateTriggerSet() {
|
|||||||
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
||||||
CONSOLE(QStringList(func) << s) << UPDATE_STEP::DEBUG;
|
CONSOLE(QStringList(func) << s) << UPDATE_STEP::DEBUG;
|
||||||
} else {
|
} else {
|
||||||
QStringList lst = (QStringList(func) << QString("-> REPEAT=%1 (%2)").arg(repeat).arg(repeats-repeat));
|
CONSOLE(QStringList(func) << QString("-> REPEAT=%1").arg(repeat)) << UPDATE_STEP::DEBUG;
|
||||||
// GUI(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER;
|
|
||||||
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((repeat % 8) == 0) {
|
if ((repeat % 10) == 0) {
|
||||||
CONSOLE(QStringList(func) << "RESTART APISM") << UPDATE_STEP::DEBUG;
|
CONSOLE(QStringList(func) << "RESTART APISM") << UPDATE_STEP::DEBUG;
|
||||||
Command c("systemctl restart apism");
|
Command c("systemctl restart apism");
|
||||||
if (c.execute("/tmp")) {
|
if (c.execute("/tmp")) {
|
||||||
@@ -577,7 +560,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
return m_ismasTriggerActive;
|
return m_ismasTriggerActive;
|
||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
QStringList lst(QString("%1 empty update trigger (%2)").arg(repeat).arg(repeats-repeat));
|
QStringList lst("empty update trigger");
|
||||||
if (m_clone) {
|
if (m_clone) {
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||||
// if the customer repository has just been cloned
|
// if the customer repository has just been cloned
|
||||||
@@ -659,7 +642,10 @@ bool Worker::filesToUpdate() {
|
|||||||
// always execute contents of opkg_commands-file
|
// always execute contents of opkg_commands-file
|
||||||
m_filesToUpdate << "etc/psa_update/opkg_commands";
|
m_filesToUpdate << "etc/psa_update/opkg_commands";
|
||||||
|
|
||||||
if (m_clone && m_alwaysDownloadConfig) {
|
if (m_alwaysDownloadConfig) {
|
||||||
|
#if 0
|
||||||
|
QStringList lst(QString("m_alwaysDownloadConfig NOT TESTED"));
|
||||||
|
CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY;
|
||||||
// always download all json-config files, even if none of them have been
|
// always download all json-config files, even if none of them have been
|
||||||
// changed in the git repository. useful for first installation.
|
// changed in the git repository. useful for first installation.
|
||||||
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config"));
|
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config"));
|
||||||
@@ -669,19 +655,24 @@ bool Worker::filesToUpdate() {
|
|||||||
m_filesToUpdate << jsons;
|
m_filesToUpdate << jsons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_clone && m_alwaysDownloadDC) {
|
if (m_alwaysDownloadDC) {
|
||||||
|
#if 0
|
||||||
|
QStringList lst(QString("m_alwaysDownloadDC NOT TESTED"));
|
||||||
|
CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY;
|
||||||
// always download the last dc-binary, even if not changed in the
|
// always download the last dc-binary, even if not changed in the
|
||||||
// git repository. useful for first installation.
|
// git repository. useful for first installation.
|
||||||
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/dc"));
|
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_update"));
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
QStringList dc = dir.entryList(QStringList() << "dc2c.bin", QDir::Files,
|
QStringList dc = dir.entryList(QStringList() << "dc2c*.bin", QDir::Files,
|
||||||
QDir::SortFlag::Time | QDir::SortFlag::Reversed);
|
QDir::SortFlag::Time | QDir::SortFlag::Reversed);
|
||||||
if (!dc.isEmpty()) {
|
if (!dc.isEmpty()) {
|
||||||
m_filesToUpdate << dc.first();
|
m_filesToUpdate << dc.first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::optional<QString> changes = m_gc.gitPull()) {
|
if (std::optional<QString> changes = m_gc.gitPull()) {
|
||||||
@@ -714,7 +705,8 @@ bool Worker::computeFilesToDownload() {
|
|||||||
fName.contains("DC2C_cash", Qt::CaseInsensitive)) {
|
fName.contains("DC2C_cash", Qt::CaseInsensitive)) {
|
||||||
m_filesToDownload << fName; // download printer-config-files
|
m_filesToDownload << fName; // download printer-config-files
|
||||||
} else {
|
} else {
|
||||||
if (fName.contains("dc2c.bin")) {
|
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
||||||
|
if (fName.contains(version)) {
|
||||||
m_filesToDownload << fName; // download device controller
|
m_filesToDownload << fName; // download device controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,7 +727,7 @@ bool Worker::execOpkgCommands() {
|
|||||||
if (f.open(QIODevice::ReadOnly)) {
|
if (f.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream in(&f);
|
QTextStream in(&f);
|
||||||
m_opkgCommands.clear();
|
m_opkgCommands.clear();
|
||||||
QStringList opkgErrorLst;
|
bool executeOpkgCommandFailed = false;
|
||||||
while (!in.atEnd()) {
|
while (!in.atEnd()) {
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
static const QRegularExpression comment("^\\s*#.*$");
|
static const QRegularExpression comment("^\\s*#.*$");
|
||||||
@@ -743,7 +735,7 @@ bool Worker::execOpkgCommands() {
|
|||||||
// found opkg command
|
// found opkg command
|
||||||
QString opkgCommand = line.trimmed();
|
QString opkgCommand = line.trimmed();
|
||||||
if (!executeOpkgCommand(opkgCommand)) {
|
if (!executeOpkgCommand(opkgCommand)) {
|
||||||
opkgErrorLst << opkgCommand;
|
executeOpkgCommandFailed = true;
|
||||||
} else {
|
} else {
|
||||||
QString cmd = "\n " + opkgCommand;
|
QString cmd = "\n " + opkgCommand;
|
||||||
emit appendText(cmd);
|
emit appendText(cmd);
|
||||||
@@ -797,15 +789,14 @@ bool Worker::execOpkgCommands() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.close();
|
f.close();
|
||||||
if (opkgErrorLst.size() == 0) {
|
if (!executeOpkgCommandFailed) {
|
||||||
if (m_opkgCommands.size() > 0) {
|
if (m_opkgCommands.size() > 0) {
|
||||||
m_displayIndex = 1;
|
m_displayIndex = 1;
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS));
|
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS;
|
||||||
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_displayIndex = 1;
|
m_displayIndex = 1;
|
||||||
ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE));
|
|
||||||
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
|
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
|
||||||
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
|
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
|
||||||
return false;
|
return false;
|
||||||
@@ -856,7 +847,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
QStringList() << "-c" << "mkdir -p /etc/psa_config /etc/dc /etc/psa_tariff")) {
|
QStringList() << "-c" << "mkdir -p /etc/psa_config /etc/dc /etc/psa_tariff")) {
|
||||||
qCritical() << "COULD NOT EXECUTE '" << md.command() << "' exitCode=(" << md.exitCode() << ")";
|
qCritical() << "COULD NOT EXECUTE '" << md.command() << "' exitCode=(" << md.exitCode() << ")";
|
||||||
}
|
}
|
||||||
QString const params("-v "
|
QString const params("-vvv "
|
||||||
"--recursive "
|
"--recursive "
|
||||||
"--progress "
|
"--progress "
|
||||||
"--checksum "
|
"--checksum "
|
||||||
|
9
worker.h
9
worker.h
@@ -557,10 +557,8 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE:
|
||||||
lst << instance->m_debugMsg;
|
break;
|
||||||
Utils::printUpdateStatusMsg(debug, lst);
|
|
||||||
} break;
|
|
||||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
||||||
@@ -1127,9 +1125,6 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
||||||
if (worker->m_guiMsg.size() > 0) {
|
|
||||||
emit worker->showStatusMessage(worker->m_guiMsg);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user