Compare commits
16 Commits
5577cc5d6d
...
gerhard-de
Author | SHA1 | Date | |
---|---|---|---|
ab13a0c8f9 | |||
263a88ce24 | |||
b06f4f46bb
|
|||
33d45eab2e
|
|||
2f9b1e93c8 | |||
0b090c618d | |||
18590ed54b | |||
d2e11d8f07 | |||
fbffdc923f | |||
8faf5af2bf | |||
1d532c13a4 | |||
d2d3afc28e | |||
f4bb201633 | |||
b68cf1fd1d | |||
0888c1b525 | |||
a6faf9ce21 |
@@ -63,8 +63,9 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# 1.3.17: Add ATBUpdateTool.ini and custom command line parser. Settings
|
# 1.3.17: Add ATBUpdateTool.ini and custom command line parser. Settings
|
||||||
# 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.
|
||||||
VERSION="1.3.19"
|
|
||||||
# 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.
|
||||||
|
|
||||||
# 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.
|
||||||
|
60
interfaces.h
60
interfaces.h
@@ -2,6 +2,7 @@
|
|||||||
#define INTERFACE_H
|
#define INTERFACE_H
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -397,6 +398,8 @@ struct T_bna
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class hwapi;
|
||||||
|
class DownloadThread;
|
||||||
class hwinf
|
class hwinf
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1834,6 +1837,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 +2276,61 @@ public:
|
|||||||
// countOfBills[1] for 10€ and so on
|
// countOfBills[1] for 10€ and so on
|
||||||
|
|
||||||
|
|
||||||
|
// download device controller
|
||||||
|
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
|
||||||
|
Q_UNUSED(fileToDownload);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadResetRequest() const { return false; }
|
||||||
|
virtual bool dcDownloadRequestAck() const { return false; }
|
||||||
|
virtual bool dcDownloadRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadFinished() { return false; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadReportStart() const { return false; }
|
||||||
|
virtual bool dcDownloadReportRunning() const { return true; }
|
||||||
|
virtual bool dcDownloadReportFinished() { return true; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadThreadFinalize(DownloadThread *) {}
|
||||||
|
virtual bool dcDownloadThreadFinished() const { return true; }
|
||||||
|
virtual bool dcDownloadReportThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadReportThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadReportThreadFinalize() {}
|
||||||
|
virtual void dcDownloadReportThreadQuit() {}
|
||||||
|
virtual bool dcDownloadReportThreadFinished() const { return true; }
|
||||||
|
|
||||||
|
|
||||||
signals:
|
virtual QString dcDownloadFileName() const { return ""; }
|
||||||
|
virtual bool dcDownloadSetRequested(bool requested) {
|
||||||
|
Q_UNUSED(requested); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetRunning(bool running) {
|
||||||
|
Q_UNUSED(running); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetFinished(bool finished) {
|
||||||
|
Q_UNUSED(finished); return false;
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
|
||||||
|
Q_UNUSED(totalBlockNumber);
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
|
||||||
|
Q_UNUSED(currentBlockNumber);
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadGetRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadGetRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadGetFinished() const { return false; }
|
||||||
|
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
|
||||||
|
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
|
||||||
|
|
||||||
|
virtual QObject const *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.
|
// 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;
|
||||||
|
14
main.cpp
14
main.cpp
@@ -85,6 +85,12 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
QString const rtPath = QCoreApplication::applicationDirPath();
|
QString const rtPath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
|
int const machineNr = Utils::read1stLineOfFile("/mnt/system_data/machine_nr");
|
||||||
|
int const customerNr = Utils::read1stLineOfFile("/mnt/system_data/cust_nr");
|
||||||
|
int const zoneNr = Utils::read1stLineOfFile("/mnt/system_data/zone_nr");
|
||||||
|
QString const branchName = (zoneNr != 0)
|
||||||
|
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||||
|
|
||||||
qInfo() << "pwd ......................" << rtPath;
|
qInfo() << "pwd ......................" << rtPath;
|
||||||
qInfo() << "repositoryUrl ............" << repositoryUrl;
|
qInfo() << "repositoryUrl ............" << repositoryUrl;
|
||||||
qInfo() << "plugInDir ................" << plugInDir;
|
qInfo() << "plugInDir ................" << plugInDir;
|
||||||
@@ -99,6 +105,9 @@ int main(int argc, char *argv[]) {
|
|||||||
qInfo() << "showExtendedVersion ......" << showExtendedVersion;
|
qInfo() << "showExtendedVersion ......" << showExtendedVersion;
|
||||||
qInfo() << "iniFileName .............." << iniFileName;
|
qInfo() << "iniFileName .............." << iniFileName;
|
||||||
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
||||||
|
qInfo() << "machineNr ................" << machineNr;
|
||||||
|
qInfo() << "customerNr ..............." << customerNr;
|
||||||
|
qInfo() << "zoneNr ..................." << zoneNr;
|
||||||
|
|
||||||
if (showExtendedVersion) {
|
if (showExtendedVersion) {
|
||||||
printf(APP_EXTENDED_VERSION"\n");
|
printf(APP_EXTENDED_VERSION"\n");
|
||||||
@@ -113,11 +122,6 @@ int main(int argc, char *argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int machineNr = Utils::read1stLineOfFile("/etc/machine_nr");
|
|
||||||
int customerNr = Utils::read1stLineOfFile("/etc/cust_nr");
|
|
||||||
int zoneNr = Utils::read1stLineOfFile("/etc/zone_nr");
|
|
||||||
QString const branchName = (zoneNr != 0)
|
|
||||||
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
|
||||||
|
|
||||||
QThread::currentThread()->setObjectName("main thread");
|
QThread::currentThread()->setObjectName("main thread");
|
||||||
qInfo() << "Main thread" << QThread::currentThreadId();
|
qInfo() << "Main thread" << QThread::currentThreadId();
|
||||||
|
@@ -156,6 +156,15 @@ void MainWindow::onQuit() {
|
|||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
int errorCode = 0;
|
int errorCode = 0;
|
||||||
|
|
||||||
|
Update *update = m_worker->update();
|
||||||
|
if (update) {
|
||||||
|
hwinf *hw = update->hw();
|
||||||
|
if (hw) {
|
||||||
|
hw->dcDownloadReportFinished();
|
||||||
|
hw->dcDownloadFinished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qCritical()
|
qCritical()
|
||||||
<< QString("ON QUIT: CURRENT STEP %1")
|
<< QString("ON QUIT: CURRENT STEP %1")
|
||||||
.arg(m_worker->getSmap()[m_worker->currentStep()]);
|
.arg(m_worker->getSmap()[m_worker->currentStep()]);
|
||||||
@@ -208,13 +217,12 @@ void MainWindow::onAppendText(QString text, QString suffix) {
|
|||||||
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
||||||
// ui->updateStatus->setText(editText.trimmed());
|
// ui->updateStatus->setText(editText.trimmed());
|
||||||
|
|
||||||
// scrollDownTextEdit();
|
scrollDownTextEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
// Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
int const s = newTextLines.size();
|
int const s = newTextLines.size();
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
@@ -249,11 +257,15 @@ void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
|||||||
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
// Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
||||||
if (lines.size() > 0) {
|
if (lines.size() > 0) {
|
||||||
lines.removeLast();
|
// removing the last line is really meant for refreshing the last line
|
||||||
|
// with a string very similar than the original one, typically only
|
||||||
|
// followed by a suffix.
|
||||||
|
if (lines.last().contains(text)) {
|
||||||
|
lines.removeLast();
|
||||||
|
}
|
||||||
if (!suffix.isNull() && suffix.size() > 0 && suffix != "\n") {
|
if (!suffix.isNull() && suffix.size() > 0 && suffix != "\n") {
|
||||||
QString const add = text.leftJustified(m_width-10) + suffix;
|
QString const add = text.leftJustified(m_width-10) + suffix;
|
||||||
if (!add.isEmpty()) {
|
if (!add.isEmpty()) {
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define INTERFACE_H
|
#define INTERFACE_H
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -397,6 +398,8 @@ struct T_bna
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class hwapi;
|
||||||
|
class DownloadThread;
|
||||||
class hwinf
|
class hwinf
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1834,6 +1837,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 +2276,61 @@ public:
|
|||||||
// countOfBills[1] for 10€ and so on
|
// countOfBills[1] for 10€ and so on
|
||||||
|
|
||||||
|
|
||||||
|
// download device controller
|
||||||
|
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
|
||||||
|
Q_UNUSED(fileToDownload);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadResetRequest() const { return false; }
|
||||||
|
virtual bool dcDownloadRequestAck() const { return false; }
|
||||||
|
virtual bool dcDownloadRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadFinished() { return false; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadReportStart() const { return false; }
|
||||||
|
virtual bool dcDownloadReportRunning() const { return true; }
|
||||||
|
virtual bool dcDownloadReportFinished() { return true; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadThreadFinalize(DownloadThread *) {}
|
||||||
|
virtual bool dcDownloadThreadFinished() const { return true; }
|
||||||
|
virtual bool dcDownloadReportThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadReportThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadReportThreadFinalize() {}
|
||||||
|
virtual void dcDownloadReportThreadQuit() {}
|
||||||
|
virtual bool dcDownloadReportThreadFinished() const { return true; }
|
||||||
|
|
||||||
|
|
||||||
signals:
|
virtual QString dcDownloadFileName() const { return ""; }
|
||||||
|
virtual bool dcDownloadSetRequested(bool requested) {
|
||||||
|
Q_UNUSED(requested); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetRunning(bool running) {
|
||||||
|
Q_UNUSED(running); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetFinished(bool finished) {
|
||||||
|
Q_UNUSED(finished); return false;
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
|
||||||
|
Q_UNUSED(totalBlockNumber);
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
|
||||||
|
Q_UNUSED(currentBlockNumber);
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadGetRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadGetRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadGetFinished() const { return false; }
|
||||||
|
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
|
||||||
|
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
|
||||||
|
|
||||||
|
virtual QObject const *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.
|
// 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;
|
||||||
|
88
update.cpp
88
update.cpp
@@ -94,6 +94,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,
|
||||||
@@ -130,18 +131,44 @@ Update::Update(Worker *worker,
|
|||||||
|
|
||||||
qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||||
|
|
||||||
//qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
QObject const *obj = m_hw->getAPI();
|
||||||
//qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
// QObject const *obj = (QObject const *)(hw);
|
||||||
//qInfo() << "UPDATE: m_customerRepository ..." << m_customerRepository;
|
|
||||||
//qInfo() << "UPDATE: m_customerNr ..........." << m_customerNrStr;
|
if (!connect(obj,
|
||||||
//qInfo() << "UPDATE: m_branchName ..........." << m_branchName;
|
SIGNAL(hwapi_reportDCDownloadStatus(QString const&)), this,
|
||||||
//qInfo() << "UPDATE: m_pluginName ..........." << m_pluginName;
|
SLOT(onReportDCDownloadStatus(QString const &)))) {
|
||||||
//qInfo() << "UPDATE: m_workingDirectory ....." << m_workingDir;
|
qCritical() << "ERROR connect() to onReportDCDownloadStatus() failed";
|
||||||
|
}
|
||||||
|
if (!connect(obj,
|
||||||
|
SIGNAL(hwapi_reportDCDownloadSuccess(QString const&)), this,
|
||||||
|
SLOT(onReportDCDownloadSuccess(QString const &)))) {
|
||||||
|
qCritical() << "ERROR connect() to onReportDCDownloadSuccess() failed";
|
||||||
|
}
|
||||||
|
if (!connect(obj,
|
||||||
|
SIGNAL(hwapi_reportDCDownloadFailure(QString const &)), this,
|
||||||
|
SLOT(onReportDCDownloadFailure(QString const &)))) {
|
||||||
|
qCritical() << "ERROR connect() to onReportDCDownloadFailure() failed";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Update::~Update() {
|
Update::~Update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Update::onReportDCDownloadStatus(QString const &status) {
|
||||||
|
emit m_worker->showStatusMessage("DL", 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 << "...";
|
||||||
@@ -501,16 +528,57 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
bool dcDownloadPossible = true;
|
||||||
|
|
||||||
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(m_customerRepository + QDir::separator() + it->trimmed());
|
||||||
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
||||||
if (fToWorkOn.contains(version)) {
|
qCritical() << "ABOUT TO START REPORTING THREAD (1)" << fToWorkOn;
|
||||||
|
if (fToWorkOn.contains(version) && dcDownloadPossible) {
|
||||||
|
// download for dc possible only once
|
||||||
|
dcDownloadPossible = false;
|
||||||
|
|
||||||
|
m_hw->dcDownloadRequest(fToWorkOn); // initiate download process
|
||||||
|
|
||||||
|
// test
|
||||||
|
m_hw->dcDownloadThreadStart();
|
||||||
|
|
||||||
|
if (!m_hw->dcDownloadRunning()) { // may take some time
|
||||||
|
qCritical() << QDateTime::currentDateTime() << __PRETTY_FUNCTION__
|
||||||
|
<< QString("line=%1 DOWNLOAD NOT RUNNING").arg(__LINE__);
|
||||||
|
continue; // wait for reporting thread to start
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_hw->dcDownloadReportThreadStart()) { // may take some time
|
||||||
|
qCritical() << QDateTime::currentDateTime() << __PRETTY_FUNCTION__
|
||||||
|
<< QString("line=%1 REPORT THREAD NOT RUNNING").arg(__LINE__);
|
||||||
|
continue; // wait for reporting thread to start
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_hw->dcDownloadReportRunning()) { // may take some time
|
||||||
|
qCritical() << QDateTime::currentDateTime() << __PRETTY_FUNCTION__
|
||||||
|
<< QString("line=%1 DOWNLOAD REPORT NOT RUNNING").arg(__LINE__);
|
||||||
|
continue; // reporting events from download thread
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_hw->dcDownloadReportFinished()) { // may take some time
|
||||||
|
qCritical() << QDateTime::currentDateTime() << __PRETTY_FUNCTION__
|
||||||
|
<< QString("line=%1 DOWNLOAD REPORT THREAD DID NOT FINISH").arg(__LINE__);
|
||||||
|
m_hw->dcDownloadReportThreadQuit();
|
||||||
|
continue; // wait for download thread to finish
|
||||||
|
}
|
||||||
|
|
||||||
|
qCritical() << QDateTime::currentDateTime() << __PRETTY_FUNCTION__
|
||||||
|
<< QString("line=%1 DOWNLOAD SUCCESS").arg(__LINE__);
|
||||||
|
|
||||||
bool updateBinaryRes = true;
|
bool updateBinaryRes = true;
|
||||||
|
|
||||||
// CONSOLE()
|
|
||||||
|
|
||||||
|
|
||||||
|
// CONSOLE()
|
||||||
|
#if 0
|
||||||
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||||
QThread::sleep(1); // wait to be sure that there are no more
|
QThread::sleep(1); // wait to be sure that there are no more
|
||||||
// commands sent to dc-hardware
|
// commands sent to dc-hardware
|
||||||
@@ -539,7 +607,7 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
res = updateBinaryRes;
|
res = updateBinaryRes;
|
||||||
|
|
||||||
} else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
} else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||||
|
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
|
||||||
|
37
worker.cpp
37
worker.cpp
@@ -157,7 +157,14 @@ Worker::Worker(int customerNr,
|
|||||||
, m_updateProcessRunning(true)
|
, m_updateProcessRunning(true)
|
||||||
, m_mainWindow(nullptr) /* contains plugin */
|
, m_mainWindow(nullptr) /* contains plugin */
|
||||||
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
||||||
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
, m_withoutIsmasDirectPort(false) /* useful for testing */
|
||||||
|
// IMPORTANT: allocate m_update here, otherwise the connects() inside of
|
||||||
|
// Update might not work: keep in mind that worker (this) is a thread without
|
||||||
|
// an own event-loop.
|
||||||
|
, m_update(new Update(this,
|
||||||
|
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
||||||
|
m_customerNrStr, m_branchName, m_pluginDir,
|
||||||
|
m_pluginName, m_workingDirectory)) {
|
||||||
|
|
||||||
// TODO: turn object into singleton
|
// TODO: turn object into singleton
|
||||||
instance = this;
|
instance = this;
|
||||||
@@ -166,9 +173,15 @@ Worker::Worker(int customerNr,
|
|||||||
QDir::setCurrent(m_workingDirectory);
|
QDir::setCurrent(m_workingDirectory);
|
||||||
|
|
||||||
m_apismVersion = getAPISMYoctoVersion();
|
m_apismVersion = getAPISMYoctoVersion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Worker::~Worker() {
|
Worker::~Worker() {
|
||||||
|
if (m_update) {
|
||||||
|
qCritical() << "DELETE UPDATE";
|
||||||
|
delete m_update;
|
||||||
|
m_update = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::displayProgressInMainWindow(int progress) {
|
void Worker::displayProgressInMainWindow(int progress) {
|
||||||
@@ -457,7 +470,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
|
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
||||||
|
|
||||||
QString triggerValue("");
|
QString triggerValue("NOT CHECKED YET");
|
||||||
|
|
||||||
for (int repeat = 1; repeat <= 100; ++repeat) {
|
for (int repeat = 1; repeat <= 100; ++repeat) {
|
||||||
|
|
||||||
@@ -682,6 +695,9 @@ bool Worker::filesToUpdate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_filesToUpdate.removeDuplicates();
|
m_filesToUpdate.removeDuplicates();
|
||||||
|
|
||||||
|
qCritical() << __PRETTY_FUNCTION__ << "FILES-TO-UPDATE" << m_filesToUpdate;
|
||||||
|
|
||||||
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
|
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
|
||||||
setProgress(_FILES_TO_UPDATE);
|
setProgress(_FILES_TO_UPDATE);
|
||||||
} else {
|
} else {
|
||||||
@@ -809,22 +825,19 @@ bool Worker::execOpkgCommands() {
|
|||||||
bool Worker::downloadFilesToPSAHardware() {
|
bool Worker::downloadFilesToPSAHardware() {
|
||||||
m_displayIndex = 0;
|
m_displayIndex = 0;
|
||||||
|
|
||||||
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
GUI(m_filesToDownload) << (CONSOLE(m_filesToDownload) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
||||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
||||||
|
|
||||||
if (m_noUpdatePsaHardware == false) {
|
if (m_noUpdatePsaHardware == false) {
|
||||||
if (computeFilesToDownload()) {
|
if (computeFilesToDownload()) {
|
||||||
CONSOLE(m_filesToDownload) << UPDATE_STEP::FILES_TO_DOWNLOAD;
|
CONSOLE(m_filesToDownload) << UPDATE_STEP::FILES_TO_DOWNLOAD;
|
||||||
|
|
||||||
Update update(this,
|
//m_update = new Update(this,
|
||||||
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
// QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
||||||
m_customerNrStr,
|
// m_customerNrStr, m_branchName, m_pluginDir,
|
||||||
m_branchName,
|
// m_pluginName, m_workingDirectory);
|
||||||
m_pluginDir,
|
|
||||||
m_pluginName,
|
|
||||||
m_workingDirectory);
|
|
||||||
|
|
||||||
return update.doUpdate(m_displayIndex, m_filesToDownload);
|
return m_update->doUpdate(m_displayIndex, m_filesToDownload);
|
||||||
} else {
|
} else {
|
||||||
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE;
|
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE;
|
||||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||||
@@ -844,7 +857,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("-vvv "
|
QString const params("-v "
|
||||||
"--recursive "
|
"--recursive "
|
||||||
"--progress "
|
"--progress "
|
||||||
"--checksum "
|
"--checksum "
|
||||||
|
9
worker.h
9
worker.h
@@ -520,8 +520,10 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::FILES_TO_UPDATE:
|
case UPDATE_STEP::FILES_TO_UPDATE: {
|
||||||
break;
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
|
||||||
lst << instance->m_debugMsg;
|
lst << instance->m_debugMsg;
|
||||||
Utils::printUpdateStatusMsg(debug, lst);
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
@@ -1173,7 +1175,8 @@ private:
|
|||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(i));
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(i));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (size == 1) {
|
||||||
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
||||||
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user