Added repoerting slots plus connects.
This commit is contained in:
parent
18590ed54b
commit
0b090c618d
48
update.cpp
48
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,18 +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());
|
||||||
|
//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)) {
|
if (fToWorkOn.contains(version)) {
|
||||||
|
m_hw->dcDownloadRequest(fToWorkOn);
|
||||||
|
m_hw->dcDownloadReportStart(); // start reporting thread
|
||||||
|
|
||||||
|
|
||||||
bool updateBinaryRes = true;
|
bool updateBinaryRes = true;
|
||||||
|
|
||||||
// CONSOLE()
|
// CONSOLE()
|
||||||
|
Loading…
Reference in New Issue
Block a user