Compare commits
81 Commits
gerhard-de
...
master
Author | SHA1 | Date | |
---|---|---|---|
a240711946 | |||
75fdca95d9 | |||
44c2820130 | |||
123f22cd21 | |||
b60af1a4fc | |||
bb3ecc4b76 | |||
fa30fe045b | |||
bae014822d | |||
6c472b542e | |||
7578746d2f | |||
0b1ed62df1 | |||
76ec41c291 | |||
630cd36f13 | |||
cbe8bb7aeb | |||
e04636e3f7 | |||
728185ddb9 | |||
aaa485e2fc | |||
9a9480035b | |||
0a43654f9b | |||
4dba36a420 | |||
f9ce6a6c1b | |||
c2c6bc3f8a | |||
8c02ebcf15 | |||
100bfd63ab | |||
23ff4977d9 | |||
8da6443833 | |||
6b3ebde2b5 | |||
41392a98e3 | |||
1c9bb11f0b | |||
ec0e687c21 | |||
e040e784fc | |||
d2300b87c6 | |||
0dff2ece75 | |||
db24853062 | |||
530ea33460 | |||
005e4d249f | |||
1c0786e28c | |||
0aa8d9ba5a | |||
1ecb844b64 | |||
9a687e6628 | |||
979afa37d3 | |||
1e1820724d | |||
d90954c6eb | |||
cf77d0ff76 | |||
73d02d214a | |||
6a67d8e9b0 | |||
30d8cc3684 | |||
bc9ebb7d68 | |||
e6f6d43bf2 | |||
854c8b9706 | |||
d521fd977a | |||
ebbdc2f864 | |||
62496c5d95 | |||
edd606fe78 | |||
1748c35c45 | |||
4c46932a3c | |||
686e113c3a | |||
6ddfbbfd9e | |||
7bfbdc0f07 | |||
dd591fdd23 | |||
18c7b656c3 | |||
5e9b05e887 | |||
37aae73f21 | |||
0b4eed9dc0 | |||
12f48ad1bb | |||
5d7d1a2870 | |||
5d7f13a254 | |||
d332a990d5 | |||
bfa39eb3df | |||
d7fcfa3d0f | |||
f1e449c108 | |||
32346c2665 | |||
38e7bf4985 | |||
6df73e1082 | |||
19250a0a2f | |||
6f5c8103e4 | |||
07dcf0ba30 | |||
1e379cf086 | |||
e87456f26b | |||
0c9a7bc7b5 | |||
a35c6afcb8 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
tags
|
||||||
|
*.tags
|
@ -6,7 +6,7 @@ plugin-directory="/usr/lib/"
|
|||||||
working-directory="/opt/app/tools/atbupdate/"
|
working-directory="/opt/app/tools/atbupdate/"
|
||||||
|
|
||||||
[PLUGINS]
|
[PLUGINS]
|
||||||
plugin-name="libCAslave.so"
|
plugin-name="libCAmaster.so"
|
||||||
|
|
||||||
[FLAGS]
|
[FLAGS]
|
||||||
no-psa-hardware-update=false
|
no-psa-hardware-update=false
|
||||||
@ -14,5 +14,5 @@ dry-run=false
|
|||||||
extended-version=false
|
extended-version=false
|
||||||
yocto-version=false
|
yocto-version=false
|
||||||
yocto-install=false
|
yocto-install=false
|
||||||
always-download-config=false
|
always-download-config=true
|
||||||
always-download-dc=false
|
always-download-dc=false
|
||||||
|
@ -53,7 +53,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# local filesystem, json-files will be downloaded to firmware.
|
# local filesystem, json-files will be downloaded to firmware.
|
||||||
# The device-controller firmware will be handled in a later version.
|
# The device-controller firmware will be handled in a later version.
|
||||||
# 1.3.15: Bug fixes found during testing.
|
# 1.3.15: Bug fixes found during testing.
|
||||||
# Don't disable Exit-button during update-process.
|
# Do not disable Exit-button during update-process.
|
||||||
# Removed worker-thread with an own event-loop: only the GUI thread
|
# Removed worker-thread with an own event-loop: only the GUI thread
|
||||||
# has an event loop. Tested JSON-downloads several times successfully
|
# has an event loop. Tested JSON-downloads several times successfully
|
||||||
# (using the slave lib where the CA helper tool was active as master).
|
# (using the slave lib where the CA helper tool was active as master).
|
||||||
@ -64,9 +64,48 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# given in ATBUpdateTool.ini can be overwritten on the command-line.
|
# given in ATBUpdateTool.ini can be overwritten on the command-line.
|
||||||
# 1.3.18: Bug fixes found during testing.
|
# 1.3.18: Bug fixes found during testing.
|
||||||
# 1.3.19: Bug fixes found during testing.
|
# 1.3.19: Bug fixes found during testing.
|
||||||
VERSION="1.3.20"
|
|
||||||
# 1.3.20: Bug fixes found during testing.
|
# 1.3.20: Bug fixes found during testing.
|
||||||
|
# 1.3.21: Bug fixes found during testing:
|
||||||
|
# Fix directory of ATBUpdateTool.ini to be the working directory of
|
||||||
|
# the application rather than just ".".
|
||||||
|
# Check existance of etc-directory inside customer repository.
|
||||||
|
# Check for valid ISMAS trigger (button) 15x (=90s).
|
||||||
|
# NOTE: if the customer repository is cloned (or repaired and cloned
|
||||||
|
# again), and if the settings always-download-config=true and
|
||||||
|
# always-download-dc=true in the ATBUpdateTool.ini file, the download
|
||||||
|
# the printer-json files and the device controller file, even without
|
||||||
|
# an activated ISMAS trigger (button). The tariff-files are rsynced to
|
||||||
|
# the local filesystem for such clone.
|
||||||
|
# Set new filename for device controller: dc2c.bin.
|
||||||
|
# 1.3.22: Bug fixes found during testing:
|
||||||
|
# Fix the path-names of the json-files and the device-controller.
|
||||||
|
# Set automatic download of json-file in ATBUpdateTool.ini file for
|
||||||
|
# a fresh clone of the repository.
|
||||||
|
# 1.3.23: Added a 'break' to prevent a possible endless loop when checking if
|
||||||
|
# the device is alive.
|
||||||
|
#
|
||||||
|
# NOTE: The versioning info has to be shifted up by one version, i.e. what
|
||||||
|
# happened for 1.3.23 was actually done in 1.3.24.
|
||||||
|
# 1.3.24
|
||||||
|
#
|
||||||
|
# 1.3._24_: Special version for szeged using a old dc-controller (4.42):
|
||||||
|
# Changes:
|
||||||
|
# (1) the ini-File now uses the libCAmaster.so.
|
||||||
|
# 1.3._25_: Again special version for szeged, using interface.h, version 4.4.
|
||||||
|
# 1.4.0 : Start with version at 1.4.0 (mainly to see a difference with Szeged)
|
||||||
|
# Set hash-value in EVENT-objects. Set location (project), version
|
||||||
|
# and info in send-last-version.
|
||||||
|
# If the customer repository does not exist, then do not check the
|
||||||
|
# ISMAS trigger, but proceed with the update procedure. Otherwise,
|
||||||
|
# check the ISMAS update-trigger as first step.
|
||||||
|
# If the current time is between 0.00 - 4.00 o'clock, then a wrong
|
||||||
|
# trigger-value will result in an UPDATE_STEP_NOT_NECESSARY.
|
||||||
|
# Move final processing to subclass UpdateProcessRunning.
|
||||||
|
# Disable EXIT-button for the whole update-process, except for the
|
||||||
|
# checking of the ISMAS-trigger-button (aka WAIT-button).
|
||||||
|
# 1.4.1 : Sync files in the customer repository (under ./etc) as the very
|
||||||
|
# first step
|
||||||
|
VERSION="1.4.1"
|
||||||
# PLANNED TODOS:
|
# PLANNED TODOS:
|
||||||
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
||||||
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu
|
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu
|
||||||
@ -80,7 +119,6 @@ VERSION="1.3.20"
|
|||||||
# ISMAS eine entsprechende Meldung anzeigen als Teil von SEND-LAST-VERSION.
|
# ISMAS eine entsprechende Meldung anzeigen als Teil von SEND-LAST-VERSION.
|
||||||
# Wenn der WAIT-button aktiv ist, dann werden zumindest die opkg-commands
|
# Wenn der WAIT-button aktiv ist, dann werden zumindest die opkg-commands
|
||||||
# ausgefuehrt.
|
# ausgefuehrt.
|
||||||
# 4: rsync: immer alle Dateien soiegeln (bis auf opkg-commands)
|
|
||||||
# 5: Falls das Tool mal abstuerzt, dann einen Signal-Handler (fuer TERM)
|
# 5: Falls das Tool mal abstuerzt, dann einen Signal-Handler (fuer TERM)
|
||||||
# installieren, sodass zumnidest SEND-LAST-VERSION mit rausgeht.
|
# installieren, sodass zumnidest SEND-LAST-VERSION mit rausgeht.
|
||||||
# 6: rsync: explizites Binary, nicht das in busybox enthaltene.
|
# 6: rsync: explizites Binary, nicht das in busybox enthaltene.
|
||||||
@ -96,6 +134,32 @@ VERSION="1.3.20"
|
|||||||
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
||||||
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
||||||
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
|
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
|
||||||
|
# 11: Das Edit-Fenster teilen um die Anzeige zu verbessern.
|
||||||
|
# 12: Bei einem Update muss immer ersichtlich sein, warum es ueberhaupt
|
||||||
|
# angestossen wurde. Steht kein "WAIT" im ISMAS-Trigger, dann kann man
|
||||||
|
# davon ausgehen, dass es sich um ein automatisches Update handelt.
|
||||||
|
# In jedem Fall wird bei einem automatischen Update, bei dem der WAIT-
|
||||||
|
# Button nicht gesetzt war, ein "OK" gesendet, falls sonst nichts weiter
|
||||||
|
# zu tun ist. Beachte aber: wir haben auch noch den Fall, dass eine SD-
|
||||||
|
# Karte gesteckt wird. In diesem Fall wird ein komplettes Update gefahren,
|
||||||
|
# und zwar explizit auch ohne WAIT-Button.
|
||||||
|
# Am Ende eines Updates steht im ISMAS entweder ein "OK" oder ein "FAIL".
|
||||||
|
# 13: SendLastVersion: fuer jedes erfolgreich installierte Paket eine
|
||||||
|
# Send-Last-Version-Nachricht an ISMAS. Dadurch entsteht im ISMAS eine
|
||||||
|
# History (Christian darueber informieren).
|
||||||
|
# 14: Installiert werden nur Dateien, die neu sind oder geaendert wurden.
|
||||||
|
# Nicht etwas Dateien, die geloescht wurden: sicherstellen, dass man hier
|
||||||
|
# immer direkt im repository arbeitet, nicht auf dem Filesystem.
|
||||||
|
# Ferner: der DeviceController heisst dc2c.bin, auch fuer die Jsons
|
||||||
|
# sind Dtandard-Namen vergeben. Alternativ: alle vorhandenen Jsons
|
||||||
|
# werden runtergeladen: Thomas ist eh fuer deren Inhalte verantworlich.
|
||||||
|
# WICHTIG: immer ueberpruefen, ob die Dateien im Customer-Repository
|
||||||
|
# wirklich die richtigen Dateien sind.
|
||||||
|
# 15: Der WAIT-Button laesst sich auf WAIT zuruecksetzen (etwa wenn git
|
||||||
|
# selber Probleme hatte).
|
||||||
|
# 16: Der Download-Thread sollte sowohl die auto-Variable auf false setzen
|
||||||
|
# als auch den cycle-Timer stoppen, damit sichergestellt ist, dass der
|
||||||
|
# Download des DC nicht gestoert wird.
|
||||||
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
@ -123,7 +187,7 @@ DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
|||||||
# keep comments, as /* fall through */
|
# keep comments, as /* fall through */
|
||||||
QMAKE_CXXFLAGS += -C
|
QMAKE_CXXFLAGS += -C
|
||||||
QMAKE_CXXFLAGS += -g
|
QMAKE_CXXFLAGS += -g
|
||||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy -O
|
||||||
|
|
||||||
contains( CONFIG, PTU5 ) {
|
contains( CONFIG, PTU5 ) {
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||||
@ -183,6 +247,7 @@ HEADERS += \
|
|||||||
process/command.h \
|
process/command.h \
|
||||||
message_handler.h \
|
message_handler.h \
|
||||||
worker.h \
|
worker.h \
|
||||||
|
interfaces.h \
|
||||||
commandline_parser.h \
|
commandline_parser.h \
|
||||||
plugins/interfaces.h
|
plugins/interfaces.h
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void CommandLineParser::configure() {
|
|||||||
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
|
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
|
||||||
m_parser.addOption(m_repositoryUrlOption);
|
m_parser.addOption(m_repositoryUrlOption);
|
||||||
|
|
||||||
m_iniFileDirectoryOption.setDefaultValue(".");
|
m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
|
||||||
m_parser.addOption(m_iniFileDirectoryOption);
|
m_parser.addOption(m_iniFileDirectoryOption);
|
||||||
|
|
||||||
m_iniFileNameOption.setDefaultValue("ATBUpdateTool.ini");
|
m_iniFileNameOption.setDefaultValue("ATBUpdateTool.ini");
|
||||||
@ -117,10 +117,10 @@ void CommandLineParser::configure() {
|
|||||||
m_extendedVersionOption.setDefaultValue("false");
|
m_extendedVersionOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_extendedVersionOption);
|
m_parser.addOption(m_extendedVersionOption);
|
||||||
|
|
||||||
m_yoctoVersionOption .setDefaultValue("false");
|
m_yoctoVersionOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_yoctoVersionOption);
|
m_parser.addOption(m_yoctoVersionOption);
|
||||||
|
|
||||||
m_yoctoInstallStatusOption .setDefaultValue("false");
|
m_yoctoInstallStatusOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_yoctoInstallStatusOption);
|
m_parser.addOption(m_yoctoInstallStatusOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,12 +129,19 @@ void CommandLineParser::readSettings() {
|
|||||||
QString const iniFileName = m_parser.value(m_iniFileNameOption);
|
QString const iniFileName = m_parser.value(m_iniFileNameOption);
|
||||||
m_iniFileName = QDir::cleanPath(iniFileDir + QDir::separator() + iniFileName);
|
m_iniFileName = QDir::cleanPath(iniFileDir + QDir::separator() + iniFileName);
|
||||||
|
|
||||||
|
qCritical() << __PRETTY_FUNCTION__ << " iniFileDir" << iniFileDir;
|
||||||
|
qCritical() << __PRETTY_FUNCTION__ << "iniFileName" << m_iniFileName;
|
||||||
|
|
||||||
if (!m_iniFileName.isEmpty()) {
|
if (!m_iniFileName.isEmpty()) {
|
||||||
if (QFile(m_iniFileName).exists()) {
|
if (QFile(m_iniFileName).exists()) {
|
||||||
QSettings settings(m_iniFileName, QSettings::IniFormat);
|
QSettings settings(m_iniFileName, QSettings::IniFormat);
|
||||||
QStringList keys = settings.allKeys();
|
QStringList keys = settings.allKeys();
|
||||||
for (QString const &key: keys) {
|
for (QString const &key: keys) {
|
||||||
QVariant v = settings.value(key);
|
QVariant v = settings.value(key);
|
||||||
|
|
||||||
|
qCritical() << __PRETTY_FUNCTION__
|
||||||
|
<< key << " -> " << v.toString();
|
||||||
|
|
||||||
if (key.contains("repository-url")) {
|
if (key.contains("repository-url")) {
|
||||||
m_repositoryUrl = v.toString();
|
m_repositoryUrl = v.toString();
|
||||||
} else
|
} else
|
||||||
@ -167,8 +174,14 @@ void CommandLineParser::readSettings() {
|
|||||||
} else
|
} else
|
||||||
if (key.contains("plugin-name")) {
|
if (key.contains("plugin-name")) {
|
||||||
m_plugInName = v.toString();
|
m_plugInName = v.toString();
|
||||||
|
} else {
|
||||||
|
qCritical() << __PRETTY_FUNCTION__
|
||||||
|
<< key << " -> (UNKNOWN) " << v.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
qCritical() << __PRETTY_FUNCTION__ << "iniFileName" << m_iniFileName
|
||||||
|
<< "DOES NOT EXIST";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,7 +252,9 @@ bool CommandLineParser::extendedVersion() {
|
|||||||
bool CommandLineParser::alwaysDownloadConfig() {
|
bool CommandLineParser::alwaysDownloadConfig() {
|
||||||
if (m_parser.isSet(m_alwaysDownloadConfigOption)) {
|
if (m_parser.isSet(m_alwaysDownloadConfigOption)) {
|
||||||
m_alwaysDownloadConfig = m_parser.value(m_alwaysDownloadConfigOption);
|
m_alwaysDownloadConfig = m_parser.value(m_alwaysDownloadConfigOption);
|
||||||
|
qCritical() << "m_alwaysDownloadConfigOption IS SET" << m_alwaysDownloadConfig;
|
||||||
}
|
}
|
||||||
|
qCritical() << "m_alwaysDownloadConfig" << m_alwaysDownloadConfig;
|
||||||
return m_alwaysDownloadConfig == "false" ? false : true;
|
return m_alwaysDownloadConfig == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
doc/ATBUpdateTool.drawio-4.pdf
Normal file
BIN
doc/ATBUpdateTool.drawio-4.pdf
Normal file
Binary file not shown.
BIN
doc/ATBUpdateTool4.pdf
Normal file
BIN
doc/ATBUpdateTool4.pdf
Normal file
Binary file not shown.
101
interfaces.h
Executable file → Normal file
101
interfaces.h
Executable file → Normal file
@ -24,7 +24,8 @@ struct T_emp
|
|||||||
|
|
||||||
// dynamic:
|
// dynamic:
|
||||||
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
||||||
// 0=start command
|
/*
|
||||||
|
// 0=start command
|
||||||
// 1=powered, do emp ini, send reset
|
// 1=powered, do emp ini, send reset
|
||||||
// 2=delay
|
// 2=delay
|
||||||
// 3=wait for response, requesting status after response
|
// 3=wait for response, requesting status after response
|
||||||
@ -39,7 +40,7 @@ struct T_emp
|
|||||||
// 90: stop all, 1s delay
|
// 90: stop all, 1s delay
|
||||||
// 99: off, all stopped
|
// 99: off, all stopped
|
||||||
|
|
||||||
|
*/
|
||||||
uint8_t pollingRunning;
|
uint8_t pollingRunning;
|
||||||
uint8_t paymentRunning;
|
uint8_t paymentRunning;
|
||||||
|
|
||||||
@ -238,6 +239,7 @@ struct T_dynamicCondition
|
|||||||
uint8_t lastVDoorState;
|
uint8_t lastVDoorState;
|
||||||
uint8_t lastCBstate;
|
uint8_t lastCBstate;
|
||||||
char paymentInProgress;
|
char paymentInProgress;
|
||||||
|
// Version Szeged: aug2023
|
||||||
// 0: stopped by timeout
|
// 0: stopped by timeout
|
||||||
// 1: running 2: wait4lastCoin
|
// 1: running 2: wait4lastCoin
|
||||||
// 3: payment stopped manually, coins in Escrow
|
// 3: payment stopped manually, coins in Escrow
|
||||||
@ -246,6 +248,21 @@ struct T_dynamicCondition
|
|||||||
// 6: coins encashed 7:coins returned
|
// 6: coins encashed 7:coins returned
|
||||||
// 8: CoinChecker or MDB on Error
|
// 8: CoinChecker or MDB on Error
|
||||||
|
|
||||||
|
// since Schoenau with bill and changer, nov2023
|
||||||
|
//0 = no payment
|
||||||
|
//will be set to 1 by cash_startCollection()
|
||||||
|
//neu 1: wait for devices getting ready for payment
|
||||||
|
//2 = payment,
|
||||||
|
//3 = wait for last coin/bill
|
||||||
|
//4 = Bezahlvorgang manuell beendet
|
||||||
|
//5 = payment stopped autom, amount collected, coins in Escrow
|
||||||
|
//6 = Bezahlvorgang beendet weil ZK voll
|
||||||
|
//4,5,6: payment done, keep on polling, wait for cash or return command
|
||||||
|
//7 = encash collected money from coin escrow into cash box
|
||||||
|
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
|
||||||
|
//9 = wait for changer result
|
||||||
|
//10= print refund receipt with "amountToReturn"
|
||||||
|
|
||||||
|
|
||||||
char res1;
|
char res1;
|
||||||
uint16_t U_Batt;
|
uint16_t U_Batt;
|
||||||
@ -397,6 +414,7 @@ struct T_bna
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DownloadThread;
|
||||||
class hwinf
|
class hwinf
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2252,14 +2270,23 @@ public:
|
|||||||
virtual void bna_requestCurrentNotes() const {}
|
virtual void bna_requestCurrentNotes() const {}
|
||||||
// send command to DC in order to get transaction data
|
// send command to DC in order to get transaction data
|
||||||
|
|
||||||
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const {
|
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const
|
||||||
|
{
|
||||||
Q_UNUSED(latestBill);
|
Q_UNUSED(latestBill);
|
||||||
Q_UNUSED(currentNotes);
|
Q_UNUSED(currentNotes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// returns number of collected bank notes since start-command (current transaction)
|
// returns number of collected bank notes since start-command (current transaction)
|
||||||
// latestBill: last accepted bank note, value in cent
|
// return value: numbers of bills or 99 in case of error
|
||||||
// currentNotes an array with up to 16 (further) notes collected
|
// latestBill: not used
|
||||||
|
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
|
||||||
|
// in normal case:
|
||||||
|
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
|
||||||
|
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
|
||||||
|
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
|
||||||
|
// currentNotes[2]: total sum of bills in cent, low word (16bit)
|
||||||
|
// currentNotes[3]: total sum of bills in cent, high word (16bit)
|
||||||
|
|
||||||
|
|
||||||
virtual void bna_requestStackerLevel() const {}
|
virtual void bna_requestStackerLevel() const {}
|
||||||
|
|
||||||
@ -2273,9 +2300,73 @@ public:
|
|||||||
// countOfBills[1] for 10€ and so on
|
// countOfBills[1] for 10€ and so on
|
||||||
|
|
||||||
|
|
||||||
|
// download device controller
|
||||||
|
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
|
||||||
|
Q_UNUSED(fileToDownload);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadResetRequest() const { return false; }
|
||||||
|
virtual bool dcDownloadRequestAck() const { return false; }
|
||||||
|
virtual bool dcDownloadRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadFinished() { return false; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadReportStart() const { return false; }
|
||||||
|
virtual bool dcDownloadReportRunning() const { return true; }
|
||||||
|
virtual bool dcDownloadReportFinished() { return true; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadThreadFinalize(DownloadThread *) {}
|
||||||
|
virtual bool dcDownloadThreadFinished() const { return true; }
|
||||||
|
virtual bool dcDownloadReportThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadReportThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadReportThreadFinalize() {}
|
||||||
|
virtual void dcDownloadReportThreadQuit() {}
|
||||||
|
virtual bool dcDownloadReportThreadFinished() const { return true; }
|
||||||
|
|
||||||
|
|
||||||
|
virtual QString dcDownloadFileName() const { return ""; }
|
||||||
|
virtual bool dcDownloadSetRequested(bool requested) {
|
||||||
|
Q_UNUSED(requested); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetRunning(bool running) {
|
||||||
|
Q_UNUSED(running); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetFinished(bool finished) {
|
||||||
|
Q_UNUSED(finished); return false;
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
|
||||||
|
Q_UNUSED(totalBlockNumber);
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
|
||||||
|
Q_UNUSED(currentBlockNumber);
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadGetRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadGetRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadGetFinished() const { return false; }
|
||||||
|
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
|
||||||
|
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
|
||||||
|
|
||||||
|
virtual QObject const *getAPI() { return nullptr; }
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/*
|
||||||
|
NOTE: the difference between a virtual Qt signal and a normal Qt signal:
|
||||||
|
A Qt virtual signal is a connection that is established using a pointer
|
||||||
|
or reference and is not connected to an object or data. It is therefore
|
||||||
|
not bound to a particular object, but to a specific class (object type).
|
||||||
|
Qt virtual signals are useful because they allow you to create
|
||||||
|
connections without worrying about whether an object or a specific data
|
||||||
|
element has been destroyed.
|
||||||
|
https://www.youtube.com/watch?v=HTH3VFfqsXw
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual void hwapi_reportDCDownloadStatus(QString const&) const {}
|
||||||
|
virtual void hwapi_reportDCDownloadSuccess(QString const&) const {}
|
||||||
|
virtual void hwapi_reportDCDownloadFailure(QString const&) const {}
|
||||||
|
|
||||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||||
|
|
||||||
|
@ -793,6 +793,152 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// prepare
|
||||||
|
QString IsmasClient::sendLastVersion(UPDATE_COMPONENT updateComponent,
|
||||||
|
PSAInstalled const &psa) {
|
||||||
|
static char buf[4096*2];
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
|
switch (updateComponent) {
|
||||||
|
case UPDATE_COMPONENT::TARIFF:
|
||||||
|
snprintf(buf, sizeof(buf)-1,
|
||||||
|
"{"
|
||||||
|
"\"VERSION_INFO\" : {"
|
||||||
|
"\"UPDATE_REASON\":\"%s\","
|
||||||
|
"\"CREATED\":\"%s\","
|
||||||
|
"\"GIT_COMMIT\":\"%s\""
|
||||||
|
"},"
|
||||||
|
"\"TARIFF\" : {"
|
||||||
|
"\"VERSION\" : \"%s\","
|
||||||
|
"\"PROJECT\" : \"%s\","
|
||||||
|
"\"ZONE\" : %d,"
|
||||||
|
"\"INFO\" : \"%s\","
|
||||||
|
"\"SIZE\" : %d\""
|
||||||
|
"},"
|
||||||
|
"}",
|
||||||
|
psa.tariff.versionInfo.reason.toStdString().c_str(),
|
||||||
|
psa.tariff.versionInfo.created.toStdString().c_str(),
|
||||||
|
psa.tariff.versionInfo.lastCommit.toStdString().c_str(),
|
||||||
|
|
||||||
|
psa.tariff.version.toStdString().c_str(),
|
||||||
|
psa.tariff.project.toStdString().c_str(),
|
||||||
|
psa.tariff.zone,
|
||||||
|
psa.tariff.info.toStdString().c_str(),
|
||||||
|
psa.tariff.size);
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::SOFTWARE_ATBQT:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::SOFTWARE_APISM:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::SOFTWARE_ATB_UPDATE_TOOL:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::CONFIG_PTU5_CPU_SERIAL:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::CONFIG_DEVICE_CONTROLLER:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::CONFIG_PRINTER:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::CONFIG_BNA:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_ATB_DEVICE_CONTROLLER:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_INGENICO_CC:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_MOBILISIS_CALC_PRICE:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_MOBILISIS_CALC_PRICE_UI:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_PRM_CALC_PRICE:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_PRM_CALC_PRICE_UI:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::PLUGIN_TCP_ZVT_CC:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::OPKG_COMMANDS:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::HARDWARE_DEVICES:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::OS:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_CASH_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_CONF_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_DEVICE_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT01_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT02_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT03_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT04_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT05_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT06_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT07_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT08_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT09_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT10_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT11_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT12_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT13_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT14_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT15_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT16_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT17_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT18_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT19_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT20_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT21_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT22_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT23_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT24_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT25_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT26_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT27_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT28_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT29_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT30_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT31_JSON:
|
||||||
|
break;
|
||||||
|
case UPDATE_COMPONENT::DC2C_PRINT32_JSON:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
qInfo() << buf;
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QString IsmasClient::updateOfPSAContinues(QString currentStage,
|
QString IsmasClient::updateOfPSAContinues(QString currentStage,
|
||||||
QString currentStageInfo,
|
QString currentStageInfo,
|
||||||
QString const &version) {
|
QString const &version) {
|
||||||
|
@ -14,6 +14,7 @@ struct PSAInstalled {
|
|||||||
} versionInfo;
|
} versionInfo;
|
||||||
|
|
||||||
struct Tariff {
|
struct Tariff {
|
||||||
|
// VersionInfo versionInfo;
|
||||||
QString name;
|
QString name;
|
||||||
QString version;
|
QString version;
|
||||||
QString project;
|
QString project;
|
||||||
@ -31,6 +32,7 @@ struct PSAInstalled {
|
|||||||
} hw;
|
} hw;
|
||||||
|
|
||||||
struct Opkg {
|
struct Opkg {
|
||||||
|
// VersionInfo versionInfo;
|
||||||
int size;
|
int size;
|
||||||
QString blob;
|
QString blob;
|
||||||
QString lastCommit;
|
QString lastCommit;
|
||||||
@ -38,6 +40,7 @@ struct PSAInstalled {
|
|||||||
} opkg;
|
} opkg;
|
||||||
|
|
||||||
struct DC {
|
struct DC {
|
||||||
|
// VersionInfo versionInfo;
|
||||||
QString versionHW;
|
QString versionHW;
|
||||||
QString versionSW;
|
QString versionSW;
|
||||||
QString gitBlob;
|
QString gitBlob;
|
||||||
@ -62,6 +65,7 @@ struct PSAInstalled {
|
|||||||
} pluginVersion;
|
} pluginVersion;
|
||||||
|
|
||||||
struct DC2C {
|
struct DC2C {
|
||||||
|
// VersionInfo versionInfo;
|
||||||
QString name;
|
QString name;
|
||||||
QString blob;
|
QString blob;
|
||||||
int size;
|
int size;
|
||||||
@ -194,8 +198,68 @@ public:
|
|||||||
QString jsonParseFailed(int resultCode, QString reason, QString const &version = QString());
|
QString jsonParseFailed(int resultCode, QString reason, QString const &version = QString());
|
||||||
std::optional<QString> finalResult(int resultCode, QString reason, QString const &version = QString());
|
std::optional<QString> finalResult(int resultCode, QString reason, QString const &version = QString());
|
||||||
|
|
||||||
|
// legacy
|
||||||
QString updateOfPSASendVersion(PSAInstalled const &psa);
|
QString updateOfPSASendVersion(PSAInstalled const &psa);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
enum class UPDATE_COMPONENT {
|
||||||
|
TARIFF,
|
||||||
|
SOFTWARE_ATBQT,
|
||||||
|
SOFTWARE_APISM,
|
||||||
|
SOFTWARE_ATB_UPDATE_TOOL,
|
||||||
|
CONFIG_PTU5_CPU_SERIAL,
|
||||||
|
CONFIG_DEVICE_CONTROLLER,
|
||||||
|
CONFIG_PRINTER,
|
||||||
|
CONFIG_BNA,
|
||||||
|
PLUGIN_ATB_DEVICE_CONTROLLER,
|
||||||
|
PLUGIN_INGENICO_CC,
|
||||||
|
PLUGIN_MOBILISIS_CALC_PRICE,
|
||||||
|
PLUGIN_MOBILISIS_CALC_PRICE_UI,
|
||||||
|
PLUGIN_PRM_CALC_PRICE,
|
||||||
|
PLUGIN_PRM_CALC_PRICE_UI,
|
||||||
|
PLUGIN_TCP_ZVT_CC,
|
||||||
|
OPKG_COMMANDS,
|
||||||
|
HARDWARE_DEVICES,
|
||||||
|
OS,
|
||||||
|
DC2C_CASH_JSON,
|
||||||
|
DC2C_CONF_JSON,
|
||||||
|
DC2C_DEVICE_JSON,
|
||||||
|
DC2C_PRINT01_JSON,
|
||||||
|
DC2C_PRINT02_JSON,
|
||||||
|
DC2C_PRINT03_JSON,
|
||||||
|
DC2C_PRINT04_JSON,
|
||||||
|
DC2C_PRINT05_JSON,
|
||||||
|
DC2C_PRINT06_JSON,
|
||||||
|
DC2C_PRINT07_JSON,
|
||||||
|
DC2C_PRINT08_JSON,
|
||||||
|
DC2C_PRINT09_JSON,
|
||||||
|
DC2C_PRINT10_JSON,
|
||||||
|
DC2C_PRINT11_JSON,
|
||||||
|
DC2C_PRINT12_JSON,
|
||||||
|
DC2C_PRINT13_JSON,
|
||||||
|
DC2C_PRINT14_JSON,
|
||||||
|
DC2C_PRINT15_JSON,
|
||||||
|
DC2C_PRINT16_JSON,
|
||||||
|
DC2C_PRINT17_JSON,
|
||||||
|
DC2C_PRINT18_JSON,
|
||||||
|
DC2C_PRINT19_JSON,
|
||||||
|
DC2C_PRINT20_JSON,
|
||||||
|
DC2C_PRINT21_JSON,
|
||||||
|
DC2C_PRINT22_JSON,
|
||||||
|
DC2C_PRINT23_JSON,
|
||||||
|
DC2C_PRINT24_JSON,
|
||||||
|
DC2C_PRINT25_JSON,
|
||||||
|
DC2C_PRINT26_JSON,
|
||||||
|
DC2C_PRINT27_JSON,
|
||||||
|
DC2C_PRINT28_JSON,
|
||||||
|
DC2C_PRINT29_JSON,
|
||||||
|
DC2C_PRINT30_JSON,
|
||||||
|
DC2C_PRINT31_JSON,
|
||||||
|
DC2C_PRINT32_JSON,
|
||||||
|
};
|
||||||
|
QString sendLastVersion(UPDATE_COMPONENT comp, PSAInstalled const &psa);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void printDebugMessage(int port, QString const &clientIP, int clientPort,
|
static void printDebugMessage(int port, QString const &clientIP, int clientPort,
|
||||||
QString const &message);
|
QString const &message);
|
||||||
|
@ -146,7 +146,7 @@ void MainWindow::onEnableExit() {
|
|||||||
|
|
||||||
void MainWindow::onRestartExitTimer() {
|
void MainWindow::onRestartExitTimer() {
|
||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
m_exitTimer->start(60 * 1000);
|
m_exitTimer->start(5 * 1000);
|
||||||
|
|
||||||
scrollDownTextEdit();
|
scrollDownTextEdit();
|
||||||
ui->updateStatus->setEnabled(false);
|
ui->updateStatus->setEnabled(false);
|
||||||
|
@ -24,7 +24,8 @@ struct T_emp
|
|||||||
|
|
||||||
// dynamic:
|
// dynamic:
|
||||||
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
||||||
// 0=start command
|
/*
|
||||||
|
// 0=start command
|
||||||
// 1=powered, do emp ini, send reset
|
// 1=powered, do emp ini, send reset
|
||||||
// 2=delay
|
// 2=delay
|
||||||
// 3=wait for response, requesting status after response
|
// 3=wait for response, requesting status after response
|
||||||
@ -39,7 +40,7 @@ struct T_emp
|
|||||||
// 90: stop all, 1s delay
|
// 90: stop all, 1s delay
|
||||||
// 99: off, all stopped
|
// 99: off, all stopped
|
||||||
|
|
||||||
|
*/
|
||||||
uint8_t pollingRunning;
|
uint8_t pollingRunning;
|
||||||
uint8_t paymentRunning;
|
uint8_t paymentRunning;
|
||||||
|
|
||||||
@ -238,6 +239,7 @@ struct T_dynamicCondition
|
|||||||
uint8_t lastVDoorState;
|
uint8_t lastVDoorState;
|
||||||
uint8_t lastCBstate;
|
uint8_t lastCBstate;
|
||||||
char paymentInProgress;
|
char paymentInProgress;
|
||||||
|
// Version Szeged: aug2023
|
||||||
// 0: stopped by timeout
|
// 0: stopped by timeout
|
||||||
// 1: running 2: wait4lastCoin
|
// 1: running 2: wait4lastCoin
|
||||||
// 3: payment stopped manually, coins in Escrow
|
// 3: payment stopped manually, coins in Escrow
|
||||||
@ -246,6 +248,21 @@ struct T_dynamicCondition
|
|||||||
// 6: coins encashed 7:coins returned
|
// 6: coins encashed 7:coins returned
|
||||||
// 8: CoinChecker or MDB on Error
|
// 8: CoinChecker or MDB on Error
|
||||||
|
|
||||||
|
// since Schoenau with bill and changer, nov2023
|
||||||
|
//0 = no payment
|
||||||
|
//will be set to 1 by cash_startCollection()
|
||||||
|
//neu 1: wait for devices getting ready for payment
|
||||||
|
//2 = payment,
|
||||||
|
//3 = wait for last coin/bill
|
||||||
|
//4 = Bezahlvorgang manuell beendet
|
||||||
|
//5 = payment stopped autom, amount collected, coins in Escrow
|
||||||
|
//6 = Bezahlvorgang beendet weil ZK voll
|
||||||
|
//4,5,6: payment done, keep on polling, wait for cash or return command
|
||||||
|
//7 = encash collected money from coin escrow into cash box
|
||||||
|
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
|
||||||
|
//9 = wait for changer result
|
||||||
|
//10= print refund receipt with "amountToReturn"
|
||||||
|
|
||||||
|
|
||||||
char res1;
|
char res1;
|
||||||
uint16_t U_Batt;
|
uint16_t U_Batt;
|
||||||
@ -397,6 +414,7 @@ struct T_bna
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DownloadThread;
|
||||||
class hwinf
|
class hwinf
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1834,6 +1852,9 @@ public:
|
|||||||
virtual uint8_t prn_getPrintResult() const {
|
virtual uint8_t prn_getPrintResult() const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// return: 0: just printing, wait
|
||||||
|
// 1: OK - last print was succesful
|
||||||
|
// 2: error - not printed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2249,14 +2270,23 @@ public:
|
|||||||
virtual void bna_requestCurrentNotes() const {}
|
virtual void bna_requestCurrentNotes() const {}
|
||||||
// send command to DC in order to get transaction data
|
// send command to DC in order to get transaction data
|
||||||
|
|
||||||
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const {
|
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const
|
||||||
|
{
|
||||||
Q_UNUSED(latestBill);
|
Q_UNUSED(latestBill);
|
||||||
Q_UNUSED(currentNotes);
|
Q_UNUSED(currentNotes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// returns number of collected bank notes since start-command (current transaction)
|
// returns number of collected bank notes since start-command (current transaction)
|
||||||
// latestBill: last accepted bank note, value in cent
|
// return value: numbers of bills or 99 in case of error
|
||||||
// currentNotes an array with up to 16 (further) notes collected
|
// latestBill: not used
|
||||||
|
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
|
||||||
|
// in normal case:
|
||||||
|
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
|
||||||
|
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
|
||||||
|
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
|
||||||
|
// currentNotes[2]: total sum of bills in cent, low word (16bit)
|
||||||
|
// currentNotes[3]: total sum of bills in cent, high word (16bit)
|
||||||
|
|
||||||
|
|
||||||
virtual void bna_requestStackerLevel() const {}
|
virtual void bna_requestStackerLevel() const {}
|
||||||
|
|
||||||
@ -2270,10 +2300,99 @@ public:
|
|||||||
// countOfBills[1] for 10€ and so on
|
// countOfBills[1] for 10€ and so on
|
||||||
|
|
||||||
|
|
||||||
|
// download device controller
|
||||||
|
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
|
||||||
|
Q_UNUSED(fileToDownload);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadResetRequest() const { return false; }
|
||||||
|
virtual bool dcDownloadRequestAck() const { return false; }
|
||||||
|
virtual bool dcDownloadRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadFinished() { return false; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadReportStart() const { return false; }
|
||||||
|
virtual bool dcDownloadReportRunning() const { return true; }
|
||||||
|
virtual bool dcDownloadReportFinished() { return true; }
|
||||||
|
|
||||||
|
virtual bool dcDownloadThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadThreadFinalize(DownloadThread *) {}
|
||||||
|
virtual bool dcDownloadThreadFinished() const { return true; }
|
||||||
|
virtual bool dcDownloadReportThreadStart() { return false; }
|
||||||
|
virtual bool dcDownloadReportThreadRunning() const { return true; }
|
||||||
|
virtual void dcDownloadReportThreadFinalize() {}
|
||||||
|
virtual void dcDownloadReportThreadQuit() {}
|
||||||
|
virtual bool dcDownloadReportThreadFinished() const { return true; }
|
||||||
|
|
||||||
|
|
||||||
|
virtual QString dcDownloadFileName() const { return ""; }
|
||||||
|
virtual bool dcDownloadSetRequested(bool requested) {
|
||||||
|
Q_UNUSED(requested); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetRunning(bool running) {
|
||||||
|
Q_UNUSED(running); return false;
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadSetFinished(bool finished) {
|
||||||
|
Q_UNUSED(finished); return false;
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
|
||||||
|
Q_UNUSED(totalBlockNumber);
|
||||||
|
}
|
||||||
|
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
|
||||||
|
Q_UNUSED(currentBlockNumber);
|
||||||
|
}
|
||||||
|
virtual bool dcDownloadGetRequested() const { return false; }
|
||||||
|
virtual bool dcDownloadGetRunning() const { return false; }
|
||||||
|
virtual bool dcDownloadGetFinished() const { return false; }
|
||||||
|
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
|
||||||
|
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
|
||||||
|
|
||||||
|
virtual QObject const *getAPI() { return nullptr; }
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/*
|
||||||
|
NOTE: the difference between a virtual Qt signal and a normal Qt signal:
|
||||||
|
A Qt virtual signal is a connection that is established using a pointer
|
||||||
|
or reference and is not connected to an object or data. It is therefore
|
||||||
|
not bound to a particular object, but to a specific class (object type).
|
||||||
|
Qt virtual signals are useful because they allow you to create
|
||||||
|
connections without worrying about whether an object or a specific data
|
||||||
|
element has been destroyed.
|
||||||
|
https://www.youtube.com/watch?v=HTH3VFfqsXw
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual void hwapi_reportDCDownloadStatus(QString const&) const {}
|
||||||
|
virtual void hwapi_reportDCDownloadSuccess(QString const&) const {}
|
||||||
|
virtual void hwapi_reportDCDownloadFailure(QString const&) const {}
|
||||||
|
|
||||||
|
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||||
|
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_coinCollectionJustStarted(void) const=0;
|
||||||
|
virtual void hwapi_coinCollectionAborted(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_gotNewCoin(void) const=0;
|
||||||
|
virtual void hwapi_payStopByMax(void) const=0;
|
||||||
|
virtual void hwapi_payStopByPushbutton(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_payStopByEscrow(void) const=0;
|
||||||
|
virtual void hwapi_payStopByError(void) const=0;
|
||||||
|
virtual void hwapi_payStopByTimeout(void) const=0;
|
||||||
|
virtual void hwapi_payCancelled(void) const=0;
|
||||||
|
virtual void hwapi_coinProcessJustStopped(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_doorServiceDoorOpened(void) const=0;
|
||||||
|
virtual void hwapi_doorVaultDoorOpened(void) const=0;
|
||||||
|
virtual void hwapi_doorCoinBoxRemoved(void) const=0;
|
||||||
|
virtual void hwapi_doorCoinBoxInserted(void) const=0;
|
||||||
|
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
|
||||||
|
virtual void hwapi_doorAllDoorsClosed(void) const=0;
|
||||||
|
|
||||||
|
|
||||||
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
||||||
|
/* GH Version, bringt Fehler
|
||||||
void hwapi_templatePrintFinished_OK() const;
|
void hwapi_templatePrintFinished_OK() const;
|
||||||
void hwapi_templatePrintFinished_Err() const;
|
void hwapi_templatePrintFinished_Err() const;
|
||||||
|
|
||||||
@ -2296,6 +2415,7 @@ signals:
|
|||||||
void hwapi_doorCoinBoxInserted() const;
|
void hwapi_doorCoinBoxInserted() const;
|
||||||
void hwapi_doorCBinAndAllDoorsClosed() const;
|
void hwapi_doorCBinAndAllDoorsClosed() const;
|
||||||
void hwapi_doorAllDoorsClosed() const;
|
void hwapi_doorAllDoorsClosed() const;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
244
update.cpp
244
update.cpp
@ -54,6 +54,10 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
|||||||
qCritical() << pluginLoader.errorString();
|
qCritical() << pluginLoader.errorString();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCritical() << "loadDCPlugin() plugin directory:" << plugInDir.absolutePath();
|
||||||
|
qCritical() << "loadDCPlugin() plugin file name:" << pluginLoader.fileName();
|
||||||
|
|
||||||
if (!pluginLoader.isLoaded()) {
|
if (!pluginLoader.isLoaded()) {
|
||||||
qCritical() << pluginLoader.errorString();
|
qCritical() << pluginLoader.errorString();
|
||||||
exit(-2);
|
exit(-2);
|
||||||
@ -123,12 +127,13 @@ Update::Update(Worker *worker,
|
|||||||
// must deliver 'true', only then are all data from hwapi valid
|
// must deliver 'true', only then are all data from hwapi valid
|
||||||
if (--tries < 0) {
|
if (--tries < 0) {
|
||||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
m_hw->dc_autoRequest(true);
|
m_hw->dc_autoRequest(true);
|
||||||
QThread::msleep(500);
|
QThread::msleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
qCritical() << __PRETTY_FUNCTION__ << "m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||||
|
|
||||||
//qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
//qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
||||||
//qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
//qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
||||||
@ -261,6 +266,7 @@ bool Update::updateBinary(QString const &fileToSendToDC) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
QFile fn(fileToSendToDC);
|
QFile fn(fileToSendToDC);
|
||||||
if (!fn.exists()) {
|
if (!fn.exists()) {
|
||||||
// output via CONSOLE() etc
|
// output via CONSOLE() etc
|
||||||
@ -329,6 +335,7 @@ bool Update::updateBinary(QString const &fileToSendToDC) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Update::jsonType(enum FileTypeJson type) {
|
QString Update::jsonType(enum FileTypeJson type) {
|
||||||
@ -376,24 +383,32 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|||||||
templateIdx,
|
templateIdx,
|
||||||
(uint8_t *)ba.data())) {
|
(uint8_t *)ba.data())) {
|
||||||
|
|
||||||
m_hw->dc_autoRequest(true);
|
/*
|
||||||
QThread::msleep(500);
|
* Note: the machine id is contained in DC2C_conf.json.
|
||||||
|
* The idea was to use this to check if the download of
|
||||||
|
* the json-file was correct. It did not work, as the
|
||||||
|
* update of the PSA (to reflect a change in the
|
||||||
|
* machine id) did not happen immediately.
|
||||||
|
*
|
||||||
|
m_hw->dc_autoRequest(true);
|
||||||
|
QThread::msleep(500);
|
||||||
|
|
||||||
// testing
|
// testing
|
||||||
m_hw->request_ReadbackMachineID();
|
m_hw->request_ReadbackMachineID();
|
||||||
QThread::msleep(500);
|
QThread::msleep(500);
|
||||||
|
|
||||||
uint8_t data[64];
|
uint8_t data[64];
|
||||||
memset(data, 0x00, sizeof(data));
|
memset(data, 0x00, sizeof(data));
|
||||||
uint8_t length = 0;
|
uint8_t length = 0;
|
||||||
|
|
||||||
m_hw->readback_machineIDdata(&length, data);
|
m_hw->readback_machineIDdata(&length, data);
|
||||||
|
|
||||||
QThread::msleep(500);
|
QThread::msleep(500);
|
||||||
|
|
||||||
QByteArray ba((const char*)data, length);
|
QByteArray ba((const char*)data, length);
|
||||||
|
|
||||||
qCritical() << length << "MACHINE ID =" << ba.toHex(':');
|
qCritical() << length << "MACHINE ID =" << ba.toHex(':');
|
||||||
|
*/
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
@ -494,6 +509,88 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
|||||||
<< "DC SW-version not available";
|
<< "DC SW-version not available";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Update::getFileVersion(QString const& jsonFileName) {
|
||||||
|
// "version":"15.10.2023 14:55 02.00.06",
|
||||||
|
static const QRegularExpression re("^.*(\\\"version\\\":)(.*)$");
|
||||||
|
|
||||||
|
QString fileVersion;
|
||||||
|
QFile inputFile(jsonFileName);
|
||||||
|
if (inputFile.open(QIODevice::ReadOnly)) {
|
||||||
|
QTextStream in(&inputFile);
|
||||||
|
while (!in.atEnd()) {
|
||||||
|
QString line = in.readLine();
|
||||||
|
|
||||||
|
QRegularExpressionMatch match;
|
||||||
|
int idx = line.indexOf(re, 0, &match);
|
||||||
|
if (idx != -1) {
|
||||||
|
fileVersion = match.captured(match.lastCapturedIndex());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Update::checkDownloadedJsonVersions(QStringList const& jsonFileNames) {
|
||||||
|
|
||||||
|
for (QStringList::size_type i=0; i < jsonFileNames.size(); ++i) {
|
||||||
|
|
||||||
|
uint8_t jsonNr = 0;
|
||||||
|
QFileInfo fInfo(jsonFileNames[i]);
|
||||||
|
|
||||||
|
if (fInfo.fileName().endsWith("conf.json")) {
|
||||||
|
jsonNr = 1;
|
||||||
|
} else
|
||||||
|
if (fInfo.fileName().endsWith("device.json")) {
|
||||||
|
jsonNr = 2;
|
||||||
|
} else
|
||||||
|
if (fInfo.fileName().endsWith("cash.json")) {
|
||||||
|
jsonNr = 3;
|
||||||
|
} else {
|
||||||
|
QRegularExpressionMatch match;
|
||||||
|
static const QRegularExpression re("^(.*print)([0-3][0-9])\\.json\\s*$");
|
||||||
|
int idx = fInfo.fileName().indexOf(re, 0, &match);
|
||||||
|
if (idx != -1) {
|
||||||
|
QString captured = match.captured(match.lastCapturedIndex());
|
||||||
|
bool ok = false;
|
||||||
|
int n = captured.toInt(&ok);
|
||||||
|
if (ok) {
|
||||||
|
jsonNr = n + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonNr != 0) {
|
||||||
|
#if 0
|
||||||
|
m_hw->sys_requestJsonVersions(jsonNr);
|
||||||
|
QThread::msleep(500);
|
||||||
|
|
||||||
|
char buf[64];
|
||||||
|
memset(buf, 0x00, sizeof(buf));
|
||||||
|
m_hw->sys_getJsonVersions(jsonNr, buf);
|
||||||
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
|
||||||
|
QString const installedVersion(buf);
|
||||||
|
QString const fileVersion = getFileVersion(jsonFileNames[i]);
|
||||||
|
|
||||||
|
qCritical() << "installed version:" << installedVersion;
|
||||||
|
qCritical() << " file version:" << fileVersion;
|
||||||
|
|
||||||
|
if (installedVersion == fileVersion) {
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
qCritical() << "CANNOT FIND JSON-NR FOR" << jsonFileNames[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||||
if (m_sys_areDCdataValid == false) {
|
if (m_sys_areDCdataValid == false) {
|
||||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||||
@ -504,26 +601,27 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
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 const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
||||||
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
|
||||||
if (fToWorkOn.contains(version)) {
|
if (fToWorkOn.contains("dc2c.bin")) {
|
||||||
bool updateBinaryRes = true;
|
bool updateBinaryRes = true;
|
||||||
|
|
||||||
// CONSOLE()
|
// CONSOLE()
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
|
|
||||||
|
|
||||||
|
// if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
|
||||||
|
//
|
||||||
// qCritical() << "downloaded binary" << fToWorkOn;
|
// qCritical() << "downloaded binary" << 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(2, ' ') + QString(")")
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
// + QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
Worker::UPDATE_STEP_DONE);
|
// Worker::UPDATE_STEP_DONE);
|
||||||
}
|
//}
|
||||||
|
|
||||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||||
|
|
||||||
@ -542,62 +640,62 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
|
|
||||||
res = updateBinaryRes;
|
res = updateBinaryRes;
|
||||||
|
|
||||||
} else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
} else {
|
||||||
|
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
res = true;
|
res = true;
|
||||||
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)) {
|
||||||
qCritical() << "WRONG TEMPLATE INDEX" << templateIdx;
|
qCritical() << "WRONG TEMPLATE INDEX" << templateIdx;
|
||||||
res = false;
|
res = false;
|
||||||
} else {
|
} else {
|
||||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||||
Utils::printInfoMsg(
|
Utils::printInfoMsg(
|
||||||
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||||
.arg(fToWorkOn)
|
.arg(fToWorkOn)
|
||||||
.arg(templateIdx));
|
.arg(templateIdx));
|
||||||
|
++displayIndex;
|
||||||
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
|
Worker::UPDATE_STEP_DONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
||||||
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
|
res = true;
|
||||||
|
if ((res = updateCashConf(fToWorkOn))) {
|
||||||
|
Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
|
||||||
++displayIndex;
|
++displayIndex;
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + 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);
|
||||||
}
|
}
|
||||||
|
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
||||||
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
|
res = true;
|
||||||
|
if ((res= updateConfig(fToWorkOn))) {
|
||||||
|
Utils::printInfoMsg(QString("DOWNLOADED CONFIG TEMPLATE %1").arg(fToWorkOn));
|
||||||
|
++displayIndex;
|
||||||
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
|
Worker::UPDATE_STEP_DONE);
|
||||||
|
}
|
||||||
|
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
||||||
|
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
|
res = true;
|
||||||
|
if ((res = updateDeviceConf(fToWorkOn))) {
|
||||||
|
Utils::printInfoMsg(QString("DOWNLOADED DEVICE TEMPLATE %1").arg(fToWorkOn));
|
||||||
|
++displayIndex;
|
||||||
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
||||||
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
|
Worker::UPDATE_STEP_DONE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||||
|
res = false;
|
||||||
}
|
}
|
||||||
} else if (fToWorkOn.contains("DC2C_cash", Qt::CaseInsensitive)
|
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
|
||||||
res = true;
|
|
||||||
if ((res = updateCashConf(fToWorkOn))) {
|
|
||||||
Utils::printInfoMsg(QString("DOWNLOADED CASH TEMPLATE %1").arg(fToWorkOn));
|
|
||||||
++displayIndex;
|
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
|
||||||
Worker::UPDATE_STEP_DONE);
|
|
||||||
}
|
|
||||||
} else if (fToWorkOn.contains("DC2C_conf", Qt::CaseInsensitive)
|
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
|
||||||
res = true;
|
|
||||||
if ((res= updateConfig(fToWorkOn))) {
|
|
||||||
Utils::printInfoMsg(QString("DOWNLOADED CONFIG TEMPLATE %1").arg(fToWorkOn));
|
|
||||||
++displayIndex;
|
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
|
||||||
Worker::UPDATE_STEP_DONE);
|
|
||||||
}
|
|
||||||
} else if (fToWorkOn.contains("DC2C_device", Qt::CaseInsensitive)
|
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
|
||||||
res = true;
|
|
||||||
if ((res = updateDeviceConf(fToWorkOn))) {
|
|
||||||
Utils::printInfoMsg(QString("DOWNLOADED DEVICE TEMPLATE %1").arg(fToWorkOn));
|
|
||||||
++displayIndex;
|
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(3, ' ') + QString(")")
|
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
|
||||||
Worker::UPDATE_STEP_DONE);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
|
||||||
res = false;
|
|
||||||
}
|
}
|
||||||
// m_worker->stopProgressLoop();
|
|
||||||
// m_worker->setProgress(100);
|
|
||||||
|
|
||||||
if (res == false) {
|
if (res == false) {
|
||||||
break;
|
break;
|
||||||
|
2
update.h
2
update.h
@ -58,6 +58,7 @@ public:
|
|||||||
char const *baudrate = "115200");
|
char const *baudrate = "115200");
|
||||||
virtual ~Update() override;
|
virtual ~Update() override;
|
||||||
bool doUpdate(int &displayIndex, QStringList const &linesToWorkOn);
|
bool doUpdate(int &displayIndex, QStringList const &linesToWorkOn);
|
||||||
|
bool checkDownloadedJsonVersions(QStringList const& jsonFileNames);
|
||||||
|
|
||||||
hwinf *hw() { return m_hw; }
|
hwinf *hw() { return m_hw; }
|
||||||
hwinf const *hw() const { return m_hw; }
|
hwinf const *hw() const { return m_hw; }
|
||||||
@ -87,6 +88,7 @@ private:
|
|||||||
bool downloadJson(enum FileTypeJson type, int templateIdx,
|
bool downloadJson(enum FileTypeJson type, int templateIdx,
|
||||||
QString jsFileToSendToDC) const;
|
QString jsFileToSendToDC) const;
|
||||||
QStringList getDcSoftAndHardWareVersion();
|
QStringList getDcSoftAndHardWareVersion();
|
||||||
|
QString getFileVersion(QString const& jsonFile);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void readyReadStandardOutput();
|
void readyReadStandardOutput();
|
||||||
|
76
utils.cpp
76
utils.cpp
@ -30,6 +30,82 @@ int Utils::read1stLineOfFile(QString fileName) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Utils::getLocation(QString fileName) {
|
||||||
|
QString location("N/A");
|
||||||
|
QFile f(fileName);
|
||||||
|
if (f.exists()) {
|
||||||
|
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QTextStream in(&f);
|
||||||
|
in.setCodec("UTF-8");
|
||||||
|
while(!in.atEnd()) {
|
||||||
|
QString const &line = in.readLine();
|
||||||
|
if (line.indexOf("Project", Qt::CaseInsensitive) != -1) {
|
||||||
|
int const c = line.indexOf(":");
|
||||||
|
if (c != -1) {
|
||||||
|
location = line.mid(c+1);
|
||||||
|
if (!location.isEmpty()) {
|
||||||
|
return location.replace(QChar('"'), QString("")).trimmed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Utils::getTariffVersion(QString fileName) {
|
||||||
|
QString version("N/A");
|
||||||
|
QFile f(fileName);
|
||||||
|
if (f.exists()) {
|
||||||
|
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QTextStream in(&f);
|
||||||
|
in.setCodec("UTF-8");
|
||||||
|
while(!in.atEnd()) {
|
||||||
|
QString const &line = in.readLine();
|
||||||
|
if (line.indexOf("Version", Qt::CaseInsensitive) != -1) {
|
||||||
|
int const c = line.indexOf(":");
|
||||||
|
if (c != -1) {
|
||||||
|
version = line.mid(c+1);
|
||||||
|
if (!version.isEmpty()) {
|
||||||
|
return version.replace(QChar('"'), QString("")).trimmed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Utils::getTariffInfo(QString fileName) {
|
||||||
|
QString info("N/A");
|
||||||
|
QFile f(fileName);
|
||||||
|
if (f.exists()) {
|
||||||
|
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QTextStream in(&f);
|
||||||
|
in.setCodec("UTF-8");
|
||||||
|
while(!in.atEnd()) {
|
||||||
|
QString const &line = in.readLine();
|
||||||
|
if (line.indexOf("Info", Qt::CaseInsensitive) != -1) {
|
||||||
|
int const c = line.indexOf(":");
|
||||||
|
if (c != -1) {
|
||||||
|
info = line.mid(c+1);
|
||||||
|
if (!info.isEmpty()) {
|
||||||
|
return info.replace(QChar('"'), QString("")).trimmed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QString Utils::zoneName(quint8 i) {
|
QString Utils::zoneName(quint8 i) {
|
||||||
static constexpr char const *zName[] = {
|
static constexpr char const *zName[] = {
|
||||||
"",
|
"",
|
||||||
|
3
utils.h
3
utils.h
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
int read1stLineOfFile(QString fileName);
|
int read1stLineOfFile(QString fileName);
|
||||||
|
QString getLocation(QString fileName);
|
||||||
|
QString getTariffVersion(QString fileName);
|
||||||
|
QString getTariffInfo(QString fileName);
|
||||||
QString zoneName(quint8 i);
|
QString zoneName(quint8 i);
|
||||||
void printCriticalErrorMsg(QString const &errorMsg, bool upper=false, bool lower=false);
|
void printCriticalErrorMsg(QString const &errorMsg, bool upper=false, bool lower=false);
|
||||||
void printCriticalErrorMsg(QStringList const &errorMsg);
|
void printCriticalErrorMsg(QStringList const &errorMsg);
|
||||||
|
416
worker.cpp
416
worker.cpp
@ -96,12 +96,15 @@ const QMap<UPDATE_STEP, const char*> Worker::smap (
|
|||||||
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS),
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_SUCCESS),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE),
|
INSERT_ELEMENT(UPDATE_STEP::SAVE_LOGS_FAILURE),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION),
|
INSERT_ELEMENT(UPDATE_STEP::SEND_LAST_VERSION),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FINALIZE),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED),
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_SUCCEEDED),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_NOT_NECESSARY),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_FAILED),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::UPDATE_ACTIVATED),
|
INSERT_ELEMENT(UPDATE_STEP::UPDATE_ACTIVATED),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::FINISHED),
|
INSERT_ELEMENT(UPDATE_STEP::FINISHED),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::DEBUG),
|
INSERT_ELEMENT(UPDATE_STEP::DEBUG),
|
||||||
INSERT_ELEMENT(UPDATE_STEP::ERROR)
|
INSERT_ELEMENT(UPDATE_STEP::ERROR),
|
||||||
|
INSERT_ELEMENT(UPDATE_STEP::NONE)
|
||||||
#undef INSERT_ELEMENT
|
#undef INSERT_ELEMENT
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -140,6 +143,7 @@ Worker::Worker(int customerNr,
|
|||||||
, m_serialInterface(serialInterface)
|
, m_serialInterface(serialInterface)
|
||||||
, m_baudrate(baudrate)
|
, m_baudrate(baudrate)
|
||||||
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
|
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
|
||||||
|
, m_versionInfo(QStringList())
|
||||||
, m_osVersion(getOsVersion())
|
, m_osVersion(getOsVersion())
|
||||||
, m_atbqtVersion(getATBQTVersion())
|
, m_atbqtVersion(getATBQTVersion())
|
||||||
, m_atbUpdateToolVersion(getATBUpdateToolVersion())
|
, m_atbUpdateToolVersion(getATBUpdateToolVersion())
|
||||||
@ -162,6 +166,8 @@ Worker::Worker(int customerNr,
|
|||||||
// TODO: turn object into singleton
|
// TODO: turn object into singleton
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||||
|
|
||||||
this->setObjectName("worker-object");
|
this->setObjectName("worker-object");
|
||||||
QDir::setCurrent(m_workingDirectory);
|
QDir::setCurrent(m_workingDirectory);
|
||||||
|
|
||||||
@ -214,6 +220,12 @@ bool Worker::isRepositoryCorrupted() {
|
|||||||
Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY .GIT DOES NOT EXIST");
|
Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY .GIT DOES NOT EXIST");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
||||||
|
if (!customerRepositoryEtc.exists()) {
|
||||||
|
// should never happen
|
||||||
|
Utils::printCriticalErrorMsg(QString("CORRUPTED CUSTOMER REPOSITORY %1/etc DOES NOT EXIST").arg(m_customerRepository));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -248,11 +260,62 @@ void Worker::privateUpdate() {
|
|||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::STARTED));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::STARTED));
|
||||||
|
|
||||||
QScopedPointer<UpdateProcessRunning> upr(new UpdateProcessRunning(this));
|
QScopedPointer<UpdateProcessRunning> upr(new UpdateProcessRunning(this));
|
||||||
|
QStringList lst;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CHECK UPDATE TRIGGER
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTE: make sure that nothing is sent to ISMAS during updateTriggerSet
|
||||||
|
ISMAS() << UPDATE_STEP::CHECK_ISMAS_TRIGGER;
|
||||||
|
m_ismasTriggerActive = false;
|
||||||
|
m_updateNotNecessary = false;
|
||||||
|
|
||||||
|
if (QDir(m_customerRepository).exists()) { // ignore a possibly corrupted repository
|
||||||
|
m_ismasTriggerActive = updateTriggerSet();
|
||||||
|
if (m_ismasTriggerActive == false) {
|
||||||
|
QDateTime const ¤t = QDateTime::currentDateTime();
|
||||||
|
m_automaticUpdate = (current.time().hour() < 4);
|
||||||
|
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||||
|
|
||||||
|
qCritical() << "***";
|
||||||
|
qCritical() << "privateUpdate ............. m_versionInfo:" << m_versionInfo;
|
||||||
|
qCritical() << "privateUpdate ......... m_automaticUpdate:" << m_automaticUpdate;
|
||||||
|
|
||||||
|
if (m_automaticUpdate) { // update has been triggered within [00:00:00, 00:03:59]
|
||||||
|
m_updateNotNecessary = true;
|
||||||
|
m_ismasTriggerStatusMessage = QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
|
||||||
|
|
||||||
|
qCritical() << "privateUpdate m_ismasTriggerStatusMessage:" << QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
|
||||||
|
qCritical() << "***";
|
||||||
|
|
||||||
|
// the customer-repository does exist, but the ISMAS-trigger is
|
||||||
|
// *NOT* "WAIT", but from 00:00:00 - 00:03:59 this counts as an
|
||||||
|
// automatic update
|
||||||
|
|
||||||
|
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qCritical() << "***";
|
||||||
|
|
||||||
|
// the customer-repository does exist, but the ISMAS-trigger is
|
||||||
|
// *NOT* "WAIT", so STOP the update procedure
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// the customer-repository does exist, and the ISMAS-trigger is "WAIT",
|
||||||
|
// so continue the update procedure
|
||||||
|
} else {
|
||||||
|
// the customer-repository does not exist, so PROCEED with the
|
||||||
|
// update procedure, even if ISMAS-trigger is not correctly set ("WAIT")
|
||||||
|
}
|
||||||
|
|
||||||
|
emit this->disableExit();
|
||||||
|
|
||||||
QDir customerRepository(m_customerRepository);
|
QDir customerRepository(m_customerRepository);
|
||||||
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
|
|
||||||
|
|
||||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY;
|
CONSOLE() << (ISMAS() << UPDATE_STEP::CHECK_SANITY);
|
||||||
|
|
||||||
m_clone = false;
|
m_clone = false;
|
||||||
m_repairClone = false;
|
m_repairClone = false;
|
||||||
@ -275,26 +338,27 @@ void Worker::privateUpdate() {
|
|||||||
|
|
||||||
if (isRepositoryCorrupted()) { // a not-existing repository is not meant
|
if (isRepositoryCorrupted()) { // a not-existing repository is not meant
|
||||||
// to be corrupted
|
// to be corrupted
|
||||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY_FAILURE;
|
CONSOLE() << (ISMAS() << UPDATE_STEP::CHECK_SANITY_FAILURE);
|
||||||
if ((continueUpdate = repairCorruptedRepository()) == true) {
|
if ((continueUpdate = repairCorruptedRepository()) == true) {
|
||||||
m_repairClone = true;
|
m_repairClone = true;
|
||||||
CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS;
|
CONSOLE() << (ISMAS() << UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE));
|
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CONSOLE() << UPDATE_STEP::CHECK_SANITY_SUCCESS;
|
CONSOLE() << (ISMAS() << UPDATE_STEP::CHECK_SANITY_SUCCESS);
|
||||||
|
|
||||||
if (continueUpdate) {
|
if (continueUpdate) {
|
||||||
if ((continueUpdate = customerRepository.exists()) == false) {
|
if ((continueUpdate = customerRepository.exists()) == false) {
|
||||||
m_initialClone = (m_repairClone == false);
|
m_initialClone = (m_repairClone == false);
|
||||||
GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY);
|
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY));
|
||||||
for (int i = 0; i < 5; ++i) { // try to checkout git repository
|
for (int i = 0; i < 5; ++i) { // try to checkout git repository
|
||||||
setProgress(i); // and switch to branch
|
setProgress(i); // and switch to branch
|
||||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||||
if (!isRepositoryCorrupted()) {
|
if (!isRepositoryCorrupted()) {
|
||||||
|
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
|
||||||
continueUpdate = true;
|
continueUpdate = true;
|
||||||
m_clone = true;
|
m_clone = true;
|
||||||
@ -305,7 +369,7 @@ void Worker::privateUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (continueUpdate == false) {
|
if (continueUpdate == false) {
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_FAILURE));
|
GUI() << (ISMAS() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CLONE_REPOSITORY_FAILURE)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,36 +383,37 @@ void Worker::privateUpdate() {
|
|||||||
|
|
||||||
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
|
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY;
|
||||||
if (isRepositoryCorrupted()) {
|
if (isRepositoryCorrupted()) {
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_FAILURE));
|
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_REPOSITORY_FAILURE)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||||
|
|
||||||
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
|
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
|
||||||
setProgress(_CHECKOUT_REPOSITORY_SUCCESS);
|
setProgress(_CHECKOUT_REPOSITORY_SUCCESS);
|
||||||
|
|
||||||
|
if (m_clone == false) {
|
||||||
////////////////////////////////////////////////////////////////////////////
|
if (m_ismasTriggerActive == false) {
|
||||||
//
|
return;
|
||||||
// CHECK UPDATE TRIGGER
|
} else {
|
||||||
//
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
||||||
////////////////////////////////////////////////////////////////////////////
|
setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||||
m_ismasTriggerActive = false;
|
}
|
||||||
if ((continueUpdate = updateTriggerSet()) == false) {
|
} else {
|
||||||
if (m_initialClone) {
|
if (m_initialClone) {
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER));
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ismasTriggerActive == false) {// make it explicit again: only if the
|
if (m_ismasTriggerActive == false) {// make it explicit again: only if the
|
||||||
// ismas trigger is active ('WAIT'),
|
// ismas trigger is active ('WAIT'),
|
||||||
// then proceed
|
// then proceed
|
||||||
return;
|
|
||||||
}
|
if (m_clone == false) { // if it is an (initial) clone, then
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
return; // run the whole update process:
|
||||||
setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
} // sync tariff-files, download jsons,
|
||||||
|
} // download device controller
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -359,9 +424,22 @@ void Worker::privateUpdate() {
|
|||||||
if ((continueUpdate = customerEnvironment()) == false) {
|
if ((continueUpdate = customerEnvironment()) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CONSOLE() << UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS;
|
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||||
|
lst = QStringList(QString(smap[UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS]));
|
||||||
|
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH);
|
||||||
setProgress(_CHECKOUT_BRANCH_SUCCESS);
|
setProgress(_CHECKOUT_BRANCH_SUCCESS);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// (R)SYNC THE REPOSITORY WITH THE LOCAL FILEYSTEM
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));
|
||||||
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
||||||
|
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@ -371,7 +449,9 @@ void Worker::privateUpdate() {
|
|||||||
if ((continueUpdate = filesToUpdate()) == false) {
|
if ((continueUpdate = filesToUpdate()) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS));
|
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||||
|
lst = QStringList(QString(smap[UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS]));
|
||||||
|
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY));
|
||||||
setProgress(_UPDATE_REPOSITORY_SUCCESS);
|
setProgress(_UPDATE_REPOSITORY_SUCCESS);
|
||||||
|
|
||||||
|
|
||||||
@ -383,7 +463,8 @@ void Worker::privateUpdate() {
|
|||||||
if ((continueUpdate = execOpkgCommands()) == false) {
|
if ((continueUpdate = execOpkgCommands()) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GUI() << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS);
|
lst = QStringList(QString(smap[UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS]));
|
||||||
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::EXEC_OPKG_COMMANDS);
|
||||||
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||||
|
|
||||||
|
|
||||||
@ -395,22 +476,10 @@ void Worker::privateUpdate() {
|
|||||||
if ((continueUpdate = downloadFilesToPSAHardware()) == false) {
|
if ((continueUpdate = downloadFilesToPSAHardware()) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GUI() << (CONSOLE() << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
lst = QStringList(QString(smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS]));
|
||||||
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
|
||||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// (R)SYNC THE REPOSITORY WITH THE LOCAL FILEYSTEM
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
|
||||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FUTURE: SAVE LOG FILES
|
// FUTURE: SAVE LOG FILES
|
||||||
@ -422,28 +491,8 @@ void Worker::privateUpdate() {
|
|||||||
// ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SAVE_LOGS_SUCCESS));
|
// ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SAVE_LOGS_SUCCESS));
|
||||||
setProgress(_SAVE_LOGS_SUCCESS);
|
setProgress(_SAVE_LOGS_SUCCESS);
|
||||||
|
|
||||||
|
// final messages: see destructor of UpdateProcessRunning subclass
|
||||||
////////////////////////////////////////////////////////////////////////////
|
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||||
//
|
|
||||||
// FINAL MESSAGES (PART 1)
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_SUCCEEDED));
|
|
||||||
setProgress(_UPDATE_SUCCEEDED);
|
|
||||||
|
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_ACTIVATED));
|
|
||||||
setProgress(_UPDATE_ACTIVATED);
|
|
||||||
|
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::FINISHED));
|
|
||||||
setProgress(_FINISHED);
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// FINAL MESSAGES (PART 2): SEND-LAST-VERSION
|
|
||||||
// (destructor of struct UpdateProcessRunning)
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::updateTriggerSet() {
|
bool Worker::updateTriggerSet() {
|
||||||
@ -451,31 +500,36 @@ bool Worker::updateTriggerSet() {
|
|||||||
// (WAIT-button) is activated even in case of initial checkout
|
// (WAIT-button) is activated even in case of initial checkout
|
||||||
static const QString func = "UPDATE-TRIGGER-SET";
|
static const QString func = "UPDATE-TRIGGER-SET";
|
||||||
|
|
||||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
// if (m_withoutIsmasDirectPort) { // useful for testing
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
|
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
m_ismasTriggerStatusMessage.clear();
|
||||||
|
|
||||||
|
GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER);
|
||||||
|
|
||||||
QString triggerValue("NOT CHECKED YET");
|
QString triggerValue("NOT CHECKED YET");
|
||||||
|
static constexpr int const repeats = 15;
|
||||||
for (int repeat = 1; repeat <= 100; ++repeat) {
|
for (int repeat = 1; repeat <= repeats; ++repeat) {
|
||||||
|
|
||||||
if (repeat > 1) {
|
if (repeat > 1) {
|
||||||
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
int const startMs = QTime::currentTime().msecsSinceStartOfDay();
|
||||||
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
|
int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs;
|
||||||
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
QString const &s = QString("elapsed: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000);
|
||||||
CONSOLE(QStringList(func) << s) << UPDATE_STEP::DEBUG;
|
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << s));
|
||||||
|
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||||
} else {
|
} else {
|
||||||
CONSOLE(QStringList(func) << QString("-> REPEAT=%1").arg(repeat)) << UPDATE_STEP::DEBUG;
|
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << QString("-> REPEAT=%1 (%2)").arg(repeat).arg(repeats-repeat)));
|
||||||
|
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((repeat % 10) == 0) {
|
if ((repeat % 8) == 0) {
|
||||||
CONSOLE(QStringList(func) << "RESTART APISM") << UPDATE_STEP::DEBUG;
|
CONSOLE(QStringList(func) << "RESTART APISM") << UPDATE_STEP::DEBUG;
|
||||||
Command c("systemctl restart apism");
|
Command c("systemctl restart apism");
|
||||||
if (c.execute("/tmp")) {
|
if (c.execute("/tmp")) {
|
||||||
QThread::sleep(20); // give APISM some time to reconnect
|
QThread::sleep(20); // give APISM some time to reconnect
|
||||||
CONSOLE(QStringList(func) << "RESTART APISM DONE") << UPDATE_STEP::DEBUG;
|
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << "RESTART APISM DONE"));
|
||||||
|
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,31 +538,35 @@ bool Worker::updateTriggerSet() {
|
|||||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||||
|
|
||||||
QString const &msg = QString("APISM RESPONSE(%1)=(").arg(repeat) + result.value() + ")";
|
QString const &msg = QString("APISM RESPONSE(%1)=(").arg(repeat) + result.value() + ")";
|
||||||
CONSOLE(QStringList(func) << msg) << UPDATE_STEP::DEBUG;
|
QStringList lst = (m_ismasTriggerStatusMessage = (QStringList(func) << msg));
|
||||||
|
CONSOLE(lst) << UPDATE_STEP::DEBUG;
|
||||||
|
|
||||||
QJsonParseError parseError;
|
QJsonParseError parseError;
|
||||||
QJsonDocument document(QJsonDocument::fromJson(result.value().toUtf8(), &parseError));
|
QJsonDocument document(QJsonDocument::fromJson(result.value().toUtf8(), &parseError));
|
||||||
if (parseError.error != QJsonParseError::NoError) {
|
if (parseError.error != QJsonParseError::NoError) {
|
||||||
QStringList lst(QString("INVALID JSON MSG: PARSING FAILED (json=<START>%1<END> error=[%2] str=[%3] offset=[%4])")
|
m_ismasTriggerStatusMessage = QStringList(QString("INVALID JSON MSG: PARSING FAILED (json=<START>%1<END> error=[%2] str=[%3] offset=[%4])")
|
||||||
.arg(msg)
|
.arg(msg)
|
||||||
.arg(parseError.error)
|
.arg(parseError.error)
|
||||||
.arg(parseError.errorString())
|
.arg(parseError.errorString())
|
||||||
.arg(parseError.offset));
|
.arg(parseError.offset));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!document.isObject()) {
|
if (!document.isObject()) {
|
||||||
QStringList lst(QString("not a json-object %1").arg(result.value()));
|
m_ismasTriggerStatusMessage = QStringList(QString("not a json-object %1").arg(result.value()));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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")) {
|
||||||
QStringList lst(obj.value("error").toString());
|
m_ismasTriggerStatusMessage = QStringList(obj.value("error").toString());
|
||||||
CONSOLE(QStringList(lst)) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE;
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
|
CONSOLE(QStringList(lst)) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -523,31 +581,35 @@ bool Worker::updateTriggerSet() {
|
|||||||
int const customerNr = obj.value("Custom_ID").toInt(-1);
|
int const customerNr = obj.value("Custom_ID").toInt(-1);
|
||||||
int const machineNr = obj.value("Device_ID").toInt(-1);
|
int const machineNr = obj.value("Device_ID").toInt(-1);
|
||||||
if (customerNr != m_customerNr) {
|
if (customerNr != m_customerNr) {
|
||||||
QStringList lst(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
m_ismasTriggerStatusMessage = QStringList(QString("CUSTOMER-NR (%1) != LOCAL CUSTOMER-NR (%2)")
|
||||||
.arg(customerNr).arg(m_customerNr));
|
.arg(customerNr).arg(m_customerNr));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (machineNr != m_machineNr) {
|
if (machineNr != m_machineNr) {
|
||||||
QStringList lst(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
m_ismasTriggerStatusMessage = QStringList(QString("MACHINE-NR (%1) != LOCAL MACHINE-NR (%2)")
|
||||||
.arg(machineNr).arg(m_machineNr));
|
.arg(machineNr).arg(m_machineNr));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
|
QStringList lst(QString("Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
break;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst("Dev_ID KEY NOT A JSON-OBJECT");
|
m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT A JSON-OBJECT (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst("Dev_ID KEY NOT AVAILABLE");
|
m_ismasTriggerStatusMessage = QStringList(QString("Dev_ID KEY NOT AVAILABLE (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.contains("Fileupload")) {
|
if (obj.contains("Fileupload")) {
|
||||||
@ -556,56 +618,68 @@ bool Worker::updateTriggerSet() {
|
|||||||
obj = v.toObject();
|
obj = v.toObject();
|
||||||
if (obj.contains("TRG")) {
|
if (obj.contains("TRG")) {
|
||||||
if ((triggerValue = obj.value("TRG").toString()) == "WAIT") {
|
if ((triggerValue = obj.value("TRG").toString()) == "WAIT") {
|
||||||
|
m_ismasTriggerStatusMessage = QStringList("ISMAS_UPDATE-TRIGGER SET TO WAIT");
|
||||||
m_ismasTriggerActive = true;
|
m_ismasTriggerActive = true;
|
||||||
return m_ismasTriggerActive;
|
return m_ismasTriggerActive;
|
||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
QStringList lst("empty update trigger");
|
m_ismasTriggerStatusMessage = QStringList(QString("%1 EMPTY UPDATE TRIGGER (%2)").arg(repeat).arg(repeats-repeat));
|
||||||
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
if (m_clone) {
|
if (m_clone) {
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)));
|
||||||
// if the customer repository has just been cloned
|
// if the customer repository has just been cloned
|
||||||
break; // it is OK the ISMAS trigger might not be 'WAIT'
|
return false; // it is OK the ISMAS trigger might not be 'WAIT'
|
||||||
} else {
|
} else {
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
}
|
}
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// if the download-button once has the wrong value, it will never recover
|
// if the download-button once has a wrong value, it will never recover
|
||||||
if (m_clone) {
|
if (m_clone) {
|
||||||
GUI() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE='%1' != 'WAIT'").arg(triggerValue));
|
||||||
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE)));
|
||||||
} else {
|
} else {
|
||||||
QStringList lst(QString("TRIGGER-VALUE=<%1> NOT 'WAIT'").arg(triggerValue));
|
m_ismasTriggerStatusMessage = QStringList(QString("TRIGGER-VALUE='%1' != 'WAIT'").arg(triggerValue));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
}
|
}
|
||||||
break;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst("TRG key not available");
|
m_ismasTriggerStatusMessage = QStringList(QString("TRG key not available (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst("Fileupload not a json-object");
|
m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not a json-object (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst(QString("Fileupload not available"));
|
m_ismasTriggerStatusMessage = QStringList(QString("Fileupload not available (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
break;
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList lst = QStringList(QString("no ISMAS response"));
|
m_ismasTriggerStatusMessage = QStringList(QString("no ISMAS response (LINE=%1)").arg(__LINE__));
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
|
CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE);
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_initialClone == false) {
|
if (m_initialClone == false) {
|
||||||
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
|
if (!triggerValue.contains("WAIT", Qt::CaseInsensitive)) {
|
||||||
QStringList lst(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")");
|
m_ismasTriggerStatusMessage = QStringList(QString("ISMAS_UPDATE-TRIGGER-NOT-SET-OR-WRONG: VALUE=(") + triggerValue + ")");
|
||||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE));
|
QStringList lst = m_ismasTriggerStatusMessage;
|
||||||
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,11 +697,11 @@ bool Worker::customerEnvironment() {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
QStringList lst(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
QStringList lst(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
||||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH_FAILURE));
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)));
|
||||||
}
|
}
|
||||||
} else {// cannot happen
|
} else {// cannot happen
|
||||||
QStringList lst(QString(m_customerRepository + " DOES NOT EXIST"));
|
QStringList lst(QString(m_customerRepository + " DOES NOT EXIST"));
|
||||||
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH_FAILURE));
|
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << (m_lastFailedUpdateStep = UPDATE_STEP::CHECKOUT_BRANCH_FAILURE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -642,37 +716,31 @@ bool Worker::filesToUpdate() {
|
|||||||
// always execute contents of opkg_commands-file
|
// always execute contents of opkg_commands-file
|
||||||
m_filesToUpdate << "etc/psa_update/opkg_commands";
|
m_filesToUpdate << "etc/psa_update/opkg_commands";
|
||||||
|
|
||||||
if (m_alwaysDownloadConfig) {
|
if (m_clone && m_alwaysDownloadConfig) {
|
||||||
#if 0
|
|
||||||
QStringList lst(QString("m_alwaysDownloadConfig NOT TESTED"));
|
|
||||||
CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY;
|
|
||||||
// always download all json-config files, even if none of them have been
|
// always download all json-config files, even if none of them have been
|
||||||
// changed in the git repository. useful for first installation.
|
// changed in the git repository. useful for first installation.
|
||||||
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config"));
|
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config"));
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files);
|
QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files);
|
||||||
if (!jsons.isEmpty()) {
|
if (!jsons.isEmpty()) {
|
||||||
m_filesToUpdate << jsons;
|
for (QStringList::size_type i=0; i<jsons.size(); ++i) {
|
||||||
|
m_filesToUpdate << QDir::cleanPath(QString("etc/psa_config/") + jsons.at(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_alwaysDownloadDC) {
|
if (m_clone && m_alwaysDownloadDC) {
|
||||||
#if 0
|
|
||||||
QStringList lst(QString("m_alwaysDownloadDC NOT TESTED"));
|
|
||||||
CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY;
|
|
||||||
// always download the last dc-binary, even if not changed in the
|
// always download the last dc-binary, even if not changed in the
|
||||||
// git repository. useful for first installation.
|
// git repository. useful for first installation.
|
||||||
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_update"));
|
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/dc"));
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
QStringList dc = dir.entryList(QStringList() << "dc2c*.bin", QDir::Files,
|
QStringList dc = dir.entryList(QStringList() << "dc2c.bin", QDir::Files,
|
||||||
QDir::SortFlag::Time | QDir::SortFlag::Reversed);
|
QDir::SortFlag::Time | QDir::SortFlag::Reversed);
|
||||||
if (!dc.isEmpty()) {
|
if (!dc.isEmpty()) {
|
||||||
m_filesToUpdate << dc.first();
|
m_filesToUpdate << QDir::cleanPath(QString("etc/dc/") + dc.first());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::optional<QString> changes = m_gc.gitPull()) {
|
if (std::optional<QString> changes = m_gc.gitPull()) {
|
||||||
@ -688,7 +756,7 @@ bool Worker::filesToUpdate() {
|
|||||||
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
|
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
|
||||||
setProgress(_FILES_TO_UPDATE);
|
setProgress(_FILES_TO_UPDATE);
|
||||||
} else {
|
} else {
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY_FAILURE));
|
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::UPDATE_REPOSITORY_FAILURE)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,8 +773,7 @@ bool Worker::computeFilesToDownload() {
|
|||||||
fName.contains("DC2C_cash", Qt::CaseInsensitive)) {
|
fName.contains("DC2C_cash", Qt::CaseInsensitive)) {
|
||||||
m_filesToDownload << fName; // download printer-config-files
|
m_filesToDownload << fName; // download printer-config-files
|
||||||
} else {
|
} else {
|
||||||
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
if (fName.contains("dc2c.bin")) {
|
||||||
if (fName.contains(version)) {
|
|
||||||
m_filesToDownload << fName; // download device controller
|
m_filesToDownload << fName; // download device controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,7 +794,7 @@ bool Worker::execOpkgCommands() {
|
|||||||
if (f.open(QIODevice::ReadOnly)) {
|
if (f.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream in(&f);
|
QTextStream in(&f);
|
||||||
m_opkgCommands.clear();
|
m_opkgCommands.clear();
|
||||||
bool executeOpkgCommandFailed = false;
|
QStringList opkgErrorLst;
|
||||||
while (!in.atEnd()) {
|
while (!in.atEnd()) {
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
static const QRegularExpression comment("^\\s*#.*$");
|
static const QRegularExpression comment("^\\s*#.*$");
|
||||||
@ -735,7 +802,7 @@ bool Worker::execOpkgCommands() {
|
|||||||
// found opkg command
|
// found opkg command
|
||||||
QString opkgCommand = line.trimmed();
|
QString opkgCommand = line.trimmed();
|
||||||
if (!executeOpkgCommand(opkgCommand)) {
|
if (!executeOpkgCommand(opkgCommand)) {
|
||||||
executeOpkgCommandFailed = true;
|
opkgErrorLst << opkgCommand;
|
||||||
} else {
|
} else {
|
||||||
QString cmd = "\n " + opkgCommand;
|
QString cmd = "\n " + opkgCommand;
|
||||||
emit appendText(cmd);
|
emit appendText(cmd);
|
||||||
@ -789,14 +856,15 @@ bool Worker::execOpkgCommands() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.close();
|
f.close();
|
||||||
if (!executeOpkgCommandFailed) {
|
if (opkgErrorLst.size() == 0) {
|
||||||
if (m_opkgCommands.size() > 0) {
|
if (m_opkgCommands.size() > 0) {
|
||||||
m_displayIndex = 1;
|
m_displayIndex = 1;
|
||||||
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS;
|
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS));
|
||||||
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
setProgress(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_displayIndex = 1;
|
m_displayIndex = 1;
|
||||||
|
ISMAS(opkgErrorLst) << (GUI(opkgErrorLst) << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE)));
|
||||||
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
|
GUI() << UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE;
|
||||||
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
|
setProgress(_EXEC_OPKG_COMMAND_FAILURE);
|
||||||
return false;
|
return false;
|
||||||
@ -816,8 +884,9 @@ bool Worker::downloadFilesToPSAHardware() {
|
|||||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
||||||
|
|
||||||
if (m_noUpdatePsaHardware == false) {
|
if (m_noUpdatePsaHardware == false) {
|
||||||
if (computeFilesToDownload()) {
|
if (computeFilesToDownload() > 0) {
|
||||||
CONSOLE(m_filesToDownload) << UPDATE_STEP::FILES_TO_DOWNLOAD;
|
QStringList lst = m_filesToDownload;
|
||||||
|
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
|
||||||
|
|
||||||
Update update(this,
|
Update update(this,
|
||||||
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
||||||
@ -827,10 +896,20 @@ bool Worker::downloadFilesToPSAHardware() {
|
|||||||
m_pluginName,
|
m_pluginName,
|
||||||
m_workingDirectory);
|
m_workingDirectory);
|
||||||
|
|
||||||
return update.doUpdate(m_displayIndex, m_filesToDownload);
|
if (update.doUpdate(m_displayIndex, m_filesToDownload)) {
|
||||||
} else {
|
// prepared for use: at the moment, the dc-library does not work
|
||||||
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE;
|
// as expected.
|
||||||
|
|
||||||
|
// static const QRegularExpression re("^.*\\.json$");
|
||||||
|
// return update.checkDownloadedJsonVersions(m_filesToDownload.filter(re));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << (m_lastFailedUpdateStep = UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -847,7 +926,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
QStringList() << "-c" << "mkdir -p /etc/psa_config /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() << ")";
|
||||||
}
|
}
|
||||||
QString const params("-vvv "
|
QString const params("-v "
|
||||||
"--recursive "
|
"--recursive "
|
||||||
"--progress "
|
"--progress "
|
||||||
"--checksum "
|
"--checksum "
|
||||||
@ -910,14 +989,14 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
QDir dir1(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_tariff"));
|
QDir dir1(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_tariff"));
|
||||||
QDir dir2("/etc/psa_tariff");
|
QDir dir2("/etc/psa_tariff");
|
||||||
if (Utils::sameFilesInDirs(dir1, dir2)) {
|
if (Utils::sameFilesInDirs(dir1, dir2)) {
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
|
CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS;
|
||||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE));
|
ISMAS() << (GUI() << (CONSOLE() << (m_lastFailedUpdateStep = UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE)));
|
||||||
setProgress(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
setProgress(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -950,7 +1029,7 @@ QString Worker::getATBUpdateToolYoctoVersion() {
|
|||||||
|
|
||||||
QString Worker::getAPISMYoctoVersion() {
|
QString Worker::getAPISMYoctoVersion() {
|
||||||
if (QFile::exists("/var/lib/opkg/status")) {
|
if (QFile::exists("/var/lib/opkg/status")) {
|
||||||
QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A1 apism | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2)");
|
QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A1 -e apism[[:space:]]*$ | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2)");
|
||||||
Command c("bash");
|
Command c("bash");
|
||||||
if (c.execute("/tmp", QStringList() << "-c" << cmd)) {
|
if (c.execute("/tmp", QStringList() << "-c" << cmd)) {
|
||||||
return c.getCommandResult(); // 1.4.1.0-r4
|
return c.getCommandResult(); // 1.4.1.0-r4
|
||||||
@ -1098,15 +1177,16 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
QString absPathName;
|
QString absPathName;
|
||||||
QString absPathNameRepository;
|
QString absPathNameRepository;
|
||||||
|
|
||||||
psaInstalled.versionInfo.lastCommit = "";
|
psaInstalled.versionInfo.lastCommit = "N/A";
|
||||||
psaInstalled.versionInfo.reason = "";
|
psaInstalled.versionInfo.reason = "N/A";
|
||||||
psaInstalled.versionInfo.created = "";
|
psaInstalled.versionInfo.created = "N/A";
|
||||||
|
|
||||||
QStringList versionInfo = m_gc.gitShowReason(m_branchName);
|
if (m_versionInfo.size() == 3) {
|
||||||
if (versionInfo.size() == 3) {
|
qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__)
|
||||||
psaInstalled.versionInfo.lastCommit = versionInfo.at(0);
|
<< "m_versionInfo" << m_versionInfo << "*****";
|
||||||
psaInstalled.versionInfo.reason = versionInfo.at(1);
|
psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0);
|
||||||
psaInstalled.versionInfo.created = versionInfo.at(2);
|
psaInstalled.versionInfo.reason = m_versionInfo.at(1);
|
||||||
|
psaInstalled.versionInfo.created = m_versionInfo.at(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_zoneNr != 0) {
|
if (m_zoneNr != 0) {
|
||||||
@ -1119,10 +1199,10 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
psaInstalled.tariff.size = getFileSize(absPathName);
|
psaInstalled.tariff.size = getFileSize(absPathName);
|
||||||
psaInstalled.tariff.zone = m_zoneNr;
|
psaInstalled.tariff.zone = m_zoneNr;
|
||||||
psaInstalled.tariff.loadTime = Utils::getTariffLoadTime(absPathName);
|
psaInstalled.tariff.loadTime = Utils::getTariffLoadTime(absPathName);
|
||||||
|
psaInstalled.tariff.project = Utils::getLocation(absPathName);
|
||||||
|
psaInstalled.tariff.version = Utils::getTariffVersion(absPathName);
|
||||||
|
psaInstalled.tariff.info = Utils::getTariffInfo(absPathName);
|
||||||
}
|
}
|
||||||
psaInstalled.tariff.project = "Szeged";
|
|
||||||
psaInstalled.tariff.info = "N/A";
|
|
||||||
psaInstalled.tariff.version = "N/A";
|
|
||||||
|
|
||||||
psaInstalled.hw.linuxVersion = getOsVersion();
|
psaInstalled.hw.linuxVersion = getOsVersion();
|
||||||
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
||||||
|
358
worker.h
358
worker.h
@ -33,37 +33,40 @@
|
|||||||
#define _ISMAS_RESET_WAIT "ISMAS" // reset WAIT-button to "WAIT"
|
#define _ISMAS_RESET_WAIT "ISMAS" // reset WAIT-button to "WAIT"
|
||||||
|
|
||||||
#define _STARTED (1)
|
#define _STARTED (1)
|
||||||
#define _CHECK_SANITY (2)
|
#define _CHECK_ISMAS_TRIGGER (2)
|
||||||
#define _CHECK_SANITY_FAILURE (3)
|
#define _CHECK_SANITY (3)
|
||||||
#define _CHECK_SANITY_SUCCESS (4)
|
#define _CHECK_SANITY_FAILURE (4)
|
||||||
#define _REPOSITORY_RECOVERED_FAILURE (5)
|
#define _CHECK_SANITY_SUCCESS (5)
|
||||||
#define _REPOSITORY_RECOVERED_SUCCESS (6)
|
#define _REPOSITORY_RECOVERED_FAILURE (6)
|
||||||
#define _CHECK_REPOSITORY (7)
|
#define _REPOSITORY_RECOVERED_SUCCESS (7)
|
||||||
#define _CHECK_REPOSITORY_FAILURE (8)
|
#define _CHECK_REPOSITORY (8)
|
||||||
#define _CHECK_REPOSITORY_SUCCESS (9)
|
#define _CHECK_REPOSITORY_FAILURE (9)
|
||||||
#define _CLONE_REPOSITORY (10)
|
#define _CHECK_REPOSITORY_SUCCESS (10)
|
||||||
#define _CLONE_REPOSITORY_FAILURE (11)
|
#define _CLONE_REPOSITORY (11)
|
||||||
#define _CLONE_REPOSITORY_SUCCESS (12)
|
#define _CLONE_REPOSITORY_FAILURE (12)
|
||||||
#define _CHECKOUT_REPOSITORY (13)
|
#define _CLONE_REPOSITORY_SUCCESS (13)
|
||||||
#define _CHECKOUT_REPOSITORY_FAILURE (14)
|
#define _CHECKOUT_REPOSITORY (14)
|
||||||
#define _CHECKOUT_REPOSITORY_SUCCESS (15)
|
#define _CHECKOUT_REPOSITORY_FAILURE (15)
|
||||||
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (16)
|
#define _CHECKOUT_REPOSITORY_SUCCESS (16)
|
||||||
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (17)
|
#define _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER (17)
|
||||||
#define _CHECK_ISMAS_TRIGGER (19)
|
#define _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER (18)
|
||||||
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (20)
|
#define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (19)
|
||||||
#define _CHECK_ISMAS_TRIGGER_SUCCESS (21)
|
#define _CHECK_ISMAS_TRIGGER_SUCCESS (20)
|
||||||
#define _CHECK_ISMAS_TRIGGER_FAILURE (22)
|
#define _CHECK_ISMAS_TRIGGER_FAILURE (21)
|
||||||
#define _CHECKOUT_BRANCH (23)
|
#define _CHECKOUT_BRANCH (22)
|
||||||
#define _CHECKOUT_BRANCH_FAILURE (24)
|
#define _CHECKOUT_BRANCH_FAILURE (23)
|
||||||
#define _CHECKOUT_BRANCH_SUCCESS (25)
|
#define _CHECKOUT_BRANCH_SUCCESS (24)
|
||||||
#define _UPDATE_REPOSITORY (26)
|
#define _UPDATE_REPOSITORY (25)
|
||||||
#define _UPDATE_REPOSITORY_FAILURE (28)
|
#define _UPDATE_REPOSITORY_FAILURE (26)
|
||||||
#define _UPDATE_REPOSITORY_SUCCESS (29)
|
#define _UPDATE_REPOSITORY_SUCCESS (27)
|
||||||
#define _CHECK_FOR_REPOSITORY_CHANGES (30)
|
#define _CHECK_FOR_REPOSITORY_CHANGES (28)
|
||||||
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (36)
|
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (29)
|
||||||
#define _FILES_TO_UPDATE (37)
|
#define _SYNC_CUSTOMER_REPOSITORY (30)
|
||||||
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (38)
|
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (31)
|
||||||
#define _FILES_TO_DOWNLOAD (39)
|
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (32)
|
||||||
|
#define _FILES_TO_UPDATE (33)
|
||||||
|
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (34)
|
||||||
|
#define _FILES_TO_DOWNLOAD (35)
|
||||||
#define _EXEC_OPKG_COMMANDS (41)
|
#define _EXEC_OPKG_COMMANDS (41)
|
||||||
#define _EXEC_OPKG_COMMAND_1 (42)
|
#define _EXEC_OPKG_COMMAND_1 (42)
|
||||||
#define _EXEC_OPKG_COMMAND_2 (43)
|
#define _EXEC_OPKG_COMMAND_2 (43)
|
||||||
@ -82,28 +85,29 @@
|
|||||||
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (56)
|
#define _DOWNLOAD_CONFIG_FILE_SUCCESS (56)
|
||||||
#define _DOWNLOAD_CONFIG_FILE_FAILURE (57)
|
#define _DOWNLOAD_CONFIG_FILE_FAILURE (57)
|
||||||
#define _DOWNLOAD_DEVICE_CONTROLLER (65)
|
#define _DOWNLOAD_DEVICE_CONTROLLER (65)
|
||||||
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (86)
|
#define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (85)
|
||||||
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (87)
|
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86)
|
||||||
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (88)
|
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87)
|
||||||
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (89)
|
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (88)
|
||||||
#define _SYNC_CUSTOMER_REPOSITORY (90)
|
#define _SAVE_LOGS (92)
|
||||||
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (91)
|
#define _SAVE_LOGS_FAILURE (93)
|
||||||
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (92)
|
#define _SAVE_LOGS_SUCCESS (94)
|
||||||
#define _SAVE_LOGS (93)
|
#define _SEND_LAST_VERSION (95)
|
||||||
#define _SAVE_LOGS_FAILURE (94)
|
#define _UPDATE_FINALIZE (95)
|
||||||
#define _SAVE_LOGS_SUCCESS (95)
|
#define _UPDATE_SUCCEEDED (96)
|
||||||
#define _SEND_LAST_VERSION (96)
|
#define _UPDATE_FAILED (97)
|
||||||
#define _UPDATE_SUCCEEDED (97)
|
#define _UPDATE_ACTIVATED (98)
|
||||||
#define _UPDATE_FAILED (98)
|
#define _UPDATE_NOT_NECESSARY (99)
|
||||||
#define _UPDATE_ACTIVATED (99)
|
|
||||||
#define _FINISHED (100)
|
#define _FINISHED (100)
|
||||||
#define _DEBUG (1000)
|
#define _DEBUG (1000)
|
||||||
#define _ERROR (1001)
|
#define _ERROR (1001)
|
||||||
|
#define _NONE (1002)
|
||||||
|
|
||||||
#define _SEND_LAST_VERSION_CORRECTION (4)
|
#define _SEND_LAST_VERSION_CORRECTION (5)
|
||||||
#define _UPDATE_SUCCEEDED_CORRECTION (3)
|
#define _UPDATE_SUCCEEDED_CORRECTION (4)
|
||||||
#define _UPDATE_FAILED_CORRECTION (2)
|
#define _UPDATE_FAILED_CORRECTION (3)
|
||||||
#define _UPDATE_ACTIVATED_CORRECTION (1)
|
#define _UPDATE_ACTIVATED_CORRECTION (2)
|
||||||
|
#define _UPDATE_NOT_NECESSARY_CORRECTION (1)
|
||||||
|
|
||||||
#define ISMAS_UPDATE_REQUESTS (10)
|
#define ISMAS_UPDATE_REQUESTS (10)
|
||||||
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
||||||
@ -132,6 +136,7 @@ class Worker : public QThread{
|
|||||||
QString const m_baudrate;
|
QString const m_baudrate;
|
||||||
IsmasClient m_ismasClient;
|
IsmasClient m_ismasClient;
|
||||||
GitClient m_gc;
|
GitClient m_gc;
|
||||||
|
QStringList m_versionInfo;
|
||||||
QString const m_osVersion;
|
QString const m_osVersion;
|
||||||
QString const m_atbqtVersion;
|
QString const m_atbqtVersion;
|
||||||
QString const m_atbUpdateToolVersion;
|
QString const m_atbUpdateToolVersion;
|
||||||
@ -155,6 +160,9 @@ class Worker : public QThread{
|
|||||||
bool m_initialClone = false;
|
bool m_initialClone = false;
|
||||||
bool m_repairClone = false;
|
bool m_repairClone = false;
|
||||||
bool m_ismasTriggerActive = false;
|
bool m_ismasTriggerActive = false;
|
||||||
|
bool m_updateNotNecessary = false;
|
||||||
|
bool m_automaticUpdate = false;
|
||||||
|
QStringList m_ismasTriggerStatusMessage;
|
||||||
|
|
||||||
MainWindow *m_mainWindow;
|
MainWindow *m_mainWindow;
|
||||||
bool m_withoutIsmasDirectPort;
|
bool m_withoutIsmasDirectPort;
|
||||||
@ -198,8 +206,48 @@ class Worker : public QThread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ~UpdateProcessRunning() {
|
virtual ~UpdateProcessRunning() {
|
||||||
m_worker->ISMAS() << (m_worker->GUI() << (m_worker->CONSOLE()
|
|
||||||
<< UPDATE_STEP::SEND_LAST_VERSION));
|
if (m_worker->m_lastFailedUpdateStep == UPDATE_STEP::NONE) {
|
||||||
|
if (m_worker->m_updateNotNecessary) {
|
||||||
|
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
|
||||||
|
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_NOT_NECESSARY));
|
||||||
|
} else {
|
||||||
|
QStringList lst(QString(m_worker->smap[UPDATE_STEP::UPDATE_SUCCEEDED]));
|
||||||
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << UPDATE_STEP::UPDATE_SUCCEEDED));
|
||||||
|
m_worker->setProgress(_UPDATE_SUCCEEDED);
|
||||||
|
|
||||||
|
lst = QStringList(QString(m_worker->smap[UPDATE_STEP::UPDATE_ACTIVATED]));
|
||||||
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << UPDATE_STEP::UPDATE_ACTIVATED));
|
||||||
|
m_worker->setProgress(_UPDATE_ACTIVATED);
|
||||||
|
|
||||||
|
lst = QStringList(QString(m_worker->smap[UPDATE_STEP::FINISHED]));
|
||||||
|
m_worker->CONSOLE(lst) << UPDATE_STEP::FINISHED;
|
||||||
|
m_worker->setProgress(_FINISHED);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
|
||||||
|
UPDATE_STEP last = m_worker->m_lastFailedUpdateStep;
|
||||||
|
if (m_worker->smap.contains(last)) {
|
||||||
|
lst << QString(" (last failed step: %1)").arg(m_worker->smap[last]);
|
||||||
|
} else {
|
||||||
|
lst << QString(" (last failed step unknown: %1)").arg((int)(last));
|
||||||
|
}
|
||||||
|
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_FAILED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_worker->m_automaticUpdate) {
|
||||||
|
QStringList lst(QString(m_worker->smap[UPDATE_STEP::SEND_LAST_VERSION]));
|
||||||
|
lst << "AUTOMATIC UPDATE";
|
||||||
|
if (m_worker->m_updateNotNecessary) {
|
||||||
|
lst << "UPDATE NOT NECESSARY";
|
||||||
|
}
|
||||||
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
|
||||||
|
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||||
|
} else {
|
||||||
|
QStringList lst(QString(m_worker->smap[UPDATE_STEP::SEND_LAST_VERSION]));
|
||||||
|
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
|
||||||
|
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||||
|
}
|
||||||
m_worker->stopProgressLoop();
|
m_worker->stopProgressLoop();
|
||||||
|
|
||||||
m_worker->m_updateProcessRunning = false;
|
m_worker->m_updateProcessRunning = false;
|
||||||
@ -273,12 +321,15 @@ public:
|
|||||||
SAVE_LOGS_SUCCESS = _SAVE_LOGS_SUCCESS,
|
SAVE_LOGS_SUCCESS = _SAVE_LOGS_SUCCESS,
|
||||||
SAVE_LOGS_FAILURE = _SAVE_LOGS_FAILURE,
|
SAVE_LOGS_FAILURE = _SAVE_LOGS_FAILURE,
|
||||||
SEND_LAST_VERSION = _SEND_LAST_VERSION,
|
SEND_LAST_VERSION = _SEND_LAST_VERSION,
|
||||||
|
UPDATE_FINALIZE = _UPDATE_FINALIZE,
|
||||||
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
UPDATE_SUCCEEDED = _UPDATE_SUCCEEDED,
|
||||||
UPDATE_ACTIVATED = _UPDATE_ACTIVATED,
|
UPDATE_ACTIVATED = _UPDATE_ACTIVATED,
|
||||||
|
UPDATE_NOT_NECESSARY = _UPDATE_NOT_NECESSARY,
|
||||||
UPDATE_FAILED = _UPDATE_FAILED,
|
UPDATE_FAILED = _UPDATE_FAILED,
|
||||||
FINISHED = _FINISHED,
|
FINISHED = _FINISHED,
|
||||||
DEBUG = _DEBUG,
|
DEBUG = _DEBUG,
|
||||||
ERROR = _ERROR
|
ERROR = _ERROR,
|
||||||
|
NONE = _NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -289,6 +340,8 @@ private:
|
|||||||
static Worker *instance;
|
static Worker *instance;
|
||||||
QStringList m_opkgCommands;
|
QStringList m_opkgCommands;
|
||||||
Update *m_update = nullptr;
|
Update *m_update = nullptr;
|
||||||
|
hwinf *m_hw = nullptr;
|
||||||
|
UPDATE_STEP m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void run();
|
virtual void run();
|
||||||
@ -346,6 +399,8 @@ public:
|
|||||||
void displayProgressInMainWindow(int progress);
|
void displayProgressInMainWindow(int progress);
|
||||||
void startProgressLoop();
|
void startProgressLoop();
|
||||||
void stopProgressLoop();
|
void stopProgressLoop();
|
||||||
|
void setHW(hwinf *hw) { m_hw = hw; }
|
||||||
|
hwinf *getHW() { return m_hw; }
|
||||||
|
|
||||||
IsmasClient &getIsmasClient() { return m_ismasClient; }
|
IsmasClient &getIsmasClient() { return m_ismasClient; }
|
||||||
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
IsmasClient const &getIsmasClient() const { return m_ismasClient; }
|
||||||
@ -405,6 +460,8 @@ private:
|
|||||||
QStringList lst = QStringList(smap[step]);
|
QStringList lst = QStringList(smap[step]);
|
||||||
|
|
||||||
switch (step) {
|
switch (step) {
|
||||||
|
case UPDATE_STEP::NONE: {
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::STARTED: {
|
case UPDATE_STEP::STARTED: {
|
||||||
Utils::printUpdateStatusMsg(
|
Utils::printUpdateStatusMsg(
|
||||||
debug,
|
debug,
|
||||||
@ -557,8 +614,10 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE:
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
||||||
break;
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
||||||
@ -610,6 +669,10 @@ private:
|
|||||||
lst << instance->m_debugMsg;
|
lst << instance->m_debugMsg;
|
||||||
Utils::printUpdateStatusMsg(debug, lst);
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
|
break;
|
||||||
case UPDATE_STEP::UPDATE_FAILED:
|
case UPDATE_STEP::UPDATE_FAILED:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::FINISHED:
|
case UPDATE_STEP::FINISHED:
|
||||||
@ -643,28 +706,86 @@ private:
|
|||||||
QStringList lst = QStringList(smap[step]);
|
QStringList lst = QStringList(smap[step]);
|
||||||
|
|
||||||
switch (step) {
|
switch (step) {
|
||||||
|
case UPDATE_STEP::NONE: {
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::STARTED: {
|
case UPDATE_STEP::STARTED: {
|
||||||
ismasClient.setProgressInPercent(_STARTED);
|
ismasClient.setProgressInPercent(_STARTED);
|
||||||
} break;
|
} break;
|
||||||
case UPDATE_STEP::CHECK_REPOSITORY:
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS: {
|
||||||
break;
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS);
|
||||||
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
QString const &ismasUpdateNews =
|
||||||
break;
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
case UPDATE_STEP::CHECK_SANITY:
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0010",
|
||||||
|
_CHECKOUT_REPOSITORY_SUCCESS,
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[UPDATE_STEP::CHECK_REPOSITORY],
|
||||||
|
QString("REPOSITORY %1 AND BRANCH %2 OK")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
|
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE: {
|
||||||
|
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE);
|
||||||
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0010",
|
||||||
|
_CHECKOUT_REPOSITORY_FAILURE,
|
||||||
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
|
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
|
||||||
|
QString("REPOSITORY %1 and BRANCH %2 ***NOT OK***")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
|
case UPDATE_STEP::CHECK_SANITY: {
|
||||||
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
||||||
break;
|
} break;
|
||||||
case UPDATE_STEP::CHECK_SANITY_SUCCESS:
|
case UPDATE_STEP::CHECK_SANITY_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS);
|
ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
case UPDATE_STEP::CHECK_SANITY_FAILURE:
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0010",
|
||||||
|
_CHECK_SANITY_SUCCESS,
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[UPDATE_STEP::CHECK_SANITY],
|
||||||
|
QString("SANITY OF %1 (BRANCH %2) OK")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
|
case UPDATE_STEP::CHECK_SANITY_FAILURE: {
|
||||||
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0010",
|
||||||
|
_CHECK_SANITY_FAILURE,
|
||||||
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
|
smap[UPDATE_STEP::CHECK_SANITY],
|
||||||
|
QString("SANITY OF %1 and BRANCH %2 ***NOT*** OK")
|
||||||
|
.arg(instance->m_customerRepository)
|
||||||
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
||||||
|
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
||||||
|
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_FAILURE);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CLONE_REPOSITORY:
|
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||||
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
||||||
@ -677,11 +798,11 @@ private:
|
|||||||
"U0010",
|
"U0010",
|
||||||
_CLONE_REPOSITORY_SUCCESS,
|
_CLONE_REPOSITORY_SUCCESS,
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::CLONE_REPOSITORY],
|
||||||
QString("CLONED REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
QString("CLONED REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||||
.arg(instance->m_customerRepository)
|
.arg(instance->m_customerRepository)
|
||||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
ismasUpdateNews);
|
ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -693,11 +814,11 @@ private:
|
|||||||
"U0003",
|
"U0003",
|
||||||
_CLONE_REPOSITORY_FAILURE,
|
_CLONE_REPOSITORY_FAILURE,
|
||||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
smap[step],
|
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
|
||||||
QString("CLONING REPOSITORY %1 OR CHECKING OUT BRANCH %2 FAILED")
|
QString("CLONING REPOSITORY %1 OR CHECKING OUT BRANCH %2 FAILED")
|
||||||
.arg(instance->m_customerRepository)
|
.arg(instance->m_customerRepository)
|
||||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -711,7 +832,8 @@ private:
|
|||||||
ismasClient.cloneAndCheckoutCustomerRepository(
|
ismasClient.cloneAndCheckoutCustomerRepository(
|
||||||
QString("CHECKED OUT REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
QString("CHECKED OUT REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||||
.arg(instance->m_customerRepository)
|
.arg(instance->m_customerRepository)
|
||||||
.arg(instance->m_gc.branchName())));
|
.arg(instance->m_gc.branchName()),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
||||||
@ -723,7 +845,8 @@ private:
|
|||||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||||
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=") +
|
||||||
ismasClient.updateTriggerSet("ISMAS TRIGGER SET", ""));
|
ismasClient.updateTriggerSet("ISMAS TRIGGER SET",
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
||||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||||
@ -736,9 +859,9 @@ private:
|
|||||||
"U0003",
|
"U0003",
|
||||||
_CHECK_ISMAS_TRIGGER_FAILURE,
|
_CHECK_ISMAS_TRIGGER_FAILURE,
|
||||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
smap[step],
|
smap[UPDATE_STEP::CHECK_ISMAS_TRIGGER],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -748,9 +871,20 @@ private:
|
|||||||
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
||||||
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER);
|
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECKOUT_BRANCH:
|
case UPDATE_STEP::CHECKOUT_BRANCH: {
|
||||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH);
|
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
"U0010",
|
||||||
|
_CHECKOUT_BRANCH_SUCCESS,
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS: {
|
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_SUCCESS);
|
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_SUCCESS);
|
||||||
QString const &ismasUpdateNews =
|
QString const &ismasUpdateNews =
|
||||||
@ -759,9 +893,9 @@ private:
|
|||||||
"U0010",
|
"U0010",
|
||||||
_CHECKOUT_BRANCH_SUCCESS,
|
_CHECKOUT_BRANCH_SUCCESS,
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -773,9 +907,9 @@ private:
|
|||||||
"U0003",
|
"U0003",
|
||||||
_CHECKOUT_BRANCH_FAILURE,
|
_CHECKOUT_BRANCH_FAILURE,
|
||||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
smap[step],
|
smap[UPDATE_STEP::CHECKOUT_BRANCH],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -909,12 +1043,23 @@ private:
|
|||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[step],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_SUCCESS);
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||||
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
_ISMAS_CONTINUE,
|
||||||
|
ismasClient.getProgressInPercent(),
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[UPDATE_STEP::EXEC_OPKG_COMMANDS],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
||||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_FAILURE);
|
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_FAILURE);
|
||||||
@ -926,7 +1071,7 @@ private:
|
|||||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
smap[step],
|
smap[step],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -950,9 +1095,9 @@ private:
|
|||||||
_ISMAS_CONTINUE,
|
_ISMAS_CONTINUE,
|
||||||
ismasClient.getProgressInPercent(),
|
ismasClient.getProgressInPercent(),
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -967,9 +1112,9 @@ private:
|
|||||||
_ISMAS_CONTINUE,
|
_ISMAS_CONTINUE,
|
||||||
ismasClient.getProgressInPercent(),
|
ismasClient.getProgressInPercent(),
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -987,9 +1132,9 @@ private:
|
|||||||
_ISMAS_CONTINUE,
|
_ISMAS_CONTINUE,
|
||||||
ismasClient.getProgressInPercent(),
|
ismasClient.getProgressInPercent(),
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -1009,7 +1154,7 @@ private:
|
|||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[step],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -1027,12 +1172,12 @@ private:
|
|||||||
QString const &ismasUpdateNews =
|
QString const &ismasUpdateNews =
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
ismasClient.updateNewsToIsmas(
|
ismasClient.updateNewsToIsmas(
|
||||||
"U0001", // WAIT-button set to 100%
|
_ISMAS_DONE, // WAIT-button set to 100%
|
||||||
ismasClient.getProgressInPercent(),
|
ismasClient.getProgressInPercent(),
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -1041,12 +1186,26 @@ private:
|
|||||||
QString const &ismasUpdateNews =
|
QString const &ismasUpdateNews =
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
ismasClient.updateNewsToIsmas(
|
ismasClient.updateNewsToIsmas(
|
||||||
"U0002", // reset WAIT-button to "" (empty string)
|
_ISMAS_SET_WAIT_OK,
|
||||||
ismasClient.getProgressInPercent(),
|
ismasClient.getProgressInPercent(),
|
||||||
IsmasClient::RESULT_CODE::SUCCESS,
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
smap[step],
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY: {
|
||||||
|
ismasClient.setProgressInPercent(_UPDATE_NOT_NECESSARY + _UPDATE_NOT_NECESSARY_CORRECTION);
|
||||||
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
_ISMAS_SET_WAIT_OK,
|
||||||
|
ismasClient.getProgressInPercent(),
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -1055,12 +1214,12 @@ private:
|
|||||||
QString const &ismasUpdateNews =
|
QString const &ismasUpdateNews =
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
ismasClient.updateNewsToIsmas(
|
ismasClient.updateNewsToIsmas(
|
||||||
"U0003",
|
_ISMAS_FAILURE,
|
||||||
ismasClient.getProgressInPercent(),
|
ismasClient.getProgressInPercent(),
|
||||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
smap[step],
|
smap[UPDATE_STEP::UPDATE_FINALIZE],
|
||||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
"");
|
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||||
ismasClient.sendRequestReceiveResponse(
|
ismasClient.sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
} break;
|
} break;
|
||||||
@ -1087,6 +1246,8 @@ private:
|
|||||||
Worker::instance->m_currentStep = step;
|
Worker::instance->m_currentStep = step;
|
||||||
|
|
||||||
switch (step) {
|
switch (step) {
|
||||||
|
case UPDATE_STEP::NONE: {
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::STARTED:
|
case UPDATE_STEP::STARTED:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_REPOSITORY:
|
case UPDATE_STEP::CHECK_REPOSITORY:
|
||||||
@ -1125,6 +1286,9 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||||
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
emit worker->appendText("\n" CHECK_UPDATE_TRIGGER_SET);
|
||||||
|
if (worker->m_guiMsg.size() > 0) {
|
||||||
|
emit worker->showStatusMessage(worker->m_guiMsg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||||
break;
|
break;
|
||||||
@ -1258,6 +1422,8 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::UPDATE_ACTIVATED:
|
case UPDATE_STEP::UPDATE_ACTIVATED:
|
||||||
break;
|
break;
|
||||||
|
case UPDATE_STEP::UPDATE_NOT_NECESSARY:
|
||||||
|
break;
|
||||||
case UPDATE_STEP::UPDATE_FAILED:
|
case UPDATE_STEP::UPDATE_FAILED:
|
||||||
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user