Compare commits
No commits in common. "2b934f6baf0e6c957fa9f57a57948a9d3815d2d4" and "60084450e6b971c757c59872578bec018372c2e1" have entirely different histories.
2b934f6baf
...
60084450e6
@ -14,7 +14,6 @@ CONFIG += c++17 console
|
||||
|
||||
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
QMAKE_CXXFLAGS += -g
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
|
||||
# custom target for 'git subtree'
|
||||
|
@ -36,8 +36,6 @@ ApismClient::ApismClient(QObject *eventReceiver, ATBHMIconfig *config, Persisten
|
||||
this, &ApismClient::onRequestResponseClientResponseTimeout);
|
||||
connect(apismTcpSendClient, &ApismTcpClient::responseTimeout,
|
||||
this, &ApismClient::onSendClientResponseTimeout);
|
||||
connect(this, SIGNAL(sendCmdSendVersionToIsmas(QString)),
|
||||
this, SLOT(onSendCmdSendVersionToIsmas(QString)));
|
||||
|
||||
// not needed as APISM closes the socket after we send data, so readyRead()
|
||||
// might not even fire
|
||||
@ -397,28 +395,7 @@ void ApismClient::requestAvailableIsmasUpdates() {
|
||||
this->apismTcpRequestResponseClient->sendData(data);
|
||||
}
|
||||
|
||||
void ApismClient::onSendCmdEventToIsmas(QString msg) {
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qCritical() << "INVALID JSON MSG: PARSING FAILED:"
|
||||
<< parseError.error << parseError.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!document.isObject()) {
|
||||
qCritical() << "FILE IS NOT A JSON OBJECT!";
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data = "#M=APISM#C=CMD_EVENT#J=";
|
||||
data += document.toJson(QJsonDocument::Compact);
|
||||
|
||||
this->currentRequest = ISMAS::REQUEST::NO_REQUEST;
|
||||
this->apismTcpSendClient->sendData(data);
|
||||
}
|
||||
|
||||
void ApismClient::onSendCmdSendVersionToIsmas(QString msg) {
|
||||
void ApismClient::sendCmdSendVersionToIsmas(QString const &msg) {
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
@ -435,13 +412,34 @@ void ApismClient::onSendCmdSendVersionToIsmas(QString msg) {
|
||||
QByteArray data = "#M=APISM#C=CMD_SENDVERSION#J=";
|
||||
data += document.toJson(QJsonDocument::Compact);
|
||||
|
||||
// printf("data=%s\n", QString(data).toStdString().c_str());
|
||||
|
||||
this->currentRequest = ISMAS::REQUEST::NO_REQUEST;
|
||||
this->apismTcpSendClient->sendData(data);
|
||||
|
||||
}
|
||||
|
||||
void ApismClient::emulateUpdatesAvailable(QString const &msg) {
|
||||
qDebug() << "EMULATE UPDATES AVAILABLE. MSG=" << msg;
|
||||
onSendCmdEventToIsmas(msg);
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument document(QJsonDocument::fromJson(msg.toUtf8(), &parseError));
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qCritical() << "INVALID JSON MSG: PARSING FAILED:"
|
||||
<< parseError.error << parseError.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!document.isObject()) {
|
||||
qCritical() << "FILE IS NOT A JSON OBJECT!";
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data = "#M=APISM#C=CMD_EVENT#J=";
|
||||
data += document.toJson(QJsonDocument::Compact);
|
||||
|
||||
qDebug() << "EMULATE UPDATES AVAILABLE" << QString(data).toStdString().c_str();
|
||||
|
||||
this->currentRequest = ISMAS::REQUEST::NO_REQUEST;
|
||||
this->apismTcpSendClient->sendData(data);
|
||||
}
|
||||
|
||||
void ApismClient::sendState(const QString & state, const QString & msg)
|
||||
@ -609,9 +607,6 @@ void ApismClient::sendMininformPingRequest()
|
||||
|
||||
|
||||
void ApismClient::onReceivedResponse(QByteArray response) {
|
||||
|
||||
qCritical() << "RECEIVED ------> " << response;
|
||||
|
||||
if (this->currentRequest == ISMAS::REQUEST::NO_REQUEST &&
|
||||
response == "RECORD SAVED") { // sent by APISM to indicate that record
|
||||
return; // has been saved in DB
|
||||
|
@ -50,9 +50,6 @@ public:
|
||||
quint32 getLastError();
|
||||
const QString & getLastErrorDescription();
|
||||
|
||||
ApismTcpClient* getApismTcpSendClient() { return apismTcpSendClient; }
|
||||
|
||||
|
||||
public slots:
|
||||
void sendSelfTest();
|
||||
void sendTransaction(const VendingData* vendingData);
|
||||
@ -61,8 +58,7 @@ public slots:
|
||||
|
||||
void sendState(const QString & state, const QString & msg);
|
||||
void emulateUpdatesAvailable(QString const &msg);
|
||||
void onSendCmdSendVersionToIsmas(QString);
|
||||
void onSendCmdEventToIsmas(QString);
|
||||
void sendCmdSendVersionToIsmas(QString const &msg);
|
||||
void requestAvailableIsmasUpdates();
|
||||
|
||||
|
||||
@ -84,8 +80,7 @@ signals:
|
||||
void sendReqSelfResponse(nsApismInterface::RESULT_STATE result, QJsonObject response);
|
||||
|
||||
void ismasResponseAvailable(QJsonObject ismasResponse);
|
||||
void sendCmdSendVersionToIsmas(QString);
|
||||
void sendCmdEventToIsmas(QString);
|
||||
|
||||
|
||||
private slots:
|
||||
// void onSocketError(QAbstractSocket::SocketError socketError);
|
||||
|
@ -29,36 +29,22 @@ GitClient::GitClient(QString const &customerNrStr,
|
||||
|
||||
void GitClient::onIsmasUpdatesAvailable() {
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
|
||||
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST,
|
||||
QString("FETCHING OF ") + m_repositoryPath +
|
||||
QString(" INTO ") + m_customerRepository);
|
||||
|
||||
qInfo() << "FETCHING OF" << m_repositoryPath
|
||||
<< "INTO" << m_customerRepository;
|
||||
std::optional<QString> changes = gitFetch();
|
||||
|
||||
if (changes) {
|
||||
std::optional<QStringList> changedFileNames = gitDiff(changes.value());
|
||||
if (changedFileNames) {
|
||||
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS,
|
||||
QString("FETCHED NEW FILES ") +
|
||||
changedFileNames.value().join(",") +
|
||||
QString(" INTO ") + m_customerRepository);
|
||||
for (int i=0;i<changedFileNames.value().size();++i) {
|
||||
QString fname = changedFileNames.value().at(i);
|
||||
QString lastCommit = gitLastCommit(fname);
|
||||
qDebug() << "CCCC" << changedFileNames.value().at(i) << lastCommit;
|
||||
}
|
||||
if (gitPull()) {
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS,
|
||||
QString("PULL NEW FILES ") +
|
||||
changedFileNames.value().join(",") +
|
||||
QString(" INTO ") + m_customerRepository);
|
||||
|
||||
emit m_worker->handleChangedFiles(changedFileNames.value());
|
||||
|
||||
} else {
|
||||
qCritical() << UpdateStatus(UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE,
|
||||
QString("PULLING NEW FILES ") +
|
||||
changedFileNames.value().join(",") +
|
||||
QString(" INTO ") + m_customerRepository + " FAILED");
|
||||
|
||||
qCritical() << "PULL FAILED FOR" << m_repositoryPath
|
||||
<< "IN " << m_customerRepository;
|
||||
emit m_worker->terminateUpdateProcess();
|
||||
}
|
||||
} else {
|
||||
@ -67,10 +53,8 @@ void GitClient::onIsmasUpdatesAvailable() {
|
||||
emit m_worker->finishUpdateProcess(false);
|
||||
}
|
||||
} else {
|
||||
qCritical() << UpdateStatus(UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE,
|
||||
QString("NO CHANGES IN ") + m_repositoryPath +
|
||||
QString(" (%1)").arg(m_customerRepository));
|
||||
|
||||
qCritical() << "NO CHANGES IN" << m_repositoryPath
|
||||
<< "(" << m_customerRepository << ")";
|
||||
emit m_worker->finishUpdateProcess(false);
|
||||
}
|
||||
} else {
|
||||
@ -94,7 +78,7 @@ bool GitClient::gitCloneCustomerRepository() {
|
||||
<< "CLONE" << m_repositoryPath << "...";
|
||||
|
||||
if (c.execute(m_workingDirectory)) { // execute the command in wd
|
||||
QString const result = c.getCommandResult();
|
||||
QString result = c.getCommandResult();
|
||||
if (!result.isEmpty()) {
|
||||
// Cloning into 'customer_281'...\n
|
||||
static QRegularExpression re("(^\\s*Cloning\\s+into\\s+[']\\s*)(.*)(\\s*['].*$)");
|
||||
@ -107,9 +91,8 @@ bool GitClient::gitCloneCustomerRepository() {
|
||||
}
|
||||
}
|
||||
}
|
||||
qCritical() << "ERROR CLONE RESULT HAS WRONG FORMAT";
|
||||
}
|
||||
qCritical() << "ERROR CLONE RESULT HAS WRONG FORMAT. CLONE_RESULT="
|
||||
<< result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -143,14 +126,8 @@ bool GitClient::gitCloneAndCheckoutBranch() {
|
||||
qInfo() << "CLONE" << m_repositoryPath << "AND CHECKOUT" << m_branchName;
|
||||
if (gitCloneCustomerRepository()) {
|
||||
//if (copyGitConfigFromMaster()) {
|
||||
if (gitCheckoutBranch()) {
|
||||
return true;
|
||||
} else {
|
||||
m_worker->terminateUpdateProcess();
|
||||
}
|
||||
return gitCheckoutBranch();
|
||||
//}
|
||||
} else {
|
||||
m_worker->terminateUpdateProcess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -204,9 +181,6 @@ std::optional<QString> GitClient::gitFetch() {
|
||||
Command c("git fetch");
|
||||
if (c.execute(m_customerRepository)) {
|
||||
QString const s = c.getCommandResult().trimmed();
|
||||
|
||||
qCritical() << "GIT RESULT" << s;
|
||||
|
||||
if (!s.isEmpty()) {
|
||||
QStringList lines = Update::split(s, '\n');
|
||||
if (!lines.empty()) {
|
||||
@ -283,17 +257,19 @@ QString GitClient::gitLastCommit(QString fileName) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// fileName has to an absolute path
|
||||
// get the blob of the file(name) passed as $1
|
||||
// note: this can be used for any file in the filesystem
|
||||
QString GitClient::gitBlob(QString fileName) {
|
||||
QFileInfo fi(fileName);
|
||||
if (fi.exists()) {
|
||||
if (QDir(m_customerRepository).exists()) {
|
||||
QString const filePath
|
||||
= QDir::cleanPath(m_customerRepository + QDir::separator() + fileName);
|
||||
QString const gitCommand = QString("git hash-object %1").arg(fileName);
|
||||
Command c(gitCommand);
|
||||
if (c.execute(m_workingDirectory)) {
|
||||
return c.getCommandResult().trimmed();
|
||||
if (c.execute(m_customerRepository)) {
|
||||
return c.getCommandResult();
|
||||
}
|
||||
}
|
||||
return "N/A";
|
||||
return "";
|
||||
}
|
||||
|
||||
QString GitClient::gitCommitForBlob(QString blob) {
|
||||
|
@ -53,13 +53,32 @@ QString IsmasClient::updateNewsToIsmas(char const *event,
|
||||
return buf;
|
||||
}
|
||||
|
||||
QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
||||
//static int const constexpr SIZE = 4096*8;
|
||||
static char buf[4096*2];
|
||||
QString IsmasClient::updateOfPSASendVersion(QString const &tariffVersion,
|
||||
QString const &tariffProject,
|
||||
int tariffZone,
|
||||
QString const &tariffInfo,
|
||||
QString const &tariffLoadTime,
|
||||
QString const &linuxVersion,
|
||||
QString const &cpuSerial,
|
||||
QString const &deviceControllerVersion,
|
||||
QString const &deviceControllerGitBlob,
|
||||
QString const &deviceControllerGitLastCommit,
|
||||
QString const &raucVersion,
|
||||
QString const &opkgVersion,
|
||||
QString const &atbQTVersion,
|
||||
QString const &atbQTGitDescribe,
|
||||
QString const &deviceControllerPluginVersion,
|
||||
QString const &ingenicoISelfCCPluginVersion,
|
||||
QString const &mobilisisCalculatePricePluginVersion,
|
||||
QString const &mobilisisCalculatePriceConfigUiVersion,
|
||||
QString const &prmCalculatePricePluginVersion,
|
||||
QString const &prmCalculatePriceConfigUiPluginVersion,
|
||||
QString const &tcpZVTPluginVersion) {
|
||||
char buf[4096];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
QString const ts = QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
|
||||
QString sendVersionHash = "N/A";
|
||||
QString sendVersionHash;
|
||||
|
||||
// local data="#M=APISM#C=CMD_SENDVERSION#J=
|
||||
snprintf(buf, sizeof(buf)-1,
|
||||
@ -73,152 +92,8 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
||||
"\"PROJECT\" : \"%s\","
|
||||
"\"ZONE\" : %d,"
|
||||
"\"INFO\" : \"%s\","
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d,"
|
||||
"\"LOADED\" : \"%s\""
|
||||
"},"
|
||||
"\"JSON\" : {"
|
||||
"\"DC2C_CASH\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_CONF\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_DEVICE\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_01\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_02\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_03\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_04\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_05\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_06\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_07\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_08\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_09\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_10\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_11\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_12\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_13\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_14\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_15\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_16\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_17\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_18\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_19\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_20\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_21\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_22\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_23\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_24\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_25\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_26\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_27\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_28\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_29\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_30\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_31\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"},"
|
||||
"\"DC2C_PRINT_32\" : {"
|
||||
"\"BLOB\" : \"%s\","
|
||||
"\"SIZE\" : %d"
|
||||
"}"
|
||||
"},"
|
||||
"\"HARDWARE\" : {"
|
||||
"\"DEVICES\" : [\"PTU5\", \"DC\", \"PRINTER\", \"BNA\"]"
|
||||
"},"
|
||||
@ -230,9 +105,7 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
||||
"\"CPU_SERIAL\" : \"%s\""
|
||||
"},"
|
||||
"\"DC\" : {"
|
||||
"\"HW-VERSION\" : \"%s\","
|
||||
"\"SW-VERSION\" : \"%s\","
|
||||
"\"SIZE\" : %d,"
|
||||
"\"VERSION\" : \"%s\","
|
||||
"\"GITBLOB\" : \"%s\","
|
||||
"\"GITLASTCOMMIT\" : \"%s\""
|
||||
"},"
|
||||
@ -245,7 +118,8 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
||||
"\"RAUC\" : \"%s\","
|
||||
"\"OPKG\" : \"%s\","
|
||||
"\"ATBQT\" : {"
|
||||
"\"VERSION\" : \"%s\""
|
||||
"\"VERSION\" : \"%s\","
|
||||
"\"GIT_DESCRIBE\" : \"%s\""
|
||||
"}"
|
||||
"},"
|
||||
"\"PLUGINS\" : {"
|
||||
@ -275,108 +149,32 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
|
||||
ts.toStdString().c_str(),
|
||||
sendVersionHash.toStdString().c_str(),
|
||||
|
||||
psa.tariff.version.toStdString().c_str(),
|
||||
psa.tariff.project.toStdString().c_str(),
|
||||
psa.tariff.zone,
|
||||
psa.tariff.info.toStdString().c_str(),
|
||||
psa.tariff.blob.toStdString().c_str(),
|
||||
psa.tariff.size,
|
||||
psa.tariff.loadTime.toStdString().c_str(),
|
||||
tariffVersion.toStdString().c_str(),
|
||||
tariffProject.toStdString().c_str(),
|
||||
tariffZone,
|
||||
tariffInfo.toStdString().c_str(),
|
||||
tariffLoadTime.toStdString().c_str(),
|
||||
|
||||
psa.cash.blob.toStdString().c_str(),
|
||||
psa.cash.size,
|
||||
psa.conf.blob.toStdString().c_str(),
|
||||
psa.conf.size,
|
||||
psa.device.blob.toStdString().c_str(),
|
||||
psa.device.size,
|
||||
linuxVersion.toStdString().c_str(),
|
||||
|
||||
psa.print[0].blob.toStdString().c_str(),
|
||||
psa.print[0].size,
|
||||
psa.print[1].blob.toStdString().c_str(),
|
||||
psa.print[1].size,
|
||||
psa.print[2].blob.toStdString().c_str(),
|
||||
psa.print[2].size,
|
||||
psa.print[3].blob.toStdString().c_str(),
|
||||
psa.print[3].size,
|
||||
psa.print[4].blob.toStdString().c_str(),
|
||||
psa.print[4].size,
|
||||
psa.print[5].blob.toStdString().c_str(),
|
||||
psa.print[5].size,
|
||||
psa.print[6].blob.toStdString().c_str(),
|
||||
psa.print[6].size,
|
||||
psa.print[7].blob.toStdString().c_str(),
|
||||
psa.print[7].size,
|
||||
psa.print[8].blob.toStdString().c_str(),
|
||||
psa.print[8].size,
|
||||
psa.print[9].blob.toStdString().c_str(),
|
||||
psa.print[9].size,
|
||||
psa.print[10].blob.toStdString().c_str(),
|
||||
psa.print[10].size,
|
||||
psa.print[11].blob.toStdString().c_str(),
|
||||
psa.print[11].size,
|
||||
psa.print[12].blob.toStdString().c_str(),
|
||||
psa.print[12].size,
|
||||
psa.print[13].blob.toStdString().c_str(),
|
||||
psa.print[13].size,
|
||||
psa.print[14].blob.toStdString().c_str(),
|
||||
psa.print[14].size,
|
||||
psa.print[15].blob.toStdString().c_str(),
|
||||
psa.print[15].size,
|
||||
psa.print[16].blob.toStdString().c_str(),
|
||||
psa.print[16].size,
|
||||
psa.print[17].blob.toStdString().c_str(),
|
||||
psa.print[17].size,
|
||||
psa.print[18].blob.toStdString().c_str(),
|
||||
psa.print[18].size,
|
||||
psa.print[19].blob.toStdString().c_str(),
|
||||
psa.print[19].size,
|
||||
psa.print[20].blob.toStdString().c_str(),
|
||||
psa.print[20].size,
|
||||
psa.print[21].blob.toStdString().c_str(),
|
||||
psa.print[21].size,
|
||||
psa.print[22].blob.toStdString().c_str(),
|
||||
psa.print[22].size,
|
||||
psa.print[23].blob.toStdString().c_str(),
|
||||
psa.print[23].size,
|
||||
psa.print[24].blob.toStdString().c_str(),
|
||||
psa.print[24].size,
|
||||
psa.print[25].blob.toStdString().c_str(),
|
||||
psa.print[25].size,
|
||||
psa.print[26].blob.toStdString().c_str(),
|
||||
psa.print[26].size,
|
||||
psa.print[27].blob.toStdString().c_str(),
|
||||
psa.print[27].size,
|
||||
psa.print[28].blob.toStdString().c_str(),
|
||||
psa.print[28].size,
|
||||
psa.print[29].blob.toStdString().c_str(),
|
||||
psa.print[29].size,
|
||||
psa.print[30].blob.toStdString().c_str(),
|
||||
psa.print[30].size,
|
||||
psa.print[31].blob.toStdString().c_str(),
|
||||
psa.print[31].size,
|
||||
cpuSerial.toStdString().c_str(),
|
||||
|
||||
psa.hw.linuxVersion.toStdString().c_str(),
|
||||
psa.hw.cpuSerial.toStdString().c_str(),
|
||||
deviceControllerVersion.toStdString().c_str(),
|
||||
deviceControllerGitBlob.toStdString().c_str(),
|
||||
deviceControllerGitLastCommit.toStdString().c_str(),
|
||||
|
||||
psa.dc.versionHW.toStdString().c_str(),
|
||||
psa.dc.versionSW.toStdString().c_str(),
|
||||
psa.dc.size,
|
||||
psa.dc.gitBlob.toStdString().c_str(),
|
||||
psa.dc.gitLastCommit.toStdString().c_str(),
|
||||
raucVersion.toStdString().c_str(),
|
||||
opkgVersion.toStdString().c_str(),
|
||||
atbQTVersion.toStdString().c_str(),
|
||||
atbQTGitDescribe.toStdString().c_str(),
|
||||
|
||||
psa.sw.raucVersion.toStdString().c_str(),
|
||||
psa.sw.opkgVersion.toStdString().c_str(),
|
||||
psa.sw.atbQTVersion.toStdString().c_str(),
|
||||
|
||||
psa.pluginVersion.deviceController.toStdString().c_str(),
|
||||
psa.pluginVersion.ingenicoISelfCC.toStdString().c_str(),
|
||||
psa.pluginVersion.mobilisisCalculatePrice.toStdString().c_str(),
|
||||
psa.pluginVersion.mobilisisCalculatePriceConfigUi.toStdString().c_str(),
|
||||
psa.pluginVersion.prmCalculatePrice.toStdString().c_str(),
|
||||
psa.pluginVersion.prmCalculatePriceConfigUi.toStdString().c_str(),
|
||||
psa.pluginVersion.tcpZVT.toStdString().c_str());
|
||||
|
||||
printf("buf=%s\n", buf);
|
||||
deviceControllerPluginVersion.toStdString().c_str(),
|
||||
ingenicoISelfCCPluginVersion.toStdString().c_str(),
|
||||
mobilisisCalculatePricePluginVersion.toStdString().c_str(),
|
||||
mobilisisCalculatePriceConfigUiVersion.toStdString().c_str(),
|
||||
prmCalculatePricePluginVersion.toStdString().c_str(),
|
||||
prmCalculatePriceConfigUiPluginVersion.toStdString().c_str(),
|
||||
tcpZVTPluginVersion.toStdString().c_str());
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -4,110 +4,6 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
struct PSAInstalled {
|
||||
struct Tariff {
|
||||
QString name;
|
||||
QString version;
|
||||
QString project;
|
||||
int zone;
|
||||
int size;
|
||||
QString blob;
|
||||
QString info;
|
||||
QString loadTime;
|
||||
} tariff;
|
||||
|
||||
struct HardWare {
|
||||
QString linuxVersion;
|
||||
QString cpuSerial;
|
||||
} hw;
|
||||
|
||||
struct DC {
|
||||
QString versionHW;
|
||||
QString versionSW;
|
||||
QString gitBlob;
|
||||
QString gitLastCommit;
|
||||
int size;
|
||||
} dc;
|
||||
|
||||
struct SoftWare {
|
||||
QString raucVersion;
|
||||
QString opkgVersion;
|
||||
QString atbQTVersion;
|
||||
} sw;
|
||||
|
||||
struct PluginVersion {
|
||||
QString deviceController;
|
||||
QString ingenicoISelfCC;
|
||||
QString mobilisisCalculatePrice;
|
||||
QString mobilisisCalculatePriceConfigUi;
|
||||
QString prmCalculatePrice;
|
||||
QString prmCalculatePriceConfigUi;
|
||||
QString tcpZVT;
|
||||
} pluginVersion;
|
||||
|
||||
struct DC2C {
|
||||
QString name;
|
||||
QString blob;
|
||||
int size;
|
||||
};
|
||||
|
||||
DC2C cash;
|
||||
DC2C conf;
|
||||
DC2C device;
|
||||
|
||||
DC2C print[32];
|
||||
|
||||
explicit PSAInstalled() {
|
||||
tariff.name = "N/A";
|
||||
tariff.version = "N/A";
|
||||
tariff.project = "N/A";
|
||||
tariff.zone = -1;
|
||||
tariff.size = -1;
|
||||
tariff.blob = "N/A";
|
||||
tariff.info = "N/A";
|
||||
tariff.loadTime = "N/A";
|
||||
|
||||
hw.linuxVersion = "N/A";
|
||||
hw.cpuSerial = "N/A";
|
||||
|
||||
dc.versionHW = "N/A";
|
||||
dc.versionSW = "N/A";
|
||||
dc.gitBlob = "N/A";
|
||||
dc.gitLastCommit = "N/A";
|
||||
dc.size = -1;
|
||||
|
||||
sw.raucVersion = "N/A";
|
||||
sw.opkgVersion = "N/A";
|
||||
sw.atbQTVersion = "N/A";
|
||||
|
||||
pluginVersion.deviceController = "N/A";
|
||||
pluginVersion.ingenicoISelfCC = "N/A";
|
||||
pluginVersion.mobilisisCalculatePrice = "N/A";
|
||||
pluginVersion.mobilisisCalculatePriceConfigUi = "N/A";
|
||||
pluginVersion.prmCalculatePrice = "N/A";
|
||||
pluginVersion.prmCalculatePriceConfigUi = "N/A";
|
||||
pluginVersion.tcpZVT = "N/A";
|
||||
|
||||
cash.name = "N/A";
|
||||
cash.blob = "N/A";
|
||||
cash.size = -1;
|
||||
|
||||
conf.name = "N/A";
|
||||
conf.blob = "N/A";
|
||||
conf.size = -1;
|
||||
|
||||
device.size = -1;
|
||||
device.blob = "N/A";
|
||||
device.size = -1;
|
||||
|
||||
for (int i=0; i < 32; ++i) {
|
||||
print[i].size = -1;
|
||||
print[i].blob = "N/A";
|
||||
print[i].size = -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class IsmasClient : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
@ -121,7 +17,27 @@ public:
|
||||
|
||||
QString updateOfPSAActivated();
|
||||
QString updateOfPSASucceeded();
|
||||
QString updateOfPSASendVersion(PSAInstalled const &psa);
|
||||
QString updateOfPSASendVersion(QString const &tariffVersion,
|
||||
QString const &tariffProject,
|
||||
int tariffZone,
|
||||
QString const &tariffInfo,
|
||||
QString const &tariffLoadTime,
|
||||
QString const &linuxVersion,
|
||||
QString const &cpuSerial,
|
||||
QString const &deviceControllerVersion,
|
||||
QString const &deviceControllerGitBlob,
|
||||
QString const &deviceControllerGitLastCommit,
|
||||
QString const &raucVersion,
|
||||
QString const &opkgVersion,
|
||||
QString const &atbQTVersion,
|
||||
QString const &atbQTGitDescribe,
|
||||
QString const &deviceControllerPluginVersion,
|
||||
QString const &ingenicoISelfCCPluginVersion,
|
||||
QString const &mobilisisCalculatePricePluginVersion,
|
||||
QString const &mobilisisCalculatePriceConfigUiVersion,
|
||||
QString const &prmCalculatePricePluginVersion,
|
||||
QString const &prmCalculatePriceConfigUiPluginVersion,
|
||||
QString const &tcpZVTPluginVersion);
|
||||
|
||||
QString setUpdatesAvailable();
|
||||
bool checkForAvailableUpdates();
|
||||
|
10
main.cpp
10
main.cpp
@ -135,12 +135,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int machineNr = Worker::read1stLineOfFile("/etc/machine_nr");
|
||||
int customerNr = Worker::read1stLineOfFile("/etc/cust_nr");
|
||||
QString customerNrStr = QString("customer_") + QString::number(customerNr).rightJustified(3, '0');
|
||||
int zoneNr = Worker::read1stLineOfFile("/etc/zone_nr");
|
||||
QString const branchName = (zoneNr != 0)
|
||||
? QString("zg1/zone%1").arg(zoneNr) : "master";
|
||||
|
||||
QThread::currentThread()->setObjectName("main thread");
|
||||
qInfo() << "Main thread" << QThread::currentThreadId();
|
||||
QString branchName = QString("zg1/zone%1").arg(zoneNr);
|
||||
|
||||
Worker worker(hw,
|
||||
customerNr,
|
||||
@ -149,7 +146,8 @@ int main(int argc, char *argv[]) {
|
||||
branchName,
|
||||
workingDir,
|
||||
maintenanceMode,
|
||||
dryRun);
|
||||
dryRun
|
||||
);
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QMessageLogContext>
|
||||
|
||||
#define OUTPUT_LEN (1024)
|
||||
#define OUTPUT_LEN (512)
|
||||
|
||||
static bool installedMsgHandler = false;
|
||||
static QtMsgType debugLevel = QtInfoMsg;
|
||||
|
@ -45,8 +45,8 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
||||
connect(&(*p), SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput()));
|
||||
connect(&(*p), SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError()));
|
||||
|
||||
//qCritical() << "START COMMAND" << m_command << "WITH ARGS" << args
|
||||
// << "IN" << workingDirectory;
|
||||
qCritical() << "START COMMAND" << m_command << "WITH ARGS" << args
|
||||
<< "IN" << workingDirectory;
|
||||
|
||||
p->setWorkingDirectory(workingDirectory);
|
||||
if (!args.isEmpty()) {
|
||||
@ -56,14 +56,14 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
||||
}
|
||||
|
||||
if (p->waitForStarted(m_waitForStartTimeout)) {
|
||||
//qDebug() << "PROCESS" << m_command << "STARTED";
|
||||
qDebug() << "PROCESS" << m_command << "STARTED";
|
||||
if (p->state() == QProcess::ProcessState::Running) {
|
||||
//qDebug() << "PROCESS" << m_command << "RUNNING";
|
||||
qDebug() << "PROCESS" << m_command << "RUNNING";
|
||||
if (p->waitForFinished(m_waitForFinishTimeout)) {
|
||||
//qDebug() << "PROCESS" << m_command << "FINISHED";
|
||||
qDebug() << "PROCESS" << m_command << "FINISHED";
|
||||
if (p->exitStatus() == QProcess::NormalExit) {
|
||||
//qInfo() << "EXECUTED" << m_command
|
||||
// << "with code" << p->exitCode();
|
||||
qInfo() << "EXECUTED" << m_command
|
||||
<< "with code" << p->exitCode();
|
||||
// qInfo() << "RESULT" << m_commandResult;
|
||||
return true;
|
||||
} else {
|
||||
|
424
worker.cpp
424
worker.cpp
@ -43,8 +43,7 @@ Worker::Worker(hwinf *hw,
|
||||
QObject *parent,
|
||||
char const *serialInterface,
|
||||
char const *baudrate)
|
||||
: m_hw(hw)
|
||||
, m_workerThread("workerThread")
|
||||
: m_workerThread("workerThread")
|
||||
, m_apismClient(0, 0, 0, this) // TODO
|
||||
, m_customerNr(customerNr)
|
||||
, m_customerNrStr(QString("customer_") + QString::number(m_customerNr).rightJustified(3, '0'))
|
||||
@ -52,22 +51,10 @@ Worker::Worker(hwinf *hw,
|
||||
, m_zoneNr(zoneNr)
|
||||
, m_workingDirectory(workingDirectory)
|
||||
, m_branchName(branchName)
|
||||
, m_customerRepositoryPath(QString("https://git.mimbach49.de/GerhardHoffmann/%1.git").arg(m_customerNrStr))
|
||||
, m_customerRepository(QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr))
|
||||
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
|
||||
, m_maintenanceMode(maintenanceMode)
|
||||
, m_osVersion(getOsVersion())
|
||||
, m_atbqtVersion(getATBQTVersion())
|
||||
, m_cpuSerial(getCPUSerial())
|
||||
, m_raucVersion(getRaucVersion())
|
||||
, m_opkgVersion(getOpkgVersion())
|
||||
, m_pluginVersionATBDeciceController(getPluginVersion("/opt/app/ATBAPP/plugins/libATBDeviceControllerPlugin.so"))
|
||||
, m_pluginVersionIngenicoISelf(getPluginVersion("/opt/app/ATBAPP/plugins/libIngenicoISelf_CCPlugin.so"))
|
||||
, m_pluginVersionMobilisisCalc(getPluginVersion("/opt/app/ATBAPP/plugins/libMOBILISIS_CalculatePricePlugin.so"))
|
||||
, m_pluginVersionMobilisisCalcConfig(getPluginVersion("/opt/app/ATBAPP/plugins/libMOBILISIS_CalculatePricePlugin_ConfigUi.so"))
|
||||
, m_pluginVersionPrmCalc(getPluginVersion("/opt/app/ATBAPP/plugins/libPRM_CalculatePricePlugin.so"))
|
||||
, m_pluginVersionPrmCalcConfig(getPluginVersion("/opt/app/ATBAPP/plugins/libPRM_CalculatePricePlugin_ConfigUi.so"))
|
||||
, m_pluginVersionTcpZvt(getPluginVersion("/opt/app/ATBAPP/plugins/libTCP_ZVT_CCPlugin.so"))
|
||||
, m_ismasUpdateRequests(ISMAS_UPDATE_REQUESTS)
|
||||
, m_waitForNewUpdates(this) {
|
||||
|
||||
@ -75,23 +62,21 @@ Worker::Worker(hwinf *hw,
|
||||
|
||||
qInfo() << "CURRENT TIME ..............." << QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||
qInfo() << "OS VERSION ................." << m_osVersion;
|
||||
qInfo() << "ATBQT VERSION .............." << m_atbqtVersion;
|
||||
qInfo() << "CPU SERIAL ................." << m_cpuSerial;
|
||||
qInfo() << "CUSTOMER_NR ................" << m_customerNr;
|
||||
qInfo() << "CUSTOMER_NR_STR ............" << m_customerNrStr;
|
||||
qInfo() << "CUSTOMER_REPOSITORY_PATH ..." << m_customerRepositoryPath;
|
||||
qInfo() << "CUSTOMER_REPOSITORY_PATH ..." << QString("https://git.mimbach49.de/GerhardHoffmann/%1.git").arg(m_customerNrStr);
|
||||
qInfo() << "CUSTOMER_REPOSITORY ........" << m_customerRepository;
|
||||
qInfo() << "MACHINE_NR ................." << m_machineNr;
|
||||
qInfo() << "ZONE_NR ...................." << m_zoneNr;
|
||||
qInfo() << "BRANCH_NAME ................" << m_branchName;
|
||||
qInfo() << "WORKING_DIRECTORY .........." << m_workingDirectory;
|
||||
|
||||
//QProcess p;
|
||||
//p.start("/bin/systemctl", {"restart", "apism"});
|
||||
//if (!p.waitForStarted(5000) || !p.waitForFinished(5000)) {
|
||||
// qCritical() << "APISM-RESTART-FAILURE";
|
||||
// return;
|
||||
//}
|
||||
QProcess p;
|
||||
p.start("/bin/systemctl", {"restart", "apism"});
|
||||
if (!p.waitForStarted(5000) || !p.waitForFinished(5000)) {
|
||||
qCritical() << "APISM-RESTART-FAILURE";
|
||||
return;
|
||||
}
|
||||
|
||||
this->moveToThread(&m_workerThread);
|
||||
m_workerThread.start();
|
||||
@ -120,22 +105,15 @@ Worker::Worker(hwinf *hw,
|
||||
connect(this, SIGNAL(terminateUpdateProcess()), this,
|
||||
SLOT(onTerminateUpdateProcess()), Qt::QueuedConnection);
|
||||
|
||||
connect(&m_emergencyTimer, SIGNAL(timeout()), this, SLOT(onTerminateUpdateProcess()), Qt::QueuedConnection);
|
||||
m_emergencyTimer.setSingleShot(true);
|
||||
m_emergencyTimer.start(1000 * 60 * 10);
|
||||
|
||||
QDir customerRepository(m_customerRepository);
|
||||
if (!customerRepository.exists()) {
|
||||
if (m_gc.gitCloneAndCheckoutBranch()) {
|
||||
// do nothing else, not even executing opkg-commands
|
||||
emit this->finishUpdateProcess(false);
|
||||
onFinishUpdateProcess(false);
|
||||
}
|
||||
} else {
|
||||
m_update = new Update(m_hw,
|
||||
m_customerRepository,
|
||||
m_customerNrStr,
|
||||
m_branchName,
|
||||
m_workingDirectory,
|
||||
m_update = new Update(hw, m_customerRepository, m_customerNrStr,
|
||||
m_branchName, m_workingDirectory,
|
||||
dryRun, parent, serialInterface, baudrate);
|
||||
|
||||
connect(&m_startUpdateProcess, SIGNAL(timeout()), this, SLOT(askIsmasForNewData()), Qt::QueuedConnection);
|
||||
@ -172,94 +150,20 @@ QString Worker::getOsVersion() const {
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QString Worker::getATBQTVersion() const {
|
||||
QString const cmd = QString("echo -n $(/opt/app/ATBAPP/ATBQT -v | head -n 2 | cut -d':' -f2)");
|
||||
Command c("bash");
|
||||
if (c.execute(m_workingDirectory, QStringList() << "-c" << cmd)) {
|
||||
return c.getCommandResult();
|
||||
}
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QString Worker::getCPUSerial() const {
|
||||
QString const cmd = QString("echo -n $(cat /proc/cpuinfo | grep -i Serial | cut -d':' -f2)");
|
||||
Command c("bash");
|
||||
if (c.execute(m_workingDirectory, QStringList() << "-c" << cmd)) {
|
||||
return c.getCommandResult();
|
||||
}
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QString Worker::getRaucVersion() const {
|
||||
QString const cmd = QString("echo -n $(rauc --version)");
|
||||
Command c("bash");
|
||||
if (c.execute(m_workingDirectory, QStringList() << "-c" << cmd)) {
|
||||
return c.getCommandResult();
|
||||
}
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QString Worker::getOpkgVersion() const {
|
||||
QString const cmd = QString("echo -n $(opkg --version)");
|
||||
Command c("bash");
|
||||
if (c.execute(m_workingDirectory, QStringList() << "-c" << cmd)) {
|
||||
return c.getCommandResult();
|
||||
}
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QString Worker::getPluginVersion(QString const &pluginFileName) const {
|
||||
QString const cmd = QString("echo -n $(strings %1 | grep \\\"Version\\\" | cut -d':' -f2 | tr -d '\"' | tr -d ',')").arg(pluginFileName);
|
||||
Command c("bash");
|
||||
if (c.execute(m_workingDirectory, QStringList() << "-c" << cmd)) {
|
||||
return c.getCommandResult();
|
||||
}
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
QStringList Worker::getDCVersion() const {
|
||||
QStringList lst = (QStringList() << "N/A" << "N/A");
|
||||
if (m_hw) {
|
||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||
|
||||
QByteArray const cmp(8, char(0));
|
||||
QByteArray hw(""), sw("");
|
||||
for (int i=0; i<5; ++i) {
|
||||
hw = m_hw->dc_getHWversion().toUtf8();
|
||||
sw = m_hw->dc_getSWversion().toUtf8();
|
||||
if (!hw.startsWith(cmp)) {
|
||||
lst.clear();
|
||||
qInfo() << hw << sw;
|
||||
lst << hw << sw;
|
||||
break;
|
||||
}
|
||||
QThread::sleep(1);
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
qint64 Worker::getFileSize(QString const &fileName) const {
|
||||
// fileName has to be an absolute path
|
||||
QFileInfo fInfo(fileName);
|
||||
return fInfo.exists() ? fInfo.size() : -1;
|
||||
}
|
||||
|
||||
void Worker::onHandleChangedFiles(QStringList changedFiles) {
|
||||
qCritical() << QDir::currentPath() << "ON HANDLE CHANGED FILES" << changedFiles;
|
||||
|
||||
QString opkg_commands;
|
||||
static const QRegularExpression re("^.*opkg_commands\\s*$");
|
||||
static const QRegularExpression comment("^\\s*#.*$");
|
||||
int idx = changedFiles.indexOf(re);
|
||||
if (idx != -1) {
|
||||
m_updateStatus = UPDATE_STATUS::EXEC_OPKG_COMMANDS_REQUEST;
|
||||
m_statusDescription = "EXECUTE OPKG COMMANDS";
|
||||
|
||||
opkg_commands = changedFiles.takeAt(idx);
|
||||
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMANDS,
|
||||
QString("EXEC OPKG-COMMANDS FOR ") + opkg_commands);
|
||||
|
||||
if (QDir::setCurrent(m_customerRepository)) {
|
||||
QFile f(opkg_commands);
|
||||
if (f.exists()) {
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QTextStream in(&f);
|
||||
while (!in.atEnd()) {
|
||||
@ -270,13 +174,12 @@ void Worker::onHandleChangedFiles(QStringList changedFiles) {
|
||||
executeOpkgCommand(opkgCommand);
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS,
|
||||
QString("EXECUTING OPKG-COMMANDS OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
// m_updateStatus = UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS;
|
||||
// m_statusDescription = QString("EXECUTE OPKG COMMANDS %1 OK").arg(opkgCommands.join('\n'));
|
||||
|
||||
f.close();
|
||||
}
|
||||
|
||||
if (m_update->doUpdate(changedFiles)) { // first update the hardware
|
||||
@ -310,7 +213,7 @@ void Worker::onHandleChangedFiles(QStringList changedFiles) {
|
||||
}
|
||||
}
|
||||
if (!error) {
|
||||
emit this->finishUpdateProcess(true);
|
||||
onFinishUpdateProcess(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -374,14 +277,11 @@ void Worker::executeOpkgCommand(QString opkgCommand) {
|
||||
Command c(opkgCommand);
|
||||
if (c.execute(m_workingDirectory)) {
|
||||
QString const r = c.getCommandResult();
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS,
|
||||
QString("EXECUTE OPKG COMMAND %1 OK: %2")
|
||||
.arg(opkgCommand)
|
||||
.arg(c.getCommandResult()));
|
||||
m_updateStatus = UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS;
|
||||
m_statusDescription = QString("EXECUTE OPKG COMMAND %1 OK").arg(opkgCommand);
|
||||
} else {
|
||||
qCritical() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE,
|
||||
QString("EXECUTE OPKG COMMAND %1 FAILED")
|
||||
.arg(opkgCommand));
|
||||
m_updateStatus = UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE;
|
||||
m_statusDescription = QString("EXECUTE OPKG COMMAND %1 FAILED").arg(opkgCommand);
|
||||
onTerminateUpdateProcess();
|
||||
return;
|
||||
}
|
||||
@ -389,14 +289,8 @@ void Worker::executeOpkgCommand(QString opkgCommand) {
|
||||
|
||||
// sollte ParameterResponse heissen
|
||||
void Worker::onIsmasResponseReceived(QJsonObject ismasResponse) {
|
||||
|
||||
qInfo() << "IN ON_ISMAS_RESPONSE_RECEIVED" << QThread::currentThread()->objectName();
|
||||
|
||||
if (!ismasResponse.isEmpty()) {
|
||||
QStringList const keys = ismasResponse.keys();
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED,
|
||||
QString("RECEIVED JSON WITH KEYS: ") + keys.join(","));
|
||||
|
||||
static QRegularExpression re("^REQ_ISMASPARAMETER.*");
|
||||
if(keys.indexOf(re) >= 0) {
|
||||
m_waitForNewUpdates.stop(); // stop asking ISMAS for updates
|
||||
@ -434,19 +328,10 @@ void Worker::onIsmasResponseReceived(QJsonObject ismasResponse) {
|
||||
if (!v.isNull() && !v.isUndefined()) {
|
||||
QString const s = v.toString("");
|
||||
if (s == "WAIT") {
|
||||
m_updateStatus = UPDATE_STATUS::ISMAS_UPDATE_REQUEST_SUCCESS;
|
||||
m_ismasUpdateRequests = ISMAS_UPDATE_REQUESTS;
|
||||
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_REQUEST_SUCCESS,
|
||||
"DETECTED AVAILABLE ISMAS-DOWNLOAD");
|
||||
|
||||
QString const &data = m_ismasClient.updateOfPSAActivated();
|
||||
m_apismClient.onSendCmdEventToIsmas(data);
|
||||
|
||||
m_statusDescription = "ISMAS UPDATES AVAILABLE";
|
||||
emit m_gc.ismasUpdatesAvailable();
|
||||
} else {
|
||||
// TODO: enorm wichtig
|
||||
qCritical() << "DID NOT RECEIVE 'WAIT' BUT" << s;
|
||||
onTerminateUpdateProcess();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -454,7 +339,6 @@ void Worker::onIsmasResponseReceived(QJsonObject ismasResponse) {
|
||||
m_statusDescription = "NO FILEUPLOAD KEY AVAILABLE";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
m_updateStatus = UPDATE_STATUS::ISMAS_UPDATE_REQUEST_FAILURE;
|
||||
@ -463,108 +347,64 @@ void Worker::onIsmasResponseReceived(QJsonObject ismasResponse) {
|
||||
}
|
||||
|
||||
void Worker::onFinishUpdateProcess(bool changes) {
|
||||
Q_UNUSED(changes);
|
||||
|
||||
qInfo() << "ON FINISH UPDATE PROCESS" << QThread::currentThread()->objectName();
|
||||
// m_emergencyTimer.stop();
|
||||
|
||||
onSendCmdSendVersionToIsmas(); // final message to ISMAS
|
||||
|
||||
qCritical() << "ON FINISH UPDATE PROCESS. CHANGES=" << changes;
|
||||
m_workerThread.quit();
|
||||
QApplication::quit();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Worker::onTerminateUpdateProcess() {
|
||||
qCritical() << "ON TERMINATE UPDATE PROCESS";
|
||||
|
||||
onSendCmdSendVersionToIsmas(); // final message to ISMAS
|
||||
|
||||
m_workerThread.quit();
|
||||
QApplication::quit();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void Worker::onSendCmdSendVersionToIsmas() {
|
||||
|
||||
QStringList const dcVersion = getDCVersion();
|
||||
QString const deviceControllerVersionHW = dcVersion.first();
|
||||
QString const deviceControllerVersionSW = dcVersion.last();
|
||||
QString const tariffVersion = "0.0.1";
|
||||
QString const tariffProject = "test_project";
|
||||
int tariffZone = 1;
|
||||
QString const tariffInfo = "test_tariff_info";
|
||||
QString const tariffLoadTime = QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
|
||||
// QString const linuxVersion = "test_linux_version";
|
||||
QString const cpuSerial = "test_cpu_serial";
|
||||
QString const deviceControllerVersion = "test_dc_version";
|
||||
QString const deviceControllerGitBlob = "test_dc_blob_2a3b4f50";
|
||||
QString const deviceControllerGitLastCommit = "test_dc_commit_12345abc";
|
||||
QString const raucVersion = "test_rauc_version";
|
||||
QString const opkgVersion = "test_opkg_version";
|
||||
QString const atbQTVersion = "test_qtbqt_version";
|
||||
QString const atbQTGitDescribe = "test_atbqt_git_describe";
|
||||
QString const deviceControllerPluginVersion = "test_CAmaster_version";
|
||||
QString const ingenicoISelfCCPluginVersion = "test_ingenico_plugin_version";
|
||||
QString const mobilisisCalculatePricePluginVersion = "test_mobilisis_plugin_version";
|
||||
QString const mobilisisCalculatePriceConfigUiVersion = "test_mobilisis_config_ui_plugin";
|
||||
QString const prmCalculatePricePluginVersion = "test_prm_calculate_price_plugin";
|
||||
QString const prmCalculatePriceConfigUiPluginVersion = "test_prm_calculate_price_config_ui_plugin";
|
||||
QString const tcpZVTPluginVersion = "test_tcp_zvt_plugin";
|
||||
|
||||
qInfo() << "CURRENT DC-HW-VERSION: " << deviceControllerVersionHW;
|
||||
qInfo() << "CURRENT DC-SW-VERSION: " << deviceControllerVersionSW;
|
||||
|
||||
QString const deviceControllerGitBlob = "N/A";
|
||||
QString const deviceControllerGitLastCommit = "N/A";
|
||||
|
||||
PSAInstalled psaInstalled;
|
||||
QString printSysDir("/etc/psa_config");
|
||||
QString tariffSysDir("/etc/psa_tariff");
|
||||
QString absPathName;
|
||||
|
||||
if (m_zoneNr != 0) {
|
||||
QString const &n = QString("%1").arg(m_zoneNr).rightJustified(2, '0');
|
||||
psaInstalled.tariff.name = QString("tariff%1.json").arg(n);
|
||||
absPathName = QDir::cleanPath(tariffSysDir + QDir::separator() + psaInstalled.tariff.name);
|
||||
psaInstalled.tariff.blob = m_gc.gitBlob(absPathName);
|
||||
psaInstalled.tariff.size = getFileSize(absPathName);
|
||||
psaInstalled.tariff.zone = m_zoneNr;
|
||||
}
|
||||
psaInstalled.tariff.project = "Szeged";
|
||||
psaInstalled.tariff.info = "N/A";
|
||||
psaInstalled.tariff.loadTime = "N/A"; // QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
|
||||
psaInstalled.tariff.version = "N/A";
|
||||
|
||||
psaInstalled.hw.linuxVersion = m_osVersion;
|
||||
psaInstalled.hw.cpuSerial = m_cpuSerial;
|
||||
|
||||
psaInstalled.dc.versionHW = deviceControllerVersionHW;
|
||||
psaInstalled.dc.versionSW = deviceControllerVersionSW;
|
||||
psaInstalled.dc.gitBlob = "N/A";
|
||||
psaInstalled.dc.gitLastCommit = "N/A";
|
||||
psaInstalled.dc.size = -1;
|
||||
|
||||
psaInstalled.sw.raucVersion = m_raucVersion;
|
||||
psaInstalled.sw.opkgVersion = m_opkgVersion;
|
||||
psaInstalled.sw.atbQTVersion = m_atbqtVersion;
|
||||
|
||||
psaInstalled.pluginVersion.deviceController = m_pluginVersionATBDeciceController;
|
||||
psaInstalled.pluginVersion.ingenicoISelfCC = m_pluginVersionIngenicoISelf;
|
||||
psaInstalled.pluginVersion.mobilisisCalculatePrice = m_pluginVersionMobilisisCalc;
|
||||
psaInstalled.pluginVersion.mobilisisCalculatePriceConfigUi = m_pluginVersionMobilisisCalcConfig;
|
||||
psaInstalled.pluginVersion.prmCalculatePrice = m_pluginVersionPrmCalc;
|
||||
psaInstalled.pluginVersion.prmCalculatePriceConfigUi = m_pluginVersionPrmCalcConfig;
|
||||
psaInstalled.pluginVersion.tcpZVT = m_pluginVersionTcpZvt;
|
||||
|
||||
psaInstalled.cash.name = "DC2C_cash.json";
|
||||
absPathName = QDir::cleanPath(printSysDir + QDir::separator() + psaInstalled.cash.name);
|
||||
psaInstalled.cash.blob = m_gc.gitBlob(absPathName);
|
||||
psaInstalled.cash.size = getFileSize(absPathName);
|
||||
|
||||
psaInstalled.conf.name = "DC2C_conf.json";
|
||||
absPathName = QDir::cleanPath(printSysDir + QDir::separator() + psaInstalled.conf.name);
|
||||
psaInstalled.conf.blob = m_gc.gitBlob(absPathName);
|
||||
psaInstalled.conf.size = getFileSize(absPathName);
|
||||
|
||||
psaInstalled.device.name = "DC2C_device.json";
|
||||
absPathName = QDir::cleanPath(printSysDir + QDir::separator() + psaInstalled.device.name);
|
||||
psaInstalled.device.blob = m_gc.gitBlob(absPathName);
|
||||
psaInstalled.device.size = getFileSize(absPathName);
|
||||
|
||||
for (int i=0; i < 32; ++i) {
|
||||
QString const &n = QString("%1").arg(i+1).rightJustified(2, '0');
|
||||
psaInstalled.print[i].name = QString("DC2C_print%1.json").arg(n);
|
||||
absPathName = QDir::cleanPath(printSysDir + QDir::separator() + psaInstalled.print[i].name);
|
||||
psaInstalled.print[i].blob = m_gc.gitBlob(absPathName);
|
||||
psaInstalled.print[i].size = getFileSize(absPathName);
|
||||
}
|
||||
|
||||
QString data = m_ismasClient.updateOfPSASendVersion(psaInstalled);
|
||||
|
||||
// printf("data=%s\n", data.toStdString().c_str());
|
||||
|
||||
m_apismClient.onSendCmdSendVersionToIsmas(data);
|
||||
QString data = m_ismasClient.updateOfPSASendVersion(tariffVersion,
|
||||
tariffProject,
|
||||
tariffZone,
|
||||
tariffInfo,
|
||||
tariffLoadTime,
|
||||
m_osVersion,
|
||||
cpuSerial,
|
||||
deviceControllerVersion,
|
||||
deviceControllerGitBlob,
|
||||
deviceControllerGitLastCommit,
|
||||
raucVersion,
|
||||
opkgVersion,
|
||||
atbQTVersion,
|
||||
atbQTGitDescribe,
|
||||
deviceControllerPluginVersion,
|
||||
ingenicoISelfCCPluginVersion,
|
||||
mobilisisCalculatePricePluginVersion,
|
||||
mobilisisCalculatePriceConfigUiVersion,
|
||||
prmCalculatePricePluginVersion,
|
||||
prmCalculatePriceConfigUiPluginVersion,
|
||||
tcpZVTPluginVersion);
|
||||
m_apismClient.sendCmdSendVersionToIsmas(data);
|
||||
}
|
||||
|
||||
void Worker::askIsmasForNewData() {
|
||||
@ -573,14 +413,7 @@ void Worker::askIsmasForNewData() {
|
||||
QString data = m_ismasClient.setUpdatesAvailable();
|
||||
m_apismClient.emulateUpdatesAvailable(data);
|
||||
}
|
||||
|
||||
//m_updateStatus = UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING;
|
||||
//m_statusDescription = "Ask ISMAS IF NEW DATA AVAILABLE";
|
||||
|
||||
qInfo() << UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING,
|
||||
QString("ASK ISMAS IF NEW DATA AVAILABLE") +
|
||||
QString(" (%1)").arg(m_ismasUpdateRequests));
|
||||
|
||||
m_updateStatus = UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING;
|
||||
m_apismClient.requestAvailableIsmasUpdates();
|
||||
|
||||
if (--m_ismasUpdateRequests > 0) {
|
||||
@ -592,116 +425,3 @@ void Worker::askIsmasForNewData() {
|
||||
onTerminateUpdateProcess();
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************************
|
||||
* operators
|
||||
*/
|
||||
QDebug operator<< (QDebug debug, UpdateStatus status) {
|
||||
switch(status.m_updateStatus) {
|
||||
case UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING:
|
||||
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::ISMAS_UPDATE_REQUEST_SUCCESS:
|
||||
debug << QString("UPDATE_STATUS::ISMAS_UPDATE_REQUEST_SUCCESS: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST:
|
||||
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE:
|
||||
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS:
|
||||
debug << QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED:
|
||||
debug << QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS:
|
||||
debug << QString("UPDATE_STATUS::GIT_PULL_UPDATES_REQUEST: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE:
|
||||
debug << QString("UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS:
|
||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS:
|
||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS:
|
||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE:
|
||||
debug << QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE: ")
|
||||
<< status.m_statusDescription;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
return debug;
|
||||
}
|
||||
|
||||
QString& operator<< (QString& str, UpdateStatus status) {
|
||||
switch(status.m_updateStatus) {
|
||||
case UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING:
|
||||
str = QString("UPDATE_STATUS::ISMAS_UPDATE_REQUEST_PENDING: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::ISMAS_UPDATE_REQUEST_SUCCESS:
|
||||
str = QString("UPDATE_STATUS::ISMAS_UPDATE_REQUEST_SUCCESS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST:
|
||||
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE:
|
||||
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_FAILURE: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS:
|
||||
str = QString("UPDATE_STATUS::GIT_FETCH_UPDATES_REQUEST_SUCCESS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS:
|
||||
str = QString("UPDATE_STATUS::GIT_PULL_UPDATES_SUCCESS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE:
|
||||
str = QString("UPDATE_STATUS::GIT_PULL_UPDATES_FAILURE: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED:
|
||||
str = QString("UPDATE_STATUS::ISMAS_RESPONSE_RECEIVED: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS:
|
||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS:
|
||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMANDS_SUCCESS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS:
|
||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_SUCCESS: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
case UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE:
|
||||
str = QString("UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE: ");
|
||||
str += status.m_statusDescription;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
57
worker.h
57
worker.h
@ -28,17 +28,15 @@ enum class UPDATE_STATUS : quint8 {
|
||||
ISMAS_UPDATE_REQUEST_FAILURE,
|
||||
ISMAS_UPDATE_REQUEST_TIMEOUT,
|
||||
ISMAS_UPDATE_REQUEST_SUCCESS,
|
||||
ISMAS_RESPONSE_RECEIVED,
|
||||
GIT_CHECKOUT_BRANCH_REQUEST,
|
||||
GIT_CHECKOUT_BRANCH_REQUEST_FAILURE,
|
||||
GIT_CHECKOUT_BRANCH_NOT_EXISTS,
|
||||
GIT_CHECKOUT_BRANCH_CHECKOUT_ERROR,
|
||||
GIT_FETCH_UPDATES_REQUEST,
|
||||
GIT_FETCH_UPDATES_REQUEST_FAILURE,
|
||||
GIT_FETCH_UPDATES_REQUEST_SUCCESS,
|
||||
GIT_PULL_UPDATES_SUCCESS,
|
||||
GIT_PULL_UPDATES_FAILURE,
|
||||
EXEC_OPKG_COMMANDS,
|
||||
GIT_FETCH_UPDATES_REQUEST_SSUCCESS,
|
||||
EXEC_OPKG_COMMANDS_REQUEST,
|
||||
EXEC_OPKG_COMMANDS_FAILURE,
|
||||
EXEC_OPKG_COMMAND_FAILURE,
|
||||
EXEC_OPKG_COMMAND_SUCCESS,
|
||||
EXEC_OPKG_COMMANDS_SUCCESS,
|
||||
@ -59,27 +57,14 @@ enum class UPDATE_STATUS : quint8 {
|
||||
ISMAS_CURRENT_PSA_STATUS_CONFIRM_SUCCESS
|
||||
};
|
||||
|
||||
struct UpdateStatus {
|
||||
UPDATE_STATUS m_updateStatus;
|
||||
QString m_statusDescription;
|
||||
|
||||
explicit UpdateStatus(UPDATE_STATUS s, QString const &d)
|
||||
: m_updateStatus(s), m_statusDescription(d) {}
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug debug, UpdateStatus status);
|
||||
QString& operator<<(QString &str, UpdateStatus status);
|
||||
|
||||
#define ISMAS_UPDATE_REQUESTS (10)
|
||||
#define ISMAS_UPDATE_REQUESTS (6)
|
||||
|
||||
class hwinf;
|
||||
class Worker : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
hwinf *m_hw;
|
||||
WorkerThread m_workerThread;
|
||||
QTimer m_startUpdateProcess;
|
||||
QTimer m_emergencyTimer;
|
||||
Update *m_update;
|
||||
ApismClient m_apismClient;
|
||||
int const m_customerNr;
|
||||
@ -88,23 +73,10 @@ class Worker : public QObject {
|
||||
int const m_zoneNr;
|
||||
QString const m_workingDirectory;
|
||||
QString const m_branchName;
|
||||
QString const m_customerRepositoryPath;
|
||||
QString const m_customerRepository;
|
||||
GitClient m_gc;
|
||||
bool m_maintenanceMode;
|
||||
QString const m_osVersion;
|
||||
QString const m_atbqtVersion;
|
||||
QString const m_cpuSerial;
|
||||
QString const m_raucVersion;
|
||||
QString const m_opkgVersion;
|
||||
QString const m_pluginVersionATBDeciceController;
|
||||
QString const m_pluginVersionIngenicoISelf;
|
||||
QString const m_pluginVersionMobilisisCalc;
|
||||
QString const m_pluginVersionMobilisisCalcConfig;
|
||||
QString const m_pluginVersionPrmCalc;
|
||||
QString const m_pluginVersionPrmCalcConfig;
|
||||
QString const m_pluginVersionTcpZvt;
|
||||
|
||||
int m_ismasUpdateRequests;
|
||||
QTimer m_waitForNewUpdates;
|
||||
IsmasClient m_ismasClient;
|
||||
@ -112,16 +84,9 @@ class Worker : public QObject {
|
||||
UPDATE_STATUS m_updateStatus;
|
||||
QString m_statusDescription;
|
||||
|
||||
|
||||
void executeOpkgCommand(QString opkgCommand);
|
||||
QString getOsVersion() const;
|
||||
QString getATBQTVersion() const;
|
||||
QString getCPUSerial() const;
|
||||
QString getRaucVersion() const;
|
||||
QString getOpkgVersion() const;
|
||||
QString getPluginVersion(QString const &pluginFileName) const;
|
||||
QStringList getDCVersion() const;
|
||||
|
||||
qint64 getFileSize(QString const &fileName) const;
|
||||
|
||||
public:
|
||||
explicit Worker(hwinf *hw,
|
||||
@ -140,15 +105,6 @@ public:
|
||||
|
||||
static int read1stLineOfFile(QString fileName);
|
||||
|
||||
//friend QDebug operator<<(QDebug debug, Worker const &w) {
|
||||
// Q_UNUSED(w);
|
||||
// return debug;
|
||||
//}
|
||||
//friend QString& operator<<(QString &str, Worker const &w) {
|
||||
// Q_UNUSED(w);
|
||||
// return str;
|
||||
//}
|
||||
|
||||
signals:
|
||||
void handleChangedFiles(QStringList);
|
||||
void summarizeUpload(QStringList);
|
||||
@ -170,4 +126,7 @@ private slots:
|
||||
void onHandleChangedFiles(QStringList);
|
||||
};
|
||||
|
||||
//Q_DECLARE_METATYPE((QHash<QString, QString>))
|
||||
//Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(QHash)
|
||||
|
||||
#endif // WORKER_H_INCLUDED
|
||||
|
Loading…
x
Reference in New Issue
Block a user