Update-object now proper memeber of worker-thread.w

This commit is contained in:
Gerhard Hoffmann 2023-11-07 09:14:49 +01:00
parent 0050ea35d0
commit 1f8b88b2b6
2 changed files with 16 additions and 8 deletions

View File

@ -94,11 +94,11 @@ bool Update::unloadDCPlugin() {
return false; return false;
} }
Update::Update(hwinf *hw, Update::Update(Worker *worker,
Worker *worker,
QString customerRepository, QString customerRepository,
QString customerNrStr, QString customerNrStr,
QString branchName, QString branchName,
QString plugInDir,
QString pluginName, QString pluginName,
QString workingDir, QString workingDir,
bool dryRun, bool dryRun,
@ -106,7 +106,7 @@ Update::Update(hwinf *hw,
char const *serialInterface, char const *serialInterface,
char const *baudrate) char const *baudrate)
: QObject(parent) : QObject(parent)
, m_hw(hw) , m_hw(loadDCPlugin(QDir(plugInDir), pluginName))
, m_worker(worker) , m_worker(worker)
, m_serialInterface(serialInterface) , m_serialInterface(serialInterface)
, m_baudrate(baudrate) , m_baudrate(baudrate)
@ -742,7 +742,12 @@ QStringList Update::getDcSoftAndHardWareVersion() {
} }
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) { 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; 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) {

View File

@ -21,8 +21,8 @@ class Worker;
class Update : public QObject { class Update : public QObject {
Q_OBJECT Q_OBJECT
hwinf *m_hw; hwinf *m_hw = nullptr;
Worker *m_worker; Worker *m_worker = nullptr;
char const *m_serialInterface; char const *m_serialInterface;
char const *m_baudrate; char const *m_baudrate;
QString m_customerRepository; QString m_customerRepository;
@ -44,11 +44,11 @@ public:
static QStringList split(QString line, QChar sep = ','); static QStringList split(QString line, QChar sep = ',');
explicit Update(hwinf *hw, explicit Update(Worker *worker,
Worker *worker,
QString customerRepository, QString customerRepository,
QString customerNrStr, QString customerNrStr,
QString branchName, QString branchName,
QString plugInDir,
QString pluginName, QString pluginName,
QString workingDir, QString workingDir,
bool dryRun = false, bool dryRun = false,
@ -58,6 +58,9 @@ public:
virtual ~Update() override; virtual ~Update() override;
bool doUpdate(int &displayIndex, QStringList const &linesToWorkOn); 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 customerId() { return m_customerId; }
//QString const customerId() const { return m_customerId; } //QString const customerId() const { return m_customerId; }