|
|
|
@@ -52,7 +52,6 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
|
|
|
|
qCritical() << "in directory" << plugInDir.absolutePath();
|
|
|
|
|
qCritical() << "cannot load plugin" << pluginLoader.fileName();
|
|
|
|
|
qCritical() << pluginLoader.errorString();
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qCritical() << "loadDCPlugin() plugin directory:" << plugInDir.absolutePath();
|
|
|
|
@@ -60,25 +59,20 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
|
|
|
|
|
|
|
|
|
if (!pluginLoader.isLoaded()) {
|
|
|
|
|
qCritical() << pluginLoader.errorString();
|
|
|
|
|
exit(-2);
|
|
|
|
|
}
|
|
|
|
|
QObject *plugin = pluginLoader.instance();
|
|
|
|
|
if (!plugin) {
|
|
|
|
|
qCritical() << "cannot start instance";
|
|
|
|
|
exit(-3);
|
|
|
|
|
}
|
|
|
|
|
if (! (hw = qobject_cast<hwinf *>(plugin))) {
|
|
|
|
|
qCritical() << "cannot cast plugin" << plugin << "to hwinf";
|
|
|
|
|
exit(-4);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
qCritical() << pluginLibName << "does not exist";
|
|
|
|
|
exit(-5);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
qCritical() << "plugins directory" << plugInDir.absolutePath()
|
|
|
|
|
<< "does not exist";
|
|
|
|
|
exit(-6);
|
|
|
|
|
}
|
|
|
|
|
return hw;
|
|
|
|
|
}
|
|
|
|
@@ -124,7 +118,7 @@ Update::Update(Worker *worker,
|
|
|
|
|
, m_sys_areDCdataValid(false) {
|
|
|
|
|
|
|
|
|
|
if (!m_hw) {
|
|
|
|
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_hw == nullptr -> ca-slave plugin loaded ???";
|
|
|
|
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_hw == nullptr -> ca-slave plugin not loaded";
|
|
|
|
|
} else {
|
|
|
|
|
int tries = 20;
|
|
|
|
|
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
|
|
|
@@ -191,6 +185,7 @@ void Update::onReportDCDownloadFailure(QString const &errorMsg) {
|
|
|
|
|
|
|
|
|
|
// br is a index into a table, used for historical reasons.
|
|
|
|
|
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
|
|
|
|
if (m_hw) {
|
|
|
|
|
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
|
|
|
|
if (m_hw->dc_openSerial(br, baudrate, comPort, 1) == true) { // 1 for connect
|
|
|
|
|
Utils::printInfoMsg(
|
|
|
|
@@ -208,16 +203,19 @@ bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
|
|
|
|
Utils::printCriticalErrorMsg(
|
|
|
|
|
QString("OPENING SERIAL %1").arg(br)
|
|
|
|
|
+ " " + baudrate + " " + comPort + "...FAILED");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Update::closeSerial() const {
|
|
|
|
|
qInfo() << "CLOSED SERIAL" << m_baudrate << m_serialInterface;
|
|
|
|
|
if (m_hw) {
|
|
|
|
|
m_hw->dc_closeSerial();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Update::isSerialOpen() const {
|
|
|
|
|
return m_hw->dc_isPortOpen();
|
|
|
|
|
return m_hw ? m_hw->dc_isPortOpen() : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@@ -396,6 +394,8 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|
|
|
|
int templateIdx,
|
|
|
|
|
QString jsFileToSendToDC) const {
|
|
|
|
|
|
|
|
|
|
bool ret = false;
|
|
|
|
|
if (m_hw) {
|
|
|
|
|
m_hw->dc_autoRequest(true); // downloading Json needs the AutoEmission flag
|
|
|
|
|
qDebug() << "SET AUTO-REQUEST=TRUE";
|
|
|
|
|
QThread::sleep(1); // make sure the auto-request flag is acknowledged
|
|
|
|
@@ -417,7 +417,6 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ret = false;
|
|
|
|
|
QString msg;
|
|
|
|
|
lst.clear();
|
|
|
|
|
if (ready) {
|
|
|
|
@@ -509,6 +508,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|
|
|
|
m_hw->dc_autoRequest(false);
|
|
|
|
|
qDebug() << "SET AUTO-REQUEST=FALSE";
|
|
|
|
|
QThread::sleep(1); // make sure the auto-request flag is acknowledged
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
@@ -564,6 +564,7 @@ void Update::finished(int /*exitCode*/, QProcess::ExitStatus /*exitStatus*/) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList Update::getDcSoftAndHardWareVersion() {
|
|
|
|
|
if (m_hw) {
|
|
|
|
|
m_hw->dc_autoRequest(true);
|
|
|
|
|
QThread::sleep(1); // make sure the timer-slots are active
|
|
|
|
|
|
|
|
|
@@ -583,6 +584,7 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
|
|
|
|
if (!hwVersion.isEmpty() && !swVersion.isEmpty()) {
|
|
|
|
|
return QStringList() << hwVersion << swVersion;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QStringList() << "DC HW-version not available"
|
|
|
|
|
<< "DC SW-version not available";
|
|
|
|
@@ -671,6 +673,11 @@ bool Update::checkDownloadedJsonVersions(QStringList const& jsonFileNames) {
|
|
|
|
|
}
|
|
|
|
|
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|
|
|
|
|
|
|
|
|
if (!m_hw) {
|
|
|
|
|
Utils::printInfoMsg("CA-PLUGIN NOT LOADED");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int tries = 20;
|
|
|
|
|
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
|
|
|
|
// must deliver 'true', only then are all data from hwapi valid
|
|
|
|
|