Compare commits
69 Commits
1.3.5
...
81c5f8ee7e
Author | SHA1 | Date | |
---|---|---|---|
81c5f8ee7e | |||
29e6a25e72 | |||
5abc057bda | |||
8aeb7ecfea | |||
4bb8e241b6 | |||
4469a23f9c | |||
d1f795e2db | |||
6865056f4b | |||
37bd5c90d3 | |||
fcba120dfa | |||
1d4f50fb9f | |||
a78040a037 | |||
9b175d7789 | |||
2d7f145a25 | |||
4589c4ca76 | |||
a32258a59e | |||
22f25e5251 | |||
258d883a51 | |||
504e242d42 | |||
731cdcbe09 | |||
b4e2d4c54a | |||
42961dea40 | |||
fd2f601f67 | |||
b45af505cd | |||
2dfe80b654 | |||
4b9dcc5e99 | |||
53639b55c9 | |||
3a83efbd3f | |||
c9d6a8d245 | |||
91db59b9f3 | |||
1d81e6b650 | |||
6d57b45d1a | |||
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,67 @@ 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.
|
||||||
|
# 1.3.11: Integrate version of ATBUpdateTool in SendLastVersion-ISMAS-message.
|
||||||
|
# 1.3.12: Add command parameters for output of yocto-infos about ATBUpdateTool.
|
||||||
|
# Use 'git pull' instead of 'git fetch'.
|
||||||
|
# Use 'git clone --filter=blob:none' instead of 'git clone' to speed
|
||||||
|
# up cloning of customer repository.
|
||||||
|
# 1.3.13: Fix: if the customer repository is corrupted, remove it and re-clone
|
||||||
|
# the repository (without checking the ISMAS-trigger (WAIT-)button.
|
||||||
|
# 1.3.14: Add additional check for sanity of customer repository using
|
||||||
|
# "git fsck".
|
||||||
|
# Stream-lined code of update process.
|
||||||
|
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
|
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
||||||
|
|
||||||
|
VERSION="1.3.11"
|
||||||
|
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||||
|
|
||||||
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\\\"
|
||||||
|
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
||||||
|
|
||||||
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 +135,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
|
||||||
|
@@ -26,29 +26,93 @@ GitClient::GitClient(QString const &customerNrStr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::gitCloneCustomerRepository() {
|
bool GitClient::gitCloneCustomerRepository() {
|
||||||
QString gitCommand("git clone ");
|
/* Blobless clone
|
||||||
|
==============
|
||||||
|
|
||||||
|
When using the --filter=blob:none option, the initial git clone will
|
||||||
|
download all reachable commits and trees, and only download the blobs
|
||||||
|
for commits when you do a git checkout. This includes the first checkout
|
||||||
|
inside the git clone operation.
|
||||||
|
|
||||||
|
The important thing to notice is that we have a copy of every blob at
|
||||||
|
HEAD but the blobs in the history are not present. If your repository
|
||||||
|
has a deep history full of large blobs, then this option can
|
||||||
|
significantly reduce your git clone times. The commit and tree data is
|
||||||
|
still present, so any subsequent git checkout only needs to download
|
||||||
|
the missing blobs. The Git client knows how to batch these requests to
|
||||||
|
ask the server only for the missing blobs.
|
||||||
|
|
||||||
|
Further, when running git fetch in a blobless clone, the server only
|
||||||
|
sends the new commits and trees. The new blobs are downloaded only
|
||||||
|
after a git checkout. Note that git pull runs git fetch and then git
|
||||||
|
merge, so it will download the necessary blobs during the git merge
|
||||||
|
command.
|
||||||
|
|
||||||
|
When using a blobless clone, you will trigger a blob download whenever
|
||||||
|
you need the contents of a file, but you will not need one if you only
|
||||||
|
need the OID (object-id) of a file. This means that git log can detect
|
||||||
|
which commits changed a given path without needing to download extra
|
||||||
|
data.
|
||||||
|
|
||||||
|
This means that blobless clones can perform commands like git
|
||||||
|
merge-base, git log, or even git log -- <path> with the same performance
|
||||||
|
as a full clone.
|
||||||
|
|
||||||
|
Commands like git diff or git blame <path> require the contents of the
|
||||||
|
paths to compute diffs, so these will trigger blob downloads the first
|
||||||
|
time they are run. However, the good news is that after that you will
|
||||||
|
have those blobs in your repository and do not need to download them a
|
||||||
|
second time. Most developers only need to run git blame on a small
|
||||||
|
number of files, so this tradeoff of a slightly slower git blame command
|
||||||
|
is worth the faster clone and fetch times.
|
||||||
|
|
||||||
|
Note: git v2.18 does not support treeless clones: --filter=tree:0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Note: for some reason it is necessary to pass "--progress ---v",
|
||||||
|
// otherwise QProcess returns an error of 128 = 0x80 for the command.
|
||||||
|
|
||||||
|
QString gitCommand("git clone --progress -vvv --filter=blob:none ");
|
||||||
gitCommand += m_repositoryPath;
|
gitCommand += m_repositoryPath;
|
||||||
Command c(gitCommand);
|
Command c(gitCommand);
|
||||||
|
|
||||||
qInfo() << "IN CURRENT WD" << m_workingDirectory
|
qInfo() << "IN CURRENT WD" << m_workingDirectory
|
||||||
<< "CLONE" << m_repositoryPath << "...";
|
<< "CLONE VIA COMMAND" << gitCommand;
|
||||||
|
|
||||||
if (c.execute(m_workingDirectory)) { // execute the command in wd
|
if (c.execute(m_workingDirectory)) { // execute the command in wd
|
||||||
QString const result = c.getCommandResult();
|
QString const result = c.getCommandResult();
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
// Cloning into 'customer_281'...\n
|
// Cloning into 'customer_281'...\n
|
||||||
static QRegularExpression re("(^\\s*Cloning\\s+into\\s+[']\\s*)(.*)(\\s*['].*$)");
|
int customer = -1;
|
||||||
QRegularExpressionMatch match = re.match(result);
|
int cloning = result.indexOf("Cloning", 0, Qt::CaseInsensitive);
|
||||||
if (match.hasMatch()) {
|
if (cloning != -1) {
|
||||||
if (re.captureCount() == 3) { // start with full match (0), then the other 3 matches
|
customer = result.indexOf("customer_", cloning, Qt::CaseInsensitive);
|
||||||
if (match.captured(2).trimmed() == m_customerNr) {
|
if (customer != -1) {
|
||||||
qInfo() << "CLONING" << m_repositoryPath << "OK";
|
QString customerNr = result.mid(customer);
|
||||||
return true;
|
static constexpr char const ch = '\'';
|
||||||
|
int i = customerNr.indexOf(QChar(ch));
|
||||||
|
if (i != -1) {
|
||||||
|
if ((customerNr = customerNr.mid(0, i)) == m_customerNr) {
|
||||||
|
qInfo() << "CLONING" << m_repositoryPath << "OK";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Utils::printCriticalErrorMsg(
|
||||||
|
QString("ERROR CLONE RESULT HAS WRONG CUSTOMER-NR. (%1 != %2) CLONE_RESULT=%3")
|
||||||
|
.arg(customerNr)
|
||||||
|
.arg(m_customerNr)
|
||||||
|
.arg(result));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Utils::printCriticalErrorMsg(
|
||||||
|
QString("ERROR CLONE RESULT HAS WRONG FORMAT. CLONING=%1 CUSTOMER=%2 CLONE_RESULT=%3")
|
||||||
|
.arg(cloning)
|
||||||
|
.arg(customer)
|
||||||
|
.arg(result));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
Utils::printCriticalErrorMsg(QString("ERROR CLONE RESULT HAS WRONG FORMAT. CLONE_RESULT=") + result);
|
Utils::printCriticalErrorMsg("ERROR CLONE RESULT IS EMPTY");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -114,16 +178,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=");
|
||||||
@@ -217,14 +279,25 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GitClient::gitFsck() {
|
||||||
|
bool r = false;
|
||||||
|
if (QDir(m_customerRepository).exists()) {
|
||||||
|
Command c("git fsck");
|
||||||
|
if ((r = c.execute(m_customerRepository)) == false) {
|
||||||
|
QString const &s = c.getCommandResult().trimmed();
|
||||||
|
Utils::printCriticalErrorMsg(QString("GIT FSCK FAILED: %1").arg(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Hat sich nichts geaendert, so werden auch keine Commits <>..<> angezeigt
|
Hat sich nichts geaendert, so werden auch keine Commits <>..<> angezeigt
|
||||||
*/
|
*/
|
||||||
std::optional<QString> GitClient::gitFetch() {
|
std::optional<QString> GitClient::gitPull() {
|
||||||
if (QDir(m_customerRepository).exists()) {
|
if (QDir(m_customerRepository).exists()) {
|
||||||
qInfo() << "BRANCH NAME" << m_branchName;
|
qInfo() << "BRANCH NAME" << m_branchName;
|
||||||
|
|
||||||
Command c("git fetch");
|
Command c("git pull");
|
||||||
if (c.execute(m_customerRepository)) {
|
if (c.execute(m_customerRepository)) {
|
||||||
QString const s = c.getCommandResult().trimmed();
|
QString const s = c.getCommandResult().trimmed();
|
||||||
if (!s.isEmpty()) {
|
if (!s.isEmpty()) {
|
||||||
@@ -250,59 +323,38 @@ std::optional<QString> GitClient::gitFetch() {
|
|||||||
if (re.captureCount() == 3) { // start with full match (0), then the other 3 matches
|
if (re.captureCount() == 3) { // start with full match (0), then the other 3 matches
|
||||||
return match.captured(2);
|
return match.captured(2);
|
||||||
} else {
|
} else {
|
||||||
emit m_worker->showErrorMessage("git fetch",
|
emit m_worker->showErrorMessage("git pull",
|
||||||
QString("(wrong cap-count (%1)").arg(re.captureCount()));
|
QString("(wrong cap-count (%1)").arg(re.captureCount()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit m_worker->showErrorMessage("git fetch",
|
emit m_worker->showErrorMessage("git pull",
|
||||||
"no regex-match for commits");
|
"no regex-match for commits");
|
||||||
Utils::printCriticalErrorMsg("NO REGEX MATCH FOR COMMITS");
|
Utils::printCriticalErrorMsg("NO REGEX MATCH FOR COMMITS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
emit m_worker->showErrorMessage("git fetch",
|
emit m_worker->showErrorMessage("git pull",
|
||||||
QString("unkown branch name ") + m_branchName);
|
QString("unkown branch name ") + m_branchName);
|
||||||
Utils::printCriticalErrorMsg("UNKNOWN BRANCH NAME " + m_branchName);
|
Utils::printCriticalErrorMsg("UNKNOWN BRANCH NAME " + m_branchName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit m_worker->showErrorMessage("git fetch",
|
emit m_worker->showErrorMessage("git pull",
|
||||||
QString("wrong format for result of 'git fetch' ") + s);
|
QString("wrong format for result of 'git pull' ") + s);
|
||||||
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 PULL'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit m_worker->showErrorMessage("git fetch", QString("repository ") + m_customerRepository + " does not exist");
|
emit m_worker->showErrorMessage("git pull", QString("repository ") + m_customerRepository + " does not exist");
|
||||||
Utils::printCriticalErrorMsg(QString("REPOSITORY ") + m_customerRepository + " DOES NOT EXIST");
|
Utils::printCriticalErrorMsg(QString("REPOSITORY ") + m_customerRepository + " DOES NOT EXIST");
|
||||||
}
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::gitFetchAndDiff() {
|
|
||||||
if (gitFetch()) {
|
|
||||||
QString gitCommand("git diff --compact-summary HEAD..FETCH_HEAD");
|
|
||||||
Command c(gitCommand);
|
|
||||||
return c.execute(m_workingDirectory);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GitClient::gitPull() {
|
|
||||||
if (QDir(m_customerRepository).exists()) {
|
|
||||||
Command c("git pull");
|
|
||||||
if (c.execute(m_customerRepository)) {
|
|
||||||
qInfo() << "PULLED INTO" << m_customerRepository;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Utils::printCriticalErrorMsg(QString("PULL INTO " + m_customerRepository + " FAILED"));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<QStringList> GitClient::gitMerge() {
|
std::optional<QStringList> GitClient::gitMerge() {
|
||||||
Command c("git merge");
|
Command c("git merge");
|
||||||
if (c.execute(m_workingDirectory)) {
|
if (c.execute(m_workingDirectory)) {
|
||||||
|
@@ -43,14 +43,14 @@ class GitClient : public QObject {
|
|||||||
|
|
||||||
bool gitCloneAndCheckoutBranch();
|
bool gitCloneAndCheckoutBranch();
|
||||||
|
|
||||||
std::optional<QString> gitFetch();
|
std::optional<QString> gitPull();
|
||||||
bool gitFetchAndDiff();
|
|
||||||
bool gitPull();
|
|
||||||
std::optional<QStringList> gitDiff(QString const &commit);
|
std::optional<QStringList> gitDiff(QString const &commit);
|
||||||
std::optional<QStringList> gitMerge();
|
std::optional<QStringList> gitMerge();
|
||||||
|
|
||||||
|
bool gitFsck();
|
||||||
|
|
||||||
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
|
||||||
@@ -47,6 +56,12 @@ void IsmasClient::printDebugMessage(int port,
|
|||||||
QString const &clientIP,
|
QString const &clientIP,
|
||||||
int clientPort,
|
int clientPort,
|
||||||
QString const &message) {
|
QString const &message) {
|
||||||
|
#if 1
|
||||||
|
Q_UNUSED(port);
|
||||||
|
Q_UNUSED(clientIP);
|
||||||
|
Q_UNUSED(clientPort);
|
||||||
|
Q_UNUSED(message);
|
||||||
|
#else
|
||||||
qDebug().noquote()
|
qDebug().noquote()
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "SEND-REQUEST-RECEIVE-RESPONSE ..." << "\n"
|
<< "SEND-REQUEST-RECEIVE-RESPONSE ..." << "\n"
|
||||||
@@ -55,12 +70,19 @@ void IsmasClient::printDebugMessage(int port,
|
|||||||
<< "local address ..." << clientIP << "\n"
|
<< "local address ..." << clientIP << "\n"
|
||||||
<< "local port ......" << clientPort << "\n"
|
<< "local port ......" << clientPort << "\n"
|
||||||
<< message;
|
<< message;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsmasClient::printInfoMessage(int port,
|
void IsmasClient::printInfoMessage(int port,
|
||||||
QString const &clientIP,
|
QString const &clientIP,
|
||||||
int clientPort,
|
int clientPort,
|
||||||
QString const &message) {
|
QString const &message) {
|
||||||
|
#if 1
|
||||||
|
Q_UNUSED(port);
|
||||||
|
Q_UNUSED(clientIP);
|
||||||
|
Q_UNUSED(clientPort);
|
||||||
|
Q_UNUSED(message);
|
||||||
|
#else
|
||||||
qInfo().noquote()
|
qInfo().noquote()
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "SEND-REQUEST-RECEIVE-RESPONSE ..." << "\n"
|
<< "SEND-REQUEST-RECEIVE-RESPONSE ..." << "\n"
|
||||||
@@ -69,6 +91,7 @@ void IsmasClient::printInfoMessage(int port,
|
|||||||
<< "local address ..." << clientIP << "\n"
|
<< "local address ..." << clientIP << "\n"
|
||||||
<< "local port ......" << clientPort << "\n"
|
<< "local port ......" << clientPort << "\n"
|
||||||
<< message;
|
<< message;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsmasClient::printErrorMessage(int port,
|
void IsmasClient::printErrorMessage(int port,
|
||||||
@@ -367,16 +390,18 @@ QString IsmasClient::errorBackendNotConnected(QString const &info,
|
|||||||
version.toStdString().c_str());
|
version.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IsmasClient::errorGitClone(int percent, QString const &info, QString const &version) {
|
QString IsmasClient::errorGitClone(QString const &info,
|
||||||
|
QString const &version) {
|
||||||
return updateNewsToIsmas("U0003",
|
return updateNewsToIsmas("U0003",
|
||||||
percent,
|
m_progressInPercent,
|
||||||
RESULT_CODE::INSTALL_ERROR,
|
RESULT_CODE::INSTALL_ERROR,
|
||||||
"CLONE CUSTOMER REPOSITORY FAILED",
|
"CLONE CUSTOMER REPOSITORY FAILED",
|
||||||
info.toStdString().c_str(),
|
info.toStdString().c_str(),
|
||||||
version.toStdString().c_str());
|
version.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IsmasClient::backendConnected(QString const &info, QString const &version) {
|
QString IsmasClient::backendConnected(QString const &info,
|
||||||
|
QString const &version) {
|
||||||
return updateNewsToIsmas("U0010",
|
return updateNewsToIsmas("U0010",
|
||||||
m_progressInPercent,
|
m_progressInPercent,
|
||||||
RESULT_CODE::SUCCESS,
|
RESULT_CODE::SUCCESS,
|
||||||
@@ -385,7 +410,8 @@ QString IsmasClient::backendConnected(QString const &info, QString const &versio
|
|||||||
version.toStdString().c_str());
|
version.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IsmasClient::execOpkgCommand(QString const &info, QString const &version) {
|
QString IsmasClient::execOpkgCommand(QString const &info,
|
||||||
|
QString const &version) {
|
||||||
return updateNewsToIsmas("U0010",
|
return updateNewsToIsmas("U0010",
|
||||||
m_progressInPercent,
|
m_progressInPercent,
|
||||||
RESULT_CODE::SUCCESS,
|
RESULT_CODE::SUCCESS,
|
||||||
@@ -622,6 +648,9 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
|||||||
"},"
|
"},"
|
||||||
"\"ATBQT\" : {"
|
"\"ATBQT\" : {"
|
||||||
"\"VERSION\" : \"%s\""
|
"\"VERSION\" : \"%s\""
|
||||||
|
"},"
|
||||||
|
"\"ATB-UPDATE-TOOL\" : {"
|
||||||
|
"\"VERSION\" : \"%s\""
|
||||||
"}"
|
"}"
|
||||||
"},"
|
"},"
|
||||||
"\"PLUGINS\" : {"
|
"\"PLUGINS\" : {"
|
||||||
@@ -749,6 +778,7 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
|||||||
|
|
||||||
psa.sw.apismVersion.toStdString().c_str(),
|
psa.sw.apismVersion.toStdString().c_str(),
|
||||||
psa.sw.atbQTVersion.toStdString().c_str(),
|
psa.sw.atbQTVersion.toStdString().c_str(),
|
||||||
|
psa.sw.atbUpdateToolVersion.toStdString().c_str(),
|
||||||
|
|
||||||
psa.pluginVersion.deviceController.toStdString().c_str(),
|
psa.pluginVersion.deviceController.toStdString().c_str(),
|
||||||
psa.pluginVersion.ingenicoISelfCC.toStdString().c_str(),
|
psa.pluginVersion.ingenicoISelfCC.toStdString().c_str(),
|
||||||
@@ -857,7 +887,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 +912,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@ struct PSAInstalled {
|
|||||||
struct SoftWare {
|
struct SoftWare {
|
||||||
QString apismVersion;
|
QString apismVersion;
|
||||||
QString atbQTVersion;
|
QString atbQTVersion;
|
||||||
|
QString atbUpdateToolVersion;
|
||||||
} sw;
|
} sw;
|
||||||
|
|
||||||
struct PluginVersion {
|
struct PluginVersion {
|
||||||
@@ -98,6 +99,7 @@ struct PSAInstalled {
|
|||||||
|
|
||||||
sw.apismVersion = "N/A";
|
sw.apismVersion = "N/A";
|
||||||
sw.atbQTVersion = "N/A";
|
sw.atbQTVersion = "N/A";
|
||||||
|
sw.atbUpdateToolVersion = "N/A";
|
||||||
|
|
||||||
pluginVersion.deviceController = "N/A";
|
pluginVersion.deviceController = "N/A";
|
||||||
pluginVersion.ingenicoISelfCC = "N/A";
|
pluginVersion.ingenicoISelfCC = "N/A";
|
||||||
@@ -175,7 +177,7 @@ public:
|
|||||||
QString cloneAndCheckoutCustomerRepository(QString const &info, QString const &version = QString()); // clone and checkout customer repository
|
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 checkoutBranch(QString const &info, QString const &version = QString()); // checkout branch
|
||||||
QString errorBackendNotConnected(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 errorGitClone(QString const &info, QString const &version = QString());
|
||||||
QString backendConnected(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 updateTriggerSet(QString const &info, QString const &version = QString());
|
||||||
QString errorUpdateTrigger(QString const &info, QString const &version = QString());
|
QString errorUpdateTrigger(QString const &info, QString const &version = QString());
|
||||||
|
66
main.cpp
66
main.cpp
@@ -112,25 +112,67 @@ int main(int argc, char *argv[]) {
|
|||||||
QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions."));
|
QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions."));
|
||||||
parser.addOption(dryRunOption);
|
parser.addOption(dryRunOption);
|
||||||
|
|
||||||
|
QCommandLineOption extendedVersionOption(QStringList() << "V" << "extended-version",
|
||||||
|
QCoreApplication::translate("main", "Show extended version (including last git commit)."));
|
||||||
|
parser.addOption(extendedVersionOption);
|
||||||
|
|
||||||
|
QCommandLineOption yoctoVersionOption(QStringList() << "y" << "yocto-version",
|
||||||
|
QCoreApplication::translate("main", "Show yocto version of ATBUpdateTool."));
|
||||||
|
parser.addOption(yoctoVersionOption);
|
||||||
|
|
||||||
|
QCommandLineOption yoctoInstallStatusOption(QStringList() << "Y" << "yocto-install",
|
||||||
|
QCoreApplication::translate("main", "Show yocto install status of ATBUpdateTool."));
|
||||||
|
parser.addOption(yoctoInstallStatusOption);
|
||||||
|
|
||||||
// Process the actual command line arguments given by the user
|
// Process the actual command line arguments given by the user
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
QString plugInDir = parser.value(pluginDirectoryOption);
|
QString plugInDir = parser.value(pluginDirectoryOption);
|
||||||
QString plugInName = parser.value(pluginNameOption);
|
QString plugInName = parser.value(pluginNameOption);
|
||||||
QString workingDir = parser.value(workingDirectoryOption);
|
QString workingDir = parser.value(workingDirectoryOption);
|
||||||
bool dryRun = parser.isSet(dryRunOption);
|
bool const dryRun = parser.isSet(dryRunOption);
|
||||||
|
bool const showYoctoVersion = parser.isSet(yoctoVersionOption);
|
||||||
|
bool const showYoctoInstallStatus = parser.isSet(yoctoInstallStatusOption);
|
||||||
|
bool const showExtendedVersion = parser.isSet(extendedVersionOption);
|
||||||
QString const rtPath = QCoreApplication::applicationDirPath();
|
QString const rtPath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
|
int machineNr = Utils::read1stLineOfFile("/etc/machine_nr");
|
||||||
|
int customerNr = Utils::read1stLineOfFile("/etc/cust_nr");
|
||||||
|
int zoneNr = Utils::read1stLineOfFile("/etc/zone_nr");
|
||||||
|
QString const branchName = (zoneNr != 0)
|
||||||
|
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||||
|
|
||||||
|
QThread::currentThread()->setObjectName("main thread");
|
||||||
|
qInfo() << "Main thread" << QThread::currentThreadId();
|
||||||
|
|
||||||
|
if (showExtendedVersion) {
|
||||||
|
printf(APP_EXTENDED_VERSION"\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showYoctoVersion) {
|
||||||
|
printf("%s\n", Worker::getATBUpdateToolYoctoVersion().toStdString().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showYoctoInstallStatus) {
|
||||||
|
printf("%s\n", Worker::getATBUpdateToolYoctoInstallationStatus().toStdString().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!QDir(plugInDir).exists()) {
|
if (!QDir(plugInDir).exists()) {
|
||||||
qCritical() << plugInDir
|
qCritical() << plugInDir
|
||||||
<< "does not exists, but has to contain dc-library";
|
<< "does not exists, but has to contain dc-library";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
qInfo() << "pwd ..............." << rtPath;
|
qInfo() << "pwd ......................" << rtPath;
|
||||||
qInfo() << "plugInDir ........." << plugInDir;
|
qInfo() << "plugInDir ................" << plugInDir;
|
||||||
qInfo() << "plugInName ........" << plugInName;
|
qInfo() << "plugInName ..............." << plugInName;
|
||||||
qInfo() << "workingDir ........" << workingDir;
|
qInfo() << "workingDir ..............." << workingDir;
|
||||||
qInfo() << "dryRun ............" << dryRun;
|
qInfo() << "dryRun ..................." << dryRun;
|
||||||
|
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
||||||
|
//qInfo() << "yocto-version ............" << Worker::getATBUpdateToolYoctoVersion();
|
||||||
|
//qInfo() << "yocto-install-status ....." << Worker::getATBUpdateToolYoctoInstallationStatus();
|
||||||
|
|
||||||
// before loading the library, delete all possible shared memory segments
|
// before loading the library, delete all possible shared memory segments
|
||||||
#if defined Q_OS_LINUX || defined Q_OS_UNIX
|
#if defined Q_OS_LINUX || defined Q_OS_UNIX
|
||||||
@@ -143,15 +185,6 @@ int main(int argc, char *argv[]) {
|
|||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
// hw->dc_openSerial(5, "115200", "ttymxc2", 1);
|
// hw->dc_openSerial(5, "115200", "ttymxc2", 1);
|
||||||
|
|
||||||
int machineNr = Utils::read1stLineOfFile("/etc/machine_nr");
|
|
||||||
int customerNr = Utils::read1stLineOfFile("/etc/cust_nr");
|
|
||||||
int zoneNr = Utils::read1stLineOfFile("/etc/zone_nr");
|
|
||||||
QString const branchName = (zoneNr != 0)
|
|
||||||
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
|
||||||
|
|
||||||
QThread::currentThread()->setObjectName("main thread");
|
|
||||||
qInfo() << "Main thread" << QThread::currentThreadId();
|
|
||||||
|
|
||||||
Worker worker(customerNr,
|
Worker worker(customerNr,
|
||||||
machineNr,
|
machineNr,
|
||||||
zoneNr,
|
zoneNr,
|
||||||
@@ -180,8 +213,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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ MainWindow::MainWindow(hwinf *hw, Worker *worker, Update *update, QWidget *paren
|
|||||||
, m_worker(worker)
|
, m_worker(worker)
|
||||||
, m_width(70)
|
, m_width(70)
|
||||||
, m_progressRunning(false)
|
, m_progressRunning(false)
|
||||||
, m_progressValue(0)
|
// , m_progressValue(0)
|
||||||
, m_update(update)
|
, m_update(update)
|
||||||
, m_updateStep(UpdateDcEvent::UpdateStep::NONE) {
|
, m_updateStep(UpdateDcEvent::UpdateStep::NONE) {
|
||||||
|
|
||||||
@@ -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'));
|
||||||
@@ -176,22 +178,22 @@ void MainWindow::customEvent(QEvent *event) {
|
|||||||
case START_PROGRESS_LOOP: {
|
case START_PROGRESS_LOOP: {
|
||||||
m_progressRunning = true;
|
m_progressRunning = true;
|
||||||
ui->updateProgress->reset();
|
ui->updateProgress->reset();
|
||||||
m_progressValue = 10;
|
// m_progressValue = 10;
|
||||||
QApplication::postEvent(this, new ProgressEvent(this, m_progressValue));
|
QApplication::postEvent(this, new ProgressEvent(this, 1));
|
||||||
} break;
|
} break;
|
||||||
case STOP_PROGRESS_LOOP: {
|
case STOP_PROGRESS_LOOP: {
|
||||||
m_progressRunning = false;
|
m_progressRunning = false;
|
||||||
m_progressValue -= 10;
|
// m_progressValue -= 10;
|
||||||
m_worker->setProgress(m_progressValue/10);
|
// m_worker->setProgress(m_progressValue/10);
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
if (m_progressRunning) {
|
if (m_progressRunning) {
|
||||||
m_progressValue = progress;
|
// m_progressValue = progress;
|
||||||
ui->updateProgress->setValue(progress/10);
|
ui->updateProgress->setValue(progress);
|
||||||
QApplication::postEvent(this, new ProgressEvent(this, progress+10));
|
// ueberpruefen: hauptfenster schickt sich selber ein event
|
||||||
QThread::msleep(500);
|
// QApplication::postEvent(this, new ProgressEvent(this, progress));
|
||||||
}
|
// QThread::msleep(500);
|
||||||
}
|
}}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (sender == m_worker) {
|
if (sender == m_worker) {
|
||||||
@@ -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);
|
||||||
|
@@ -34,7 +34,7 @@ public:
|
|||||||
static const int BL_IS_UP_COUNT = 5;
|
static const int BL_IS_UP_COUNT = 5;
|
||||||
static const int BL_STOP_COUNT = 5;
|
static const int BL_STOP_COUNT = 5;
|
||||||
|
|
||||||
int progressValue() const { return m_progressValue; }
|
// int progressValue() const { return m_progressValue; }
|
||||||
hwinf *getPlugin() { return m_hw; }
|
hwinf *getPlugin() { return m_hw; }
|
||||||
hwinf const *getPlugin() const { return m_hw; }
|
hwinf const *getPlugin() const { return m_hw; }
|
||||||
Update *getUpdate() { return m_update; }
|
Update *getUpdate() { return m_update; }
|
||||||
@@ -76,7 +76,7 @@ private:
|
|||||||
QTimer *m_startTimer;
|
QTimer *m_startTimer;
|
||||||
QTimer *m_exitTimer;
|
QTimer *m_exitTimer;
|
||||||
bool m_progressRunning;
|
bool m_progressRunning;
|
||||||
int m_progressValue;
|
//int m_progressValue;
|
||||||
Update *m_update;
|
Update *m_update;
|
||||||
UpdateDcEvent::UpdateStep m_updateStep;
|
UpdateDcEvent::UpdateStep m_updateStep;
|
||||||
};
|
};
|
||||||
|
@@ -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()
|
||||||
|
135
update.cpp
135
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,68 +802,60 @@ 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;
|
||||||
}
|
}
|
||||||
m_worker->stopProgressLoop();
|
// m_worker->stopProgressLoop();
|
||||||
m_worker->setProgress(100);
|
// m_worker->setProgress(100);
|
||||||
|
|
||||||
if (res == false) {
|
if (res == false) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // 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;
|
||||||
}
|
}
|
||||||
|
37
utils.cpp
37
utils.cpp
@@ -47,16 +47,45 @@ QString Utils::zoneName(quint8 i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Utils::printCriticalErrorMsg(QString const &errorMsg) {
|
void Utils::printCriticalErrorMsg(QString const &errorMsg) {
|
||||||
qCritical() << QString(80, '!');
|
qCritical() << QString(80, 'E');
|
||||||
qCritical() << errorMsg;
|
qCritical() << errorMsg;
|
||||||
qCritical() << QString(80, '!');
|
qCritical() << QString(80, 'E');
|
||||||
|
}
|
||||||
|
|
||||||
|
void Utils::printCriticalErrorMsg(QStringList const &errorMsg) {
|
||||||
|
qCritical() << QString(80, 'E');
|
||||||
|
for (int i = 0; i < errorMsg.size(); ++i) {
|
||||||
|
qCritical() << errorMsg.at(i);
|
||||||
|
}
|
||||||
|
qCritical() << QString(80, 'E');
|
||||||
|
}
|
||||||
|
|
||||||
|
void Utils::printUpdateStatusMsg(QStringList const &updateMsg) {
|
||||||
|
qCritical() << QString(80, 'U');
|
||||||
|
for (int i = 0; i < updateMsg.size(); ++i) {
|
||||||
|
qCritical() << updateMsg.at(i);
|
||||||
|
}
|
||||||
|
qCritical() << QString(80, 'U');
|
||||||
|
}
|
||||||
|
|
||||||
|
void Utils::printUpdateStatusMsg(QString const &updateMsg) {
|
||||||
|
qCritical() << QString(80, 'U');
|
||||||
|
qCritical() << updateMsg;
|
||||||
|
qCritical() << QString(80, 'U');
|
||||||
}
|
}
|
||||||
|
|
||||||
void Utils::printInfoMsg(QString const &infoMsg) {
|
void Utils::printInfoMsg(QString const &infoMsg) {
|
||||||
qCritical() << QString(80, '=');
|
qCritical() << QString(80, 'I');
|
||||||
qCritical() << infoMsg;
|
qCritical() << infoMsg;
|
||||||
qCritical() << QString(80, '=');
|
qCritical() << QString(80, 'I');
|
||||||
|
}
|
||||||
|
|
||||||
|
void Utils::printInfoMsg(QStringList const &infoMsg) {
|
||||||
|
qCritical() << QString(80, 'I');
|
||||||
|
for (int i = 0; i < infoMsg.size(); ++i) {
|
||||||
|
qCritical() << infoMsg.at(i);
|
||||||
|
}
|
||||||
|
qCritical() << QString(80, 'I');
|
||||||
}
|
}
|
||||||
|
|
||||||
void Utils::printLineEditInfo(QStringList const &lines) {
|
void Utils::printLineEditInfo(QStringList const &lines) {
|
||||||
|
4
utils.h
4
utils.h
@@ -13,7 +13,11 @@ namespace Utils {
|
|||||||
int read1stLineOfFile(QString fileName);
|
int read1stLineOfFile(QString fileName);
|
||||||
QString zoneName(quint8 i);
|
QString zoneName(quint8 i);
|
||||||
void printCriticalErrorMsg(QString const &errorMsg);
|
void printCriticalErrorMsg(QString const &errorMsg);
|
||||||
|
void printCriticalErrorMsg(QStringList const &errorMsg);
|
||||||
void printInfoMsg(QString const &infoMsg);
|
void printInfoMsg(QString const &infoMsg);
|
||||||
|
void printInfoMsg(QStringList const &infoMsg);
|
||||||
|
void printUpdateStatusMsg(QStringList const &updateMsg);
|
||||||
|
void printUpdateStatusMsg(QString const &updateMsg);
|
||||||
void printLineEditInfo(QStringList const &lines);
|
void printLineEditInfo(QStringList const &lines);
|
||||||
QString getTariffLoadTime(QString fileName);
|
QString getTariffLoadTime(QString fileName);
|
||||||
QString rstrip(QString const &str);
|
QString rstrip(QString const &str);
|
||||||
|
836
worker.cpp
836
worker.cpp
File diff suppressed because it is too large
Load Diff
305
worker.h
305
worker.h
@@ -8,13 +8,17 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
#include "worker_thread.h"
|
#include "worker_thread.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "git/git_client.h"
|
#include "git/git_client.h"
|
||||||
#include "ismas/ismas_client.h"
|
#include "ismas/ismas_client.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#ifdef PTU5
|
#ifdef PTU5
|
||||||
#define SERIAL_PORT "ttymxc2"
|
#define SERIAL_PORT "ttymxc2"
|
||||||
@@ -52,7 +56,8 @@ enum class UPDATE_STATUS : quint8 {
|
|||||||
PSA_UPDATE_FILES_FAILED,
|
PSA_UPDATE_FILES_FAILED,
|
||||||
GIT_CHECK_FILES_TO_UPDATE_SUCCESS,
|
GIT_CHECK_FILES_TO_UPDATE_SUCCESS,
|
||||||
ISMAS_SEND_LAST_VERSION_FAILED,
|
ISMAS_SEND_LAST_VERSION_FAILED,
|
||||||
SAVE_LOG_FILES_FAILED
|
SAVE_LOG_FILES_FAILED,
|
||||||
|
REMOVE_GIT_REPOSITORY_FAILED
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UpdateStatus {
|
struct UpdateStatus {
|
||||||
@@ -64,8 +69,6 @@ struct UpdateStatus {
|
|||||||
: m_updateStatus(s), m_statusDescription(d) {}
|
: m_updateStatus(s), m_statusDescription(d) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, UpdateStatus status);
|
|
||||||
QString& operator<<(QString &str, UpdateStatus status);
|
|
||||||
|
|
||||||
#define ISMAS_UPDATE_REQUESTS (10)
|
#define ISMAS_UPDATE_REQUESTS (10)
|
||||||
|
|
||||||
@@ -92,6 +95,7 @@ class Worker : public QObject {
|
|||||||
GitClient m_gc;
|
GitClient m_gc;
|
||||||
QString const m_osVersion;
|
QString const m_osVersion;
|
||||||
QString const m_atbqtVersion;
|
QString const m_atbqtVersion;
|
||||||
|
QString const m_atbUpdateToolVersion;
|
||||||
QString const m_cpuSerial;
|
QString const m_cpuSerial;
|
||||||
QString const m_pluginVersionATBDeciceController;
|
QString const m_pluginVersionATBDeciceController;
|
||||||
QString const m_pluginVersionIngenicoISelf;
|
QString const m_pluginVersionIngenicoISelf;
|
||||||
@@ -107,18 +111,19 @@ class Worker : public QObject {
|
|||||||
UpdateStatus m_updateStatus;
|
UpdateStatus m_updateStatus;
|
||||||
|
|
||||||
QStringList m_filesToUpdate;
|
QStringList m_filesToUpdate;
|
||||||
|
QStringList m_filesToDownload;
|
||||||
bool m_updateProcessRunning;
|
bool m_updateProcessRunning;
|
||||||
int m_displayIndex;
|
int m_displayIndex;
|
||||||
int m_returnCode;
|
int m_returnCode;
|
||||||
|
|
||||||
MainWindow *m_mainWindow;
|
MainWindow *m_mainWindow;
|
||||||
int m_progressValue;
|
|
||||||
bool m_withoutIsmasDirectPort;
|
bool m_withoutIsmasDirectPort;
|
||||||
QString m_apismVersion;
|
QString m_apismVersion;
|
||||||
|
|
||||||
bool executeOpkgCommand(QString opkgCommand);
|
bool executeOpkgCommand(QString opkgCommand);
|
||||||
QString getOsVersion() const;
|
QString getOsVersion() const;
|
||||||
QString getATBQTVersion() const;
|
QString getATBQTVersion() const;
|
||||||
|
QString getATBUpdateToolVersion() const;
|
||||||
QString getCPUSerial() const;
|
QString getCPUSerial() const;
|
||||||
QString getRaucVersion() const;
|
QString getRaucVersion() const;
|
||||||
QString getOpkgVersion() const;
|
QString getOpkgVersion() const;
|
||||||
@@ -126,8 +131,81 @@ class Worker : public QObject {
|
|||||||
QStringList getDCVersion() const;
|
QStringList getDCVersion() const;
|
||||||
|
|
||||||
qint64 getFileSize(QString const &fileName) const;
|
qint64 getFileSize(QString const &fileName) const;
|
||||||
|
bool isRepositoryCorrupted();
|
||||||
|
bool repairCorruptedRepository();
|
||||||
|
|
||||||
|
int sendCloneAndCheckoutSuccess();
|
||||||
|
int sendCloneAndCheckoutFailure();
|
||||||
|
int sendIsmasTriggerFailure();
|
||||||
|
int sendPullFailure();
|
||||||
|
int sendFileUpdateFailure();
|
||||||
|
int sendRsyncFailure();
|
||||||
|
int sendLastVersionFailure();
|
||||||
|
int sendSaveLogFilesFailure();
|
||||||
|
int sendCustomerEnvironmentConfigurationFailed();
|
||||||
|
int sendFoundFilesToUpdateSuccess();
|
||||||
|
int sendUpdateSucceededAndActivated();
|
||||||
|
int sendFinalResult();
|
||||||
|
|
||||||
|
static constexpr const int UPDATE_SUCCESS_AND_ACTIVATED = 0;
|
||||||
|
static constexpr const int CLONE_AND_CHECKOUT_SUCCESS = 0;
|
||||||
|
static constexpr const int CLONE_AND_CHECKOUT_FAILURE = -3;
|
||||||
|
static constexpr const int ISMAS_TRIGGER_FAILURE = -5;
|
||||||
|
static constexpr const int ENVIRONMENT_CONFIG_FAILURE = -6;
|
||||||
|
static constexpr const int GIT_PULL_FAILURE = -7;
|
||||||
|
static constexpr const int UPDATE_FILES_FAILURE = -8;
|
||||||
|
static constexpr const int RSYNC_FAILURE = -9;
|
||||||
|
static constexpr const int SEND_LAST_VERSION_FAILURE = -10;
|
||||||
|
static constexpr const int SAVE_LOG_FILES_FAILURE = -11;
|
||||||
|
|
||||||
|
enum class UPDATE_STEP {
|
||||||
|
STARTED = 1,
|
||||||
|
CHECK_REPOSITORY = 2,
|
||||||
|
CHECK_SANITY = 3,
|
||||||
|
CHECK_SANITY_SUCCESS = 4,
|
||||||
|
CHECK_SANITY_FAILURE = 5,
|
||||||
|
CLONE_REPOSITORY = 6,
|
||||||
|
CLONE_REPOSITORY_SUCCESS = 7,
|
||||||
|
CLONE_REPOSITORY_FAILURE = 8,
|
||||||
|
SWITCH_BRANCH = 12,
|
||||||
|
SWITCH_BRANCH_SUCCESS = 13,
|
||||||
|
SWITCH_BRANCH_FAILURE = 14,
|
||||||
|
CHECK_ISMAS_TRIGGER = 15,
|
||||||
|
CHECK_ISMAS_TRIGGER_SUCCESS = 23,
|
||||||
|
CHECK_ISMAS_TRIGGER_FAILURE = 24,
|
||||||
|
UPDATE_REPOSITORY = 25,
|
||||||
|
UPDATE_REPOSITORY_SUCCESS = 28,
|
||||||
|
UPDATE_REPOSITORY_FAILURE = 29,
|
||||||
|
CHECK_FOR_REPOSITORY_CHANGES = 30,
|
||||||
|
CHECK_FOR_REPOSITORY_CHANGES_SUCCESS = 38,
|
||||||
|
CHECK_FOR_REPOSITORY_CHANGES_FAILURE = 39,
|
||||||
|
APPLY_REPOSITORY_CHANGES = 40,
|
||||||
|
DOWNLOAD_CONFIG_FILE = 41,
|
||||||
|
DOWNLOAD_CONFIG_FILE_SUCCESS = 63,
|
||||||
|
DOWNLOAD_CONFIG_FILE_FAILURE = 64,
|
||||||
|
DOWNLOAD_DEVICE_CONTROLLER = 65,
|
||||||
|
DOWNLOAD_DEVICE_CONTROLLER_SUCCESS = 86,
|
||||||
|
DOWNLOAD_DEVICE_CONTROLLER_FAILURE = 87,
|
||||||
|
APPLY_REPOSITORY_CHANGES_SUCCESS = 88,
|
||||||
|
APPLY_REPOSITORY_CHANGES_FAILURE = 89,
|
||||||
|
SYNC_CUSTOMER_REPOSITORY = 90,
|
||||||
|
SYNC_CUSTOMER_REPOSITORY_SUCCESS = 91,
|
||||||
|
SYNC_CUSTOMER_REPOSITORY_FAILURE = 92,
|
||||||
|
SAVE_LOGS = 94,
|
||||||
|
SAVE_LOGS_SUCCESS = 95,
|
||||||
|
SAVE_LOGS_FAILURE = 96,
|
||||||
|
SEND_LAST_VERSION = 97,
|
||||||
|
UPDATE_SUCCEEDED = 98,
|
||||||
|
UPDATE_FAILED = 99,
|
||||||
|
FINISHED = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
static Worker const *instance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static QString getATBUpdateToolYoctoVersion();
|
||||||
|
static QString getATBUpdateToolYoctoInstallationStatus();
|
||||||
|
|
||||||
static const QString UPDATE_STEP_OK;
|
static const QString UPDATE_STEP_OK;
|
||||||
static const QString UPDATE_STEP_DONE;
|
static const QString UPDATE_STEP_DONE;
|
||||||
static const QString UPDATE_STEP_FAIL;
|
static const QString UPDATE_STEP_FAIL;
|
||||||
@@ -149,6 +227,7 @@ public:
|
|||||||
hwinf *getPlugin();
|
hwinf *getPlugin();
|
||||||
hwinf const *getPlugin() const;
|
hwinf const *getPlugin() const;
|
||||||
void setProgress(int progress);
|
void setProgress(int progress);
|
||||||
|
void displayProgressInMainWindow(int progress);
|
||||||
void startProgressLoop();
|
void startProgressLoop();
|
||||||
void stopProgressLoop();
|
void stopProgressLoop();
|
||||||
|
|
||||||
@@ -162,19 +241,11 @@ public:
|
|||||||
int customerNr() const { return m_customerNr; }
|
int customerNr() const { return m_customerNr; }
|
||||||
int zoneNr() const { return m_zoneNr; }
|
int zoneNr() const { return m_zoneNr; }
|
||||||
QString apismVersion() const { return m_apismVersion; }
|
QString apismVersion() const { return m_apismVersion; }
|
||||||
|
QString atbUpdateToolVersion() const { return m_atbUpdateToolVersion; }
|
||||||
|
|
||||||
MainWindow *mainWindow() { return m_mainWindow; }
|
MainWindow *mainWindow() { return m_mainWindow; }
|
||||||
MainWindow const *mainWindow() const { return m_mainWindow; }
|
MainWindow const *mainWindow() const { return m_mainWindow; }
|
||||||
|
|
||||||
//friend QDebug operator<<(QDebug debug, Worker const &w) {
|
|
||||||
// Q_UNUSED(w);
|
|
||||||
// return debug;
|
|
||||||
//}
|
|
||||||
//friend QString& operator<<(QString &str, Worker const &w) {
|
|
||||||
// Q_UNUSED(w);
|
|
||||||
// return str;
|
|
||||||
//}
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void appendText(QString, QString suffix = "");
|
void appendText(QString, QString suffix = "");
|
||||||
void replaceLast(QString, QString);
|
void replaceLast(QString, QString);
|
||||||
@@ -190,18 +261,212 @@ 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(int progress);
|
||||||
bool updateFiles(quint8 percent);
|
bool updateFiles(int percent);
|
||||||
bool syncCustomerRepositoryAndFS();
|
bool syncCustomerRepositoryAndFS(int progress);
|
||||||
bool sendIsmasLastVersionNotification();
|
bool sendIsmasLastVersionNotification(int progress);
|
||||||
bool saveLogFile();
|
bool saveLogFile(int progress);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PSAInstalled getPSAInstalled();
|
PSAInstalled getPSAInstalled();
|
||||||
void privateUpdate();
|
void privateUpdate();
|
||||||
std::optional<QString> getApismVersion();
|
std::optional<QString> getApismVersion();
|
||||||
|
void printProgress(UPDATE_STEP step);
|
||||||
|
|
||||||
|
friend QDebug operator<<(QDebug debug, UPDATE_STEP step) {
|
||||||
|
if (!Worker::instance) {
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const QMap<UPDATE_STEP, const char*> smap (
|
||||||
|
std::initializer_list<std::pair<UPDATE_STEP, const char*>>{
|
||||||
|
#define INSERT_ELEMENT(p) std::pair(p, #p)
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::STARTED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_SANITY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CLONE_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SWITCH_BRANCH_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::FINISHED)
|
||||||
|
#undef INSERT_ELEMENT
|
||||||
|
});
|
||||||
|
|
||||||
|
switch (step) {
|
||||||
|
case UPDATE_STEP::STARTED:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_SANITY:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CLONE_REPOSITORY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CLONE_REPOSITORY_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SWITCH_BRANCH:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SWITCH_BRANCH_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SWITCH_BRANCH_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_REPOSITORY:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SAVE_LOGS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SEND_LAST_VERSION:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_FAILED:
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::FINISHED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
case UPDATE_STEP::CHECK_SANITY:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 1: CHECKED SANITY OF CUSTOMER REPOSITORY %1 DONE")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
<< QString("STEP 2: FETCH CUSTOMER REPOSITORY %1...")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
|
break;
|
||||||
|
//case UPDATE_STEP::FETCH_REPOSITORY:
|
||||||
|
// Utils::printUpdateStatusMsg(
|
||||||
|
// QStringList()
|
||||||
|
// << QString("STEP 2: FETCHED CUSTOMER REPOSITORY %1 DONE")
|
||||||
|
// .arg(instance->m_customerRepository)
|
||||||
|
// << QString("STEP 3: CHECK ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS..."));
|
||||||
|
// break;
|
||||||
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 3: CHECKED ISMAS-UPDATE-TRIGGER FOR WAIT-STATUS. SUCCESS.")
|
||||||
|
<< QString("STEP 4: CHECK-OUT BRANCH %1...").arg(instance->m_gc.branchName()));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::CHECKED_OUT_BRANCH:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 4: CHECKED-OUT BRANCH %1 DONE")
|
||||||
|
.arg(instance->m_gc.branchName())
|
||||||
|
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE..."));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::COMPUTE_FILES_TO_UPDATE:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 5: COMPUTE FILES-TO-UPDATE %1 DONE")
|
||||||
|
.arg(instance->m_filesToUpdate.join(','))
|
||||||
|
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS...")
|
||||||
|
.arg(instance->m_filesToDownload.join(',')));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_UPDATE:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 6: DOWNLOAD FILES-TO-DOWNLOAD %1 AND EXECUTE OPKG_COMMANDS DONE")
|
||||||
|
.arg(instance->m_filesToDownload.join(','))
|
||||||
|
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM...")
|
||||||
|
.arg(instance->m_customerRepository));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 7: SYNC CUSTOMER REPOSITORY %1 WITH FILESYSTEM DONE")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
<< QString("STEP 8: SEND-LAST-VERSION TO ISMAS..."));
|
||||||
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_SUCCESS:
|
||||||
|
Utils::printUpdateStatusMsg(
|
||||||
|
QStringList()
|
||||||
|
<< QString("STEP 9: SAVE-LOG-FILES (FUTURE USE) DONE")
|
||||||
|
<< QString("STEP 10: MARK UPDATE AS SUCCESSFUL AND ACTIVE..."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WORKER_H_INCLUDED
|
#endif // WORKER_H_INCLUDED
|
||||||
|
Reference in New Issue
Block a user