diff --git a/update.cpp b/update.cpp index 190534f..351f49c 100644 --- a/update.cpp +++ b/update.cpp @@ -123,26 +123,51 @@ Update::Update(Worker *worker, , m_dryRun(dryRun) , m_sys_areDCdataValid(false) { - int tries = 20; - while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) { - // must deliver 'true', only then are all data from hwapi valid - if (--tries < 0) { - qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED"; - break; + if (!m_hw) { + qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_hw == nullptr -> ca-slave plugin loaded ???"; + } else { + int tries = 20; + while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) { + // must deliver 'true', only then are all data from hwapi valid + if (--tries < 0) { + qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED"; + break; + } + m_hw->dc_autoRequest(true); + QThread::msleep(500); } - m_hw->dc_autoRequest(true); - QThread::msleep(500); + + qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_sys_areDCDataValid ..." + << m_sys_areDCdataValid; + + QObject const *obj = m_hw->getAPI(); + Q_ASSERT(obj != nullptr); + + QDebug critical = qCritical(); + critical << "connect() to onReportDCDownloadStatus() ..."; + if (!connect(obj, + SIGNAL(hwapi_reportDCDownloadStatus(QString const&)), this, + SLOT(onReportDCDownloadStatus(QString const &)))) { + critical << "FAILED"; + } + critical << "DONE"; + critical = qCritical(); + critical << "connect() to onReportDCDownloadSuccess() ..."; + if (!connect(obj, + SIGNAL(hwapi_reportDCDownloadSuccess(QString const&)), this, + SLOT(onReportDCDownloadSuccess(QString const &)))) { + critical << "FAILED"; + } + critical << "DONE"; + critical = qCritical(); + critical << "connect() to onReportDCDownloadFailure() ..."; + if (!connect(obj, + SIGNAL(hwapi_reportDCDownloadFailure(QString const &)), this, + SLOT(onReportDCDownloadFailure(QString const &)))) { + critical << "FAILED"; + } + critical << "DONE"; } - - qCritical() << __PRETTY_FUNCTION__ << "m_sys_areDCDataValid ..." << m_sys_areDCdataValid; - - //qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface; - //qInfo() << "UPDATE: m_baudrate ..." << m_baudrate; - //qInfo() << "UPDATE: m_customerRepository ..." << m_customerRepository; - //qInfo() << "UPDATE: m_customerNr ..........." << m_customerNrStr; - //qInfo() << "UPDATE: m_branchName ..........." << m_branchName; - //qInfo() << "UPDATE: m_pluginName ..........." << m_pluginName; - //qInfo() << "UPDATE: m_workingDirectory ....." << m_workingDir; } Update::~Update() {