Compare commits
37 Commits
1.3.5
...
4e7ce2cd70
Author | SHA1 | Date | |
---|---|---|---|
4e7ce2cd70 | |||
47fac31223 | |||
0d353cfbcf | |||
bdcb073bf8 | |||
226553a8ab | |||
d4ee56559b | |||
355b28ba40 | |||
edeff35d7e | |||
09d5de1b0b | |||
145fdab26e | |||
89d1ec5b21 | |||
f38c975dc6 | |||
fba007aa35 | |||
8b6adb3ea7 | |||
30603317c6 | |||
7083f3b4f8 | |||
7ff866525e | |||
2164037123 | |||
2e7d33c4c8 | |||
2a2751f6f3 | |||
2764ef4371 | |||
9783f343e1 | |||
8c6f0dfcc7 | |||
d688ad3d5c | |||
7b3f652b0e | |||
4cc42b2a65 | |||
d783fd7fb6 | |||
e0a0ff54e1 | |||
863d052a21 | |||
61b3d29e31 | |||
cac4f7249e | |||
3223c430be | |||
c09682ea33 | |||
fef1d43d5f | |||
705424727b | |||
b96f0896e3 | |||
a3967c76ac |
@@ -15,39 +15,53 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# In order to do so, uncomment the following line.
|
# In order to do so, uncomment the following line.
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
VERSION=1.3.5
|
|
||||||
|
# 1.3.6 : Do not update device-controller/json files, but have the library
|
||||||
|
# (in a later step) do that.
|
||||||
|
# Fixed sending messages to ISMAS.
|
||||||
|
# Always execute contents of opkg_commands-file (even if there are no
|
||||||
|
# changes).
|
||||||
|
# 1.3.7 : Wait forever for git-commands to finish in QProcess executing such
|
||||||
|
# a command.
|
||||||
|
# 1.3.8 : Remove accessing opkg_commands under file-system-path /etc/psa_update.
|
||||||
|
# Activate download of json-configuration files.
|
||||||
|
# 1.3.9 : Fix sendLastVersion: use configured branch and not master branch in
|
||||||
|
# git show origin/master -s --format="c=%h m=%s d=%cI" ==>
|
||||||
|
# git show origin/zg1/zone1 -s --format="c=%h m=%s d=%cI"
|
||||||
|
# Use dynamic values for os-release and apism-version when sending
|
||||||
|
# last version info.
|
||||||
|
# 1.3.10: Fix premature killing opkg-commands: detected timeout of 100s was
|
||||||
|
# too small when updating apism.
|
||||||
|
# Fix display of UPDATE_SUCCESS when opkg_command fails. Detected when
|
||||||
|
# updating apsim failed.
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
BUILD_DATE=$$system("date /t")
|
||||||
|
BUILD_TIME=$$system("time /t")
|
||||||
|
} else {
|
||||||
|
BUILD_DATE=$$system("date +%d-%m-%y")
|
||||||
|
BUILD_TIME=$$system("date +%H:%M:%S")
|
||||||
|
}
|
||||||
|
|
||||||
|
VERSION="1.3.10"
|
||||||
|
|
||||||
INCLUDEPATH += plugins
|
INCLUDEPATH += plugins
|
||||||
|
|
||||||
CONFIG += c++17 console
|
CONFIG += c++17
|
||||||
# CONFIG -= app_bundle
|
# CONFIG -= app_bundle
|
||||||
|
|
||||||
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
||||||
|
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
||||||
|
DEFINES+=APP_BUILD_TIME=\\\"$$BUILD_TIME\\\"
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -g
|
QMAKE_CXXFLAGS += -g
|
||||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
|
|
||||||
# custom target for 'git subtree'
|
|
||||||
# subtree.target = subtree
|
|
||||||
# subtree.commands = git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
|
|
||||||
# subtree.depends =
|
|
||||||
# QMAKE_EXTRA_UNIX_TARGETS += subtree
|
|
||||||
|
|
||||||
# ! exists(DCPlugin) {
|
|
||||||
# $$system("git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash")
|
|
||||||
# } else {
|
|
||||||
# $$system("git subtree pull --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash")
|
|
||||||
# }
|
|
||||||
|
|
||||||
# You can make your code fail to compile if it uses deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
|
|
||||||
contains( CONFIG, PTU5 ) {
|
contains( CONFIG, PTU5 ) {
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
lessThan(QT_MAJOR_VERSION, 5): PKGCONFIG += qextserialport
|
lessThan(QT_MAJOR_VERSION, 5): PKGCONFIG += qextserialport
|
||||||
QMAKE_CXXFLAGS += -std=c++17 # for GCC >= 4.7
|
QMAKE_CXXFLAGS += -O2 -std=c++17 # for GCC >= 4.7
|
||||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
DEFINES+=PTU5
|
DEFINES+=PTU5
|
||||||
@@ -107,18 +121,6 @@ HEADERS += \
|
|||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
|
||||||
OTHER_FILES += \
|
|
||||||
/opt/app/tools/atbupdate/update_log.csv \
|
|
||||||
main.cpp.bck \
|
|
||||||
main.cpp.bck2 \
|
|
||||||
main.cpp.bck3
|
|
||||||
|
|
||||||
# https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
|
|
||||||
# git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
|
|
||||||
# git subtree pull --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
|
|
||||||
# include(./DCPlugin/DCPlugin.pri)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# for running program on target through QtCreator
|
# for running program on target through QtCreator
|
||||||
|
@@ -114,16 +114,14 @@ bool GitClient::gitCloneAndCheckoutBranch() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList GitClient::gitShowReason() {
|
QStringList GitClient::gitShowReason(QString branchName) {
|
||||||
QStringList lst;
|
QStringList lst;
|
||||||
if (QDir(m_customerRepository).exists()) {
|
if (QDir(m_customerRepository).exists()) {
|
||||||
// %h: commit (short form)
|
// %h: commit (short form)
|
||||||
// %s: commit message
|
// %s: commit message
|
||||||
// %cI: commit date, strict ISO 8601 format
|
// %cI: commit date, strict ISO 8601 format
|
||||||
// Note: use master branch. By convention, there is a ChangeLog file
|
// Note: branch with branchName has to exist: format zg1/zone1
|
||||||
// in the root of the repository, which has to be always the last file
|
Command c(QString("git show origin/%1 -s --format=\"c=%h m=%s d=%cI\"").arg(branchName));
|
||||||
// to be checked in when the customer repository somehow changed.
|
|
||||||
Command c("git show origin/master -s --format=\"c=%h m=%s d=%cI\"");
|
|
||||||
if (c.execute(m_customerRepository)) {
|
if (c.execute(m_customerRepository)) {
|
||||||
QString const s = c.getCommandResult().trimmed();
|
QString const s = c.getCommandResult().trimmed();
|
||||||
int const c = s.indexOf("c=");
|
int const c = s.indexOf("c=");
|
||||||
@@ -271,8 +269,8 @@ std::optional<QString> GitClient::gitFetch() {
|
|||||||
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
|
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
|
// emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
|
||||||
Utils::printCriticalErrorMsg("EMPTY RESULT FOR 'GIT FETCH'");
|
Utils::printInfoMsg("EMPTY RESULT FOR 'GIT FETCH'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -50,7 +50,7 @@ class GitClient : public QObject {
|
|||||||
std::optional<QStringList> gitMerge();
|
std::optional<QStringList> gitMerge();
|
||||||
|
|
||||||
QString gitLastCommit(QString fileName);
|
QString gitLastCommit(QString fileName);
|
||||||
QStringList gitShowReason();
|
QStringList gitShowReason(QString branchName);
|
||||||
static QString gitBlob(QString fileName);
|
static QString gitBlob(QString fileName);
|
||||||
QString gitCommitForBlob(QString blob);
|
QString gitCommitForBlob(QString blob);
|
||||||
bool gitIsFileTracked(QString file2name);
|
bool gitIsFileTracked(QString file2name);
|
||||||
|
@@ -23,6 +23,15 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
########################
|
||||||
|
# Spec vom 27.10.2023:
|
||||||
|
# U0010 -> %-Werte
|
||||||
|
# U0001 -> 100%
|
||||||
|
# U0003 -> "FAIL"
|
||||||
|
# U0002 -> "" (OK -> WAIT state reset)
|
||||||
|
# ISMAS -> "WAIT"
|
||||||
|
########################
|
||||||
|
#
|
||||||
# $1: EVENT: U0001 update finished: 100%
|
# $1: EVENT: U0001 update finished: 100%
|
||||||
# U0002 reset TRG
|
# U0002 reset TRG
|
||||||
# U0003 error
|
# U0003 error
|
||||||
@@ -857,7 +866,14 @@ QString IsmasClient::jsonParseFailed(int resultCode, QString reason, QString con
|
|||||||
version.toStdString().c_str());
|
version.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QString> IsmasClient::finalResult(int resultCode, QString reason, QString const &version) {
|
std::optional<QString> IsmasClient::finalResult(int resultCode,
|
||||||
|
QString reason,
|
||||||
|
QString const &version) {
|
||||||
|
Q_UNUSED(resultCode);
|
||||||
|
Q_UNUSED(reason);
|
||||||
|
Q_UNUSED(version);
|
||||||
|
|
||||||
|
/*
|
||||||
m_progressInPercent = 100;
|
m_progressInPercent = 100;
|
||||||
if (resultCode == RESULT_CODE::SUCCESS) {
|
if (resultCode == RESULT_CODE::SUCCESS) {
|
||||||
return updateNewsToIsmas("U0002",
|
return updateNewsToIsmas("U0002",
|
||||||
@@ -875,6 +891,7 @@ std::optional<QString> IsmasClient::finalResult(int resultCode, QString reason,
|
|||||||
reason.toStdString().c_str(),
|
reason.toStdString().c_str(),
|
||||||
version.toStdString().c_str());
|
version.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
main.cpp
3
main.cpp
@@ -180,8 +180,7 @@ int main(int argc, char *argv[]) {
|
|||||||
worker.setMainWindow(&mw);
|
worker.setMainWindow(&mw);
|
||||||
|
|
||||||
mw.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
mw.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||||
mw.setWindowState(Qt::WindowFullScreen);
|
mw.showFullScreen();
|
||||||
mw.show();
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -125,10 +126,11 @@ MainWindow::MainWindow(hwinf *hw, Worker *worker, Update *update, QWidget *paren
|
|||||||
QString start = QDateTime::currentDateTime().toString(Qt::ISODate);
|
QString start = QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||||
lst << QString("Start: ") + start.leftJustified(m_width-10);
|
lst << QString("Start: ") + start.leftJustified(m_width-10);
|
||||||
lst << QString("").leftJustified(m_width-3, '=');
|
lst << QString("").leftJustified(m_width-3, '=');
|
||||||
lst << QString("Machine number : %1 ").arg(m_worker->machineNr()).leftJustified(m_width-3);
|
lst << QString("Update tool version: %1 - %2 %3").arg(APP_VERSION).arg(APP_BUILD_DATE).arg(APP_BUILD_TIME).leftJustified(m_width-3);
|
||||||
lst << QString("Customer number : %1 ").arg(m_worker->customerNr()).leftJustified(m_width-3);
|
lst << QString("Machine number : %1 ").arg(m_worker->machineNr()).leftJustified(m_width-3);
|
||||||
lst << QString("Zone number : %1 (%2)").arg(m_worker->zoneNr()).arg(Utils::zoneName(m_worker->zoneNr())).leftJustified(m_width-3);
|
lst << QString("Customer number : %1 ").arg(m_worker->customerNr()).leftJustified(m_width-3);
|
||||||
lst << QString("APISM version : %1").arg(m_worker->apismVersion()).leftJustified(m_width-3);
|
lst << QString("Zone number : %1 (%2)").arg(m_worker->zoneNr()).arg(Utils::zoneName(m_worker->zoneNr())).leftJustified(m_width-3);
|
||||||
|
lst << QString("APISM version : %1").arg(m_worker->apismVersion()).leftJustified(m_width-3);
|
||||||
lst << QString("").leftJustified(m_width-3, '=');
|
lst << QString("").leftJustified(m_width-3, '=');
|
||||||
|
|
||||||
ui->updateStatus->setText(lst.join('\n'));
|
ui->updateStatus->setText(lst.join('\n'));
|
||||||
@@ -319,7 +321,8 @@ void MainWindow::onRestartExitTimer() {
|
|||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
m_exitTimer->start(60 * 1000);
|
m_exitTimer->start(60 * 1000);
|
||||||
|
|
||||||
// ui->updateStatus->blockSignals(true);
|
scrollDownTextEdit();
|
||||||
|
ui->updateStatus->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onQuit() {
|
void MainWindow::onQuit() {
|
||||||
@@ -329,8 +332,8 @@ void MainWindow::onQuit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::scrollDownTextEdit() {
|
void MainWindow::scrollDownTextEdit() {
|
||||||
Utils::printInfoMsg(QString("SCROLL-DOWN-TEXT_EDIT CALLED AT ")
|
// Utils::printInfoMsg(QString("SCROLL-DOWN-TEXT_EDIT CALLED AT ")
|
||||||
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
ui->updateStatus->setEnabled(true);
|
ui->updateStatus->setEnabled(true);
|
||||||
|
|
||||||
@@ -341,10 +344,12 @@ void MainWindow::scrollDownTextEdit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAppendText(QString text, QString suffix) {
|
void MainWindow::onAppendText(QString text, QString suffix) {
|
||||||
Utils::printInfoMsg(QString("ON APPEND CALLED AT ")
|
// Utils::printInfoMsg(QString("ON APPEND CALLED AT ")
|
||||||
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
|
scrollDownTextEdit();
|
||||||
|
|
||||||
if (!suffix.isNull() && suffix.size() > 0) {
|
if (!suffix.isNull() && suffix.size() > 0) {
|
||||||
//qInfo() << "TEXT" << text << "SUFFIX" << suffix;
|
//qInfo() << "TEXT" << text << "SUFFIX" << suffix;
|
||||||
if (suffix == Worker::UPDATE_STEP_SUCCESS || suffix == Worker::UPDATE_STEP_FAIL) {
|
if (suffix == Worker::UPDATE_STEP_SUCCESS || suffix == Worker::UPDATE_STEP_FAIL) {
|
||||||
@@ -366,12 +371,12 @@ void MainWindow::onAppendText(QString text, QString suffix) {
|
|||||||
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
||||||
// ui->updateStatus->setText(editText.trimmed());
|
// ui->updateStatus->setText(editText.trimmed());
|
||||||
|
|
||||||
scrollDownTextEdit();
|
// scrollDownTextEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
||||||
Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
// Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
||||||
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
int const s = newTextLines.size();
|
int const s = newTextLines.size();
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
@@ -405,8 +410,8 @@ void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
||||||
Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
// Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
||||||
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
||||||
|
@@ -69,7 +69,14 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
|||||||
qDebug() << "PROCESS" << m_command << "STARTED IN" << p->workingDirectory();
|
qDebug() << "PROCESS" << m_command << "STARTED IN" << p->workingDirectory();
|
||||||
if (p->state() == QProcess::ProcessState::Running) {
|
if (p->state() == QProcess::ProcessState::Running) {
|
||||||
qDebug() << "PROCESS" << m_command << "RUNNING IN" << p->workingDirectory();
|
qDebug() << "PROCESS" << m_command << "RUNNING IN" << p->workingDirectory();
|
||||||
if (p->waitForFinished(m_waitForFinishTimeout)) {
|
// wait forever for git/opkg-commands to finish
|
||||||
|
int wait = m_waitForFinishTimeout;
|
||||||
|
if (m_command.trimmed().startsWith("git", Qt::CaseInsensitive) ||
|
||||||
|
m_command.trimmed().startsWith("opkg", Qt::CaseInsensitive)) {
|
||||||
|
wait = -1;
|
||||||
|
}
|
||||||
|
bool const no_timeout = p->waitForFinished(wait);
|
||||||
|
if (no_timeout) {
|
||||||
qDebug() << "PROCESS" << m_command << "FINISHED IN" << p->workingDirectory();
|
qDebug() << "PROCESS" << m_command << "FINISHED IN" << p->workingDirectory();
|
||||||
if (p->exitStatus() == QProcess::NormalExit) {
|
if (p->exitStatus() == QProcess::NormalExit) {
|
||||||
if ((m_exitCode = p->exitCode()) == 0) {
|
if ((m_exitCode = p->exitCode()) == 0) {
|
||||||
@@ -89,8 +96,8 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "PROCESS" << m_command
|
qCritical() << "PROCESS" << m_command
|
||||||
<< "DID NOT FINISH"
|
<< "DID NOT FINISH WITH" << wait
|
||||||
<< "IN" << p->workingDirectory();
|
<< "MS IN" << p->workingDirectory();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "WRONG PROCESS STATE" << p->state()
|
qCritical() << "WRONG PROCESS STATE" << p->state()
|
||||||
|
131
update.cpp
131
update.cpp
@@ -29,11 +29,7 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#define UPDATE_OPKG (1)
|
#define UPDATE_OPKG (1)
|
||||||
#define UPDATE_DC (1)
|
#define UPDATE_DC (0)
|
||||||
#define UPDATE_PRINTER_TEMPLATES (1)
|
|
||||||
#define UPDATE_CASH_TEMPLATE (1)
|
|
||||||
#define UPDATE_CONF_TEMPLATE (1)
|
|
||||||
#define UPDATE_DEVICE_TEMPLATE (1)
|
|
||||||
|
|
||||||
static const QMap<QString, int> baudrateMap = {
|
static const QMap<QString, int> baudrateMap = {
|
||||||
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
||||||
@@ -610,9 +606,12 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|||||||
int templateIdx,
|
int templateIdx,
|
||||||
QString jsFileToSendToDC) const {
|
QString jsFileToSendToDC) const {
|
||||||
|
|
||||||
qDebug() << "updating json-file:" << jsFileToSendToDC << "...";
|
|
||||||
qDebug() << " template-index:" << templateIdx;
|
Utils::printInfoMsg(
|
||||||
qDebug() << " json-type:" << jsonType(type);
|
QString("UPDATING JSON-FILE=%1, TEMPLATE-INDEX=%2, JSON-TYPE=%3")
|
||||||
|
.arg(jsFileToSendToDC)
|
||||||
|
.arg(templateIdx)
|
||||||
|
.arg(jsonType(type)));
|
||||||
|
|
||||||
m_hw->dc_autoRequest(true); // downloading Json needs the AutoEmission flag
|
m_hw->dc_autoRequest(true); // downloading Json needs the AutoEmission flag
|
||||||
qDebug() << "SET AUTO-REQUEST=TRUE";
|
qDebug() << "SET AUTO-REQUEST=TRUE";
|
||||||
@@ -623,7 +622,7 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|||||||
while ((ready = m_hw->sys_ready4sending()) == false) {
|
while ((ready = m_hw->sys_ready4sending()) == false) {
|
||||||
QThread::msleep(200);
|
QThread::msleep(200);
|
||||||
if (--nTry <= 0) {
|
if (--nTry <= 0) {
|
||||||
qCritical() << "SYS NOT READY FOR SENDING AFTER 5 SECONDS";
|
Utils::printCriticalErrorMsg("SYS NOT READY FOR SENDING AFTER 5 SECONDS");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -636,22 +635,27 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
if (fi.size() <= 800) {
|
if (fi.size() <= 800) {
|
||||||
QByteArray ba = file.readAll();
|
QByteArray ba = file.readAll();
|
||||||
|
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
|
||||||
|
// nrOfTemplate=1...32 if kindOfFile==6
|
||||||
|
// content = content of the Json file, max 800byte ascii signs
|
||||||
if (m_hw->sys_sendJsonFileToDc((uint8_t)(type),
|
if (m_hw->sys_sendJsonFileToDc((uint8_t)(type),
|
||||||
templateIdx,
|
templateIdx,
|
||||||
(uint8_t *)ba.data())) {
|
(uint8_t *)ba.data())) {
|
||||||
QThread::sleep(1);
|
QThread::sleep(1);
|
||||||
qDebug() << "SENT" << jsFileToSendToDC;
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "SIZE OF" << jsFileToSendToDC
|
Utils::printCriticalErrorMsg(
|
||||||
<< "TOO BIG (" << fi.size() << "BYTES)";
|
QString("SIZE OF %1 TOO BIG (%2 BYTES)")
|
||||||
|
.arg(jsFileToSendToDC).arg(fi.size()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "CANNOT OPEN" << jsFileToSendToDC << "FOR READING";
|
Utils::printCriticalErrorMsg(
|
||||||
|
QString("CAN NOT OPEN ") + jsFileToSendToDC + " FOR READING");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << jsFileToSendToDC << "DOES NOT EXIST";
|
Utils::printCriticalErrorMsg(
|
||||||
|
QString(jsFileToSendToDC) + " DOES NOT EXIST");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,64 +742,13 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||||
bool serialOpened = false;
|
// always assume that serial line is open
|
||||||
|
|
||||||
QString const &parentName = Utils::getParentName();
|
|
||||||
|
|
||||||
Utils::printInfoMsg(
|
|
||||||
QString("PARENT OF ATB-UPDATE-TOOL (ppid=%1) ").arg(getppid()) + parentName);
|
|
||||||
|
|
||||||
if (parentName == "ATBQT" || parentName == "systemd") {
|
|
||||||
// the tool was not called during 'service' ot during an automatic
|
|
||||||
// update procedure. and it was called explicitly with libCAmaster.so
|
|
||||||
if (m_pluginName.contains("master", Qt::CaseInsensitive)) {
|
|
||||||
Utils::printCriticalErrorMsg(parentName
|
|
||||||
+ " IS MASTER, BUT ATB-UPDATE-TOOL CALLED WITH libCAmaster.so");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Utils::printInfoMsg(
|
|
||||||
QString("ATB-UPDATE-TOOL STARTED AS SLAVE OF ") + parentName);
|
|
||||||
} else
|
|
||||||
if (Utils::isATBQTRunning()) { // manual testing
|
|
||||||
if (m_pluginName.contains("master", Qt::CaseInsensitive)) {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
"ATBQT IS MASTER, BUT ATB-UPDATE-TOOL CALLED WITH libCAmaster.so");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Utils::printInfoMsg(
|
|
||||||
"ATB-UPDATE-TOOL STARTED AS SLAVE-SIBLING OF ATBQT-MASTER");
|
|
||||||
} else {
|
|
||||||
if (m_pluginName.contains("slave", Qt::CaseInsensitive)) {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
"ATB-UPDATE-TOOL CALLED WITH libCAslave.so ALTHOUGH MASTER");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Utils::printInfoMsg("ATB-UPDATE-TOOL STARTED AS MASTER");
|
|
||||||
|
|
||||||
if ((serialOpened = openSerial(baudrateMap.value(m_baudrate),
|
|
||||||
m_baudrate,
|
|
||||||
m_serialInterface)) == false) {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
QString("CANNOT OPEN ")
|
|
||||||
+ m_serialInterface
|
|
||||||
+ "( BAUDRATE=" + m_baudrate + ")");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hw->dc_autoRequest(false);
|
|
||||||
|
|
||||||
Utils::printInfoMsg(
|
|
||||||
QString("SERIAL OPEN ") + m_serialInterface
|
|
||||||
+ " (BAUDRATE=" + m_baudrate + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
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 fToWorkOn = (*it).trimmed();
|
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
||||||
fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + fToWorkOn);
|
#if UPDATE_DC == 1
|
||||||
|
|
||||||
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)) {
|
||||||
Utils::printInfoMsg("DO-UPDATE FILE-TO-WORK-ON " + fToWorkOn);
|
Utils::printInfoMsg("DO-UPDATE FILE-TO-WORK-ON " + fToWorkOn);
|
||||||
@@ -810,7 +763,6 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
bool updateBinaryRes = true;
|
bool updateBinaryRes = true;
|
||||||
|
|
||||||
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC";
|
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC";
|
||||||
#if UPDATE_DC == 1
|
|
||||||
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||||
QThread::sleep(1); // wait to be sure that there are no more
|
QThread::sleep(1); // wait to be sure that there are no more
|
||||||
// commands sent to dc-hardware
|
// commands sent to dc-hardware
|
||||||
@@ -837,13 +789,12 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
res = updateBinaryRes;
|
res = updateBinaryRes;
|
||||||
}
|
}
|
||||||
} else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
#endif
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||||
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
res = true;
|
res = true;
|
||||||
#if UPDATE_PRINTER_TEMPLATES == 1
|
|
||||||
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
||||||
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
||||||
if ((templateIdx < 1) || (templateIdx > 32)) {
|
if ((templateIdx < 1) || (templateIdx > 32)) {
|
||||||
@@ -851,50 +802,46 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
res = false;
|
res = false;
|
||||||
} else {
|
} else {
|
||||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||||
qInfo() << "downloaded printer template"<< fToWorkOn;
|
Utils::printInfoMsg(
|
||||||
|
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||||
|
.arg(fToWorkOn)
|
||||||
|
.arg(templateIdx));
|
||||||
++displayIndex;
|
++displayIndex;
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
Worker::UPDATE_STEP_DONE);
|
Worker::UPDATE_STEP_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
res = true;
|
res = true;
|
||||||
#if UPDATE_CASH_TEMPLATE == 1
|
|
||||||
if ((res = updateCashConf(fToWorkOn))) {
|
if ((res = updateCashConf(fToWorkOn))) {
|
||||||
qInfo() << "downloaded cash template"<< fToWorkOn;
|
Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
|
||||||
++displayIndex;
|
++displayIndex;
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
Worker::UPDATE_STEP_DONE);
|
Worker::UPDATE_STEP_DONE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
res = true;
|
res = true;
|
||||||
#if UPDATE_CONF_TEMPLATE == 1
|
|
||||||
if ((res= updateConfig(fToWorkOn))) {
|
if ((res= updateConfig(fToWorkOn))) {
|
||||||
qInfo() << "downloaded config template"<< fToWorkOn;
|
Utils::printInfoMsg(QString("DOWNLOADED CONFIG TEMPLATE %1").arg(fToWorkOn));
|
||||||
++displayIndex;
|
++displayIndex;
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
Worker::UPDATE_STEP_DONE);
|
Worker::UPDATE_STEP_DONE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
res = true;
|
res = true;
|
||||||
#if UPDATE_DEVICE_TEMPLATE == 1
|
|
||||||
if ((res = updateDeviceConf(fToWorkOn))) {
|
if ((res = updateDeviceConf(fToWorkOn))) {
|
||||||
qInfo() << "downloaded device template"<< fToWorkOn;
|
Utils::printInfoMsg(QString("DOWNLOADED DEVICE TEMPLATE %1").arg(fToWorkOn));
|
||||||
++displayIndex;
|
++displayIndex;
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
Worker::UPDATE_STEP_DONE);
|
Worker::UPDATE_STEP_DONE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||||
res = false;
|
res = false;
|
||||||
@@ -907,12 +854,8 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
}
|
}
|
||||||
} // for (it = openLines.cbegin(); it != openLines.end(); ++it) {
|
} // for (it = openLines.cbegin(); it != openLines.end(); ++it) {
|
||||||
|
|
||||||
//m_hw->dc_autoRequest(true); // ALWAYS turn autoRequest ON
|
m_hw->dc_autoRequest(true); // ALWAYS turn autoRequest ON
|
||||||
//qDebug() << "SET AUTO-REQUEST=TRUE";
|
qDebug() << "SET AUTO-REQUEST=TRUE";
|
||||||
|
|
||||||
if (serialOpened) {
|
|
||||||
m_hw->dc_closeSerial();
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
228
worker.cpp
228
worker.cpp
@@ -88,6 +88,7 @@ Worker::Worker(int customerNr,
|
|||||||
m_apismVersion = v.value();
|
m_apismVersion = v.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::printInfoMsg("STARTING PTU-UPDATE");
|
||||||
qInfo() << "CURRENT TIME ..............." << QDateTime::currentDateTime().toString(Qt::ISODate);
|
qInfo() << "CURRENT TIME ..............." << QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||||
qInfo() << "OS VERSION ................." << m_osVersion;
|
qInfo() << "OS VERSION ................." << m_osVersion;
|
||||||
qInfo() << "ATBQT VERSION .............." << m_atbqtVersion;
|
qInfo() << "ATBQT VERSION .............." << m_atbqtVersion;
|
||||||
@@ -170,8 +171,7 @@ void Worker::privateUpdate() {
|
|||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
||||||
|
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(5);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
||||||
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
||||||
@@ -181,7 +181,7 @@ void Worker::privateUpdate() {
|
|||||||
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
|
|
||||||
setProgress(progress + 10);
|
setProgress(10);
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
@@ -195,9 +195,7 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = 0;
|
m_returnCode = 0;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
|
setProgress(0);
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
@@ -210,11 +208,9 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = -3;
|
m_returnCode = -3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_ismasClient.setProgressInPercent(10);
|
if (updateTriggerSet(5)) {
|
||||||
if (updateTriggerSet()) {
|
if (customerEnvironment(30)) {
|
||||||
m_ismasClient.setProgressInPercent(20);
|
m_ismasClient.setProgressInPercent(50);
|
||||||
if (customerEnvironment()) {
|
|
||||||
m_ismasClient.setProgressInPercent(30);
|
|
||||||
if (filesToUpdate()) {
|
if (filesToUpdate()) {
|
||||||
// send message to ISMAS about files which have been
|
// send message to ISMAS about files which have been
|
||||||
// checked in into git repository
|
// checked in into git repository
|
||||||
@@ -224,23 +220,19 @@ void Worker::privateUpdate() {
|
|||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAContinues("CHECK-FILES-TO-UPDATE",
|
m_ismasClient.updateOfPSAContinues("CHECK-FILES-TO-UPDATE",
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
m_ismasClient.setProgressInPercent(40);
|
if (updateFiles(60)) {
|
||||||
if (updateFiles(50)) {
|
m_ismasClient.setProgressInPercent(70);
|
||||||
m_ismasClient.setProgressInPercent(50);
|
|
||||||
if (syncCustomerRepositoryAndFS()) {
|
if (syncCustomerRepositoryAndFS()) {
|
||||||
m_ismasClient.setProgressInPercent(60);
|
m_ismasClient.setProgressInPercent(80);
|
||||||
if (sendIsmasLastVersionNotification()) {
|
if (sendIsmasLastVersionNotification()) {
|
||||||
m_ismasClient.setProgressInPercent(70);
|
m_ismasClient.setProgressInPercent(90);
|
||||||
sentIsmasLastVersionNotification = true;
|
sentIsmasLastVersionNotification = true;
|
||||||
if (saveLogFile()) {
|
if (saveLogFile()) {
|
||||||
m_ismasClient.setProgressInPercent(80);
|
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSASucceeded(""));
|
m_ismasClient.updateOfPSASucceeded(""));
|
||||||
|
|
||||||
// mark update as activated -> this resets the WAIT button
|
// mark update as activated -> this resets the WAIT button
|
||||||
m_ismasClient.setProgressInPercent(95);
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAActivated());
|
m_ismasClient.updateOfPSAActivated());
|
||||||
@@ -325,13 +317,14 @@ void Worker::privateUpdate() {
|
|||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE,
|
// m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE,
|
||||||
QString("Update process failed"));
|
// QString("Update process failed"));
|
||||||
if (std::optional<QString> s = m_ismasClient.finalResult(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
// if (std::optional<QString> s = m_ismasClient.finalResult(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
m_updateStatus.m_statusDescription)) {
|
// m_updateStatus.m_statusDescription)) {
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
// IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") + s.value());
|
// QString("#M=APISM#C=CMD_EVENT#J=") + s.value());
|
||||||
}
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
||||||
|
|
||||||
@@ -414,7 +407,7 @@ std::optional<QString> Worker::getApismVersion() {
|
|||||||
|
|
||||||
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
||||||
|
|
||||||
bool Worker::updateTriggerSet() {
|
bool Worker::updateTriggerSet(int progress) {
|
||||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -450,8 +443,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
= IsmasClient::sendRequestReceiveResponse(
|
= IsmasClient::sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
QString msg = result.value();
|
QString msg = result.value();
|
||||||
|
|
||||||
@@ -490,15 +482,13 @@ bool Worker::updateTriggerSet() {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
QJsonObject obj = document.object();
|
QJsonObject obj = document.object();
|
||||||
|
|
||||||
// always look for an 'error' first
|
// always look for an 'error' first
|
||||||
if (obj.contains("error")) {
|
if (obj.contains("error")) {
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
QString value = obj.value("error").toString();
|
QString value = obj.value("error").toString();
|
||||||
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
||||||
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
||||||
@@ -583,8 +573,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
if (obj.contains("Fileupload")) {
|
if (obj.contains("Fileupload")) {
|
||||||
QJsonValue v = obj.value("Fileupload");
|
QJsonValue v = obj.value("Fileupload");
|
||||||
@@ -602,11 +591,17 @@ bool Worker::updateTriggerSet() {
|
|||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
||||||
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
||||||
.arg(m_machineNr).arg(m_customerNr));
|
.arg(m_machineNr).arg(m_customerNr));
|
||||||
|
|
||||||
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
|
|
||||||
|
progress += 5;
|
||||||
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
||||||
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
@@ -618,9 +613,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
progress += 1;
|
|
||||||
setProgress(progress);
|
|
||||||
emit showErrorMessage("check update trigger", "empty update-trigger");
|
emit showErrorMessage("check update trigger", "empty update-trigger");
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
@@ -675,9 +668,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
progress += 1;
|
|
||||||
setProgress(progress);
|
|
||||||
emit showErrorMessage("check update trigger", "no ISMAS response");
|
emit showErrorMessage("check update trigger", "no ISMAS response");
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
}
|
}
|
||||||
@@ -695,14 +686,14 @@ bool Worker::updateTriggerSet() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::customerEnvironment() {
|
bool Worker::customerEnvironment(int progress) {
|
||||||
emit appendText("\nPrepare customer environment ...");
|
emit appendText("\nPrepare customer environment ...");
|
||||||
if (QDir(m_customerRepository).exists()) {
|
if (QDir(m_customerRepository).exists()) {
|
||||||
startProgressLoop();
|
startProgressLoop();
|
||||||
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
if (m_gc.gitCheckoutBranch()) {
|
if (m_gc.gitCheckoutBranch()) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
||||||
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
||||||
@@ -717,8 +708,8 @@ bool Worker::customerEnvironment() {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
m_ismasClient.setProgressInPercent(0);
|
||||||
setProgress(progress);
|
|
||||||
emit showErrorMessage("cust-env",
|
emit showErrorMessage("cust-env",
|
||||||
QString("Checkout ") + m_customerRepository + " failed");
|
QString("Checkout ") + m_customerRepository + " failed");
|
||||||
Utils::printCriticalErrorMsg(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
Utils::printCriticalErrorMsg(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
||||||
@@ -736,6 +727,10 @@ bool Worker::customerEnvironment() {
|
|||||||
bool Worker::filesToUpdate() {
|
bool Worker::filesToUpdate() {
|
||||||
emit appendText("\nFetch changes files ...");
|
emit appendText("\nFetch changes files ...");
|
||||||
startProgressLoop();
|
startProgressLoop();
|
||||||
|
|
||||||
|
// always execute contents of opkg_commands-file
|
||||||
|
m_filesToUpdate << "etc/psa_update/opkg_commands";
|
||||||
|
|
||||||
if (std::optional<QString> changes = m_gc.gitFetch()) {
|
if (std::optional<QString> changes = m_gc.gitFetch()) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
@@ -750,47 +745,38 @@ bool Worker::filesToUpdate() {
|
|||||||
setProgress(progress + 20);
|
setProgress(progress + 20);
|
||||||
if (m_gc.gitPull()) {
|
if (m_gc.gitPull()) {
|
||||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_DONE);
|
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_DONE);
|
||||||
m_filesToUpdate = changedFileNames.value();
|
m_filesToUpdate << changedFileNames.value();
|
||||||
|
} else {
|
||||||
|
emit showErrorMessage("files to update", "pulling files failed");
|
||||||
|
Utils::printCriticalErrorMsg("PULLING FILES FAILED");
|
||||||
|
|
||||||
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
int const size = m_filesToUpdate.size();
|
stopProgressLoop();
|
||||||
if (size > 1) {
|
setProgress(100);
|
||||||
emit appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
|
||||||
for (int i = 0; i < size; ++i) {
|
return false;
|
||||||
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));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
emit showErrorMessage("files to update", "pulling files failed");
|
|
||||||
Utils::printCriticalErrorMsg("PULLING FILES FAILED");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
emit showErrorMessage("files to update", "no files to update (checked-in any files?)");
|
|
||||||
Utils::printCriticalErrorMsg("NO FILES TO UPDATE (CHECKED IN ANY FILES?)");
|
|
||||||
}
|
}
|
||||||
setProgress(progress + 30);
|
|
||||||
} else {
|
|
||||||
stopProgressLoop();
|
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
|
||||||
setProgress(progress + 30);
|
|
||||||
|
|
||||||
emit showErrorMessage("files to update",
|
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
||||||
QString("no changes in ") + m_customerRepository +
|
|
||||||
" (checked-in any files?)");
|
|
||||||
|
|
||||||
Utils::printCriticalErrorMsg("NO CHANGES IN "
|
m_filesToUpdate.removeDuplicates();
|
||||||
+ m_customerRepository
|
int const size = m_filesToUpdate.size();
|
||||||
+ " (CHECKED IN ANY FILES?)");
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
setProgress(progress + 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
return true;
|
||||||
setProgress(100);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::updateFiles(quint8 percent) {
|
bool Worker::updateFiles(quint8 percent) {
|
||||||
@@ -809,45 +795,56 @@ bool Worker::updateFiles(quint8 percent) {
|
|||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
if (f.open(QIODevice::ReadOnly)) {
|
if (f.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream in(&f);
|
QTextStream in(&f);
|
||||||
int cmdCount = 0;
|
|
||||||
QStringList opkgCommands;
|
QStringList opkgCommands;
|
||||||
|
bool executeOpkgCommandFailed = false;
|
||||||
while (!in.atEnd()) {
|
while (!in.atEnd()) {
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
static const QRegularExpression comment("^\\s*#.*$");
|
static const QRegularExpression comment("^\\s*#.*$");
|
||||||
if (line.indexOf(comment, 0) == -1) {
|
if (line.indexOf(comment, 0) == -1) {
|
||||||
// found opkg command
|
// found opkg command
|
||||||
QString opkgCommand = line.trimmed();
|
QString opkgCommand = line.trimmed();
|
||||||
++cmdCount;
|
if (!executeOpkgCommand(opkgCommand)) {
|
||||||
executeOpkgCommand(opkgCommand);
|
executeOpkgCommandFailed = true;
|
||||||
QString cmd = "\n " + opkgCommand;
|
} else {
|
||||||
emit appendText(cmd);
|
QString cmd = "\n " + opkgCommand;
|
||||||
opkgCommands << cmd;
|
emit appendText(cmd);
|
||||||
|
opkgCommands << cmd;
|
||||||
|
|
||||||
m_ismasClient.setProgressInPercent(++percent);
|
m_ismasClient.setProgressInPercent(++percent);
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND,
|
||||||
QString("EXEC OPKG-COMMAND ") + opkgCommand);
|
QString("EXEC OPKG-COMMAND ") + opkgCommand);
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.execOpkgCommand(m_updateStatus.m_statusDescription, ""));
|
m_ismasClient.execOpkgCommand(m_updateStatus.m_statusDescription, ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.close();
|
f.close();
|
||||||
if (cmdCount > 0) {
|
if (!executeOpkgCommandFailed) {
|
||||||
m_displayIndex = 1;
|
if (opkgCommands.size() > 0) {
|
||||||
QString prepend = QString("(") + QString("%1").arg(m_displayIndex).rightJustified(2, ' ') + QString(")")
|
m_displayIndex = 1;
|
||||||
+ QString(" Update opkg pakets ... ");
|
QString prepend = QString("(") + QString("%1").arg(m_displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
opkgCommands.prepend(prepend);
|
+ QString(" Update opkg pakets ... ");
|
||||||
emit replaceLast(opkgCommands, UPDATE_STEP_DONE);
|
opkgCommands.prepend(prepend);
|
||||||
|
emit replaceLast(opkgCommands, UPDATE_STEP_DONE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_displayIndex = 1;
|
m_displayIndex = 1;
|
||||||
emit replaceLast(QString("(") + QString("%1").arg(m_displayIndex).rightJustified(2, ' ') + QString(")")
|
emit replaceLast(QString("(") + QString("%1").arg(m_displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
+ QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
|
+ QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
|
stopProgressLoop();
|
||||||
|
setProgress(100);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (fName.contains("print", Qt::CaseInsensitive)) {
|
if (fName.contains("DC2C_print", Qt::CaseInsensitive) ||
|
||||||
|
fName.contains("DC2C_device", Qt::CaseInsensitive) ||
|
||||||
|
fName.contains("DC2C_conf", Qt::CaseInsensitive) ||
|
||||||
|
fName.contains("DC2C_cash", Qt::CaseInsensitive)) {
|
||||||
filesToDownload << fName; // download printer-config-files
|
filesToDownload << fName; // download printer-config-files
|
||||||
} else {
|
} else {
|
||||||
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.*$");
|
||||||
@@ -866,6 +863,8 @@ bool Worker::updateFiles(quint8 percent) {
|
|||||||
Update *update = m_mainWindow->getUpdate();
|
Update *update = m_mainWindow->getUpdate();
|
||||||
if (update) {
|
if (update) {
|
||||||
return update->doUpdate(m_displayIndex, filesToDownload);
|
return update->doUpdate(m_displayIndex, filesToDownload);
|
||||||
|
} else {
|
||||||
|
Utils::printCriticalErrorMsg("UPDATE NOT SET");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Utils::printCriticalErrorMsg("NO FILES_TO_DOWNLOAD_TO_PSA_HW");
|
Utils::printCriticalErrorMsg("NO FILES_TO_DOWNLOAD_TO_PSA_HW");
|
||||||
@@ -882,7 +881,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
if (QDir::setCurrent(m_customerRepository)) {
|
if (QDir::setCurrent(m_customerRepository)) {
|
||||||
Command md("bash");
|
Command md("bash");
|
||||||
if (!md.execute(m_customerRepository,
|
if (!md.execute(m_customerRepository,
|
||||||
QStringList() << "-c" << "mkdir -p /etc/psa_config /etc/psa_update /etc/dc /etc/psa_tariff")) {
|
QStringList() << "-c" << "mkdir -p /etc/psa_config /etc/dc /etc/psa_tariff")) {
|
||||||
qCritical() << "COULD NOT EXECUTE '" << md.command() << "' exitCode=(" << md.exitCode() << ")";
|
qCritical() << "COULD NOT EXECUTE '" << md.command() << "' exitCode=(" << md.exitCode() << ")";
|
||||||
}
|
}
|
||||||
int progress = 10;
|
int progress = 10;
|
||||||
@@ -894,11 +893,17 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
"--exclude=.* "
|
"--exclude=.* "
|
||||||
"--include=*.bin "
|
"--include=*.bin "
|
||||||
"--include=*.json "
|
"--include=*.json "
|
||||||
"--include=opkg_commands "
|
|
||||||
"--include=*.ini");
|
"--include=*.ini");
|
||||||
QStringList cmds;
|
QStringList cmds;
|
||||||
cmds << QString("rsync ") + params.simplified() + " etc/ /etc";
|
|
||||||
cmds << QString("rsync ") + params.simplified() + " opt/ /opt";
|
if (QDir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/")).exists()) {
|
||||||
|
cmds << QString("rsync ") + params.simplified() + " etc/ /etc";
|
||||||
|
Utils::printInfoMsg(QString("CONFIGURED SYNCING TO /ETC"));
|
||||||
|
}
|
||||||
|
if (QDir(QDir::cleanPath(m_customerRepository + QDir::separator() + "opt/")).exists()) {
|
||||||
|
cmds << QString("rsync ") + params.simplified() + " opt/ /opt";
|
||||||
|
Utils::printInfoMsg(QString("CONFIGURED SYNCING TO /OPT"));
|
||||||
|
}
|
||||||
|
|
||||||
QString cmd;
|
QString cmd;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
@@ -908,6 +913,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
Command c("bash");
|
Command c("bash");
|
||||||
qInfo() << "EXECUTING CMD..." << cmd;
|
qInfo() << "EXECUTING CMD..." << cmd;
|
||||||
|
Utils::printInfoMsg(QString("EXECUTING CMD %1...").arg(cmd));
|
||||||
if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) {
|
if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) {
|
||||||
QStringList result = c.getCommandResult().split('\n');
|
QStringList result = c.getCommandResult().split('\n');
|
||||||
QString const &p1 = "send_files mapped ";
|
QString const &p1 = "send_files mapped ";
|
||||||
@@ -1082,9 +1088,7 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
QString printSysDir("/etc/psa_config");
|
QString printSysDir("/etc/psa_config");
|
||||||
QString tariffSysDir("/etc/psa_tariff");
|
QString tariffSysDir("/etc/psa_tariff");
|
||||||
QString tariffRepoDir("etc/psa_tariff");
|
QString tariffRepoDir("etc/psa_tariff");
|
||||||
QString opkgSysDir("/etc/psa_update");
|
|
||||||
QString opkgRepoDir("etc/psa_update");
|
QString opkgRepoDir("etc/psa_update");
|
||||||
QString const &absPathNameOpkg = QDir::cleanPath(opkgSysDir + QDir::separator() + "opkg_commands");
|
|
||||||
QString const &absPathNameRepositoryOpkg = QDir::cleanPath(opkgRepoDir + QDir::separator() + "opkg_commands");
|
QString const &absPathNameRepositoryOpkg = QDir::cleanPath(opkgRepoDir + QDir::separator() + "opkg_commands");
|
||||||
QString absPathName;
|
QString absPathName;
|
||||||
QString absPathNameRepository;
|
QString absPathNameRepository;
|
||||||
@@ -1093,7 +1097,7 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
psaInstalled.versionInfo.reason = "";
|
psaInstalled.versionInfo.reason = "";
|
||||||
psaInstalled.versionInfo.created = "";
|
psaInstalled.versionInfo.created = "";
|
||||||
|
|
||||||
QStringList versionInfo = m_gc.gitShowReason();
|
QStringList versionInfo = m_gc.gitShowReason(m_branchName);
|
||||||
if (versionInfo.size() == 3) {
|
if (versionInfo.size() == 3) {
|
||||||
psaInstalled.versionInfo.lastCommit = versionInfo.at(0);
|
psaInstalled.versionInfo.lastCommit = versionInfo.at(0);
|
||||||
psaInstalled.versionInfo.reason = versionInfo.at(1);
|
psaInstalled.versionInfo.reason = versionInfo.at(1);
|
||||||
@@ -1115,12 +1119,12 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
psaInstalled.tariff.info = "N/A";
|
psaInstalled.tariff.info = "N/A";
|
||||||
psaInstalled.tariff.version = "N/A";
|
psaInstalled.tariff.version = "N/A";
|
||||||
|
|
||||||
psaInstalled.hw.linuxVersion = m_osVersion;
|
psaInstalled.hw.linuxVersion = getOsVersion();
|
||||||
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
||||||
|
|
||||||
psaInstalled.opkg.blob = m_gc.gitBlob(absPathNameOpkg);
|
psaInstalled.opkg.blob = m_gc.gitBlob(absPathNameRepositoryOpkg);
|
||||||
psaInstalled.opkg.size = getFileSize(absPathNameOpkg);
|
psaInstalled.opkg.size = getFileSize(absPathNameRepositoryOpkg);
|
||||||
psaInstalled.opkg.loadTime = Utils::getTariffLoadTime(absPathNameOpkg);
|
psaInstalled.opkg.loadTime = Utils::getTariffLoadTime(absPathNameRepositoryOpkg);
|
||||||
psaInstalled.opkg.lastCommit = m_gc.gitLastCommit(absPathNameRepositoryOpkg);
|
psaInstalled.opkg.lastCommit = m_gc.gitLastCommit(absPathNameRepositoryOpkg);
|
||||||
|
|
||||||
psaInstalled.dc.versionHW = deviceControllerVersionHW;
|
psaInstalled.dc.versionHW = deviceControllerVersionHW;
|
||||||
@@ -1129,7 +1133,9 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
psaInstalled.dc.gitLastCommit = "N/A";
|
psaInstalled.dc.gitLastCommit = "N/A";
|
||||||
psaInstalled.dc.size = -1;
|
psaInstalled.dc.size = -1;
|
||||||
|
|
||||||
psaInstalled.sw.apismVersion = m_apismVersion;
|
if (std::optional<QString> v = getApismVersion()) {
|
||||||
|
psaInstalled.sw.apismVersion = v.value();
|
||||||
|
}
|
||||||
psaInstalled.sw.atbQTVersion = m_atbqtVersion;
|
psaInstalled.sw.atbQTVersion = m_atbqtVersion;
|
||||||
|
|
||||||
psaInstalled.pluginVersion.deviceController = m_pluginVersionATBDeciceController;
|
psaInstalled.pluginVersion.deviceController = m_pluginVersionATBDeciceController;
|
||||||
|
4
worker.h
4
worker.h
@@ -190,8 +190,8 @@ public slots:
|
|||||||
void update();
|
void update();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
bool updateTriggerSet();
|
bool updateTriggerSet(int progress);
|
||||||
bool customerEnvironment();
|
bool customerEnvironment(int progress);
|
||||||
bool filesToUpdate();
|
bool filesToUpdate();
|
||||||
bool updateFiles(quint8 percent);
|
bool updateFiles(quint8 percent);
|
||||||
bool syncCustomerRepositoryAndFS();
|
bool syncCustomerRepositoryAndFS();
|
||||||
|
Reference in New Issue
Block a user