Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
bfa39eb3df | |||
d7fcfa3d0f | |||
f1e449c108 | |||
32346c2665 | |||
38e7bf4985 | |||
6df73e1082 | |||
19250a0a2f | |||
6f5c8103e4 | |||
07dcf0ba30 | |||
1e379cf086 | |||
e87456f26b | |||
0c9a7bc7b5 | |||
a35c6afcb8 | |||
b06f4f46bb
|
|||
33d45eab2e
|
|||
d2e11d8f07 | |||
fbffdc923f | |||
8faf5af2bf | |||
1d532c13a4 | |||
d2d3afc28e | |||
f4bb201633 | |||
b68cf1fd1d | |||
0888c1b525 | |||
a6faf9ce21 | |||
5577cc5d6d | |||
9967d5cc45 | |||
e20ed57bd5 | |||
6986007b16 | |||
9ecdf73bc0 | |||
59d6c49cb2 | |||
f6a8059e2d | |||
4372cb578b | |||
d683a8fc32 | |||
4e92522578 | |||
b45f3a04b4 | |||
0db39746db | |||
f2844aa4d9 | |||
d4043bd7d2 | |||
89b639c0ed | |||
1ad13d9a8a | |||
6f2cbb0a26 | |||
c15cebf503 | |||
5ee1308c9d | |||
746d96ca7c | |||
f387eaedea | |||
0fd977c399 | |||
d53d72c536 | |||
f4be1f3f51 |
@@ -14,3 +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-dc=false
|
||||||
|
@@ -60,8 +60,24 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# Turned previous worker-object into its own thread, but without any
|
# Turned previous worker-object into its own thread, but without any
|
||||||
# own event-loop (so it cannot block anything inside the CA-plugin).
|
# own event-loop (so it cannot block anything inside the CA-plugin).
|
||||||
# 1.3.16: Bug fixes found during testing.
|
# 1.3.16: Bug fixes found during testing.
|
||||||
VERSION="1.3.17"
|
# 1.3.17: Add ATBUpdateTool.ini and custom command line parser. Settings
|
||||||
# Add ATBUpdateTool.ini and custom command line parser.
|
# given in ATBUpdateTool.ini can be overwritten on the command-line.
|
||||||
|
# 1.3.18: Bug fixes found during testing.
|
||||||
|
# 1.3.19: 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.
|
||||||
|
VERSION="1.3.22"
|
||||||
|
|
||||||
# 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.
|
||||||
@@ -81,6 +97,21 @@ VERSION="1.3.17"
|
|||||||
# 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.
|
||||||
# 7: Versionen der Json-Files lassen sich auslesen.
|
# 7: Versionen der Json-Files lassen sich auslesen.
|
||||||
|
# Problem: Einstellungen in den Json-Files lassen sich auch mittels
|
||||||
|
# Funktionen in der CD-Library ueberschreiben. Damit ist dann wieder nicht
|
||||||
|
# mehr so klar, was jetzt eigentlich aktiv ist.
|
||||||
|
# 8: m_alwaysDownloadConfig und m_alwaysDownloadDC: vorbereitet: man koennte
|
||||||
|
# es so arrangieren, dass der DC plus die Json-files im Repository immer
|
||||||
|
# runtergeladen werden, obwohl sich im Repository gar nicts veraendert
|
||||||
|
# hat. Eeventuell nuetzlich beim initialen Setuo eines PSA.
|
||||||
|
# 9: Das Kunden-Repository sollte immer gezogen werden, unabhaengig von der
|
||||||
|
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
|
||||||
|
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
|
||||||
|
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
|
||||||
|
# 10: Bei einer Neuinstallation (Neuhauser) immer JSON files runterladen,
|
||||||
|
# Tariff-Files syncen (d.h. nur wenn noch kein Repo vorhanden ist), und
|
||||||
|
# zwar auch ohne WAIT-Button.
|
||||||
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
BUILD_DATE=$$system("date /t")
|
BUILD_DATE=$$system("date /t")
|
||||||
|
@@ -6,16 +6,18 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
CommandLineParser::CommandLineParser()
|
CommandLineParser::CommandLineParser()
|
||||||
: m_repositoryUrl("")
|
: m_repositoryUrl("https://git.mimbach49.de/GerhardHoffmann")
|
||||||
, m_plugInDir("")
|
, m_plugInDir("/usr/lib/")
|
||||||
, m_plugInName("")
|
, m_plugInName("libCAslave.so")
|
||||||
, m_workingDir("")
|
, m_workingDir("/opt/app/tools/atbupdate/")
|
||||||
, m_dryRun("")
|
, m_dryRun("false")
|
||||||
, m_noUpdatePsaHardware("")
|
, m_noUpdatePsaHardware("false")
|
||||||
, m_showYoctoVersion("")
|
, m_showYoctoVersion("false")
|
||||||
, m_showYoctoInstallStatus("")
|
, m_showYoctoInstallStatus("false")
|
||||||
, m_showExtendedVersion("")
|
, m_showExtendedVersion("false")
|
||||||
, m_iniFileName("")
|
, m_iniFileName("ATBUpdateTool.ini")
|
||||||
|
, m_alwaysDownloadConfig("false")
|
||||||
|
, m_alwaysDownloadDC("false")
|
||||||
, m_repositoryUrlOption(
|
, m_repositoryUrlOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "repository-url" << "repository-url",
|
QStringList() << "repository-url" << "repository-url",
|
||||||
@@ -45,6 +47,14 @@ CommandLineParser::CommandLineParser()
|
|||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
"no-psa-hardware-update",
|
"no-psa-hardware-update",
|
||||||
QCoreApplication::translate("main", "Do not update the PSA firmware (json, device-controller).")))
|
QCoreApplication::translate("main", "Do not update the PSA firmware (json, device-controller).")))
|
||||||
|
, m_alwaysDownloadConfigOption(
|
||||||
|
QCommandLineOption(
|
||||||
|
"always-download-config",
|
||||||
|
QCoreApplication::translate("main", "Always download the (json-)configs to DC).")))
|
||||||
|
, m_alwaysDownloadDCOption(
|
||||||
|
QCommandLineOption(
|
||||||
|
"always-download-dc",
|
||||||
|
QCoreApplication::translate("main", "Always download the dc-bin-file to DC).")))
|
||||||
, m_workingDirectoryOption(
|
, m_workingDirectoryOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "working-directory" << "working-directory",
|
QStringList() << "working-directory" << "working-directory",
|
||||||
@@ -77,26 +87,40 @@ 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");
|
||||||
m_parser.addOption(m_iniFileNameOption);
|
m_parser.addOption(m_iniFileNameOption);
|
||||||
|
|
||||||
m_pluginDirectoryOption.setDefaultValue("/usr/lib");
|
m_pluginDirectoryOption.setDefaultValue("/usr/lib/");
|
||||||
m_parser.addOption(m_pluginDirectoryOption);
|
m_parser.addOption(m_pluginDirectoryOption);
|
||||||
|
|
||||||
m_pluginNameOption.setDefaultValue("libCAslave.so");
|
m_pluginNameOption.setDefaultValue("libCAslave.so");
|
||||||
m_parser.addOption(m_pluginNameOption);
|
m_parser.addOption(m_pluginNameOption);
|
||||||
|
|
||||||
|
m_alwaysDownloadConfigOption.setDefaultValue("false");
|
||||||
|
m_parser.addOption(m_alwaysDownloadConfigOption);
|
||||||
|
|
||||||
|
m_alwaysDownloadDCOption.setDefaultValue("false");
|
||||||
|
m_parser.addOption(m_alwaysDownloadDCOption);
|
||||||
|
|
||||||
|
m_noDownloadOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_noDownloadOption);
|
m_parser.addOption(m_noDownloadOption);
|
||||||
|
|
||||||
m_workingDirectoryOption.setDefaultValue("/opt/app/tools/atbupdate");
|
m_workingDirectoryOption.setDefaultValue("/opt/app/tools/atbupdate/");
|
||||||
m_parser.addOption(m_workingDirectoryOption);
|
m_parser.addOption(m_workingDirectoryOption);
|
||||||
|
|
||||||
|
m_dryRunOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_dryRunOption);
|
m_parser.addOption(m_dryRunOption);
|
||||||
|
|
||||||
|
m_extendedVersionOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_extendedVersionOption);
|
m_parser.addOption(m_extendedVersionOption);
|
||||||
|
|
||||||
|
m_yoctoVersionOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_yoctoVersionOption);
|
m_parser.addOption(m_yoctoVersionOption);
|
||||||
|
|
||||||
|
m_yoctoInstallStatusOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_yoctoInstallStatusOption);
|
m_parser.addOption(m_yoctoInstallStatusOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +128,6 @@ void CommandLineParser::readSettings() {
|
|||||||
QString const iniFileDir = m_parser.value(m_iniFileDirectoryOption);
|
QString const iniFileDir = m_parser.value(m_iniFileDirectoryOption);
|
||||||
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);
|
||||||
|
|
||||||
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);
|
||||||
@@ -118,7 +141,7 @@ void CommandLineParser::readSettings() {
|
|||||||
m_plugInDir = v.toString();
|
m_plugInDir = v.toString();
|
||||||
} else
|
} else
|
||||||
if (key.contains("working-directory")) {
|
if (key.contains("working-directory")) {
|
||||||
m_plugInName = v.toString();
|
m_workingDir = v.toString();
|
||||||
} else
|
} else
|
||||||
if (key.contains("dry-run")) {
|
if (key.contains("dry-run")) {
|
||||||
m_dryRun = (v.toBool() ? "true" : "false");
|
m_dryRun = (v.toBool() ? "true" : "false");
|
||||||
@@ -129,6 +152,12 @@ void CommandLineParser::readSettings() {
|
|||||||
if (key.contains("no-psa-hardware-update")) {
|
if (key.contains("no-psa-hardware-update")) {
|
||||||
m_noUpdatePsaHardware = (v.toBool() ? "true" : "false");
|
m_noUpdatePsaHardware = (v.toBool() ? "true" : "false");
|
||||||
} else
|
} else
|
||||||
|
if (key.contains("always-download-config")) {
|
||||||
|
m_alwaysDownloadConfig = (v.toBool() ? "true" : "false");
|
||||||
|
} else
|
||||||
|
if (key.contains("always-download-dc")) {
|
||||||
|
m_alwaysDownloadDC = (v.toBool() ? "true" : "false");
|
||||||
|
} else
|
||||||
if (key.contains("yocto-install")) {
|
if (key.contains("yocto-install")) {
|
||||||
m_showYoctoInstallStatus = (v.toBool() ? "true" : "false");
|
m_showYoctoInstallStatus = (v.toBool() ? "true" : "false");
|
||||||
} else
|
} else
|
||||||
@@ -144,65 +173,78 @@ void CommandLineParser::readSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString CommandLineParser::repositoryUrl() {
|
QString CommandLineParser::repositoryUrl() {
|
||||||
return m_repositoryUrl;
|
if (m_parser.isSet(m_repositoryUrlOption)) {
|
||||||
if (m_repositoryUrl.isEmpty()) {
|
|
||||||
m_repositoryUrl = m_parser.value(m_repositoryUrlOption);
|
m_repositoryUrl = m_parser.value(m_repositoryUrlOption);
|
||||||
}
|
}
|
||||||
return m_repositoryUrl;
|
return m_repositoryUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CommandLineParser::plugInDir() {
|
QString CommandLineParser::plugInDir() {
|
||||||
if (m_plugInDir.isEmpty()) {
|
if (m_parser.isSet(m_pluginDirectoryOption)) {
|
||||||
m_plugInDir = m_parser.value(m_pluginDirectoryOption);
|
m_plugInDir = m_parser.value(m_pluginDirectoryOption);
|
||||||
}
|
}
|
||||||
return m_plugInDir;
|
return m_plugInDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CommandLineParser::plugInName() {
|
QString CommandLineParser::plugInName() {
|
||||||
if (m_plugInName.isEmpty()) {
|
if (m_parser.isSet(m_pluginNameOption)) {
|
||||||
m_plugInName = m_parser.value(m_pluginNameOption);
|
m_plugInName = m_parser.value(m_pluginNameOption);
|
||||||
}
|
}
|
||||||
return m_plugInName;
|
return m_plugInName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CommandLineParser::workingDir() {
|
QString CommandLineParser::workingDir() {
|
||||||
if (m_workingDir.isEmpty()) {
|
if (m_parser.isSet(m_workingDirectoryOption)) {
|
||||||
m_workingDir = m_parser.value(m_workingDirectoryOption);
|
m_workingDir = m_parser.value(m_workingDirectoryOption);
|
||||||
}
|
}
|
||||||
return m_workingDir;
|
return m_workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::dryRun() {
|
bool CommandLineParser::dryRun() {
|
||||||
if (m_dryRun.isEmpty()) {
|
if (m_parser.isSet(m_dryRunOption)) {
|
||||||
m_dryRun = m_parser.value(m_dryRunOption);
|
m_dryRun = m_parser.value(m_dryRunOption);
|
||||||
}
|
}
|
||||||
return m_dryRun == "false" ? false : true;
|
return m_dryRun == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::noUpdatePsaHardware() {
|
bool CommandLineParser::noUpdatePsaHardware() {
|
||||||
if (m_noUpdatePsaHardware.isEmpty()) {
|
if (m_parser.isSet(m_noDownloadOption)) {
|
||||||
m_noUpdatePsaHardware = m_parser.value(m_noDownloadOption);
|
m_noUpdatePsaHardware = m_parser.value(m_noDownloadOption);
|
||||||
}
|
}
|
||||||
return m_noUpdatePsaHardware == "false" ? false : true;
|
return m_noUpdatePsaHardware == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::yoctoVersion() {
|
bool CommandLineParser::yoctoVersion() {
|
||||||
if (m_showYoctoVersion.isEmpty()) {
|
if (m_parser.isSet(m_yoctoVersionOption)) {
|
||||||
m_showYoctoVersion = m_parser.value(m_yoctoVersionOption);
|
m_showYoctoVersion = m_parser.value(m_yoctoVersionOption);
|
||||||
}
|
}
|
||||||
return m_showYoctoVersion == "false" ? false : true;
|
return m_showYoctoVersion == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::yoctoInstallStatus() {
|
bool CommandLineParser::yoctoInstallStatus() {
|
||||||
if (m_showYoctoInstallStatus.isEmpty()) {
|
if (m_parser.isSet(m_yoctoInstallStatusOption)) {
|
||||||
m_showYoctoInstallStatus = m_parser.value(m_yoctoInstallStatusOption);
|
m_showYoctoInstallStatus = m_parser.value(m_yoctoInstallStatusOption);
|
||||||
}
|
}
|
||||||
return m_showYoctoInstallStatus == "false" ? false : true;
|
return m_showYoctoInstallStatus == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::extendedVersion() {
|
bool CommandLineParser::extendedVersion() {
|
||||||
if (m_showExtendedVersion.isEmpty()) {
|
if (m_parser.isSet(m_extendedVersionOption)) {
|
||||||
m_showExtendedVersion = m_parser.value(m_extendedVersionOption);
|
m_showExtendedVersion = m_parser.value(m_extendedVersionOption);
|
||||||
}
|
}
|
||||||
return m_showExtendedVersion == "false" ? false : true;
|
return m_showExtendedVersion == "false" ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommandLineParser::alwaysDownloadConfig() {
|
||||||
|
if (m_parser.isSet(m_alwaysDownloadConfigOption)) {
|
||||||
|
m_alwaysDownloadConfig = m_parser.value(m_alwaysDownloadConfigOption);
|
||||||
|
}
|
||||||
|
return m_alwaysDownloadConfig == "false" ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommandLineParser::alwaysDownloadDC() {
|
||||||
|
if (m_parser.isSet(m_alwaysDownloadDCOption)) {
|
||||||
|
m_alwaysDownloadDC = m_parser.value(m_alwaysDownloadDCOption);
|
||||||
|
}
|
||||||
|
return m_alwaysDownloadDC == "false" ? false : true;
|
||||||
|
}
|
||||||
|
@@ -17,6 +17,8 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QString m_showYoctoInstallStatus;
|
QString m_showYoctoInstallStatus;
|
||||||
QString m_showExtendedVersion;
|
QString m_showExtendedVersion;
|
||||||
QString m_iniFileName;
|
QString m_iniFileName;
|
||||||
|
QString m_alwaysDownloadConfig;
|
||||||
|
QString m_alwaysDownloadDC;
|
||||||
|
|
||||||
QCommandLineOption m_repositoryUrlOption;
|
QCommandLineOption m_repositoryUrlOption;
|
||||||
QCommandLineOption m_iniFileDirectoryOption;
|
QCommandLineOption m_iniFileDirectoryOption;
|
||||||
@@ -24,6 +26,8 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QCommandLineOption m_pluginDirectoryOption;
|
QCommandLineOption m_pluginDirectoryOption;
|
||||||
QCommandLineOption m_pluginNameOption;
|
QCommandLineOption m_pluginNameOption;
|
||||||
QCommandLineOption m_noDownloadOption;
|
QCommandLineOption m_noDownloadOption;
|
||||||
|
QCommandLineOption m_alwaysDownloadConfigOption;
|
||||||
|
QCommandLineOption m_alwaysDownloadDCOption;
|
||||||
QCommandLineOption m_workingDirectoryOption;
|
QCommandLineOption m_workingDirectoryOption;
|
||||||
QCommandLineOption m_dryRunOption;
|
QCommandLineOption m_dryRunOption;
|
||||||
QCommandLineOption m_extendedVersionOption;
|
QCommandLineOption m_extendedVersionOption;
|
||||||
@@ -53,5 +57,7 @@ public:
|
|||||||
bool yoctoVersion();
|
bool yoctoVersion();
|
||||||
bool yoctoInstallStatus();
|
bool yoctoInstallStatus();
|
||||||
bool extendedVersion();
|
bool extendedVersion();
|
||||||
|
bool alwaysDownloadConfig();
|
||||||
|
bool alwaysDownloadDC();
|
||||||
};
|
};
|
||||||
#endif // COMMAND_LINE_PARSER_H_INCLUDED
|
#endif // COMMAND_LINE_PARSER_H_INCLUDED
|
||||||
|
29
interfaces.h
29
interfaces.h
@@ -1834,6 +1834,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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2273,7 +2276,32 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
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 +2324,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;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
25
main.cpp
25
main.cpp
@@ -74,14 +74,23 @@ int main(int argc, char *argv[]) {
|
|||||||
QString plugInDir = parser.plugInDir();
|
QString plugInDir = parser.plugInDir();
|
||||||
QString plugInName = parser.plugInName();
|
QString plugInName = parser.plugInName();
|
||||||
QString workingDir = parser.workingDir();
|
QString workingDir = parser.workingDir();
|
||||||
|
QString iniFileName = parser.iniFileName();
|
||||||
bool const dryRun = parser.dryRun();
|
bool const dryRun = parser.dryRun();
|
||||||
bool const noUpdatePsaHardware = parser.noUpdatePsaHardware();
|
bool const noUpdatePsaHardware = parser.noUpdatePsaHardware();
|
||||||
bool const showYoctoVersion = parser.yoctoVersion();
|
bool const showYoctoVersion = parser.yoctoVersion();
|
||||||
bool const showYoctoInstallStatus = parser.yoctoInstallStatus();
|
bool const showYoctoInstallStatus = parser.yoctoInstallStatus();
|
||||||
bool const showExtendedVersion = parser.extendedVersion();
|
bool const showExtendedVersion = parser.extendedVersion();
|
||||||
|
bool const alwaysDownloadConfig = parser.alwaysDownloadConfig();
|
||||||
|
bool const alwaysDownloadDC = parser.alwaysDownloadDC();
|
||||||
|
|
||||||
QString const rtPath = QCoreApplication::applicationDirPath();
|
QString const rtPath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
|
int const machineNr = Utils::read1stLineOfFile("/mnt/system_data/machine_nr");
|
||||||
|
int const customerNr = Utils::read1stLineOfFile("/mnt/system_data/cust_nr");
|
||||||
|
int const zoneNr = Utils::read1stLineOfFile("/mnt/system_data/zone_nr");
|
||||||
|
QString const branchName = (zoneNr != 0)
|
||||||
|
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||||
|
|
||||||
qInfo() << "pwd ......................" << rtPath;
|
qInfo() << "pwd ......................" << rtPath;
|
||||||
qInfo() << "repositoryUrl ............" << repositoryUrl;
|
qInfo() << "repositoryUrl ............" << repositoryUrl;
|
||||||
qInfo() << "plugInDir ................" << plugInDir;
|
qInfo() << "plugInDir ................" << plugInDir;
|
||||||
@@ -89,7 +98,16 @@ int main(int argc, char *argv[]) {
|
|||||||
qInfo() << "workingDir ..............." << workingDir;
|
qInfo() << "workingDir ..............." << workingDir;
|
||||||
qInfo() << "dryRun ..................." << dryRun;
|
qInfo() << "dryRun ..................." << dryRun;
|
||||||
qInfo() << "noUpdatePsaHardware ......" << noUpdatePsaHardware;
|
qInfo() << "noUpdatePsaHardware ......" << noUpdatePsaHardware;
|
||||||
|
qInfo() << "alwaysDownloadConfig ....." << alwaysDownloadConfig;
|
||||||
|
qInfo() << "alwaysDownloadDC ........." << alwaysDownloadDC;
|
||||||
|
qInfo() << "showYoctoVersion ........." << showYoctoVersion;
|
||||||
|
qInfo() << "showYoctoInstallStatus ..." << showYoctoInstallStatus;
|
||||||
|
qInfo() << "showExtendedVersion ......" << showExtendedVersion;
|
||||||
|
qInfo() << "iniFileName .............." << iniFileName;
|
||||||
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
||||||
|
qInfo() << "machineNr ................" << machineNr;
|
||||||
|
qInfo() << "customerNr ..............." << customerNr;
|
||||||
|
qInfo() << "zoneNr ..................." << zoneNr;
|
||||||
|
|
||||||
if (showExtendedVersion) {
|
if (showExtendedVersion) {
|
||||||
printf(APP_EXTENDED_VERSION"\n");
|
printf(APP_EXTENDED_VERSION"\n");
|
||||||
@@ -104,11 +122,6 @@ int main(int argc, char *argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int machineNr = Utils::read1stLineOfFile("/etc/machine_nr");
|
|
||||||
int customerNr = Utils::read1stLineOfFile("/etc/cust_nr");
|
|
||||||
int zoneNr = Utils::read1stLineOfFile("/etc/zone_nr");
|
|
||||||
QString const branchName = (zoneNr != 0)
|
|
||||||
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
|
||||||
|
|
||||||
QThread::currentThread()->setObjectName("main thread");
|
QThread::currentThread()->setObjectName("main thread");
|
||||||
qInfo() << "Main thread" << QThread::currentThreadId();
|
qInfo() << "Main thread" << QThread::currentThreadId();
|
||||||
@@ -136,6 +149,8 @@ int main(int argc, char *argv[]) {
|
|||||||
plugInName,
|
plugInName,
|
||||||
workingDir,
|
workingDir,
|
||||||
noUpdatePsaHardware,
|
noUpdatePsaHardware,
|
||||||
|
alwaysDownloadConfig,
|
||||||
|
alwaysDownloadDC,
|
||||||
dryRun);
|
dryRun);
|
||||||
|
|
||||||
MainWindow mw(&worker);
|
MainWindow mw(&worker);
|
||||||
|
@@ -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);
|
||||||
@@ -208,13 +208,12 @@ void MainWindow::onAppendText(QString text, QString suffix) {
|
|||||||
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
||||||
// ui->updateStatus->setText(editText.trimmed());
|
// ui->updateStatus->setText(editText.trimmed());
|
||||||
|
|
||||||
// scrollDownTextEdit();
|
scrollDownTextEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
// Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
int const s = newTextLines.size();
|
int const s = newTextLines.size();
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
@@ -249,11 +248,15 @@ void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
|||||||
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
// Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
||||||
if (lines.size() > 0) {
|
if (lines.size() > 0) {
|
||||||
lines.removeLast();
|
// removing the last line is really meant for refreshing the last line
|
||||||
|
// with a string very similar than the original one, typically only
|
||||||
|
// followed by a suffix.
|
||||||
|
if (lines.last().contains(text)) {
|
||||||
|
lines.removeLast();
|
||||||
|
}
|
||||||
if (!suffix.isNull() && suffix.size() > 0 && suffix != "\n") {
|
if (!suffix.isNull() && suffix.size() > 0 && suffix != "\n") {
|
||||||
QString const add = text.leftJustified(m_width-10) + suffix;
|
QString const add = text.leftJustified(m_width-10) + suffix;
|
||||||
if (!add.isEmpty()) {
|
if (!add.isEmpty()) {
|
||||||
|
535
update.cpp
535
update.cpp
@@ -115,214 +115,33 @@ Update::Update(Worker *worker,
|
|||||||
, m_branchName(branchName)
|
, m_branchName(branchName)
|
||||||
, m_pluginName(pluginName)
|
, m_pluginName(pluginName)
|
||||||
, m_workingDir(workingDir)
|
, m_workingDir(workingDir)
|
||||||
, m_dryRun(dryRun) {
|
, m_dryRun(dryRun)
|
||||||
|
, m_sys_areDCdataValid(false) {
|
||||||
|
|
||||||
qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
int tries = 20;
|
||||||
qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||||
qInfo() << "UPDATE: m_customerRepository ..." << m_customerRepository;
|
// must deliver 'true', only then are all data from hwapi valid
|
||||||
qInfo() << "UPDATE: m_customerNr ..........." << m_customerNrStr;
|
if (--tries < 0) {
|
||||||
qInfo() << "UPDATE: m_branchName ..........." << m_branchName;
|
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||||
qInfo() << "UPDATE: m_pluginName ..........." << m_pluginName;
|
}
|
||||||
qInfo() << "UPDATE: m_workingDirectory ....." << m_workingDir;
|
m_hw->dc_autoRequest(true);
|
||||||
|
QThread::msleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
qCritical() << "UPDATE: m_sys_areDCDataValid ..." << m_sys_areDCdataValid;
|
||||||
|
|
||||||
|
//qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface;
|
||||||
|
//qInfo() << "UPDATE: m_baudrate ..." << m_baudrate;
|
||||||
|
//qInfo() << "UPDATE: m_customerRepository ..." << m_customerRepository;
|
||||||
|
//qInfo() << "UPDATE: m_customerNr ..........." << m_customerNrStr;
|
||||||
|
//qInfo() << "UPDATE: m_branchName ..........." << m_branchName;
|
||||||
|
//qInfo() << "UPDATE: m_pluginName ..........." << m_pluginName;
|
||||||
|
//qInfo() << "UPDATE: m_workingDirectory ....." << m_workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
Update::~Update() {
|
Update::~Update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Update::DownloadResult Update::sendStatus(int ret) const {
|
|
||||||
switch (ret) { // return values of dc are:
|
|
||||||
case 0: // 0: no answer by now
|
|
||||||
return DownloadResult::NOP; // 1: error
|
|
||||||
case 10: // 10: success
|
|
||||||
return DownloadResult::OK;
|
|
||||||
default:;
|
|
||||||
}
|
|
||||||
return DownloadResult::ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Update::DownloadResult Update::sendNextAddress(int bNum) const {
|
|
||||||
// sends address only if blockNumber is one of 0, 1024, 2048, 3072, 4096
|
|
||||||
int noAnswerCount = 0;
|
|
||||||
int errorCount = 0;
|
|
||||||
if ( bNum==0 || bNum==1024 || bNum==2048 || bNum==3072 || bNum==4096 ) {
|
|
||||||
// qDebug() << "addr-block" << bNum << "...";
|
|
||||||
while (noAnswerCount <= 250) {
|
|
||||||
m_hw->bl_sendAddress(bNum);
|
|
||||||
QThread::msleep(100);
|
|
||||||
DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK());
|
|
||||||
if (res != DownloadResult::NOP) {
|
|
||||||
if (res == DownloadResult::ERROR) {
|
|
||||||
if (++errorCount >= 10) {
|
|
||||||
qCritical() << "addr-block" << bNum << "...FAILED";
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
} else { // res == DownloadResult::OK
|
|
||||||
// qInfo() << "addr-block" << bNum << "...OK";
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
noAnswerCount += 1; // no answer by now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// wait max. about 3 seconds
|
|
||||||
return DownloadResult::TIMEOUT;
|
|
||||||
}
|
|
||||||
// blockNumber is not one of 0, 1024, 2048, 3072, 4096 -> do nothing
|
|
||||||
return DownloadResult::NOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
Update::DownloadResult Update::sendNextDataBlock(QByteArray const &binary,
|
|
||||||
int bNum) const {
|
|
||||||
uint8_t local[66];
|
|
||||||
int const bAddr = bNum * 64;
|
|
||||||
int noAnswerCount = 0;
|
|
||||||
int errorCount = 0;
|
|
||||||
|
|
||||||
memcpy(local, binary.constData() + bAddr, 64);
|
|
||||||
local[64] = local[65] = 0x00;
|
|
||||||
|
|
||||||
// QByteArray b((const char *)(&local[0]), 64);
|
|
||||||
// qCritical() << "SNDB" << bNum << b.size() << b.toHex();
|
|
||||||
|
|
||||||
while (noAnswerCount <= 250) {
|
|
||||||
m_hw->bl_sendDataBlock(64, local);
|
|
||||||
QThread::msleep(10);
|
|
||||||
DownloadResult const res = sendStatus(m_hw->bl_wasSendingDataOK());
|
|
||||||
if (res != DownloadResult::NOP) {
|
|
||||||
if (res == DownloadResult::ERROR) {
|
|
||||||
if (++errorCount >= 10) {
|
|
||||||
qCritical() << "data for block" << bNum << "...FAILED";
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// qInfo() << "data for block" << bNum << "OK";
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
noAnswerCount += 1; // no answer by now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// wait max. about 3 seconds
|
|
||||||
return DownloadResult::TIMEOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
Update::DownloadResult Update::dc_downloadBinary(QByteArray const &b) const {
|
|
||||||
int const nBlocks = (((b.size())%64)==0) ? (b.size()/64) : (b.size()/64)+1;
|
|
||||||
|
|
||||||
// fill lst block of data to be sent with 0xFF
|
|
||||||
QByteArray ba = b.leftJustified(nBlocks*64, (char)(0xFF));
|
|
||||||
|
|
||||||
qInfo() << "total number of bytes to send to dc" << ba.size();
|
|
||||||
qInfo() << "total number of blocks to send to dc" << nBlocks;
|
|
||||||
|
|
||||||
int bNum = 0;
|
|
||||||
DownloadResult res = DownloadResult::OK;
|
|
||||||
fprintf(stderr, "\n64-byte block %04d ", bNum);
|
|
||||||
while (res != DownloadResult::ERROR && bNum < nBlocks) {
|
|
||||||
if ((res = sendNextAddress(bNum)) != DownloadResult::ERROR) {
|
|
||||||
if ((res = sendNextDataBlock(ba, bNum)) != DownloadResult::ERROR) {
|
|
||||||
bNum += 1;
|
|
||||||
fprintf(stderr, ".");
|
|
||||||
if ((bNum % 80) == 0) {
|
|
||||||
fprintf(stderr, "\n64-byte block %04d ", bNum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\nlast 64-byte block %04d\n", bNum);
|
|
||||||
|
|
||||||
int const rest = ba.size() % 64;
|
|
||||||
int const offset = ba.size() - rest;
|
|
||||||
char const *startAddress = ba.constData() + offset;
|
|
||||||
|
|
||||||
if (rest > 0) {
|
|
||||||
// SHOULD NEVER HAPPEN !!!
|
|
||||||
uint8_t local[66];
|
|
||||||
memset(local, 0xFF, sizeof(local));
|
|
||||||
memcpy(local, startAddress, rest);
|
|
||||||
qCritical() << "ERROR SEND REMAINING" << rest << "BYTES";
|
|
||||||
m_hw->bl_sendDataBlock(64, local);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hw->bl_sendLastBlock();
|
|
||||||
qInfo() << "last result" << (int)sendStatus(m_hw->bl_wasSendingDataOK());
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Update::startBootloader() const { // deprecated
|
|
||||||
return false;
|
|
||||||
#if 0
|
|
||||||
int nStartTry = 5;
|
|
||||||
while (--nStartTry >= 0) {
|
|
||||||
m_hw->bl_startBL();
|
|
||||||
QThread::msleep(500);
|
|
||||||
int nCheckTry = 10;
|
|
||||||
while (--nCheckTry >= 0) {
|
|
||||||
m_hw->bl_checkBL();
|
|
||||||
QThread::msleep(500);
|
|
||||||
if (m_hw->bl_isUp()) {
|
|
||||||
qInfo() << "starting bootloader...OK";
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
qCritical() << "bootloader not up ("
|
|
||||||
<< nStartTry << "," << nCheckTry << ")" << QThread::currentThread();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
qCritical() << "starting bootloader...FAILED" << QThread::currentThread();
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Update::stopBootloader() const {
|
|
||||||
// stop bootloader: this MUST work -> otherwise the PSA has to be restarted
|
|
||||||
// manually
|
|
||||||
emit m_worker->showErrorMessage("dc update", "stopping bootloader...");
|
|
||||||
|
|
||||||
int nTryFinalize = 1; // could do this in an endless loop
|
|
||||||
|
|
||||||
do {
|
|
||||||
// in principle, any value except BL_STOP will do, as we want to detect
|
|
||||||
// change to BL_STOP
|
|
||||||
m_worker->mainWindow()->setUpdateStep(UpdateDcEvent::UpdateStep::BL_CHECK);
|
|
||||||
|
|
||||||
QApplication::postEvent(
|
|
||||||
m_worker->mainWindow(),
|
|
||||||
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_STOP, nTryFinalize));
|
|
||||||
|
|
||||||
QThread::sleep(1);
|
|
||||||
|
|
||||||
int const cntLimit = 20;
|
|
||||||
int cnt = 0;
|
|
||||||
while (++cnt < cntLimit &&
|
|
||||||
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_STOP) {
|
|
||||||
// wait until bl_stopBL() has been sent
|
|
||||||
QThread::msleep(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplication::postEvent(
|
|
||||||
m_worker->mainWindow(),
|
|
||||||
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_CHECK, nTryFinalize));
|
|
||||||
QThread::sleep(1);
|
|
||||||
|
|
||||||
QApplication::postEvent(
|
|
||||||
m_worker->mainWindow(),
|
|
||||||
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_IS_UP, nTryFinalize));
|
|
||||||
QThread::sleep(1);
|
|
||||||
|
|
||||||
cnt = 0;
|
|
||||||
while (++cnt < cntLimit &&
|
|
||||||
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_IS_DOWN) {
|
|
||||||
// wait until done
|
|
||||||
QThread::msleep(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (++nTryFinalize <= MainWindow::BL_STOP_COUNT &&
|
|
||||||
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_IS_DOWN);
|
|
||||||
|
|
||||||
return (m_worker->mainWindow()->updateStep() == UpdateDcEvent::UpdateStep::BL_IS_DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
// br is a index into a table, used for historical reasons.
|
// br is a index into a table, used for historical reasons.
|
||||||
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
||||||
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
||||||
@@ -354,51 +173,6 @@ bool Update::isSerialOpen() const {
|
|||||||
return m_hw->dc_isPortOpen();
|
return m_hw->dc_isPortOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Update::resetDeviceController() const { // deprecated
|
|
||||||
return false;
|
|
||||||
#if 0
|
|
||||||
qDebug() << "resetting device controller...";
|
|
||||||
m_hw->bl_rebootDC();
|
|
||||||
// wait maximally 3 seconds, before starting bootloader
|
|
||||||
qInfo() << "resetting device controller...OK";
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Update::loadBinaryDCFile(QString filename) const {
|
|
||||||
qDebug() << "loading dc binary" << filename << "...";
|
|
||||||
|
|
||||||
QFile file(filename); // closed in destructor call
|
|
||||||
if (!file.exists()) {
|
|
||||||
qCritical() << file.fileName() << "does not exist";
|
|
||||||
return QByteArray();
|
|
||||||
}
|
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
|
||||||
qCritical() << "cannot open file" << file.fileName();
|
|
||||||
return QByteArray();
|
|
||||||
}
|
|
||||||
qInfo() << "loading dc binary" << filename << "...OK";
|
|
||||||
return file.readAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Update::downloadBinaryToDC(QString const &bFile) const {
|
|
||||||
qDebug() << "sending" << bFile << "to dc...";
|
|
||||||
QByteArray const dcBinary = loadBinaryDCFile(bFile);
|
|
||||||
if (dcBinary.size() > 0) {
|
|
||||||
if (dc_downloadBinary(dcBinary) != DownloadResult::OK) {
|
|
||||||
qCritical() << "sending" << bFile << "to dc...FAILED";
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
qInfo() << "sending" << bFile << "to dc...OK";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qCritical() << "sending" << bFile << "to dc...FAILED";
|
|
||||||
qCritical() << "loading binary" << bFile << "FAILED";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -482,111 +256,78 @@ bool Update::downloadBinaryToDC(QString const &bFile) const {
|
|||||||
// There is no problem to repeat this command until the
|
// There is no problem to repeat this command until the
|
||||||
// bootloader is really not running anymore.
|
// bootloader is really not running anymore.
|
||||||
*/
|
*/
|
||||||
bool Update::updateBinary(char const *fileToSendToDC) {
|
bool Update::updateBinary(QString const &fileToSendToDC) {
|
||||||
qInfo() << "UPDATING DEVICE CONTROLLER FIRMWARE BINARY" << fileToSendToDC;
|
qInfo() << "UPDATING DEVICE CONTROLLER FIRMWARE BINARY" << fileToSendToDC;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
QFile fn(fileToSendToDC);
|
QFile fn(fileToSendToDC);
|
||||||
bool r;
|
if (!fn.exists()) {
|
||||||
if ((r = fn.exists()) == true) {
|
// output via CONSOLE() etc
|
||||||
QFileInfo fi(fn);
|
return false;
|
||||||
if ((r = updateDC(fileToSendToDC)) == true) {
|
}
|
||||||
Utils::printInfoMsg(
|
|
||||||
QString(" UPDATING BINARY ") + fi.fileName()
|
bool bl_isUp = false;
|
||||||
+ QString(" (size=%1").arg(fi.size()) + ") DONE");
|
if (m_hw->bl_completeStart()) {
|
||||||
} else {
|
int cnt = 5;
|
||||||
Utils::printCriticalErrorMsg(
|
while (--cnt > 0) {
|
||||||
QString(" UPDATING BINARY ") + fi.fileName()
|
if (m_hw->bl_isUp()) {
|
||||||
+ QString(" (size=%1").arg(fi.size()) + ") FAILED");
|
bl_isUp = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
QString(fileToSendToDC) + " DOES NOT EXIST -> NO UPDATE OF DC FIRMWARE");
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Update::updateDC(QString bFile) const {
|
|
||||||
qDebug() << "IN UPDATEDC: UPDATING DC: FILE TO SEND" << bFile;
|
|
||||||
|
|
||||||
m_worker->mainWindow()->setUpdateStep(UpdateDcEvent::UpdateStep::NONE);
|
|
||||||
|
|
||||||
QApplication::postEvent( // step 1: reset device controller
|
|
||||||
m_worker->mainWindow(),
|
|
||||||
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::DC_REBOOT, 1));
|
|
||||||
QThread::sleep(1);
|
|
||||||
|
|
||||||
for (int i=1; i <= MainWindow::BL_START_COUNT; ++i) {
|
|
||||||
QApplication::postEvent( // step 2: start bootloader (5x)
|
|
||||||
m_worker->mainWindow(),
|
|
||||||
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_START, i));
|
|
||||||
QThread::sleep(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int const cntLimit = 100; // wait until its for sure that bl_startBL()
|
if (!bl_isUp) {
|
||||||
int cnt = 0; // has been excuted
|
|
||||||
while (++cnt < cntLimit &&
|
|
||||||
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_START) {
|
|
||||||
// wait until all bl_startBL() are done
|
|
||||||
QThread::msleep(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cnt == cntLimit) {
|
|
||||||
// start events not received ???
|
|
||||||
Utils::printCriticalErrorMsg("BL_START EVENT NOT RECEIVED AFTER 20 SECS");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_worker->mainWindow()->setUpdateStep(UpdateDcEvent::UpdateStep::BL_CHECK);
|
if (!m_hw->bl_storeFirmware(fileToSendToDC)) {
|
||||||
|
m_hw->bl_stopBL();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=1; i <= MainWindow::BL_IS_UP_COUNT; ++i) {
|
uint16_t const nrOfFirmwareBlocks = m_hw->bl_getNrOfFirmwareBlocks();
|
||||||
QApplication::postEvent(m_worker->mainWindow(), new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_CHECK, i));
|
|
||||||
QThread::sleep(1);
|
for (uint16_t blockNr = 0; blockNr <= nrOfFirmwareBlocks; ++blockNr) {
|
||||||
QApplication::postEvent(m_worker->mainWindow(), new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_IS_UP, i));
|
m_hw->bl_blockAutoLoad(blockNr);
|
||||||
if (m_worker->mainWindow()->updateStep() == UpdateDcEvent::UpdateStep::BL_IS_UP) {
|
|
||||||
break;
|
int sleepTime = 0;
|
||||||
|
while (1) {
|
||||||
|
if (sleepTime > 1500) {
|
||||||
|
m_hw->bl_stopBL();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int8_t const r = m_hw->bl_blockAutoResponse();
|
||||||
|
|
||||||
|
// after every "bl_blockAutoLoad()" call this until response
|
||||||
|
// retval 0: wait 1: OK, blk was sent 2: OK, transfer complete
|
||||||
|
// 3: error despite repeating, cancel. probably bin file corrupted
|
||||||
|
// Max duration: 3x no response from BL = 900ms
|
||||||
|
|
||||||
|
switch(r) {
|
||||||
|
case 1:
|
||||||
|
/* fall through */
|
||||||
|
case 2:
|
||||||
|
sleepTime = 0;
|
||||||
|
break;
|
||||||
|
case 0: {
|
||||||
|
QThread::msleep(100);
|
||||||
|
sleepTime += 100;
|
||||||
|
} break;
|
||||||
|
case 3:
|
||||||
|
m_hw->bl_stopBL();
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
m_hw->bl_stopBL();
|
||||||
|
return false; // unknown error code
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QThread::sleep(1);
|
|
||||||
|
m_hw->bl_stopBL();
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt = 0;
|
|
||||||
while (++cnt < cntLimit &&
|
|
||||||
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_IS_UP) {
|
|
||||||
// wait until all bl_startBL() are done
|
|
||||||
QThread::msleep(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cnt == cntLimit) {
|
|
||||||
// really not up
|
|
||||||
Utils::printCriticalErrorMsg("BL_IS_UP EVENT NOT RECEIVED AFTER 20 SECS");
|
|
||||||
stopBootloader(); // try to stop bootloader whichhas been already started
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_worker->mainWindow()->updateStep() == UpdateDcEvent::UpdateStep::BL_IS_UP) {
|
|
||||||
// bootloader MUST be running to download device-controller
|
|
||||||
#if 0
|
|
||||||
if (!downloadBinaryToDC(bFile)) {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
QString("UPDATING DC: ") + bFile + " ...DOWNLOAD FAILED");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
QString("UPDATING DC: ") + bFile + " BOOT LOADER NOT RUNNING -> NO DOWNLOAD ("
|
|
||||||
+ QThread::currentThread()->objectName() + ")");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// do this unconditionally, even if bootloader is not running at all ->
|
|
||||||
// the controller possibly tells us nonsense.
|
|
||||||
if (!stopBootloader()) {
|
|
||||||
Utils::printCriticalErrorMsg(
|
|
||||||
QString("UPDATING DC: ") + bFile + " BOOT LOADER STILL RUNNING ("
|
|
||||||
+ QThread::currentThread()->objectName() + ")");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils::printInfoMsg(QString("UPDATING DC: ") + bFile + " ...OK");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,13 +347,6 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|||||||
int templateIdx,
|
int templateIdx,
|
||||||
QString jsFileToSendToDC) const {
|
QString jsFileToSendToDC) const {
|
||||||
|
|
||||||
|
|
||||||
Utils::printInfoMsg(
|
|
||||||
QString("UPDATING JSON-FILE=%1, TEMPLATE-INDEX=%2, JSON-TYPE=%3")
|
|
||||||
.arg(jsFileToSendToDC)
|
|
||||||
.arg(templateIdx)
|
|
||||||
.arg(jsonType(type)));
|
|
||||||
|
|
||||||
m_hw->dc_autoRequest(true); // downloading Json needs the AutoEmission flag
|
m_hw->dc_autoRequest(true); // downloading Json needs the AutoEmission flag
|
||||||
qDebug() << "SET AUTO-REQUEST=TRUE";
|
qDebug() << "SET AUTO-REQUEST=TRUE";
|
||||||
QThread::sleep(1); // make sure the auto-request flag is acknowledged
|
QThread::sleep(1); // make sure the auto-request flag is acknowledged
|
||||||
@@ -641,7 +375,26 @@ bool Update::downloadJson(enum FileTypeJson type,
|
|||||||
if (m_hw->sys_sendJsonFileToDc((uint8_t)(type),
|
if (m_hw->sys_sendJsonFileToDc((uint8_t)(type),
|
||||||
templateIdx,
|
templateIdx,
|
||||||
(uint8_t *)ba.data())) {
|
(uint8_t *)ba.data())) {
|
||||||
QThread::sleep(1);
|
|
||||||
|
m_hw->dc_autoRequest(true);
|
||||||
|
QThread::msleep(500);
|
||||||
|
|
||||||
|
// testing
|
||||||
|
m_hw->request_ReadbackMachineID();
|
||||||
|
QThread::msleep(500);
|
||||||
|
|
||||||
|
uint8_t data[64];
|
||||||
|
memset(data, 0x00, sizeof(data));
|
||||||
|
uint8_t length = 0;
|
||||||
|
|
||||||
|
m_hw->readback_machineIDdata(&length, data);
|
||||||
|
|
||||||
|
QThread::msleep(500);
|
||||||
|
|
||||||
|
QByteArray ba((const char*)data, length);
|
||||||
|
|
||||||
|
qCritical() << length << "MACHINE ID =" << ba.toHex(':');
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -742,15 +495,9 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||||
int tries = 20;
|
if (m_sys_areDCdataValid == false) {
|
||||||
while (!m_hw->sys_areDCdataValid()) { // must deliver 'true', only then are all
|
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||||
// data from hwapi valid
|
return false;
|
||||||
if (--tries < 0) {
|
|
||||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
m_hw->dc_autoRequest(true);
|
|
||||||
QThread::msleep(500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
@@ -758,52 +505,44 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
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());
|
||||||
#if UPDATE_DC == 1
|
if (fToWorkOn.contains("dc2c.bin")) {
|
||||||
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
|
bool updateBinaryRes = true;
|
||||||
if (fToWorkOn.contains(version)) {
|
|
||||||
Utils::printInfoMsg("DO-UPDATE FILE-TO-WORK-ON " + fToWorkOn);
|
|
||||||
|
|
||||||
QFile fn(fToWorkOn);
|
// CONSOLE()
|
||||||
QFileInfo finfo(fn);
|
|
||||||
if (!fn.exists()) { // check for broken link
|
|
||||||
Utils::printCriticalErrorMsg("DO-UPDATE FILE-TO-WORK-ON "
|
|
||||||
+ fToWorkOn + " DOES NOT EXIST");
|
|
||||||
res = false;
|
|
||||||
} else {
|
|
||||||
bool updateBinaryRes = true;
|
|
||||||
|
|
||||||
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC";
|
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
|
|
||||||
qInfo() << "SET AUTO-REQUEST=FALSE";
|
|
||||||
|
|
||||||
if ((updateBinaryRes = updateBinary(fToWorkOn.toStdString().c_str())) == true) {
|
if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
|
||||||
qCritical() << "downloaded binary" << fToWorkOn;
|
|
||||||
++displayIndex;
|
|
||||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
|
||||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
|
||||||
Worker::UPDATE_STEP_DONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
// qCritical() << "downloaded binary" << fToWorkOn;
|
||||||
qInfo() << "SET AUTO-REQUEST=TRUE";
|
|
||||||
|
|
||||||
QStringList const &versions = Update::getDcSoftAndHardWareVersion();
|
++displayIndex;
|
||||||
if (versions.size() >= 2) {
|
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
||||||
if (updateBinaryRes == true) {
|
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||||
qInfo() << "dc-hardware-version (UPDATED)" << versions[0];
|
Worker::UPDATE_STEP_DONE);
|
||||||
qInfo() << "dc-firmware-version (UPDATED)" << versions[1];
|
|
||||||
} else {
|
|
||||||
qInfo() << "dc-hardware-version (NOT UPDATED)" << versions[0];
|
|
||||||
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res = updateBinaryRes;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
|
||||||
|
// qInfo() << "SET AUTO-REQUEST=TRUE";
|
||||||
|
|
||||||
|
QStringList const &versions = Update::getDcSoftAndHardWareVersion();
|
||||||
|
if (versions.size() >= 2) {
|
||||||
|
if (updateBinaryRes == true) {
|
||||||
|
qInfo() << "dc-hardware-version (UPDATED)" << versions[0];
|
||||||
|
qInfo() << "dc-firmware-version (UPDATED)" << versions[1];
|
||||||
|
} else {
|
||||||
|
qInfo() << "dc-hardware-version (NOT UPDATED)" << versions[0];
|
||||||
|
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res = updateBinaryRes;
|
||||||
|
|
||||||
|
} else if (fToWorkOn.contains("DC2C_print", 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();
|
||||||
@@ -856,8 +595,6 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
|||||||
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
qCritical() << "UNKNOWN JSON FILE NAME" << fToWorkOn;
|
||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
// m_worker->stopProgressLoop();
|
|
||||||
// m_worker->setProgress(100);
|
|
||||||
|
|
||||||
if (res == false) {
|
if (res == false) {
|
||||||
break;
|
break;
|
||||||
|
12
update.h
12
update.h
@@ -32,6 +32,7 @@ class Update : public QObject {
|
|||||||
QString m_workingDir;
|
QString m_workingDir;
|
||||||
bool m_maintenanceMode;
|
bool m_maintenanceMode;
|
||||||
bool m_dryRun;
|
bool m_dryRun;
|
||||||
|
bool m_sys_areDCdataValid;
|
||||||
|
|
||||||
static QPluginLoader pluginLoader;
|
static QPluginLoader pluginLoader;
|
||||||
|
|
||||||
@@ -72,23 +73,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static QString jsonType(enum FileTypeJson type);
|
static QString jsonType(enum FileTypeJson type);
|
||||||
|
|
||||||
DownloadResult sendStatus(int ret) const;
|
|
||||||
DownloadResult sendNextAddress(int bNum) const;
|
|
||||||
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
|
||||||
DownloadResult dc_downloadBinary(QByteArray const &binary) const;
|
|
||||||
|
|
||||||
bool startBootloader() const;
|
|
||||||
bool stopBootloader() const;
|
|
||||||
bool openSerial(int br, QString baudrate, QString comPort) const;
|
bool openSerial(int br, QString baudrate, QString comPort) const;
|
||||||
void closeSerial() const;
|
void closeSerial() const;
|
||||||
bool isSerialOpen() const;
|
bool isSerialOpen() const;
|
||||||
bool resetDeviceController() const;
|
bool resetDeviceController() const;
|
||||||
QByteArray loadBinaryDCFile(QString filename) const;
|
QByteArray loadBinaryDCFile(QString filename) const;
|
||||||
bool downloadBinaryToDC(QString const &bFile) const;
|
bool downloadBinaryToDC(QString const &bFile) const;
|
||||||
bool updateDC(QString bFile) const;
|
|
||||||
bool updatePrinterTemplate(int templateIdx, QString fname) const;
|
bool updatePrinterTemplate(int templateIdx, QString fname) const;
|
||||||
bool updateBinary(char const *fileToSendToDC);
|
bool updateBinary(QString const &fileToSendToDC);
|
||||||
bool updateConfig(QString jsFileToSendToDC);
|
bool updateConfig(QString jsFileToSendToDC);
|
||||||
bool updateCashConf(QString jsFileToSendToDC);
|
bool updateCashConf(QString jsFileToSendToDC);
|
||||||
bool updateDeviceConf(QString jsFileToSendToDC);
|
bool updateDeviceConf(QString jsFileToSendToDC);
|
||||||
|
94
worker.cpp
94
worker.cpp
@@ -116,6 +116,8 @@ Worker::Worker(int customerNr,
|
|||||||
QString pluginName,
|
QString pluginName,
|
||||||
QString workingDirectory,
|
QString workingDirectory,
|
||||||
bool noUpdatePsaHardware,
|
bool noUpdatePsaHardware,
|
||||||
|
bool alwaysDownloadConfig,
|
||||||
|
bool alwaysDownloadDC,
|
||||||
bool dryRun,
|
bool dryRun,
|
||||||
QObject *parent,
|
QObject *parent,
|
||||||
char const *serialInterface,
|
char const *serialInterface,
|
||||||
@@ -131,6 +133,8 @@ Worker::Worker(int customerNr,
|
|||||||
, m_customerRepositoryPath(QString("%1/%2.git").arg(repositoryUrl).arg(m_customerNrStr))
|
, m_customerRepositoryPath(QString("%1/%2.git").arg(repositoryUrl).arg(m_customerNrStr))
|
||||||
, m_customerRepository(QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr))
|
, m_customerRepository(QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr))
|
||||||
, m_noUpdatePsaHardware(noUpdatePsaHardware)
|
, m_noUpdatePsaHardware(noUpdatePsaHardware)
|
||||||
|
, m_alwaysDownloadConfig(alwaysDownloadConfig)
|
||||||
|
, m_alwaysDownloadDC(alwaysDownloadDC)
|
||||||
, m_dryRun(dryRun)
|
, m_dryRun(dryRun)
|
||||||
, m_parent(parent)
|
, m_parent(parent)
|
||||||
, m_serialInterface(serialInterface)
|
, m_serialInterface(serialInterface)
|
||||||
@@ -210,6 +214,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;
|
||||||
}
|
}
|
||||||
@@ -330,21 +340,30 @@ void Worker::privateUpdate() {
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
m_ismasTriggerActive = false;
|
m_ismasTriggerActive = false;
|
||||||
if ((continueUpdate = updateTriggerSet()) == false) {
|
if (m_clone == false) {
|
||||||
|
if ((continueUpdate = updateTriggerSet()) == false) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS));
|
||||||
|
setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||||
|
}
|
||||||
|
} 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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCritical() << "**** m_ismasTriggerActive:" << m_ismasTriggerActive;
|
||||||
|
qCritical() << "**** m_clone:" << m_clone;
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -453,9 +472,9 @@ bool Worker::updateTriggerSet() {
|
|||||||
|
|
||||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER));
|
||||||
|
|
||||||
QString triggerValue("");
|
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();
|
||||||
@@ -463,10 +482,12 @@ bool Worker::updateTriggerSet() {
|
|||||||
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;
|
CONSOLE(QStringList(func) << s) << UPDATE_STEP::DEBUG;
|
||||||
} else {
|
} else {
|
||||||
CONSOLE(QStringList(func) << QString("-> REPEAT=%1").arg(repeat)) << UPDATE_STEP::DEBUG;
|
QStringList lst = (QStringList(func) << QString("-> REPEAT=%1 (%2)").arg(repeat).arg(repeats-repeat));
|
||||||
|
// GUI(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER;
|
||||||
|
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")) {
|
||||||
@@ -556,7 +577,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
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");
|
QStringList lst(QString("%1 empty update trigger (%2)").arg(repeat).arg(repeats-repeat));
|
||||||
if (m_clone) {
|
if (m_clone) {
|
||||||
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||||
// if the customer repository has just been cloned
|
// if the customer repository has just been cloned
|
||||||
@@ -638,6 +659,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_clone && m_alwaysDownloadConfig) {
|
||||||
|
// always download all json-config files, even if none of them have been
|
||||||
|
// changed in the git repository. useful for first installation.
|
||||||
|
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config"));
|
||||||
|
if (dir.exists()) {
|
||||||
|
QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files);
|
||||||
|
if (!jsons.isEmpty()) {
|
||||||
|
m_filesToUpdate << jsons;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_clone && m_alwaysDownloadDC) {
|
||||||
|
// always download the last dc-binary, even if not changed in the
|
||||||
|
// git repository. useful for first installation.
|
||||||
|
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/dc"));
|
||||||
|
if (dir.exists()) {
|
||||||
|
QStringList dc = dir.entryList(QStringList() << "dc2c.bin", QDir::Files,
|
||||||
|
QDir::SortFlag::Time | QDir::SortFlag::Reversed);
|
||||||
|
if (!dc.isEmpty()) {
|
||||||
|
m_filesToUpdate << dc.first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (std::optional<QString> changes = m_gc.gitPull()) {
|
if (std::optional<QString> changes = m_gc.gitPull()) {
|
||||||
if (!changes.value().contains("Already up to date")) {
|
if (!changes.value().contains("Already up to date")) {
|
||||||
if (std::optional<QStringList> changedFileNames = m_gc.gitDiff(changes.value())) {
|
if (std::optional<QStringList> changedFileNames = m_gc.gitDiff(changes.value())) {
|
||||||
@@ -645,6 +691,9 @@ bool Worker::filesToUpdate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_filesToUpdate.removeDuplicates();
|
m_filesToUpdate.removeDuplicates();
|
||||||
|
|
||||||
|
qCritical() << __PRETTY_FUNCTION__ << "FILES-TO-UPDATE" << m_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 {
|
||||||
@@ -652,7 +701,6 @@ bool Worker::filesToUpdate() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,8 +714,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -688,7 +735,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*#.*$");
|
||||||
@@ -696,7 +743,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);
|
||||||
@@ -750,14 +797,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() << 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;
|
||||||
@@ -773,7 +821,7 @@ bool Worker::execOpkgCommands() {
|
|||||||
bool Worker::downloadFilesToPSAHardware() {
|
bool Worker::downloadFilesToPSAHardware() {
|
||||||
m_displayIndex = 0;
|
m_displayIndex = 0;
|
||||||
|
|
||||||
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
GUI(m_filesToDownload) << (CONSOLE(m_filesToDownload) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
||||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE);
|
||||||
|
|
||||||
if (m_noUpdatePsaHardware == false) {
|
if (m_noUpdatePsaHardware == false) {
|
||||||
@@ -808,7 +856,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 "
|
||||||
|
94
worker.h
94
worker.h
@@ -124,6 +124,8 @@ class Worker : public QThread{
|
|||||||
QString const m_customerRepositoryPath;
|
QString const m_customerRepositoryPath;
|
||||||
QString const m_customerRepository;
|
QString const m_customerRepository;
|
||||||
bool const m_noUpdatePsaHardware;
|
bool const m_noUpdatePsaHardware;
|
||||||
|
bool const m_alwaysDownloadConfig;
|
||||||
|
bool const m_alwaysDownloadDC;
|
||||||
bool const m_dryRun;
|
bool const m_dryRun;
|
||||||
QObject *m_parent;
|
QObject *m_parent;
|
||||||
QString const m_serialInterface;
|
QString const m_serialInterface;
|
||||||
@@ -331,6 +333,8 @@ public:
|
|||||||
QString pluginName,
|
QString pluginName,
|
||||||
QString workingDir = ".",
|
QString workingDir = ".",
|
||||||
bool noUpdatePsaHardware = false,
|
bool noUpdatePsaHardware = false,
|
||||||
|
bool alwaysDownloadConfig = false,
|
||||||
|
bool alwaysDownloadDC = false,
|
||||||
bool dryRun = false,
|
bool dryRun = false,
|
||||||
QObject *parent = nullptr,
|
QObject *parent = nullptr,
|
||||||
char const *serialInterface = SERIAL_PORT,
|
char const *serialInterface = SERIAL_PORT,
|
||||||
@@ -516,8 +520,10 @@ private:
|
|||||||
break;
|
break;
|
||||||
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::FILES_TO_UPDATE:
|
case UPDATE_STEP::FILES_TO_UPDATE: {
|
||||||
break;
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE: {
|
||||||
lst << instance->m_debugMsg;
|
lst << instance->m_debugMsg;
|
||||||
Utils::printUpdateStatusMsg(debug, lst);
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
@@ -551,8 +557,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:
|
||||||
@@ -572,18 +580,24 @@ private:
|
|||||||
Utils::printUpdateStatusMsg(debug, lst);
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SAVE_LOGS:
|
case UPDATE_STEP::SAVE_LOGS:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||||
break;
|
break;
|
||||||
@@ -591,12 +605,18 @@ private:
|
|||||||
// SEND_LAST_VERSION_CORRECTION
|
// SEND_LAST_VERSION_CORRECTION
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::UPDATE_ACTIVATED:
|
case UPDATE_STEP::UPDATE_ACTIVATED:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::UPDATE_FAILED:
|
case UPDATE_STEP::UPDATE_FAILED:
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::FINISHED:
|
case UPDATE_STEP::FINISHED:
|
||||||
|
lst << instance->m_debugMsg;
|
||||||
|
Utils::printUpdateStatusMsg(debug, lst);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DEBUG: {
|
case UPDATE_STEP::DEBUG: {
|
||||||
lst << instance->m_debugMsg;
|
lst << instance->m_debugMsg;
|
||||||
@@ -924,33 +944,77 @@ private:
|
|||||||
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER:
|
||||||
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER);
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS:
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_SUCCESS);
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_SUCCESS);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
_ISMAS_CONTINUE,
|
||||||
|
ismasClient.getProgressInPercent(),
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[step],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
"");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
case UPDATE_STEP::DOWNLOAD_DEVICE_CONTROLLER_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_FAILURE);
|
ismasClient.setProgressInPercent(_DOWNLOAD_DEVICE_CONTROLLER_FAILURE);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS:
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
_ISMAS_CONTINUE,
|
||||||
|
ismasClient.getProgressInPercent(),
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[step],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
"");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
case UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
ismasClient.setProgressInPercent(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
||||||
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY);
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
_ISMAS_CONTINUE,
|
||||||
|
ismasClient.getProgressInPercent(),
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[step],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
"");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
ismasClient.setProgressInPercent(_SYNC_CUSTOMER_REPOSITORY_FAILURE);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SAVE_LOGS:
|
case UPDATE_STEP::SAVE_LOGS:
|
||||||
ismasClient.setProgressInPercent(_SAVE_LOGS);
|
ismasClient.setProgressInPercent(_SAVE_LOGS);
|
||||||
break;
|
break;
|
||||||
case UPDATE_STEP::SAVE_LOGS_SUCCESS:
|
case UPDATE_STEP::SAVE_LOGS_SUCCESS: {
|
||||||
ismasClient.setProgressInPercent(_SAVE_LOGS_SUCCESS);
|
ismasClient.setProgressInPercent(_SAVE_LOGS_SUCCESS);
|
||||||
break;
|
QString const &ismasUpdateNews =
|
||||||
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
|
ismasClient.updateNewsToIsmas(
|
||||||
|
_ISMAS_CONTINUE,
|
||||||
|
ismasClient.getProgressInPercent(),
|
||||||
|
IsmasClient::RESULT_CODE::SUCCESS,
|
||||||
|
smap[step],
|
||||||
|
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||||
|
"");
|
||||||
|
ismasClient.sendRequestReceiveResponse(
|
||||||
|
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||||
|
} break;
|
||||||
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||||
ismasClient.setProgressInPercent(_SAVE_LOGS_FAILURE);
|
ismasClient.setProgressInPercent(_SAVE_LOGS_FAILURE);
|
||||||
break;
|
break;
|
||||||
@@ -1063,6 +1127,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;
|
||||||
@@ -1113,7 +1180,8 @@ private:
|
|||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(i));
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(i));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (size == 1) {
|
||||||
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
||||||
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user