Compare commits
9 Commits
686e113c3a
...
979afa37d3
Author | SHA1 | Date | |
---|---|---|---|
979afa37d3 | |||
1e1820724d | |||
d90954c6eb | |||
cf77d0ff76 | |||
73d02d214a | |||
6a67d8e9b0 | |||
30d8cc3684 | |||
bc9ebb7d68 | |||
e6f6d43bf2 |
@ -81,9 +81,21 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# Fix the path-names of the json-files and the device-controller.
|
||||
# Set automatic download of json-file in ATBUpdateTool.ini file for
|
||||
# a fresh clone of the repository.
|
||||
# 1.3.23 Added a 'break' to prevent a possible endless loop when checking if
|
||||
# 1.3.23: Added a 'break' to prevent a possible endless loop when checking if
|
||||
# the device is alive.
|
||||
VERSION="1.3.24"
|
||||
#
|
||||
# NOTE: The versioning info has to be shifted up by one version, i.e. what
|
||||
# happened for 1.3.23 was actually done in 1.3.24.
|
||||
# 1.3.24
|
||||
#
|
||||
# 1.3._24_: Special version for szeged using a old dc-controller (4.42):
|
||||
# Changes:
|
||||
# (1) the ini-File now uses the libCAmaster.so.
|
||||
# 1.3._25_: Again special version for szeged, using interface.h, version 4.4.
|
||||
# 1.4.0 : Start with version at 1.4.0 (mainly to see a difference with Szeged)
|
||||
# Set hash-value in EVENT-objects. Set location (project), version
|
||||
# and info in send-last-version.
|
||||
VERSION="1.4.0"
|
||||
|
||||
# PLANNED TODOS:
|
||||
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
||||
@ -170,7 +182,7 @@ DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
||||
# keep comments, as /* fall through */
|
||||
QMAKE_CXXFLAGS += -C
|
||||
QMAKE_CXXFLAGS += -g
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy -O
|
||||
|
||||
contains( CONFIG, PTU5 ) {
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||
|
76
utils.cpp
76
utils.cpp
@ -30,6 +30,82 @@ int Utils::read1stLineOfFile(QString fileName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString Utils::getLocation(QString fileName) {
|
||||
QString location("N/A");
|
||||
QFile f(fileName);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
QString const &line = in.readLine();
|
||||
if (line.indexOf("Project", Qt::CaseInsensitive) != -1) {
|
||||
int const c = line.indexOf(":");
|
||||
if (c != -1) {
|
||||
location = line.mid(c+1);
|
||||
if (!location.isEmpty()) {
|
||||
return location.replace(QChar('"'), QString("")).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
QString Utils::getTariffVersion(QString fileName) {
|
||||
QString version("N/A");
|
||||
QFile f(fileName);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
QString const &line = in.readLine();
|
||||
if (line.indexOf("Version", Qt::CaseInsensitive) != -1) {
|
||||
int const c = line.indexOf(":");
|
||||
if (c != -1) {
|
||||
version = line.mid(c+1);
|
||||
if (!version.isEmpty()) {
|
||||
return version.replace(QChar('"'), QString("")).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
QString Utils::getTariffInfo(QString fileName) {
|
||||
QString info("N/A");
|
||||
QFile f(fileName);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&f);
|
||||
in.setCodec("UTF-8");
|
||||
while(!in.atEnd()) {
|
||||
QString const &line = in.readLine();
|
||||
if (line.indexOf("Info", Qt::CaseInsensitive) != -1) {
|
||||
int const c = line.indexOf(":");
|
||||
if (c != -1) {
|
||||
info = line.mid(c+1);
|
||||
if (!info.isEmpty()) {
|
||||
return info.replace(QChar('"'), QString("")).trimmed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
QString Utils::zoneName(quint8 i) {
|
||||
static constexpr char const *zName[] = {
|
||||
"",
|
||||
|
3
utils.h
3
utils.h
@ -12,6 +12,9 @@
|
||||
|
||||
namespace Utils {
|
||||
int read1stLineOfFile(QString fileName);
|
||||
QString getLocation(QString fileName);
|
||||
QString getTariffVersion(QString fileName);
|
||||
QString getTariffInfo(QString fileName);
|
||||
QString zoneName(quint8 i);
|
||||
void printCriticalErrorMsg(QString const &errorMsg, bool upper=false, bool lower=false);
|
||||
void printCriticalErrorMsg(QStringList const &errorMsg);
|
||||
|
30
worker.cpp
30
worker.cpp
@ -140,6 +140,7 @@ Worker::Worker(int customerNr,
|
||||
, m_serialInterface(serialInterface)
|
||||
, m_baudrate(baudrate)
|
||||
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
|
||||
, m_versionInfo(QStringList())
|
||||
, m_osVersion(getOsVersion())
|
||||
, m_atbqtVersion(getATBQTVersion())
|
||||
, m_atbUpdateToolVersion(getATBUpdateToolVersion())
|
||||
@ -301,6 +302,9 @@ void Worker::privateUpdate() {
|
||||
setProgress(i); // and switch to branch
|
||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||
if (!isRepositoryCorrupted()) {
|
||||
if (m_versionInfo.size() == 0) {
|
||||
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
}
|
||||
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
|
||||
continueUpdate = true;
|
||||
m_clone = true;
|
||||
@ -330,6 +334,11 @@ void Worker::privateUpdate() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_versionInfo.size() == 0) {
|
||||
m_versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
}
|
||||
|
||||
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
|
||||
setProgress(_CHECKOUT_REPOSITORY_SUCCESS);
|
||||
|
||||
@ -1118,15 +1127,14 @@ PSAInstalled Worker::getPSAInstalled() {
|
||||
QString absPathName;
|
||||
QString absPathNameRepository;
|
||||
|
||||
psaInstalled.versionInfo.lastCommit = "";
|
||||
psaInstalled.versionInfo.reason = "";
|
||||
psaInstalled.versionInfo.created = "";
|
||||
psaInstalled.versionInfo.lastCommit = "N/A";
|
||||
psaInstalled.versionInfo.reason = "N/A";
|
||||
psaInstalled.versionInfo.created = "N/A";
|
||||
|
||||
QStringList versionInfo = m_gc.gitShowReason(m_branchName);
|
||||
if (versionInfo.size() == 3) {
|
||||
psaInstalled.versionInfo.lastCommit = versionInfo.at(0);
|
||||
psaInstalled.versionInfo.reason = versionInfo.at(1);
|
||||
psaInstalled.versionInfo.created = versionInfo.at(2);
|
||||
if (m_versionInfo.size() == 3) {
|
||||
psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0);
|
||||
psaInstalled.versionInfo.reason = m_versionInfo.at(1);
|
||||
psaInstalled.versionInfo.created = m_versionInfo.at(2);
|
||||
}
|
||||
|
||||
if (m_zoneNr != 0) {
|
||||
@ -1139,10 +1147,10 @@ PSAInstalled Worker::getPSAInstalled() {
|
||||
psaInstalled.tariff.size = getFileSize(absPathName);
|
||||
psaInstalled.tariff.zone = m_zoneNr;
|
||||
psaInstalled.tariff.loadTime = Utils::getTariffLoadTime(absPathName);
|
||||
psaInstalled.tariff.project = Utils::getLocation(absPathName);
|
||||
psaInstalled.tariff.version = Utils::getTariffVersion(absPathName);
|
||||
psaInstalled.tariff.info = Utils::getTariffInfo(absPathName);
|
||||
}
|
||||
psaInstalled.tariff.project = "Szeged";
|
||||
psaInstalled.tariff.info = "N/A";
|
||||
psaInstalled.tariff.version = "N/A";
|
||||
|
||||
psaInstalled.hw.linuxVersion = getOsVersion();
|
||||
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
||||
|
39
worker.h
39
worker.h
@ -132,6 +132,7 @@ class Worker : public QThread{
|
||||
QString const m_baudrate;
|
||||
IsmasClient m_ismasClient;
|
||||
GitClient m_gc;
|
||||
QStringList m_versionInfo;
|
||||
QString const m_osVersion;
|
||||
QString const m_atbqtVersion;
|
||||
QString const m_atbUpdateToolVersion;
|
||||
@ -652,8 +653,10 @@ private:
|
||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS:
|
||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE:
|
||||
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_SANITY:
|
||||
ismasClient.setProgressInPercent(_CHECK_SANITY);
|
||||
@ -665,8 +668,10 @@ private:
|
||||
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
|
||||
break;
|
||||
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
|
||||
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS);
|
||||
break;
|
||||
case UPDATE_STEP::REPOSITORY_RECOVERED_FAILURE:
|
||||
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_FAILURE);
|
||||
break;
|
||||
case UPDATE_STEP::CLONE_REPOSITORY:
|
||||
ismasClient.setProgressInPercent(_CLONE_REPOSITORY);
|
||||
@ -683,7 +688,7 @@ private:
|
||||
QString("CLONED REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
ismasUpdateNews);
|
||||
} break;
|
||||
@ -699,7 +704,7 @@ private:
|
||||
QString("CLONING REPOSITORY %1 OR CHECKING OUT BRANCH %2 FAILED")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -713,7 +718,8 @@ private:
|
||||
ismasClient.cloneAndCheckoutCustomerRepository(
|
||||
QString("CHECKED OUT REPOSITORY %1 AND CHECKED OUT BRANCH %2")
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName())));
|
||||
.arg(instance->m_gc.branchName()),
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
||||
@ -725,7 +731,8 @@ private:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_SUCCESS);
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateTriggerSet("ISMAS TRIGGER SET", ""));
|
||||
ismasClient.updateTriggerSet("ISMAS TRIGGER SET",
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"));
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||
@ -740,7 +747,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -763,7 +770,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -777,7 +784,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -911,7 +918,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -928,7 +935,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -954,7 +961,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -971,7 +978,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -991,7 +998,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1011,7 +1018,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1034,7 +1041,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1048,7 +1055,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
@ -1062,7 +1069,7 @@ private:
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user