Add m_sys_areDCdataValid plus its handling

This commit is contained in:
Gerhard Hoffmann 2023-11-24 14:08:54 +01:00
parent 9967d5cc45
commit 5577cc5d6d
2 changed files with 36 additions and 27 deletions

View File

@ -115,15 +115,28 @@ Update::Update(Worker *worker,
, m_branchName(branchName)
, m_pluginName(pluginName)
, m_workingDir(workingDir)
, m_dryRun(dryRun) {
, m_dryRun(dryRun)
, m_sys_areDCdataValid(false) {
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;
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";
}
m_hw->dc_autoRequest(true);
QThread::msleep(500);
}
qCritical() << "UPDATE: 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() {
@ -363,23 +376,24 @@ bool Update::downloadJson(enum FileTypeJson type,
templateIdx,
(uint8_t *)ba.data())) {
QThread::msleep(1000);
m_hw->dc_autoRequest(true);
QThread::msleep(500);
// testing
//m_hw->request_ReadbackMachineID();
//QThread::msleep(500);
m_hw->request_ReadbackMachineID();
QThread::msleep(500);
//uint8_t data[64];
//memset(data, 0x00, sizeof(data));
//uint8_t length = 0;
uint8_t data[64];
memset(data, 0x00, sizeof(data));
uint8_t length = 0;
//m_hw->readback_machineIDdata(&length, data);
m_hw->readback_machineIDdata(&length, data);
//QThread::msleep(500);
QThread::msleep(500);
//QByteArray ba((const char*)data, length);
QByteArray ba((const char*)data, length);
//qCritical() << length << "MACHINE ID =" << ba.toHex(':');
qCritical() << length << "MACHINE ID =" << ba.toHex(':');
ret = true;
}
@ -481,15 +495,9 @@ QStringList Update::getDcSoftAndHardWareVersion() {
}
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
int tries = 20;
while (!m_hw->sys_areDCdataValid()) { // 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";
return false;
}
m_hw->dc_autoRequest(true);
QThread::msleep(500);
if (m_sys_areDCdataValid == false) {
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
return false;
}
bool res = false;

View File

@ -32,6 +32,7 @@ class Update : public QObject {
QString m_workingDir;
bool m_maintenanceMode;
bool m_dryRun;
bool m_sys_areDCdataValid;
static QPluginLoader pluginLoader;