From 1f8b88b2b65d171afe3207208c23e839b61a861a Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 7 Nov 2023 09:14:49 +0100 Subject: [PATCH] Update-object now proper memeber of worker-thread.w --- update.cpp | 13 +++++++++---- update.h | 11 +++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/update.cpp b/update.cpp index 75c4047..bcc565f 100644 --- a/update.cpp +++ b/update.cpp @@ -94,11 +94,11 @@ bool Update::unloadDCPlugin() { return false; } -Update::Update(hwinf *hw, - Worker *worker, +Update::Update(Worker *worker, QString customerRepository, QString customerNrStr, QString branchName, + QString plugInDir, QString pluginName, QString workingDir, bool dryRun, @@ -106,7 +106,7 @@ Update::Update(hwinf *hw, char const *serialInterface, char const *baudrate) : QObject(parent) - , m_hw(hw) + , m_hw(loadDCPlugin(QDir(plugInDir), pluginName)) , m_worker(worker) , m_serialInterface(serialInterface) , m_baudrate(baudrate) @@ -742,7 +742,12 @@ QStringList Update::getDcSoftAndHardWareVersion() { } bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) { - // always assume that serial line is open + if (!m_hw->sys_areDCdataValid()) { // must deliver 'true', only then are all + // data from hwapi valid + qCritical() << "ERROR!!! DC DATA NOT VALID"; + return false; + } + bool res = false; QList::const_iterator it; for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) { diff --git a/update.h b/update.h index f56cdc7..0e303ca 100644 --- a/update.h +++ b/update.h @@ -21,8 +21,8 @@ class Worker; class Update : public QObject { Q_OBJECT - hwinf *m_hw; - Worker *m_worker; + hwinf *m_hw = nullptr; + Worker *m_worker = nullptr; char const *m_serialInterface; char const *m_baudrate; QString m_customerRepository; @@ -44,11 +44,11 @@ public: static QStringList split(QString line, QChar sep = ','); - explicit Update(hwinf *hw, - Worker *worker, + explicit Update(Worker *worker, QString customerRepository, QString customerNrStr, QString branchName, + QString plugInDir, QString pluginName, QString workingDir, bool dryRun = false, @@ -58,6 +58,9 @@ public: virtual ~Update() override; bool doUpdate(int &displayIndex, QStringList const &linesToWorkOn); + hwinf *hw() { return m_hw; } + hwinf const *hw() const { return m_hw; } + //QString customerId() { return m_customerId; } //QString const customerId() const { return m_customerId; }