save files with comment

This commit is contained in:
2025-01-09 15:22:10 +01:00
parent 7bfb7f5a3b
commit 8f822c5383
17 changed files with 441 additions and 54 deletions

View File

@@ -21,10 +21,13 @@
#include <QDateTime>
#include <QPluginLoader>
#include <QMap>
#include <cmath>
#define UPDATE_OPKG (1)
#define UPDATE_DC (0)
qint64 Update::c_ppid = -1;
static const QMap<QString, int> baudrateMap = {
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
{"57600" , 4}, {"115200" , 5}
@@ -104,7 +107,7 @@ Update::Update(QString customerRepository,
char const *serialInterface,
char const *baudrate)
: QObject(parent)
, m_hw(loadDCPlugin(QDir(plugInDir), pluginName))
// , m_hw(loadDCPlugin(QDir(plugInDir), pluginName))
, m_serialInterface(serialInterface)
, m_baudrate(baudrate)
, m_customerRepository(customerRepository)
@@ -115,27 +118,65 @@ Update::Update(QString customerRepository,
, m_dryRun(dryRun)
, m_sys_areDCdataValid(false) {
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);
}
m_start = QDateTime::currentDateTime();
qCritical() << "(" << __func__ << ":" << __LINE__ << ") m_sys_areDCDataValid ..."
<< m_sys_areDCdataValid;
if (Update::ppid() == -1) {
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() {
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) {