Compare commits
No commits in common. "5e9b05e88748681216d161220a919089e3d7476f" and "bfa39eb3df581ea696dc47a155bcefb7acca6705" have entirely different histories.
5e9b05e887
...
bfa39eb3df
@ -14,5 +14,5 @@ dry-run=false
|
||||
extended-version=false
|
||||
yocto-version=false
|
||||
yocto-install=false
|
||||
always-download-config=true
|
||||
always-download-config=false
|
||||
always-download-dc=false
|
||||
|
@ -77,11 +77,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# 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.
|
||||
VERSION="1.3.23"
|
||||
VERSION="1.3.22"
|
||||
|
||||
# PLANNED TODOS:
|
||||
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
||||
@ -115,7 +111,6 @@ VERSION="1.3.23"
|
||||
# 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.
|
||||
# 11: Das Edit-Fenster teilen um die Anzeige zu verbessern.
|
||||
|
||||
|
||||
win32 {
|
||||
|
216
update.cpp
216
update.cpp
@ -376,32 +376,24 @@ bool Update::downloadJson(enum FileTypeJson type,
|
||||
templateIdx,
|
||||
(uint8_t *)ba.data())) {
|
||||
|
||||
/*
|
||||
* 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);
|
||||
m_hw->dc_autoRequest(true);
|
||||
QThread::msleep(500);
|
||||
|
||||
// testing
|
||||
m_hw->request_ReadbackMachineID();
|
||||
QThread::msleep(500);
|
||||
// testing
|
||||
m_hw->request_ReadbackMachineID();
|
||||
QThread::msleep(500);
|
||||
|
||||
uint8_t data[64];
|
||||
memset(data, 0x00, sizeof(data));
|
||||
uint8_t length = 0;
|
||||
uint8_t data[64];
|
||||
memset(data, 0x00, sizeof(data));
|
||||
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;
|
||||
}
|
||||
@ -502,86 +494,6 @@ QStringList Update::getDcSoftAndHardWareVersion() {
|
||||
<< "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) {
|
||||
|
||||
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) {
|
||||
|
||||
}
|
||||
} else {
|
||||
qCritical() << "CANNOT FIND JSON-NR FOR" << jsonFileNames[i];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
if (m_sys_areDCdataValid == false) {
|
||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||
@ -592,9 +504,7 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
QList<QString>::const_iterator it;
|
||||
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
||||
m_worker->startProgressLoop();
|
||||
|
||||
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
|
||||
|
||||
if (fToWorkOn.contains("dc2c.bin")) {
|
||||
bool updateBinaryRes = true;
|
||||
|
||||
@ -631,61 +541,59 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
|
||||
res = updateBinaryRes;
|
||||
|
||||
} else {
|
||||
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||
} else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
res = true;
|
||||
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
||||
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
||||
if ((templateIdx < 1) || (templateIdx > 32)) {
|
||||
qCritical() << "WRONG TEMPLATE INDEX" << templateIdx;
|
||||
res = false;
|
||||
} else {
|
||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||
Utils::printInfoMsg(
|
||||
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||
.arg(fToWorkOn)
|
||||
.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;
|
||||
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 = true;
|
||||
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
||||
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
||||
if ((templateIdx < 1) || (templateIdx > 32)) {
|
||||
qCritical() << "WRONG TEMPLATE INDEX" << templateIdx;
|
||||
res = false;
|
||||
} else {
|
||||
if ((res = updatePrinterTemplate(templateIdx, fToWorkOn))) {
|
||||
Utils::printInfoMsg(
|
||||
QString("DOWNLOADED PRINTER TEMPLATE %1 WITH INDEX=%2")
|
||||
.arg(fToWorkOn)
|
||||
.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;
|
||||
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;
|
||||
}
|
||||
|
||||
if (res == false) {
|
||||
|
2
update.h
2
update.h
@ -58,7 +58,6 @@ public:
|
||||
char const *baudrate = "115200");
|
||||
virtual ~Update() override;
|
||||
bool doUpdate(int &displayIndex, QStringList const &linesToWorkOn);
|
||||
bool checkDownloadedJsonVersions(QStringList const& jsonFileNames);
|
||||
|
||||
hwinf *hw() { return m_hw; }
|
||||
hwinf const *hw() const { return m_hw; }
|
||||
@ -88,7 +87,6 @@ private:
|
||||
bool downloadJson(enum FileTypeJson type, int templateIdx,
|
||||
QString jsFileToSendToDC) const;
|
||||
QStringList getDcSoftAndHardWareVersion();
|
||||
QString getFileVersion(QString const& jsonFile);
|
||||
|
||||
private slots:
|
||||
void readyReadStandardOutput();
|
||||
|
17
worker.cpp
17
worker.cpp
@ -666,9 +666,7 @@ bool Worker::filesToUpdate() {
|
||||
if (dir.exists()) {
|
||||
QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files);
|
||||
if (!jsons.isEmpty()) {
|
||||
for (QStringList::size_type i=0; i<jsons.size(); ++i) {
|
||||
m_filesToUpdate << QDir::cleanPath(QString("etc/psa_config/") + jsons.at(i));
|
||||
}
|
||||
m_filesToUpdate << jsons;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -681,7 +679,7 @@ bool Worker::filesToUpdate() {
|
||||
QStringList dc = dir.entryList(QStringList() << "dc2c.bin", QDir::Files,
|
||||
QDir::SortFlag::Time | QDir::SortFlag::Reversed);
|
||||
if (!dc.isEmpty()) {
|
||||
m_filesToUpdate << QDir::cleanPath(QString("etc/dc/") + dc.first());
|
||||
m_filesToUpdate << dc.first();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -838,16 +836,7 @@ bool Worker::downloadFilesToPSAHardware() {
|
||||
m_pluginName,
|
||||
m_workingDirectory);
|
||||
|
||||
if (update.doUpdate(m_displayIndex, m_filesToDownload)) {
|
||||
// prepared for use: at the moment, the dc-library does not work
|
||||
// as expected.
|
||||
|
||||
// static const QRegularExpression re("^.*\\.json$");
|
||||
// return update.checkDownloadedJsonVersions(m_filesToDownload.filter(re));
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return update.doUpdate(m_displayIndex, m_filesToDownload);
|
||||
} else {
|
||||
CONSOLE(QStringList("NO FILES TO DOWNLOAD TO PSA-HW")) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE;
|
||||
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user