Compare commits
No commits in common. "042e6dfa38ff8bfd8c153d3c3dbbfc7311430b97" and "4ff3b0efdfb8f0289b471916000f7b1cbb639e66" have entirely different histories.
042e6dfa38
...
4ff3b0efdf
@ -48,9 +48,8 @@ bool GitClient::gitCloneCustomerRepository() {
|
||||
}
|
||||
}
|
||||
}
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "ERROR CLONE RESULT HAS WRONG FORMAT. CLONE_RESULT=" << result;
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "ERROR CLONE RESULT HAS WRONG FORMAT. CLONE_RESULT="
|
||||
<< result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -97,9 +96,7 @@ bool GitClient::gitCheckoutBranch() {
|
||||
Command c(gitCommand);
|
||||
return c.execute(m_customerRepository); // execute command in customerRepo
|
||||
}
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "ERROR" << m_customerRepository << "DOES NOT EXIST";
|
||||
qCritical() << QString(80, '*');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -111,12 +108,12 @@ bool GitClient::gitCloneAndCheckoutBranch() {
|
||||
return true;
|
||||
} else {
|
||||
// TODO
|
||||
// m_worker->terminateUpdateProcess();
|
||||
}
|
||||
//}
|
||||
} else {
|
||||
qCritical() << QString(80, '*');
|
||||
qInfo() << "CLONE" << m_repositoryPath << "AND CHECKOUT FAILED";
|
||||
qCritical() << QString(80, '*');
|
||||
// TODO
|
||||
//m_worker->terminateUpdateProcess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -135,41 +132,23 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
if (c.execute(m_customerRepository)) { // execute command in local customerRepo
|
||||
QString s = c.getCommandResult().trimmed();
|
||||
QStringList lines = Update::split(s, '\n');
|
||||
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "GIT DIFF RESULT" << lines;
|
||||
qInfo() << QString(80, '*');
|
||||
|
||||
QStringList fileNames;
|
||||
// each line has the format "etc/psa_config/DC2C_print01.json | 1 +
|
||||
// or the format "etc/psa_config/DC2C_print01.json (new) | 1 +
|
||||
// the filenames are relativ to the repository
|
||||
for (int i = 0; i < lines.size(); ++i) {
|
||||
QString const &line = lines.at(i);
|
||||
int newIndex = line.indexOf("(new"); // for new files
|
||||
int goneIndex = line.indexOf("(gone"); // for removed files
|
||||
int modeIndex = line.indexOf("(mode");
|
||||
// int pipeIndex = line.indexOf('|');
|
||||
// TODO: koennte auch (delete) kommen ?
|
||||
int newIndex = lines.at(i).indexOf("(new)"); // for new files
|
||||
// int goneIndex = lines.at(i).indexOf("(gone)"); // for removed files
|
||||
if (newIndex != -1) {
|
||||
QString file = line.left(newIndex).trimmed();
|
||||
qInfo() << "FILE (NEW)" << file;
|
||||
fileNames << file;
|
||||
} else
|
||||
if (modeIndex != -1) {
|
||||
QString const file = line.left(modeIndex).trimmed();
|
||||
qInfo() << "FILE (MODE)" << file;
|
||||
fileNames << file;
|
||||
} else
|
||||
//if (pipeIndex != -1) {
|
||||
// QString const file = line.left(pipeIndex).trimmed();
|
||||
// qInfo() << "FILE (PIPE)" << file;
|
||||
// fileNames << file;
|
||||
//} else
|
||||
if (goneIndex != -1) {
|
||||
QString const file = line.left(goneIndex).trimmed();
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "FILE (GONE)" << file;
|
||||
qCritical() << QString(80, '*');
|
||||
QString fileName = lines.at(i).mid(0, newIndex).trimmed();
|
||||
fileNames << fileName;
|
||||
} else {
|
||||
int pipeIndex = lines.at(i).indexOf('|');
|
||||
if (pipeIndex != -1) {
|
||||
QString fileName = lines.at(i).mid(0, pipeIndex).trimmed();
|
||||
fileNames << fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!fileNames.isEmpty()) {
|
||||
@ -185,9 +164,8 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
*/
|
||||
std::optional<QString> GitClient::gitFetch() {
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
qCritical() << QString(80, '*');
|
||||
qInfo() << "BRANCH NAME" << m_branchName;
|
||||
qCritical() << QString(80, '*');
|
||||
|
||||
qCritical() << "BRANCH NAME" << m_branchName;
|
||||
|
||||
Command c("git fetch");
|
||||
if (c.execute(m_customerRepository)) {
|
||||
@ -220,39 +198,26 @@ std::optional<QString> GitClient::gitFetch() {
|
||||
}
|
||||
} else {
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
"no regex-match for commits");
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "NO REGEX MATCH FOR COMMITS";
|
||||
qCritical() << QString(80, '*');
|
||||
"regex-match for commits");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("unkown branch name ") + m_branchName);
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "UNKNOWN BRANCH NAME" << m_branchName;
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
} else {
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("wrong format for result of 'git fetch' ") + s);
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "WRONG FORMAT FOR RESULT OF 'GIT FETCH'" << s;
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
} else {
|
||||
emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "EMPTY RESULT FOR 'GIT FETCH'";
|
||||
qCritical() << QString(80, '*');
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
"empty result for 'git fetch'");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emit m_worker->showErrorMessage("git fetch", QString("repository ") + m_customerRepository + " does not exist");
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "REPOSITORY" << m_customerRepository << "DOES NOT EXIST";
|
||||
qCritical() << QString(80, '*');
|
||||
emit m_worker->showErrorMessage("git fetch",
|
||||
QString("repository ") + m_customerRepository + " does not exist");
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -273,9 +238,7 @@ bool GitClient::gitPull() {
|
||||
qInfo() << "PULLED INTO" << m_customerRepository;
|
||||
return true;
|
||||
}
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "PULL INTO" << m_customerRepository << "FAILED";
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -148,7 +148,6 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
|
||||
int const bytesToWrite = strlen(request.toStdString().c_str());
|
||||
strncpy(buf, request.toStdString().c_str(), sizeof(buf)-1);
|
||||
|
||||
int loop = 0;
|
||||
int bytesWritten = 0;
|
||||
while (bytesWritten < bytesToWrite) {
|
||||
int n = ::sendto(sockfd, buf+bytesWritten, bytesToWrite-bytesWritten, 0, NULL, 0);
|
||||
@ -156,18 +155,14 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
|
||||
bytesWritten += n;
|
||||
} else {
|
||||
if (errno == EWOULDBLOCK) {
|
||||
if (++loop < 10) {
|
||||
QThread::msleep(500);
|
||||
continue;
|
||||
}
|
||||
printErrorMessage(port, clientIP, clientPort,
|
||||
QString("WRITE TIMEOUT %1(").arg(loop) + strerror(errno) + ")");
|
||||
QString("TIMEOUT (") + strerror(errno) + ")");
|
||||
::close(sockfd);
|
||||
return std::nullopt;
|
||||
} else
|
||||
if (errno == EINTR) {
|
||||
printErrorMessage(port, clientIP, clientPort,
|
||||
QString("WRITE INTERRUPTED BY SIGNAL (1) (") + strerror(errno) + ")");
|
||||
QString("INTERRUPTED BY SIGNAL (1) (") + strerror(errno) + ")");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -182,7 +177,6 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
|
||||
|
||||
printInfoMessage(port, clientIP, clientPort, QString("MESSAGE SENT ") + buf);
|
||||
|
||||
loop = 0;
|
||||
bzero(buf, sizeof(buf));
|
||||
int bytesToRead = sizeof(buf)-1;
|
||||
int bytesRead = 0;
|
||||
@ -202,12 +196,8 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
|
||||
} else
|
||||
if (n < 0) {
|
||||
if (errno == EWOULDBLOCK) {
|
||||
if (++loop < 10) {
|
||||
QThread::msleep(500);
|
||||
continue;
|
||||
}
|
||||
printErrorMessage(port, clientIP, clientPort,
|
||||
QString("READ TIMEOUT %1(").arg(loop) + strerror(errno) + ")");
|
||||
QString("TIMEOUT (") + strerror(errno) + ")");
|
||||
::close(sockfd);
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -224,8 +214,8 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
|
||||
if (int idx = response.indexOf("{\"error\":\"ISMAS is offline\"}")) {
|
||||
response = response.mid(0, idx);
|
||||
} else
|
||||
if (response.contains("RECORD")) { // RECORD SAVED or RECORD WRITE ABORTED
|
||||
printInfoMessage(port, clientIP, clientPort, QString("IGNORED '") + response + "' RESPONSE");
|
||||
if (response == "RECORD SAVED") {
|
||||
printInfoMessage(port, clientIP, clientPort, "IGNORED 'RECORD SAVED' RESPONSE");
|
||||
::close(sockfd);
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -293,15 +283,6 @@ QString IsmasClient::errorBackendNotConnected(QString const &info,
|
||||
version.toStdString().c_str());
|
||||
}
|
||||
|
||||
QString IsmasClient::errorGitClone(int percent, QString const &info, QString const &version) {
|
||||
return updateNewsToIsmas("U0003",
|
||||
percent,
|
||||
RESULT_CODE::INSTALL_ERROR,
|
||||
"CLONE CUSTOMER REPOSITORY FAILED",
|
||||
info.toStdString().c_str(),
|
||||
version.toStdString().c_str());
|
||||
}
|
||||
|
||||
QString IsmasClient::backendConnected(QString const &info, QString const &version) {
|
||||
return updateNewsToIsmas("U0010",
|
||||
m_progressInPercent,
|
||||
|
@ -144,7 +144,6 @@ public:
|
||||
QString cloneAndCheckoutCustomerRepository(QString const &info, QString const &version = QString()); // clone and checkout customer repository
|
||||
QString checkoutBranch(QString const &info, QString const &version = QString()); // checkout branch
|
||||
QString errorBackendNotConnected(QString const &info, QString const &version = QString()); // checkout branch
|
||||
QString errorGitClone(int percent, QString const &info, QString const &version = QString());
|
||||
QString backendConnected(QString const &info, QString const &version = QString());
|
||||
QString updateTriggerSet(QString const &info, QString const &version = QString());
|
||||
QString errorUpdateTrigger(QString const &info, QString const &version = QString());
|
||||
|
@ -32,9 +32,15 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||
ui->updateStatus->setText(lst.join('\n'));
|
||||
ui->updateStatus->setEnabled(true);
|
||||
|
||||
ui->reserved_1->setVisible(false);
|
||||
ui->reserved_2->setVisible(false);
|
||||
ui->reserved_3->setVisible(false);
|
||||
ui->reserved_4->setVisible(false);
|
||||
ui->reserved_5->setVisible(false);
|
||||
ui->reserved_6->setVisible(false);
|
||||
|
||||
m_startTimer = new QTimer(this);
|
||||
// connect(m_startTimer, SIGNAL(timeout()), ui->start, SLOT(click()));
|
||||
connect(m_startTimer, SIGNAL(timeout()), m_worker, SLOT(update()));
|
||||
connect(m_startTimer, SIGNAL(timeout()), ui->start, SLOT(click()));
|
||||
m_startTimer->setSingleShot(true);
|
||||
m_startTimer->start(5 * 1000);
|
||||
|
||||
@ -43,6 +49,9 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||
m_exitTimer->setSingleShot(true);
|
||||
m_exitTimer->start(1800 * 1000);
|
||||
|
||||
connect(m_startTimer, SIGNAL(timeout()), ui->start, SLOT(click()));
|
||||
connect(m_exitTimer, SIGNAL(timeout()), ui->exit, SLOT(click()));
|
||||
connect(ui->start, SIGNAL(clicked()), m_worker, SLOT(update()));
|
||||
connect(ui->exit, SIGNAL(clicked()), this, SLOT(onQuit()));
|
||||
connect(m_worker, SIGNAL(disableExit()), this, SLOT(onDisableExit()));
|
||||
connect(m_worker, SIGNAL(enableExit()), this, SLOT(onEnableExit()));
|
||||
@ -127,7 +136,7 @@ void MainWindow::onEnableExit() {
|
||||
|
||||
void MainWindow::onRestartExitTimer() {
|
||||
m_exitTimer->stop();
|
||||
m_exitTimer->start(60 * 1000);
|
||||
m_exitTimer->start(10 * 1000);
|
||||
}
|
||||
|
||||
void MainWindow::onQuit() {
|
||||
@ -138,64 +147,39 @@ void MainWindow::onQuit() {
|
||||
|
||||
void MainWindow::onAppendText(QString text, QString suffix) {
|
||||
QString editText = ui->updateStatus->toPlainText();
|
||||
if (!suffix.isNull() && suffix.size() > 0) {
|
||||
qInfo() << "TEXT" << text << "SUFFIX" << suffix;
|
||||
if (suffix == Worker::UPDATE_STEP_SUCCESS || suffix == Worker::UPDATE_STEP_FAIL) {
|
||||
editText += QString("\n").leftJustified(m_width-3, '=');
|
||||
editText += " ";
|
||||
}
|
||||
if (suffix.size() > 0) {
|
||||
editText += QString("\n").leftJustified(m_width-3, '=');
|
||||
editText += " ";
|
||||
editText += (QString("\n") + text).leftJustified(m_width - (2 + suffix.size()) ) + suffix;
|
||||
} else {
|
||||
editText += text.leftJustified(m_width-9);
|
||||
}
|
||||
|
||||
QStringList const lines = editText.split('\n');
|
||||
QStringList lines = editText.split('\n');
|
||||
for (int i=0; i<lines.size(); ++i) {
|
||||
qInfo() << lines.at(i);
|
||||
} qInfo() << ""; qInfo() << "";
|
||||
qDebug() << lines.at(i);
|
||||
} qDebug() << ""; qDebug() << "";
|
||||
|
||||
ui->updateStatus->setPlainText(editText.trimmed());
|
||||
ui->updateStatus->setPlainText(editText);
|
||||
ui->updateStatus->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
||||
qInfo() << "REPL TEXT" << text << "SUFFIX" << suffix;
|
||||
|
||||
QString editText = ui->updateStatus->toPlainText();
|
||||
QStringList lines = editText.split('\n');
|
||||
if (lines.size() > 0) {
|
||||
lines.removeLast();
|
||||
if (!suffix.isNull() && suffix.size() > 0 && suffix != "\n") {
|
||||
lines += text.leftJustified(m_width-10) + suffix;
|
||||
} else {
|
||||
lines += text.leftJustified(m_width-10);
|
||||
}
|
||||
lines += text.leftJustified(m_width-10) + suffix;
|
||||
}
|
||||
|
||||
for (int i=0; i<lines.size(); ++i) {
|
||||
qInfo() << lines.at(i);
|
||||
} qInfo() << ""; qInfo() << "";
|
||||
qDebug() << lines.at(i);
|
||||
} qDebug() << ""; qDebug() << "";
|
||||
|
||||
ui->updateStatus->setText(lines.join('\n').trimmed());
|
||||
ui->updateStatus->setText(lines.join('\n'));
|
||||
ui->updateStatus->setEnabled(true);
|
||||
}
|
||||
void MainWindow::onShowErrorMessage(QString title, QString text) {
|
||||
text = text.leftJustified(50, ' ');
|
||||
QMessageBox msgBox(QMessageBox::NoIcon, title,
|
||||
text, QMessageBox::Ok,
|
||||
nullptr, Qt::FramelessWindowHint);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.setStyleSheet("QDialog {background-color: red;}"
|
||||
"QPushButton {background-color: blue;}");
|
||||
QTimer *t = new QTimer(this);
|
||||
connect(t, SIGNAL(timeout()), msgBox.defaultButton(), SLOT(click()));
|
||||
t->setSingleShot(true);
|
||||
t->start(5 * 1000);
|
||||
|
||||
if(msgBox.exec() == QMessageBox::Ok) {
|
||||
// do something
|
||||
} else {
|
||||
// do something else
|
||||
}
|
||||
disconnect(t, SIGNAL(timeout()), msgBox.defaultButton(), SLOT(click()));
|
||||
void MainWindow::onShowErrorMessage(QString title, QString text) {
|
||||
QMessageBox::critical(this, title, text, QMessageBox::Ok);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void onAppendText(QString, QString suffix = "");
|
||||
void onReplaceLast(QString, QString suffix = "");
|
||||
void onReplaceLast(QString, QString);
|
||||
void onShowErrorMessage(QString, QString);
|
||||
void onStopStartTimer();
|
||||
void onRestartExitTimer();
|
||||
|
@ -22,41 +22,114 @@
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<x>11</x>
|
||||
<y>11</y>
|
||||
<width>781</width>
|
||||
<height>461</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="start">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Terminus</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="exit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QProgressBar" name="updateProgress">
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="reserved_1">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3" colspan="3">
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="reserved_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QPushButton" name="reserved_3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QPushButton" name="reserved_4">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QPushButton" name="reserved_6">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7">
|
||||
<widget class="QPushButton" name="reserved_5">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="8">
|
||||
<widget class="QTextEdit" name="updateStatus">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Misc Fixed</family>
|
||||
<pointsize>11</pointsize>
|
||||
<family>Monospace</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="8">
|
||||
<widget class="QProgressBar" name="updateProgress">
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
73
update.cpp
73
update.cpp
@ -8,7 +8,6 @@
|
||||
#include <QDebug>
|
||||
#include <QTextStream>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
|
||||
//#include <iostream>
|
||||
//#include <fstream>
|
||||
@ -351,25 +350,21 @@ bool Update::downloadBinaryToDC(QString const &bFile) const {
|
||||
10 : bl_stopBL() // leave bl and start (the new) application
|
||||
*/
|
||||
bool Update::updateBinary(char const *fileToSendToDC) {
|
||||
qInfo() << "UPDATING DEVICE CONTROLLER BINARY" << fileToSendToDC;
|
||||
qInfo() << "updating device controller binary" << fileToSendToDC;
|
||||
QFile fn(fileToSendToDC);
|
||||
bool r;
|
||||
if ((r = fn.exists()) == true) {
|
||||
QFileInfo fi(fn);
|
||||
qInfo() << " UPDATING BINARY" << fi.fileName() << "(size=" << fi.size() << ")";
|
||||
if ((r = updateDC(fileToSendToDC)) == true) {
|
||||
qCritical() << QString(80, '*');
|
||||
qInfo() << " UPDATING BINARY" << fi.fileName() << "(size=" << fi.size() << ") DONE";
|
||||
qCritical() << QString(80, '*');
|
||||
QString const linkTarget = fn.symLinkTarget();
|
||||
QFileInfo fi(linkTarget);
|
||||
qInfo() << " updating binary (size=" << linkTarget << fi.size() << ")";
|
||||
if ((r = updateDC(linkTarget)) == true) {
|
||||
qInfo() << " updating binary (size=" << linkTarget << fi.size() << ") done";
|
||||
} else {
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << " UPDATING BINARY" << fi.fileName() << "(size=" << fi.size() << ") FAILED";
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "updating binary (size=" << linkTarget << fi.size() << ")... FAILED";
|
||||
}
|
||||
} else {
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << fileToSendToDC << "does not exist -> NO UPDATE OF DC FIRMWARE";
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "symlink" << fileToSendToDC
|
||||
<< "does not exist -> NO UPDATE OF DC FIRMWARE";
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -519,6 +514,7 @@ void Update::finished(int /*exitCode*/, QProcess::ExitStatus /*exitStatus*/) {
|
||||
}
|
||||
|
||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
|
||||
//
|
||||
// ACHTUNG !!!
|
||||
//
|
||||
@ -527,6 +523,11 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
bool serialOpened = false;
|
||||
bool serialOpen = false;
|
||||
|
||||
if (filesToWorkOn.size() == 0) {
|
||||
qCritical() << "NOTHING TO UPDATE";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!serialOpen) {
|
||||
if (!isSerialOpen()) { // open serial only if not already open
|
||||
if ((serialOpened = openSerial(baudrateMap.value(m_baudrate), m_baudrate, m_serialInterface)) == false) {
|
||||
@ -536,23 +537,18 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
}
|
||||
}
|
||||
serialOpen = true;
|
||||
qInfo() << "SERIAL OPEN" << m_serialInterface << "(BAUDRATE=" << m_baudrate << ")";
|
||||
qCritical() << "SERIAL OPEN" << m_serialInterface << "(BAUDRATE=" << m_baudrate << ")";
|
||||
}
|
||||
|
||||
bool res = false;
|
||||
QList<QString>::const_iterator it;
|
||||
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
||||
m_worker->startProgressLoop();
|
||||
bool res = false;
|
||||
QString fToWorkOn = (*it).trimmed();
|
||||
fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + fToWorkOn);
|
||||
|
||||
static const QRegularExpression version("^.*dc2c[.][0-9][0-9][.][0-9][0-9][.]bin.*$");
|
||||
if (fToWorkOn.contains(version)) {
|
||||
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "DO-UPDATE FILE-TO-WORK-ON" << fToWorkOn;
|
||||
qInfo() << QString(80, '*');
|
||||
if (fToWorkOn.contains("dc2c", Qt::CaseInsensitive) &&
|
||||
fToWorkOn.endsWith(".bin", Qt::CaseInsensitive)) {
|
||||
|
||||
qDebug() << "sending sw/hw-requests...";
|
||||
for (int i=0; i < 3; ++i) { // send explicit reuests to get
|
||||
// current SW/HW-versions
|
||||
m_hw->request_DC2_SWversion();
|
||||
@ -562,16 +558,12 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
|
||||
QString const hwVersion = m_hw->dc_getHWversion().toLower();
|
||||
QString const fwVersion = m_hw->dc_getSWversion().toLower();
|
||||
|
||||
qInfo() << "current dc-hardware-version" << hwVersion;
|
||||
qInfo() << "current dc-firmware-version" << fwVersion;
|
||||
|
||||
QFile fn(fToWorkOn);
|
||||
QFileInfo finfo(fn);
|
||||
if (!fn.exists()) { // check for broken link
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "FILE-TO-WORK-ON" << fn << "DOES NOT EXIST";
|
||||
qCritical() << QString(80, '*');
|
||||
QFileInfo linkTarget(fn.symLinkTarget());
|
||||
if (!linkTarget.exists()) { // check for broken link
|
||||
res = false;
|
||||
} else {
|
||||
if (false) {
|
||||
@ -582,12 +574,13 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
} else {
|
||||
res = true;
|
||||
|
||||
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC";
|
||||
qCritical() << "downloading" << fToWorkOn.trimmed() << "->"
|
||||
<< linkTarget.completeBaseName() << "to DC";
|
||||
#if UPDATE_DC == 1
|
||||
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||
QThread::sleep(1); // wait to be sure that there are no more
|
||||
// commands sent to dc-hardware
|
||||
qInfo() << "SET AUTO-REQUEST=FALSE";
|
||||
qDebug() << "SET AUTO-REQUEST=FALSE";
|
||||
|
||||
if ((res = updateBinary(fToWorkOn.toStdString().c_str())) == true) {
|
||||
qCritical() << "downloaded binary" << fToWorkOn;
|
||||
@ -598,13 +591,13 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
}
|
||||
|
||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||
qInfo() << "SET AUTO-REQUEST=TRUE";
|
||||
qInfo() << "WAIT 10 SECS TO RECEIVE RESPONSES...";
|
||||
qDebug() << "SET AUTO-REQUEST=TRUE";
|
||||
qDebug() << "WAIT 10 SECS TO RECEIVE RESPONSES...";
|
||||
|
||||
QThread::sleep(10); // wait to be sure that responses
|
||||
// have been received
|
||||
qInfo() << "updated dc-hardware-version" << m_hw->dc_getHWversion();
|
||||
qInfo() << "updated dc-firmware-version" << m_hw->dc_getSWversion();
|
||||
qCritical() << "updated dc-hardware-version" << m_hw->dc_getHWversion();
|
||||
qCritical() << "updated dc-firmware-version" << m_hw->dc_getSWversion();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -667,16 +660,10 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||
res = false;
|
||||
}
|
||||
m_worker->stopProgressLoop();
|
||||
m_worker->setProgress(100);
|
||||
|
||||
if (res == false) {
|
||||
break;
|
||||
}
|
||||
} // for (it = openLines.cbegin(); it != openLines.end(); ++it) {
|
||||
|
||||
m_hw->dc_autoRequest(true); // ALWAYS turn autoRequest ON
|
||||
qDebug() << "SET AUTO-REQUEST=TRUE";
|
||||
|
||||
return res;
|
||||
return true;
|
||||
}
|
||||
|
575
worker.cpp
575
worker.cpp
@ -69,8 +69,7 @@ Worker::Worker(hwinf *hw,
|
||||
, m_filesToUpdate()
|
||||
, m_updateProcessRunning(false)
|
||||
, m_returnCode(0)
|
||||
, m_progressValue(0)
|
||||
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
||||
, m_progressValue{0} {
|
||||
|
||||
QDir::setCurrent(m_workingDirectory);
|
||||
|
||||
@ -138,35 +137,42 @@ void Worker::update() {
|
||||
}
|
||||
|
||||
void Worker::privateUpdate() {
|
||||
QPushButton *start = qobject_cast<QPushButton *>(QObject::sender());
|
||||
start->setEnabled(false);
|
||||
|
||||
#if 0
|
||||
emit appendText("\nConnecting backend ...");
|
||||
|
||||
for (int i=0;i <= 100; ++i) {
|
||||
setProgress(i);
|
||||
QThread::msleep(100);
|
||||
}
|
||||
emit replaceLast("Connecting backend ...", UPDATE_STEP_OK);
|
||||
emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
||||
emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||
setProgress(0);
|
||||
|
||||
startProgressLoop();
|
||||
QThread::sleep(5); // long running process
|
||||
stopProgressLoop();
|
||||
for (int i=m_mainWindow->progressValue()/10; i <= 100; ++i) {
|
||||
setProgress(i);
|
||||
QThread::msleep(100);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
emit stopStartTimer();
|
||||
emit disableExit();
|
||||
m_updateProcessRunning = true;
|
||||
|
||||
bool sentIsmasLastVersionNotification = false;
|
||||
|
||||
//emit appendText("\nRestart APISM ...");
|
||||
//startProgressLoop();
|
||||
//Command c("systemctl restart apism");
|
||||
//if (c.execute("/tmp")) {
|
||||
// QThread::sleep(10); // give APISM some time to reconnect
|
||||
// stopProgressLoop();
|
||||
// emit replaceLast("Restart APISM ...", UPDATE_STEP_DONE);
|
||||
//} else {
|
||||
// stopProgressLoop();
|
||||
// emit replaceLast("Restart APISM ...", UPDATE_STEP_FAIL);
|
||||
//}
|
||||
|
||||
emit disableExit();
|
||||
|
||||
m_returnCode = -1;
|
||||
QDir customerRepository(m_customerRepository);
|
||||
if (!customerRepository.exists()) {
|
||||
emit appendText("\nInitializing customer environment ...");
|
||||
startProgressLoop();
|
||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||
stopProgressLoop();
|
||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
||||
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
emit appendText("\nInitializing customer environment", UPDATE_STEP_DONE);
|
||||
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_SUCCESS,
|
||||
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
||||
@ -176,110 +182,112 @@ void Worker::privateUpdate() {
|
||||
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
||||
m_updateStatus.m_statusDescription));
|
||||
|
||||
setProgress(progress + 10);
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSASucceeded(""));
|
||||
|
||||
emit appendText(QString(""), UPDATE_STEP_SUCCESS);
|
||||
|
||||
setProgress(100);
|
||||
m_ismasClient.setProgressInPercent(100);
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") + m_ismasClient.updateOfPSAActivated());
|
||||
|
||||
m_returnCode = 0;
|
||||
} else {
|
||||
stopProgressLoop();
|
||||
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
|
||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
||||
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE,
|
||||
QString("CLONE OR CHECKOUT FAILED: ") + m_customerRepository);
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.errorGitClone(100, m_updateStatus.m_statusDescription));
|
||||
|
||||
m_returnCode = -3;
|
||||
}
|
||||
} else {
|
||||
qInfo() << "CHECKOUT BRANCH...";
|
||||
emit appendText("\nInitializing customer environment ...");
|
||||
startProgressLoop();
|
||||
qCritical() << "CHECKOUT BRANCH...";
|
||||
// checkout branch
|
||||
if (m_gc.gitCheckoutBranch()) {
|
||||
stopProgressLoop();
|
||||
emit replaceLast("Initializing customer environment ...", UPDATE_STEP_DONE);
|
||||
setProgress(100);
|
||||
int progress = 10;
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
||||
QString("CHECKED OUT BRANCH: ") + m_gc.branchName());
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.checkoutBranch(
|
||||
m_updateStatus.m_statusDescription, ""));
|
||||
setProgress(progress);
|
||||
|
||||
m_ismasClient.setProgressInPercent(10);
|
||||
//m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
||||
// QString("CHECKED OUT BRANCH: ") + m_gc.branchName());
|
||||
//IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
// QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
// m_ismasClient.checkoutBranch(
|
||||
// m_updateStatus.m_statusDescription, ""));
|
||||
|
||||
qInfo() << "CHECKED OUT BRANCH";
|
||||
if (backendConnected()) {
|
||||
m_ismasClient.setProgressInPercent(20);
|
||||
if (updateTriggerSet()) {
|
||||
m_ismasClient.setProgressInPercent(30);
|
||||
if (customerEnvironment()) {
|
||||
m_ismasClient.setProgressInPercent(40);
|
||||
if (filesToUpdate()) {
|
||||
m_ismasClient.setProgressInPercent(50);
|
||||
if (updateFiles(50)) {
|
||||
m_ismasClient.setProgressInPercent(60);
|
||||
if (syncCustomerRepositoryAndFS()) {
|
||||
m_ismasClient.setProgressInPercent(70);
|
||||
if (sendIsmasLastVersionNotification()) {
|
||||
m_ismasClient.setProgressInPercent(80);
|
||||
qCritical() << "CHECKED OUT BRANCH";
|
||||
if (backendConnected()) { qCritical() << "BACKEND CONNECTED";
|
||||
progress = 20;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (updateTriggerSet()) { qCritical() << "UPDATE TRIGGER SET";
|
||||
progress = 30;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (customerEnvironment()) { qCritical() << "CUSTOMER ENVIRONMENT";
|
||||
progress = 40;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (filesToUpdate()) { qCritical() << "FILES TO UPDATE";
|
||||
progress = 50;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (updateFiles(progress)) { qCritical() << "UPDATE FILES";
|
||||
progress = 60;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (syncCustomerRepositoryAndFS()) { qCritical() << "SYNC REPOSITORY";
|
||||
progress = 70;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
if (sendIsmasLastVersionNotification()) { qCritical() << "SEND LAST NOTIFICATION";
|
||||
progress = 80;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
sentIsmasLastVersionNotification = true;
|
||||
if (saveLogFile()) {
|
||||
m_ismasClient.setProgressInPercent(90);
|
||||
if (saveLogFile()) { qCritical() << "SAVE LOG FILE";
|
||||
progress = 90;
|
||||
setProgress(progress);
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
emit appendText(QString("Update process "), UPDATE_STEP_SUCCESS);
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSASucceeded(""));
|
||||
|
||||
// mark update as activated -> this resets the WAIT button
|
||||
m_ismasClient.setProgressInPercent(95);
|
||||
progress = 100;
|
||||
setProgress(progress);
|
||||
|
||||
m_ismasClient.setProgressInPercent(progress);
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateOfPSAActivated());
|
||||
|
||||
m_returnCode = 0;
|
||||
} else {
|
||||
m_returnCode = -12;
|
||||
m_returnCode = -9;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -11;
|
||||
m_returnCode = -8;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -10;
|
||||
m_returnCode = -7;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -9;
|
||||
m_returnCode = -6;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -8;
|
||||
m_returnCode = -5;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -7;
|
||||
m_returnCode = -4;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -6;
|
||||
m_returnCode = -3;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -5;
|
||||
m_returnCode = -2;
|
||||
}
|
||||
} else {
|
||||
m_returnCode = -4;
|
||||
m_returnCode = -1;
|
||||
}
|
||||
}
|
||||
|
||||
setProgress(100);
|
||||
m_ismasClient.setProgressInPercent(100);
|
||||
|
||||
if (!sentIsmasLastVersionNotification) {
|
||||
@ -288,54 +296,37 @@ void Worker::privateUpdate() {
|
||||
}
|
||||
|
||||
if (m_returnCode != 0) {
|
||||
stopProgressLoop();
|
||||
emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||
} else {
|
||||
emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
||||
emit appendText(QString("Update process "), UPDATE_STEP_FAIL);
|
||||
}
|
||||
|
||||
setProgress(100);
|
||||
m_updateProcessRunning = false;
|
||||
emit enableExit();
|
||||
emit restartExitTimer();
|
||||
}
|
||||
|
||||
bool Worker::backendConnected() {
|
||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||
return true;
|
||||
}
|
||||
static int repeat = 0;
|
||||
|
||||
emit appendText("\nConnecting backend ...");
|
||||
|
||||
for (int repeat = 0; repeat < 50; ++repeat) {
|
||||
qInfo() << "REPEAT" << repeat << "In backendConnected() -> #M=APISM#C=REQ_SELF#J={}";
|
||||
startProgressLoop();
|
||||
if (repeat < 3) {
|
||||
qCritical() << "In backendConnected() -> #M=APISM#C=REQ_SELF#J={}";
|
||||
std::optional<QString> result
|
||||
= IsmasClient::sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_SELF#J={}");
|
||||
if (result) {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
|
||||
QString msg = result.value();
|
||||
qInfo() << "In backendConnected() -> APISM response" << msg;
|
||||
qCritical() << "In backendConnected() -> APISM response" << msg;
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):"
|
||||
<< parseError.error << parseError.errorString();
|
||||
emit replaceLast("Connecting backend ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
if (!document.isObject()) {
|
||||
qCritical() << "FILE IS NOT A JSON OBJECT!";
|
||||
emit replaceLast("Connecting backend ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
||||
setProgress(progress + 1);
|
||||
|
||||
QJsonObject obj = document.object();
|
||||
QStringList keys = obj.keys();
|
||||
for (QString const& key : keys ) {
|
||||
@ -345,36 +336,30 @@ bool Worker::backendConnected() {
|
||||
obj = v.toObject();
|
||||
bool ismas = obj.value("ISMAS").toBool();
|
||||
QString status = obj.value("Broker").toString();
|
||||
qInfo() << "REPEAT" << repeat << "In backendConnected() Broker=<"
|
||||
<< status << ">, ISMAS=<" << (ismas ? "true>" : "false>");
|
||||
|
||||
qCritical() << "In backendConnected() STATUS" << status;
|
||||
|
||||
if (ismas) {
|
||||
if (status == "Connected") {
|
||||
// do not send, as this would result in a corrupted wait button
|
||||
// but update the user-interface
|
||||
setProgress(100);
|
||||
emit replaceLast("Connecting backend ...", UPDATE_STEP_OK);
|
||||
emit appendText("\nBackend connected", UPDATE_STEP_OK);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
emit showErrorMessage("Check backend connection",
|
||||
QString ("REPEAT %1 Broker=<").arg(repeat)
|
||||
+ status + ">, ISMAS=<" + (ismas ? "true>" : "false>"));
|
||||
QThread::sleep(6);
|
||||
continue;
|
||||
if (status.startsWith("Connecting") || status.startsWith("Re-Connecting")) {
|
||||
QThread::sleep(1);
|
||||
++repeat;
|
||||
return backendConnected();
|
||||
}
|
||||
emit appendText("\nBackend connected", UPDATE_STEP_FAIL);
|
||||
emit showErrorMessage("Error", "Backend not available");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
}
|
||||
}
|
||||
|
||||
setProgress(100);
|
||||
|
||||
emit replaceLast("Connecting backend", UPDATE_STEP_FAIL);
|
||||
emit showErrorMessage("Error", "Backend not available");
|
||||
qCritical() << "In backendConnected() ERROR";
|
||||
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::BACKEND_NOT_CONNECTED,
|
||||
QString("NO BACKEND CONNECTION"));
|
||||
@ -386,283 +371,174 @@ bool Worker::backendConnected() {
|
||||
}
|
||||
|
||||
bool Worker::updateTriggerSet() {
|
||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||
return true;
|
||||
}
|
||||
// nmap -Pn 62.141.45.68 -p 8883
|
||||
// Host is up (0.053s latency).
|
||||
//
|
||||
// PORT STATE SERVICE
|
||||
// 8883/tcp open secure-mqtt
|
||||
|
||||
emit appendText("\nUpdate trigger set ...");
|
||||
QString triggerValue("");
|
||||
|
||||
for (int repeat = 0; repeat < 50; ++repeat) {
|
||||
startProgressLoop();
|
||||
if (std::optional<QString> result
|
||||
= IsmasClient::sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
if (std::optional<QString> result
|
||||
= IsmasClient::sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||
QString msg = result.value();
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):"
|
||||
<< parseError.error << parseError.errorString();
|
||||
emit showErrorMessage("check update trigger",
|
||||
QString("invalid json ") + msg.mid(0, 20));
|
||||
return false;
|
||||
}
|
||||
if (!document.isObject()) {
|
||||
qCritical() << "FILE IS NOT A JSON OBJECT!";
|
||||
emit showErrorMessage("check update trigger",
|
||||
QString("not a json object") + msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
QString msg = result.value();
|
||||
QJsonObject obj = document.object();
|
||||
// sanity check: cust_nr and machine_nr of PSA correct ?
|
||||
if (obj.contains("Dev_ID")) {
|
||||
QJsonValue v = obj.value("Dev_ID");
|
||||
if (v.isObject()) {
|
||||
QJsonObject obj = v.toObject();
|
||||
if (obj.contains("Custom_ID") && obj.contains("Device_ID")) {
|
||||
QJsonValue const c = obj.value("Custom_ID");
|
||||
QJsonValue const m = obj.value("Device_ID");
|
||||
int customerNr = c.toInt(-1);
|
||||
int machineNr = m.toInt(-1);
|
||||
if (customerNr != m_customerNr) {
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
||||
QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
||||
.arg(customerNr).arg(m_customerNr));
|
||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
||||
|
||||
qInfo() << "REPEAT" << repeat << "APISM RESPONSE" << msg;
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
m_updateStatus.m_statusDescription));
|
||||
return false;
|
||||
}
|
||||
if (machineNr != m_machineNr) {
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
||||
QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
||||
.arg(machineNr).arg(m_machineNr));
|
||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
||||
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):"
|
||||
<< parseError.error << parseError.errorString();
|
||||
emit showErrorMessage("check update trigger",
|
||||
QString("invalid json ") + msg.mid(0, 20));
|
||||
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
if (!document.isObject()) {
|
||||
qCritical() << "FILE IS NOT A JSON OBJECT!";
|
||||
emit showErrorMessage("check update trigger",
|
||||
QString("not a json object") + msg);
|
||||
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
||||
setProgress(progress + 1);
|
||||
|
||||
QJsonObject obj = document.object();
|
||||
// sanity check: cust_nr and machine_nr of PSA correct ?
|
||||
// note: this check has to be done here, as the cust_nr and the machine_nr
|
||||
// of the PSA are sent by ISMAS.
|
||||
if (obj.contains("Dev_ID")) {
|
||||
QJsonValue v = obj.value("Dev_ID");
|
||||
if (v.isObject()) {
|
||||
QJsonObject obj = v.toObject();
|
||||
if (obj.contains("Custom_ID") && obj.contains("Device_ID")) {
|
||||
QJsonValue const c = obj.value("Custom_ID");
|
||||
QJsonValue const m = obj.value("Device_ID");
|
||||
int customerNr = c.toInt(-1);
|
||||
int machineNr = m.toInt(-1);
|
||||
if (customerNr != m_customerNr) {
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
||||
QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
||||
.arg(customerNr).arg(m_customerNr));
|
||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
m_updateStatus.m_statusDescription));
|
||||
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
if (machineNr != m_machineNr) {
|
||||
setProgress(100);
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
|
||||
QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
||||
.arg(machineNr).arg(m_machineNr));
|
||||
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
m_updateStatus.m_statusDescription));
|
||||
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
m_updateStatus.m_statusDescription));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj.contains("Fileupload")) {
|
||||
QJsonValue v = obj.value("Fileupload");
|
||||
if (v.isObject()) {
|
||||
obj = v.toObject();
|
||||
if (obj.contains("TRG")) {
|
||||
v = obj.value("TRG");
|
||||
if (v.isString()) {
|
||||
triggerValue = v.toString();
|
||||
if (triggerValue == "WAIT") {
|
||||
emit appendText("\nUpdate trigger set", UPDATE_STEP_OK);
|
||||
|
||||
setProgress(progress + 1);
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_SET,
|
||||
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
||||
|
||||
if (obj.contains("Fileupload")) {
|
||||
QJsonValue v = obj.value("Fileupload");
|
||||
if (v.isObject()) {
|
||||
obj = v.toObject();
|
||||
if (obj.contains("TRG")) {
|
||||
v = obj.value("TRG");
|
||||
if (v.isString()) {
|
||||
triggerValue = v.toString();
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateTriggerSet(m_updateStatus.m_statusDescription, ""));
|
||||
|
||||
qInfo() << "REPEAT" << repeat
|
||||
<< "In updateTriggerSet() TRG value=<"
|
||||
<< triggerValue << ">";
|
||||
|
||||
if (triggerValue == "WAIT") {
|
||||
setProgress(100);
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_SET,
|
||||
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.updateTriggerSet(m_updateStatus.m_statusDescription, ""));
|
||||
|
||||
emit replaceLast("Update trigger set ...", UPDATE_STEP_OK);
|
||||
return true;
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger",
|
||||
QString ("TRG value=<") + triggerValue
|
||||
+ ">\n(reset download button?)");
|
||||
QThread::sleep(6);
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger",
|
||||
QString ("TRG key=<") + triggerValue
|
||||
+ ">\n(reset download button?)");
|
||||
}
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger", "TRG key not contained");
|
||||
}
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger", "Fileupload not a json-object");
|
||||
emit showErrorMessage("check update trigger", "TRG key not contained");
|
||||
}
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger", "Fileupload not a json-object");
|
||||
}
|
||||
|
||||
if (obj.contains("error")) {
|
||||
QString value = obj.value("error").toString();
|
||||
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
||||
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
||||
<< value << ">";
|
||||
}
|
||||
} else {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
emit showErrorMessage("check update trigger", "no ISMAS response");
|
||||
QThread::sleep(6);
|
||||
}
|
||||
} else {
|
||||
emit showErrorMessage("check update trigger", "no ISMAS response");
|
||||
}
|
||||
|
||||
setProgress(100);
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_NOT_SET_OR_WRONG,
|
||||
QString("UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") +
|
||||
triggerValue + ")");
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.errorUpdateTrigger(m_updateStatus.m_statusDescription, ""));
|
||||
|
||||
emit replaceLast("Update trigger set ...", UPDATE_STEP_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Worker::customerEnvironment() {
|
||||
emit appendText("\nPrepare customer environment ...");
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
startProgressLoop();
|
||||
if (m_gc.gitCheckoutBranch()) {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
|
||||
emit appendText("\nPrepare customer environment", UPDATE_STEP_DONE);
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
||||
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
||||
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
m_ismasClient.checkoutBranch(m_updateStatus.m_statusDescription, ""));
|
||||
|
||||
setProgress(100);
|
||||
emit replaceLast("Prepare customer environment ...", UPDATE_STEP_DONE);
|
||||
qInfo() << "PREPARE CUSTOMER ENVIRONMENT DONE";
|
||||
return true;
|
||||
} else {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
emit showErrorMessage("cust-env",
|
||||
QString("Checkout ") + m_customerRepository + " failed");
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "CHECKOUT OF" << m_customerRepository << "FAILED";
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
} else {
|
||||
emit showErrorMessage("cust-env", m_customerRepository + " does not exist");
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << m_customerRepository << "DOES NOT EXIST";
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
|
||||
setProgress(100);
|
||||
emit replaceLast("Prepare customer environment ...", UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Worker::filesToUpdate() {
|
||||
emit appendText("\nFetch changes files ...");
|
||||
startProgressLoop();
|
||||
if (std::optional<QString> changes = m_gc.gitFetch()) {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress);
|
||||
|
||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_FETCH_UPDATES,
|
||||
QString("FETCHING OF ") + m_customerRepositoryPath +
|
||||
QString(" INTO ") + m_customerRepository);
|
||||
|
||||
setProgress(progress + 10);
|
||||
if (std::optional<QStringList> changedFileNames = m_gc.gitDiff(changes.value())) {
|
||||
setProgress(progress + 20);
|
||||
m_filesToUpdate = changedFileNames.value();
|
||||
int const size = m_filesToUpdate.size();
|
||||
if (size > 1) {
|
||||
emit appendText(QString("\nFound %1 files to update ").arg(size), UPDATE_STEP_DONE);
|
||||
} else {
|
||||
emit appendText(QString("\nFound 1 file to update "), UPDATE_STEP_DONE);
|
||||
}
|
||||
if (m_gc.gitPull()) {
|
||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_DONE);
|
||||
m_filesToUpdate = changedFileNames.value();
|
||||
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "FILES-TO-UPDATE" << m_filesToUpdate;
|
||||
qInfo() << QString(80, '*');
|
||||
|
||||
int const size = m_filesToUpdate.size();
|
||||
if (size > 1) {
|
||||
emit appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
emit appendText(QString("\n ") + m_filesToUpdate.at(i));
|
||||
}
|
||||
} else {
|
||||
emit appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
||||
emit appendText(QString("\n ") + m_filesToUpdate.at(0));
|
||||
}
|
||||
emit appendText(QString("\nFetch changes files "), UPDATE_STEP_DONE);
|
||||
return true;
|
||||
}
|
||||
emit showErrorMessage("files to update", "pulling files failed");
|
||||
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "PULLING FILES FAILED";
|
||||
qCritical() << QString(80, '*');
|
||||
|
||||
} else {
|
||||
emit showErrorMessage("files to update", "no files to update (checked-in any files?)");
|
||||
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "NO FILES TO UPDATE (CHECKED IN ANY FILES?)";
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
setProgress(progress + 30);
|
||||
} else {
|
||||
stopProgressLoop();
|
||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||
setProgress(progress + 30);
|
||||
|
||||
emit showErrorMessage("files to update",
|
||||
QString("no changes in ") + m_customerRepository +
|
||||
" (checked-in any files?)");
|
||||
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "NO CHANGES IN" << m_customerRepository << "(CHECKED IN ANY FILES?)";
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
|
||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
||||
setProgress(100);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Worker::updateFiles(quint8 percent) {
|
||||
QStringList filesToDownload;
|
||||
m_displayIndex = 0;
|
||||
|
||||
startProgressLoop();
|
||||
for (int i = 0; i < m_filesToUpdate.size(); ++i) {
|
||||
QString fName = m_filesToUpdate.at(i);
|
||||
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "FNAME" << fName;
|
||||
qInfo() << QString(80, '*');
|
||||
|
||||
if (fName.contains("opkg_commands", Qt::CaseInsensitive)) {
|
||||
emit appendText("\n( ) Update opkg pakets ...");
|
||||
// execute opkg commands
|
||||
if (QDir::setCurrent(m_customerRepository)) {
|
||||
QFile f(fName);
|
||||
@ -690,12 +566,8 @@ bool Worker::updateFiles(quint8 percent) {
|
||||
f.close();
|
||||
if (cmdCount > 0) {
|
||||
m_displayIndex = 1;
|
||||
emit replaceLast(QString("(") + QString("%1").arg(m_displayIndex).rightJustified(2, ' ') + QString(")")
|
||||
+ QString(" Update opkg pakets ... "), UPDATE_STEP_DONE);
|
||||
} else {
|
||||
m_displayIndex = 1;
|
||||
emit replaceLast(QString("(") + QString("%1").arg(m_displayIndex).rightJustified(2, ' ') + QString(")")
|
||||
+ QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
|
||||
emit appendText(QString("\n(") + QString("%1").arg(m_displayIndex).rightJustified(2, ' ') + QString(")")
|
||||
+ QString(" Update opkg pakets "), UPDATE_STEP_DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -703,39 +575,22 @@ bool Worker::updateFiles(quint8 percent) {
|
||||
} else
|
||||
if (fName.contains("print", Qt::CaseInsensitive)) {
|
||||
filesToDownload << fName; // download printer-config-files
|
||||
} else {
|
||||
static const QRegularExpression version("^.*dc2c[.][0-9][0-9][.][0-9][0-9][.]bin.*$");
|
||||
if (fName.contains(version)) {
|
||||
filesToDownload << fName; // download device controller
|
||||
}
|
||||
} else
|
||||
if (fName == "dc2c.bin") {
|
||||
filesToDownload << fName; // download device controller
|
||||
}
|
||||
}
|
||||
|
||||
stopProgressLoop();
|
||||
setProgress(100);
|
||||
bool ret = true;
|
||||
|
||||
if (filesToDownload.size() > 0) {
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "FILES_TO_WORK_ON" << filesToDownload;
|
||||
qInfo() << QString(80, '*');
|
||||
ret = m_update->doUpdate(m_displayIndex, filesToDownload);
|
||||
} else {
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "NO FILES_TO_WORK_ON";
|
||||
qInfo() << QString(80, '*');
|
||||
qCritical() << "FILES_TO_WORK_ON" << filesToDownload;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return m_update->doUpdate(m_displayIndex, filesToDownload);
|
||||
}
|
||||
|
||||
bool Worker::syncCustomerRepositoryAndFS() {
|
||||
setProgress(0);
|
||||
emit appendText("\nSync customer environment with filesystem ...");
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
if (QDir::setCurrent(m_customerRepository)) {
|
||||
int progress = 10;
|
||||
setProgress(progress);
|
||||
QString const params("-vv "
|
||||
"--recursive "
|
||||
"--progress "
|
||||
@ -752,37 +607,29 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
||||
QString cmd;
|
||||
bool error = false;
|
||||
foreach (cmd, cmds) {
|
||||
progress += 5;
|
||||
setProgress(progress);
|
||||
if (!error) {
|
||||
Command c("bash");
|
||||
qInfo() << "EXECUTING CMD..." << cmd;
|
||||
if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) {
|
||||
QStringList result = c.getCommandResult().split('\n');
|
||||
for (int i = 0; i < result.size(); ++i) {
|
||||
qInfo() << result.at(i);
|
||||
qCritical() << result.at(i);
|
||||
}
|
||||
qInfo() << "SUCCESS";
|
||||
qCritical() << "SUCCESS";
|
||||
} else {
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "CMD" << cmd << "FAILED";
|
||||
qCritical() << c.getCommandResult().split('\n');
|
||||
qCritical() << QString(80, '*');
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
progress += 5;
|
||||
setProgress(progress);
|
||||
if (!error) {
|
||||
setProgress(100);
|
||||
emit replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_DONE);
|
||||
emit appendText(QString("\nSync customer environment with filesystem "),
|
||||
UPDATE_STEP_DONE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
setProgress(100);
|
||||
emit replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -790,7 +637,7 @@ bool Worker::sendIsmasLastVersionNotification() {
|
||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_SENDVERSION#J=") +
|
||||
m_ismasClient.updateOfPSASendVersion(getPSAInstalled()));
|
||||
emit appendText(QString("Send last version info "), UPDATE_STEP_DONE);
|
||||
emit appendText(QString("\nSend last version info "), UPDATE_STEP_DONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -889,11 +736,9 @@ bool Worker::executeOpkgCommand(QString opkgCommand) {
|
||||
.arg(c.getCommandResult()));
|
||||
return true;
|
||||
} else {
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE,
|
||||
QString("EXECUTE OPKG COMMAND %1 FAILED")
|
||||
.arg(opkgCommand));
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
5
worker.h
5
worker.h
@ -127,7 +127,6 @@ class Worker : public QObject {
|
||||
|
||||
MainWindow *m_mainWindow;
|
||||
int m_progressValue;
|
||||
bool m_withoutIsmasDirectPort;
|
||||
|
||||
bool executeOpkgCommand(QString opkgCommand);
|
||||
QString getOsVersion() const;
|
||||
@ -160,8 +159,6 @@ public:
|
||||
|
||||
void setMainWindow(MainWindow *mainWindow) { m_mainWindow = mainWindow; }
|
||||
void setProgress(int progress);
|
||||
void startProgressLoop();
|
||||
void stopProgressLoop();
|
||||
|
||||
IsmasClient &getIsmasClient() { return m_ismasClient; }
|
||||
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
||||
@ -208,6 +205,8 @@ private:
|
||||
PSAInstalled getPSAInstalled();
|
||||
QString sendCmdSendVersionToIsmas();
|
||||
void privateUpdate();
|
||||
void startProgressLoop();
|
||||
void stopProgressLoop();
|
||||
};
|
||||
|
||||
#endif // WORKER_H_INCLUDED
|
||||
|
Loading…
x
Reference in New Issue
Block a user