save files with comment
This commit is contained in:
parent
7bfb7f5a3b
commit
8f822c5383
@ -1,3 +1,3 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
SUBDIRS = DownloadDCFirmware DownloadDCJsonFiles UpdatePTUDevCtrl
|
SUBDIRS = DownloadDCFirmware DownloadDCJsonFiles SyncTariffs UpdatePTUDevCtrl
|
||||||
|
@ -209,7 +209,7 @@ Update::sendNextDataBlock(QByteArray const &binary, int bNum) const {
|
|||||||
|
|
||||||
QString s = nextTimePoint();
|
QString s = nextTimePoint();
|
||||||
s += " sending block ";
|
s += " sending block ";
|
||||||
s += QString("%1/%2 ...done <PROGRESS>").arg(bNum).arg(m_totalBlocks);
|
s += QString("%1/%2 ...done <DC-PROGRESS>").arg(bNum).arg(m_totalBlocks);
|
||||||
s += QString::number(ceil(((bNum * 100.0) / (double)m_totalBlocks)));
|
s += QString::number(ceil(((bNum * 100.0) / (double)m_totalBlocks)));
|
||||||
|
|
||||||
qInfo() << s.toUtf8().constData();
|
qInfo() << s.toUtf8().constData();
|
||||||
|
@ -79,6 +79,7 @@ int main(int argc, char **argv) {
|
|||||||
bool const showExtendedVersion = parser.extendedVersion();
|
bool const showExtendedVersion = parser.extendedVersion();
|
||||||
bool const alwaysDownloadConfig = parser.alwaysDownloadConfig();
|
bool const alwaysDownloadConfig = parser.alwaysDownloadConfig();
|
||||||
bool const alwaysDownloadDC = parser.alwaysDownloadDC();
|
bool const alwaysDownloadDC = parser.alwaysDownloadDC();
|
||||||
|
Update::setPPid(parser.ppid());
|
||||||
|
|
||||||
QString const rtPath = QCoreApplication::applicationDirPath();
|
QString const rtPath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
@ -88,29 +89,32 @@ int main(int argc, char **argv) {
|
|||||||
QString const branchName = (zoneNr != 0)
|
QString const branchName = (zoneNr != 0)
|
||||||
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||||
|
|
||||||
qInfo() << "pwd ......................" << rtPath;
|
if (Update::ppid() == -1) {
|
||||||
qInfo() << "repositoryUrl ............" << repositoryUrl;
|
qInfo() << "pwd ......................" << rtPath;
|
||||||
qInfo() << "plugInDir ................" << plugInDir;
|
qInfo() << "repositoryUrl ............" << repositoryUrl;
|
||||||
qInfo() << "plugInName ..............." << plugInName;
|
qInfo() << "plugInDir ................" << plugInDir;
|
||||||
qInfo() << "workingDir ..............." << workingDir;
|
qInfo() << "plugInName ..............." << plugInName;
|
||||||
qInfo() << "psaConfigDir ............." << psaConfigDir;
|
qInfo() << "workingDir ..............." << workingDir;
|
||||||
qInfo() << "psaTariffDir ............." << psaTariffDir;
|
qInfo() << "psaConfigDir ............." << psaConfigDir;
|
||||||
qInfo() << "dryRun ..................." << dryRun;
|
qInfo() << "psaTariffDir ............." << psaTariffDir;
|
||||||
qInfo() << "noUpdatePsaHardware ......" << noUpdatePsaHardware;
|
qInfo() << "dryRun ..................." << dryRun;
|
||||||
qInfo() << "alwaysDownloadConfig ....." << alwaysDownloadConfig;
|
qInfo() << "noUpdatePsaHardware ......" << noUpdatePsaHardware;
|
||||||
qInfo() << "alwaysDownloadDC ........." << alwaysDownloadDC;
|
qInfo() << "alwaysDownloadConfig ....." << alwaysDownloadConfig;
|
||||||
qInfo() << "showYoctoVersion ........." << showYoctoVersion;
|
qInfo() << "alwaysDownloadDC ........." << alwaysDownloadDC;
|
||||||
qInfo() << "showYoctoInstallStatus ..." << showYoctoInstallStatus;
|
qInfo() << "showYoctoVersion ........." << showYoctoVersion;
|
||||||
qInfo() << "showExtendedVersion ......" << showExtendedVersion;
|
qInfo() << "showYoctoInstallStatus ..." << showYoctoInstallStatus;
|
||||||
qInfo() << "iniFileName .............." << iniFileName;
|
qInfo() << "showExtendedVersion ......" << showExtendedVersion;
|
||||||
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
qInfo() << "iniFileName .............." << iniFileName;
|
||||||
qInfo() << "machineNr ................" << machineNr;
|
qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
|
||||||
qInfo() << "customerNr ..............." << customerNr;
|
qInfo() << "machineNr ................" << machineNr;
|
||||||
qInfo() << "zoneNr ..................." << zoneNr;
|
qInfo() << "customerNr ..............." << customerNr;
|
||||||
|
qInfo() << "zoneNr ..................." << zoneNr;
|
||||||
|
qInfo() << "parent pid ..............." << Update::ppid();
|
||||||
|
|
||||||
if (showExtendedVersion) {
|
if (showExtendedVersion) {
|
||||||
printf(APP_EXTENDED_VERSION"\n");
|
printf(APP_EXTENDED_VERSION"\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
||||||
@ -121,7 +125,10 @@ int main(int argc, char **argv) {
|
|||||||
if (mountPath.has_value()) {
|
if (mountPath.has_value()) {
|
||||||
filesToUpdate = System::getJsonFilesOnUsbStick(mountPath.value());
|
filesToUpdate = System::getJsonFilesOnUsbStick(mountPath.value());
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "Using customer repository" << customerRepo;
|
|
||||||
|
if (Update::ppid() == -1) {
|
||||||
|
qCritical() << "Using customer repository" << customerRepo;
|
||||||
|
}
|
||||||
|
|
||||||
QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config"));
|
QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config"));
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
@ -146,13 +153,16 @@ int main(int argc, char **argv) {
|
|||||||
plugInName,
|
plugInName,
|
||||||
workingDir);
|
workingDir);
|
||||||
|
|
||||||
update.doUpdate(filesToUpdate, mountPath.has_value());
|
update.doUpdate();
|
||||||
update.checkJsonVersions();
|
// update.doUpdate(filesToUpdate, mountPath.has_value());
|
||||||
|
// update.checkJsonVersions();
|
||||||
//update.checkJsonVersions(filesToUpdate);
|
//update.checkJsonVersions(filesToUpdate);
|
||||||
|
|
||||||
if (mountPath.has_value()) {
|
if (mountPath.has_value()) {
|
||||||
System::umountUSBStick();
|
System::umountUSBStick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qInfo() << "<JS-UPDATE-FINISH>";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,13 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#define UPDATE_OPKG (1)
|
#define UPDATE_OPKG (1)
|
||||||
#define UPDATE_DC (0)
|
#define UPDATE_DC (0)
|
||||||
|
|
||||||
|
qint64 Update::c_ppid = -1;
|
||||||
|
|
||||||
static const QMap<QString, int> baudrateMap = {
|
static const QMap<QString, int> baudrateMap = {
|
||||||
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
||||||
{"57600" , 4}, {"115200" , 5}
|
{"57600" , 4}, {"115200" , 5}
|
||||||
@ -104,7 +107,7 @@ Update::Update(QString customerRepository,
|
|||||||
char const *serialInterface,
|
char const *serialInterface,
|
||||||
char const *baudrate)
|
char const *baudrate)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_hw(loadDCPlugin(QDir(plugInDir), pluginName))
|
// , m_hw(loadDCPlugin(QDir(plugInDir), pluginName))
|
||||||
, m_serialInterface(serialInterface)
|
, m_serialInterface(serialInterface)
|
||||||
, m_baudrate(baudrate)
|
, m_baudrate(baudrate)
|
||||||
, m_customerRepository(customerRepository)
|
, m_customerRepository(customerRepository)
|
||||||
@ -115,27 +118,65 @@ Update::Update(QString customerRepository,
|
|||||||
, m_dryRun(dryRun)
|
, m_dryRun(dryRun)
|
||||||
, m_sys_areDCdataValid(false) {
|
, m_sys_areDCdataValid(false) {
|
||||||
|
|
||||||
if (!m_hw) {
|
m_start = QDateTime::currentDateTime();
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_hw == nullptr -> ca-slave plugin loaded ???";
|
|
||||||
} else {
|
|
||||||
int tries = 20;
|
|
||||||
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
|
||||||
// must deliver 'true', only then are all data from hwapi valid
|
|
||||||
if (--tries < 0) {
|
|
||||||
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_hw->dc_autoRequest(true);
|
|
||||||
QThread::msleep(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_sys_areDCDataValid ..."
|
if (Update::ppid() == -1) {
|
||||||
<< m_sys_areDCdataValid;
|
if (!m_hw) {
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_hw == nullptr -> ca-slave plugin loaded ???";
|
||||||
|
} else {
|
||||||
|
int tries = 20;
|
||||||
|
while ((m_sys_areDCdataValid = m_hw->sys_areDCdataValid()) == false) {
|
||||||
|
// must deliver 'true', only then are all data from hwapi valid
|
||||||
|
if (--tries < 0) {
|
||||||
|
qCritical() << "ERROR!!! DC DATA NOT VALID -> CA-MASTER-PLUGIN NOT CONNECTED";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_hw->dc_autoRequest(true);
|
||||||
|
QThread::msleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_sys_areDCDataValid ..."
|
||||||
|
<< m_sys_areDCdataValid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Update::~Update() {
|
Update::~Update() {
|
||||||
unloadDCPlugin();
|
// unloadDCPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Update::doUpdate() {
|
||||||
|
|
||||||
|
int numberOfFiles = 3;
|
||||||
|
|
||||||
|
QString s = nextTimePoint();
|
||||||
|
s += " sending ";
|
||||||
|
s += QString("%1 ...done <JS-PROGRESS>").arg("DC2C_cash.json");
|
||||||
|
s += QString::number(ceil(((1 * 100.0) / (double)numberOfFiles)));
|
||||||
|
|
||||||
|
qInfo() << s.toUtf8().constData();
|
||||||
|
|
||||||
|
QThread::msleep(2000);
|
||||||
|
|
||||||
|
s = nextTimePoint();
|
||||||
|
s += " sending ";
|
||||||
|
s += QString("%1 ...done <JS-PROGRESS>").arg("DC2C_device.json");
|
||||||
|
s += QString::number(ceil(((2 * 100.0) / (double)numberOfFiles)));
|
||||||
|
|
||||||
|
qInfo() << s.toUtf8().constData();
|
||||||
|
|
||||||
|
QThread::msleep(2000);
|
||||||
|
|
||||||
|
s = nextTimePoint();
|
||||||
|
s += " sending ";
|
||||||
|
s += QString("%1 ...done <JS-PROGRESS>").arg("DC2C_print01.json");
|
||||||
|
s += QString::number(ceil(((3 * 100.0) / (double)numberOfFiles)));
|
||||||
|
|
||||||
|
qInfo() << s.toUtf8().constData();
|
||||||
|
|
||||||
|
QThread::msleep(2000);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Update::doUpdate(QStringList const &filesToWorkOn, bool usbStickDetected) {
|
bool Update::doUpdate(QStringList const &filesToWorkOn, bool usbStickDetected) {
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
@ -36,6 +37,14 @@ class Update : public QObject {
|
|||||||
|
|
||||||
static QPluginLoader pluginLoader;
|
static QPluginLoader pluginLoader;
|
||||||
|
|
||||||
|
QDateTime m_start;
|
||||||
|
QString nextTimePoint() const {
|
||||||
|
float const secs = m_start.msecsTo(QDateTime::currentDateTime()) / 1000.0;
|
||||||
|
return QStringLiteral("+%1s").arg(secs, 7, 'f', 2, QChar('0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
static qint64 c_ppid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
||||||
enum class FileTypeJson {CONFIG=1, DEVICE=2, CASH=3, SERIAL=4, TIME=5, PRINTER=6};
|
enum class FileTypeJson {CONFIG=1, DEVICE=2, CASH=3, SERIAL=4, TIME=5, PRINTER=6};
|
||||||
@ -44,6 +53,8 @@ public:
|
|||||||
static bool unloadDCPlugin();
|
static bool unloadDCPlugin();
|
||||||
static QStringList split(QString line, QChar sep = ',');
|
static QStringList split(QString line, QChar sep = ',');
|
||||||
|
|
||||||
|
static qint64 ppid() { return c_ppid; }
|
||||||
|
static void setPPid(qint64 ppid) { c_ppid = ppid; }
|
||||||
|
|
||||||
explicit Update(QString customerRepository,
|
explicit Update(QString customerRepository,
|
||||||
QString customerNrStr,
|
QString customerNrStr,
|
||||||
@ -59,6 +70,7 @@ public:
|
|||||||
virtual ~Update() override;
|
virtual ~Update() override;
|
||||||
|
|
||||||
bool doUpdate(QStringList const &jsonFilesToDownload, bool usbStickDetected = false);
|
bool doUpdate(QStringList const &jsonFilesToDownload, bool usbStickDetected = false);
|
||||||
|
bool doUpdate();
|
||||||
|
|
||||||
bool updatePrinterTemplate(int templateIdx, QString fname) const;
|
bool updatePrinterTemplate(int templateIdx, QString fname) const;
|
||||||
bool updateConfig(QString jsFileToSendToDC);
|
bool updateConfig(QString jsFileToSendToDC);
|
||||||
|
77
SyncTariffs/SyncTariffs.pro
Normal file
77
SyncTariffs/SyncTariffs.pro
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
QT += core
|
||||||
|
|
||||||
|
TARGET = ATBDownloadDCFirmware
|
||||||
|
|
||||||
|
VERSION="1.0.0"
|
||||||
|
win32 {
|
||||||
|
BUILD_DATE=$$system("date /t")
|
||||||
|
BUILD_TIME=$$system("time /t")
|
||||||
|
} else {
|
||||||
|
BUILD_DATE=$$system("date +%d-%m-%y")
|
||||||
|
BUILD_TIME=$$system("date +%H:%M:%S")
|
||||||
|
}
|
||||||
|
|
||||||
|
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
||||||
|
|
||||||
|
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDEPATH += \
|
||||||
|
plugins \
|
||||||
|
$${INCLUDEINTERFACES} \
|
||||||
|
$${_PRO_FILE_PWD_}/../UpdatePTUDevCtrl \
|
||||||
|
$${_PRO_FILE_PWD_}/../common/include
|
||||||
|
|
||||||
|
CONFIG += c++17
|
||||||
|
|
||||||
|
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
||||||
|
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
||||||
|
DEFINES+=APP_BUILD_TIME=\\\"$$BUILD_TIME\\\"
|
||||||
|
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
||||||
|
|
||||||
|
# keep comments, as /* fall through */
|
||||||
|
QMAKE_CXXFLAGS += -C
|
||||||
|
QMAKE_CXXFLAGS += -g
|
||||||
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy -O
|
||||||
|
|
||||||
|
contains( CONFIG, PTU5 ) {
|
||||||
|
CONFIG += link_pkgconfig
|
||||||
|
QMAKE_CXXFLAGS += -O2 -std=c++17 # for GCC >= 4.7
|
||||||
|
# QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
|
PTU5BASEPATH = /opt/devel/ptu5
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PTU5BASEPATH/qt/libs/devicecontroller/include
|
||||||
|
LIBS += -L$$PTU5BASEPATH/qt/libs/devicecontroller/library
|
||||||
|
|
||||||
|
ARCH = PTU5
|
||||||
|
DEFINES+=PTU5
|
||||||
|
}
|
||||||
|
contains( CONFIG, PTU5_YOCTO ) {
|
||||||
|
QMAKE_CXXFLAGS += -std=c++17 # for GCC >= 4.7
|
||||||
|
# QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
|
PTU5BASEPATH = /opt/devel/ptu5
|
||||||
|
ARCH = PTU5
|
||||||
|
DEFINES+=PTU5
|
||||||
|
}
|
||||||
|
contains( CONFIG, DesktopLinux ) {
|
||||||
|
# QMAKE_CC = ccache $$QMAKE_CC
|
||||||
|
# QMAKE_CXX = ccache $$QMAKE_CXX
|
||||||
|
QMAKE_CXXFLAGS += -std=c++17
|
||||||
|
# QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
|
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||||
|
ARCH = DesktopLinux
|
||||||
|
DEFINES+=DesktopLinux
|
||||||
|
}
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
# HEADERS += \
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# for running program on target through QtCreator
|
||||||
|
contains( CONFIG, PTU5 ) {
|
||||||
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
else: unix:!android: target.path = /opt/app/tools/atbupdate/
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
}
|
14
SyncTariffs/main.cpp
Normal file
14
SyncTariffs/main.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <QtGlobal>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QCommandLineParser>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
return 0;
|
||||||
|
}
|
@ -95,7 +95,13 @@ CommandLineParser::CommandLineParser()
|
|||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "D" << "read-dc-version",
|
QStringList() << "D" << "read-dc-version",
|
||||||
QCoreApplication::translate("main", "Show version of device controller."),
|
QCoreApplication::translate("main", "Show version of device controller."),
|
||||||
QCoreApplication::translate("main", "Show version of device controller."))) {
|
QCoreApplication::translate("main", "Show version of device controller.")))
|
||||||
|
, m_setPPid(
|
||||||
|
QCommandLineOption(
|
||||||
|
QStringList() << "P" << "set-ppid",
|
||||||
|
QCoreApplication::translate("main", "Set pid of parent process."),
|
||||||
|
QCoreApplication::translate("main", "Set pid of parent process."))) {
|
||||||
|
|
||||||
configure();
|
configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +160,9 @@ void CommandLineParser::configure() {
|
|||||||
|
|
||||||
m_readDCVersionOption.setDefaultValue("false");
|
m_readDCVersionOption.setDefaultValue("false");
|
||||||
m_parser.addOption(m_readDCVersionOption);
|
m_parser.addOption(m_readDCVersionOption);
|
||||||
|
|
||||||
|
m_setPPid.setDefaultValue("-1");
|
||||||
|
m_parser.addOption(m_setPPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandLineParser::readSettings() {
|
void CommandLineParser::readSettings() {
|
||||||
@ -286,6 +295,19 @@ QString CommandLineParser::workingDir() {
|
|||||||
return m_workingDir;
|
return m_workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 CommandLineParser::ppid() {
|
||||||
|
m_ppid = -1;
|
||||||
|
if (m_parser.isSet(m_setPPid)) {
|
||||||
|
QString p = m_parser.value(m_setPPid);
|
||||||
|
bool ok;
|
||||||
|
qint64 q = p.toLongLong(&ok);
|
||||||
|
if (ok) {
|
||||||
|
m_ppid = q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_ppid;
|
||||||
|
}
|
||||||
|
|
||||||
bool CommandLineParser::dryRun() {
|
bool CommandLineParser::dryRun() {
|
||||||
if (m_parser.isSet(m_dryRunOption)) {
|
if (m_parser.isSet(m_dryRunOption)) {
|
||||||
m_dryRun = m_parser.value(m_dryRunOption);
|
m_dryRun = m_parser.value(m_dryRunOption);
|
||||||
|
@ -23,6 +23,7 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QString m_alwaysDownloadDC;
|
QString m_alwaysDownloadDC;
|
||||||
QString m_readDCVersion{"false"};
|
QString m_readDCVersion{"false"};
|
||||||
QString m_dcDir{"etc/dc/"};
|
QString m_dcDir{"etc/dc/"};
|
||||||
|
qint64 m_ppid;
|
||||||
|
|
||||||
QCommandLineOption m_repositoryUrlOption;
|
QCommandLineOption m_repositoryUrlOption;
|
||||||
QCommandLineOption m_iniFileDirectoryOption;
|
QCommandLineOption m_iniFileDirectoryOption;
|
||||||
@ -41,6 +42,7 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QCommandLineOption m_yoctoInstallStatusOption;
|
QCommandLineOption m_yoctoInstallStatusOption;
|
||||||
QCommandLineOption m_dcDirectoryOption;
|
QCommandLineOption m_dcDirectoryOption;
|
||||||
QCommandLineOption m_readDCVersionOption;
|
QCommandLineOption m_readDCVersionOption;
|
||||||
|
QCommandLineOption m_setPPid;
|
||||||
|
|
||||||
QCommandLineParser m_parser;
|
QCommandLineParser m_parser;
|
||||||
|
|
||||||
@ -63,6 +65,7 @@ public:
|
|||||||
QString psaConfigDir();
|
QString psaConfigDir();
|
||||||
QString psaTariffDir();
|
QString psaTariffDir();
|
||||||
bool dryRun();
|
bool dryRun();
|
||||||
|
qint64 ppid();
|
||||||
bool noUpdatePsaHardware();
|
bool noUpdatePsaHardware();
|
||||||
bool yoctoVersion();
|
bool yoctoVersion();
|
||||||
bool yoctoInstallStatus();
|
bool yoctoInstallStatus();
|
||||||
|
@ -87,10 +87,12 @@ int main(int argc, char *argv[]) {
|
|||||||
if (v.isEmpty()) {
|
if (v.isEmpty()) {
|
||||||
QString sshKeyFile("/opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig");
|
QString sshKeyFile("/opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig");
|
||||||
if (QFileInfo(sshKeyFile).exists()) {
|
if (QFileInfo(sshKeyFile).exists()) {
|
||||||
gitSSHCommand = "ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig";
|
if (qgetenv("GIT_SSH_COMMAND").isNull()) {
|
||||||
if (!qputenv("GIT_SSH_COMMAND", QByteArray(gitSSHCommand.toStdString().c_str()))) {
|
gitSSHCommand = "ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig";
|
||||||
qCritical() << "ERROR: GIT_SSH_COMMAND not put into env. Exiting...";
|
if (!qputenv("GIT_SSH_COMMAND", QByteArray(gitSSHCommand.toStdString().c_str()))) {
|
||||||
return -1;
|
qCritical() << "ERROR: GIT_SSH_COMMAND not put into env. Exiting...";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "ERROR ssh-key-file" << sshKeyFile << "does not exists. Exiting...";
|
qCritical() << "ERROR ssh-key-file" << sshKeyFile << "does not exists. Exiting...";
|
||||||
@ -201,7 +203,7 @@ int main(int argc, char *argv[]) {
|
|||||||
mw.showFullScreen();
|
mw.showFullScreen();
|
||||||
|
|
||||||
// test
|
// test
|
||||||
worker.dcUpdate();
|
worker.jsUpdate();
|
||||||
// worker.summary();
|
// worker.summary();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -83,6 +83,9 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
|||||||
connect(m_worker, SIGNAL(showSummary(QString)),this,SLOT(onShowSummary(QString)));
|
connect(m_worker, SIGNAL(showSummary(QString)),this,SLOT(onShowSummary(QString)));
|
||||||
connect(m_worker, SIGNAL(disableExit()),this,SLOT(onDisableExit()));
|
connect(m_worker, SIGNAL(disableExit()),this,SLOT(onDisableExit()));
|
||||||
connect(m_worker, SIGNAL(showDcDownload(QString)),this,SLOT(onShowDcDownload(QString)));
|
connect(m_worker, SIGNAL(showDcDownload(QString)),this,SLOT(onShowDcDownload(QString)));
|
||||||
|
connect(m_worker, SIGNAL(showJsonDownload(QString)),this,SLOT(onShowJsonDownload(QString)));
|
||||||
|
connect(m_worker, SIGNAL(showTariffUpdate(QString)),this,SLOT(onShowTariffUpdate(QString)));
|
||||||
|
connect(m_worker, SIGNAL(showISMASChecks(QString)),this,SLOT(onShowISMASChecks(QString)));
|
||||||
connect(m_worker, SIGNAL(setDcDownloadProgress(int)),this,SLOT(onSetDcDownloadProgress(int)));
|
connect(m_worker, SIGNAL(setDcDownloadProgress(int)),this,SLOT(onSetDcDownloadProgress(int)));
|
||||||
connect(m_worker, SIGNAL(enableExit()),this,SLOT(onEnableExit()));
|
connect(m_worker, SIGNAL(enableExit()),this,SLOT(onEnableExit()));
|
||||||
connect(m_worker, SIGNAL(stopStartTimer()),this,SLOT(onStopStartTimer()));
|
connect(m_worker, SIGNAL(stopStartTimer()),this,SLOT(onStopStartTimer()));
|
||||||
@ -105,6 +108,7 @@ void MainWindow::onShowSummary(QString text) {
|
|||||||
ui->updateLabel->setText(s);
|
ui->updateLabel->setText(s);
|
||||||
ui->updateLabel->hide();
|
ui->updateLabel->hide();
|
||||||
ui->stepLabel->hide();
|
ui->stepLabel->hide();
|
||||||
|
ui->updateProgress->hide();
|
||||||
|
|
||||||
s += text;
|
s += text;
|
||||||
ui->updateStatus->setText(s);
|
ui->updateStatus->setText(s);
|
||||||
@ -114,10 +118,80 @@ void MainWindow::onSetDcDownloadProgress(int v) {
|
|||||||
ui->updateProgress->setValue(v);
|
ui->updateProgress->setValue(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowTariffUpdate(QString) {
|
||||||
|
ui->exit->setEnabled(false);
|
||||||
|
|
||||||
|
QString s = ui->stepLabel->text();
|
||||||
|
|
||||||
|
QString tmp("Install tariff files ");
|
||||||
|
int len = m_showLineLength - tmp.length();
|
||||||
|
while (--len > 0) {
|
||||||
|
tmp += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
s += QString("%1 <font color='Green'>[OK ]</font><br />").arg(tmp);
|
||||||
|
|
||||||
|
ui->stepLabel->setText(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowISMASChecks(QString) {
|
||||||
|
QString s = ui->stepLabel->text();
|
||||||
|
|
||||||
|
QString tmp("Check ISMAS connectivity ");
|
||||||
|
int len = m_showLineLength - tmp.length();
|
||||||
|
while (--len > 0) {
|
||||||
|
tmp += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
s += QString("%1 <font color='Green'>[OK ]</font><br />").arg(tmp);
|
||||||
|
|
||||||
|
tmp = "Check update activation ";
|
||||||
|
len = m_showLineLength - tmp.length();
|
||||||
|
|
||||||
|
while (--len > 0) {
|
||||||
|
tmp += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
s += QString("%1 <font color='Green'>[OK ]</font><br />").arg(tmp);
|
||||||
|
ui->stepLabel->setText(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowJsonDownload(QString) {
|
||||||
|
ui->exit->setEnabled(false);
|
||||||
|
|
||||||
|
QString s = ui->stepLabel->text();
|
||||||
|
|
||||||
|
QString tmp("Send json files to dc-hardware ");
|
||||||
|
int len = m_showLineLength - tmp.length();
|
||||||
|
while (--len > 0) {
|
||||||
|
tmp += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
s += QString("%1 <font color='Green'>[OK ]</font><br />").arg(tmp);
|
||||||
|
|
||||||
|
ui->stepLabel->setText(s);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onShowDcDownload(QString version) {
|
void MainWindow::onShowDcDownload(QString version) {
|
||||||
m_targetDcVersion = version;
|
m_targetDcVersion = version;
|
||||||
ui->exit->setEnabled(false);
|
ui->exit->setEnabled(false);
|
||||||
ui->stepLabel->setText(QString("Device controller update. Target version: %1").arg(version).leftJustified(m_width-3));
|
|
||||||
|
// test
|
||||||
|
onShowISMASChecks("");
|
||||||
|
onShowTariffUpdate("");
|
||||||
|
onShowJsonDownload("");
|
||||||
|
|
||||||
|
QString s = ui->stepLabel->text();
|
||||||
|
|
||||||
|
QString tmp("Send dc-firmware to dc-hardware ");
|
||||||
|
int len = m_showLineLength - tmp.length();
|
||||||
|
while (--len > 0) {
|
||||||
|
tmp += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
s += QString("%1 <font color='#33FF50'>[OK ]</font> (%2)").arg(tmp).arg(version);
|
||||||
|
|
||||||
|
ui->stepLabel->setText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
@ -52,6 +52,9 @@ public slots:
|
|||||||
void onEnableExit();
|
void onEnableExit();
|
||||||
void onDisableExit();
|
void onDisableExit();
|
||||||
void onShowDcDownload(QString);
|
void onShowDcDownload(QString);
|
||||||
|
void onShowJsonDownload(QString);
|
||||||
|
void onShowTariffUpdate(QString);
|
||||||
|
void onShowISMASChecks(QString);
|
||||||
void onSetDcDownloadProgress(int);
|
void onSetDcDownloadProgress(int);
|
||||||
void onShowSummary(QString);
|
void onShowSummary(QString);
|
||||||
#if EMERGENCY_LEAVE_BL==1
|
#if EMERGENCY_LEAVE_BL==1
|
||||||
@ -68,6 +71,9 @@ private slots:
|
|||||||
void onQuit();
|
void onQuit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
int const m_showLineLength = 37;
|
||||||
|
|
||||||
void scrollDownTextEdit();
|
void scrollDownTextEdit();
|
||||||
void onShowMessage(QString, QString);
|
void onShowMessage(QString, QString);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ void Command::readyReadStandardOutput() {
|
|||||||
QProcess *p = (QProcess *)sender();
|
QProcess *p = (QProcess *)sender();
|
||||||
if (p) {
|
if (p) {
|
||||||
QString s = p->readAllStandardOutput();
|
QString s = p->readAllStandardOutput();
|
||||||
|
|
||||||
if (m_worker) {
|
if (m_worker) {
|
||||||
int i = -1;
|
int i = -1;
|
||||||
if ((i = s.indexOf("<DC-VERSION>")) != -1) {
|
if ((i = s.indexOf("<DC-VERSION>")) != -1) {
|
||||||
@ -49,9 +50,9 @@ void Command::readyReadStandardOutput() {
|
|||||||
}
|
}
|
||||||
emit m_worker->showDcDownload(s);
|
emit m_worker->showDcDownload(s);
|
||||||
} else
|
} else
|
||||||
if ((i = s.indexOf("<PROGRESS>")) != -1) {
|
if ((i = s.indexOf("<DC-PROGRESS>")) != -1) {
|
||||||
bool ok;
|
bool ok;
|
||||||
int v = s.mid(i+10).trimmed().toInt(&ok);
|
int v = s.mid(i+13).trimmed().toInt(&ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
emit m_worker->setDcDownloadProgress(v);
|
emit m_worker->setDcDownloadProgress(v);
|
||||||
emit m_worker->insertText(s.mid(0,i) + "\n");
|
emit m_worker->insertText(s.mid(0,i) + "\n");
|
||||||
@ -67,6 +68,14 @@ void Command::readyReadStandardOutput() {
|
|||||||
if ((i = s.indexOf("<DC-UPDATE-FAILURE>")) != -1) {
|
if ((i = s.indexOf("<DC-UPDATE-FAILURE>")) != -1) {
|
||||||
m_worker->summary();
|
m_worker->summary();
|
||||||
//qApp->exit(-1);
|
//qApp->exit(-1);
|
||||||
|
} else
|
||||||
|
if ((i = s.indexOf("<JS-PROGRESS>")) != -1) {
|
||||||
|
bool ok;
|
||||||
|
int v = s.mid(i+13).trimmed().toInt(&ok);
|
||||||
|
if (ok) {
|
||||||
|
emit m_worker->setDcDownloadProgress(v);
|
||||||
|
emit m_worker->insertText(s.mid(0,i) + "\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit m_worker->insertText(s);
|
emit m_worker->insertText(s);
|
||||||
}
|
}
|
||||||
@ -93,6 +102,11 @@ void Command::finished(int /*exitCode*/, QProcess::ExitStatus /*exitStatus*/) {
|
|||||||
}
|
}
|
||||||
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardOutput()));
|
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardOutput()));
|
||||||
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardError()));
|
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardError()));
|
||||||
|
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus)));
|
||||||
|
|
||||||
|
if (m_command.contains("ATBDownloadDCJsonFiles")) {
|
||||||
|
m_worker->dcUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Command::start(QString workingDirectory, QStringList args) {
|
bool Command::start(QString workingDirectory, QStringList args) {
|
||||||
@ -104,12 +118,16 @@ bool Command::start(QString workingDirectory, QStringList args) {
|
|||||||
if (m_p != nullptr) {
|
if (m_p != nullptr) {
|
||||||
delete m_p;
|
delete m_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCritical() << "COMMAND" << m_command << workingDirectory << args;
|
||||||
|
|
||||||
m_p = new QProcess(this);
|
m_p = new QProcess(this);
|
||||||
m_p->setWorkingDirectory(workingDirectory);
|
m_p->setWorkingDirectory(workingDirectory);
|
||||||
m_p->setProcessChannelMode(QProcess::MergedChannels);
|
m_p->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
|
||||||
connect(m_p, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput()));
|
connect(m_p, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput()));
|
||||||
connect(m_p, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError()));
|
connect(m_p, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError()));
|
||||||
|
connect(m_p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus)));
|
||||||
|
|
||||||
if (!args.isEmpty()) {
|
if (!args.isEmpty()) {
|
||||||
m_p->start(m_command, args);
|
m_p->start(m_command, args);
|
||||||
|
@ -18,9 +18,99 @@
|
|||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QDirIterator>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
QVector<QPair<QString, QString>> Utils::installedJsonFiles(QDir const &customerDir) {
|
||||||
|
QVector<QPair<QString, QString>> vec;
|
||||||
|
QStringList fileList;
|
||||||
|
|
||||||
|
QDirIterator it(QDir::cleanPath(customerDir.absolutePath() + QDir::separator() + "etc/psa_config"));
|
||||||
|
while (it.hasNext()) {
|
||||||
|
QFileInfo const fi(it.next());
|
||||||
|
if (fi.fileName().startsWith("DC2C") && fi.fileName().endsWith(".json")) {
|
||||||
|
fileList << fi.absoluteFilePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileList.sort();
|
||||||
|
|
||||||
|
QString const ¤t = QDir::current().absolutePath();
|
||||||
|
|
||||||
|
if (!QDir::setCurrent(customerDir.absolutePath())) {
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << ": ERROR: can not set"
|
||||||
|
<< "working directory to" << customerDir.absolutePath();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (int i = 0; i < fileList.size(); ++i) {
|
||||||
|
|
||||||
|
QProcess p;
|
||||||
|
QStringList params;
|
||||||
|
params << "-c" << "git log -n 1 --pretty=format:%H -- " << fileList[i];
|
||||||
|
|
||||||
|
p.start("bash", params);
|
||||||
|
p.waitForFinished();
|
||||||
|
QString r = p.readAllStandardOutput().left(8);
|
||||||
|
|
||||||
|
vec.push_back(QPair<QString, QString>(QFileInfo(fileList[i]).fileName(), r));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!QDir::setCurrent(current)) {
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << ": ERROR: can not set"
|
||||||
|
<< "working directory to" << current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<QPair<QString, QString>> Utils::installedTariffFiles(QDir const &customerDir) {
|
||||||
|
QVector<QPair<QString, QString>> vec;
|
||||||
|
QStringList fileList;
|
||||||
|
|
||||||
|
QDirIterator it(QDir::cleanPath(customerDir.absolutePath() + QDir::separator() + "etc/psa_tariff"));
|
||||||
|
while (it.hasNext()) {
|
||||||
|
QFileInfo const fi(it.next());
|
||||||
|
if (fi.fileName().startsWith("tariff") && fi.fileName().endsWith(".json")) {
|
||||||
|
fileList << fi.absoluteFilePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileList.sort();
|
||||||
|
|
||||||
|
QString const ¤t = QDir::current().absolutePath();
|
||||||
|
|
||||||
|
if (!QDir::setCurrent(customerDir.absolutePath())) {
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << ": ERROR: can not set"
|
||||||
|
<< "working directory to" << customerDir.absolutePath();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (int i = 0; i < fileList.size(); ++i) {
|
||||||
|
|
||||||
|
QProcess p;
|
||||||
|
QStringList params;
|
||||||
|
params << "-c" << "git log -n 1 --pretty=format:%H -- " << fileList[i];
|
||||||
|
|
||||||
|
qCritical() << current << "git log -n 1 --pretty=format:%H -- " << fileList[i];
|
||||||
|
|
||||||
|
p.start("bash", params);
|
||||||
|
p.waitForFinished();
|
||||||
|
QString r = p.readAllStandardOutput().left(8);
|
||||||
|
|
||||||
|
vec.push_back(QPair<QString, QString>(QFileInfo(fileList[i]).fileName(), r));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!QDir::setCurrent(current)) {
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << ": ERROR: can not set"
|
||||||
|
<< "working directory to" << current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
QVector<QPair<QString, QString>> Utils::installedPackages() {
|
QVector<QPair<QString, QString>> Utils::installedPackages() {
|
||||||
QVector<QPair<QString, QString>> vec;
|
QVector<QPair<QString, QString>> vec;
|
||||||
if (QFile::exists("/usr/bin/ptuPackageVersions")) {
|
if (QFile::exists("/usr/bin/ptuPackageVersions")) {
|
||||||
@ -165,7 +255,7 @@ QString Utils::getTariffInfo(QString fileName) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::zoneName(quint8 i) {
|
QString Utils::zoneName(quint8 /* i */) {
|
||||||
//static constexpr char const *zName[] = {
|
//static constexpr char const *zName[] = {
|
||||||
// "",
|
// "",
|
||||||
// "purple",
|
// "purple",
|
||||||
|
@ -36,6 +36,8 @@ namespace Utils {
|
|||||||
bool isATBQTRunning();
|
bool isATBQTRunning();
|
||||||
|
|
||||||
QVector<QPair<QString, QString>> installedPackages();
|
QVector<QPair<QString, QString>> installedPackages();
|
||||||
|
QVector<QPair<QString, QString>> installedJsonFiles(QDir const &customerDir);
|
||||||
|
QVector<QPair<QString, QString>> installedTariffFiles(QDir const &customerDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // UTILS_H_INCLUDED
|
#endif // UTILS_H_INCLUDED
|
||||||
|
@ -178,12 +178,15 @@ Worker::Worker(int customerNr,
|
|||||||
, m_updateProcessRunning(true)
|
, m_updateProcessRunning(true)
|
||||||
, m_mainWindow(nullptr) /* contains plugin */
|
, m_mainWindow(nullptr) /* contains plugin */
|
||||||
, m_dcDownloadFirmware(new Command("/opt/app/tools/atbupdate/ATBDownloadDCFirmware --read-dc-version true"))
|
, m_dcDownloadFirmware(new Command("/opt/app/tools/atbupdate/ATBDownloadDCFirmware --read-dc-version true"))
|
||||||
|
, m_dcDownloadJsonFiles(new Command(
|
||||||
|
QString("/opt/app/tools/atbupdate/ATBDownloadDCJsonFiles --set-ppid %1").arg(QCoreApplication::applicationPid())))
|
||||||
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
||||||
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
||||||
|
|
||||||
|
|
||||||
m_start = QDateTime::currentDateTime();
|
m_start = QDateTime::currentDateTime();
|
||||||
m_dcDownloadFirmware->setWorker(this);
|
m_dcDownloadFirmware->setWorker(this);
|
||||||
|
m_dcDownloadJsonFiles->setWorker(this);
|
||||||
|
|
||||||
// TODO: turn object into singleton
|
// TODO: turn object into singleton
|
||||||
instance = this;
|
instance = this;
|
||||||
@ -1511,6 +1514,10 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
return psaInstalled;
|
return psaInstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Worker::jsUpdate() {
|
||||||
|
return m_dcDownloadJsonFiles->start("/opt/app/tools/atbupdate");
|
||||||
|
}
|
||||||
|
|
||||||
bool Worker::dcUpdate() {
|
bool Worker::dcUpdate() {
|
||||||
return m_dcDownloadFirmware->start("/opt/app/tools/atbupdate");
|
return m_dcDownloadFirmware->start("/opt/app/tools/atbupdate");
|
||||||
}
|
}
|
||||||
@ -1520,6 +1527,9 @@ void Worker::summary() {
|
|||||||
QString summary, first, second, line, tmp;
|
QString summary, first, second, line, tmp;
|
||||||
QVector<QPair<QString, QString>> vec = Utils::installedPackages();
|
QVector<QPair<QString, QString>> vec = Utils::installedPackages();
|
||||||
|
|
||||||
|
vec.append(Utils::installedTariffFiles(m_customerRepository));
|
||||||
|
vec.append(Utils::installedJsonFiles(m_customerRepository));
|
||||||
|
|
||||||
int max_first = 0, max_second = 0;
|
int max_first = 0, max_second = 0;
|
||||||
for (int i = 0; i < vec.size(); ++i) {
|
for (int i = 0; i < vec.size(); ++i) {
|
||||||
max_first = std::max(max_first, vec[i].first.length());
|
max_first = std::max(max_first, vec[i].first.length());
|
||||||
@ -1584,4 +1594,5 @@ void Worker::summary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit showSummary(summary);
|
emit showSummary(summary);
|
||||||
|
emit enableExit();
|
||||||
}
|
}
|
||||||
|
@ -191,6 +191,7 @@ class Worker : public QThread{
|
|||||||
|
|
||||||
MainWindow *m_mainWindow;
|
MainWindow *m_mainWindow;
|
||||||
Command *m_dcDownloadFirmware;
|
Command *m_dcDownloadFirmware;
|
||||||
|
Command *m_dcDownloadJsonFiles;
|
||||||
bool m_withoutIsmasDirectPort;
|
bool m_withoutIsmasDirectPort;
|
||||||
QString m_apismVersion;
|
QString m_apismVersion;
|
||||||
|
|
||||||
@ -460,6 +461,7 @@ public:
|
|||||||
Update *update() { return m_update; }
|
Update *update() { return m_update; }
|
||||||
Update const *update() const { return m_update; }
|
Update const *update() const { return m_update; }
|
||||||
|
|
||||||
|
bool jsUpdate();
|
||||||
bool dcUpdate();
|
bool dcUpdate();
|
||||||
void summary();
|
void summary();
|
||||||
QDateTime start() { return m_start; }
|
QDateTime start() { return m_start; }
|
||||||
@ -478,6 +480,9 @@ signals:
|
|||||||
void enableExit();
|
void enableExit();
|
||||||
void disableExit();
|
void disableExit();
|
||||||
void showDcDownload(QString);
|
void showDcDownload(QString);
|
||||||
|
void showJsonDownload(QString);
|
||||||
|
void showTariffUpdate(QString);
|
||||||
|
void showISMASChecks(QString);
|
||||||
void showSummary(QString);
|
void showSummary(QString);
|
||||||
void setDcDownloadProgress(int);
|
void setDcDownloadProgress(int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user