provide (dummies) for receiving responses from binaries

This commit is contained in:
Gerhard Hoffmann 2025-02-06 16:25:50 +01:00
parent 44585f2c59
commit 238f2498b7
19 changed files with 162 additions and 4 deletions

View File

@ -1,6 +1,21 @@
#include "process/check_and_fetch_customer_repository_command.h"
#include "worker.h"
CheckAndFetchCustomerRepositoryCommand::CheckAndFetchCustomerRepositoryCommand(
QString const &command, Worker *worker, int start_timeout, int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void CheckAndFetchCustomerRepositoryCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// TODO
Worker *w = worker();
if (w) {
// static constexpr const char *GIT_CUSTOMER_REPO_UP_TO_DATE{"up to date"};
emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE);
}
}
}

View File

@ -9,6 +9,8 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // CHECK_AND_FETCH_CUSTOMER_REPOSITORY_COMMAND_H_INCLUDED

View File

@ -1,5 +1,7 @@
#include "process/check_ismas_connectivity_command.h"
#include "worker.h"
#include <QDebug>
CheckIsmasConnectivityCommand::CheckIsmasConnectivityCommand(QString const &command,
Worker *worker,
@ -7,3 +9,19 @@ CheckIsmasConnectivityCommand::CheckIsmasConnectivityCommand(QString const &comm
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void CheckIsmasConnectivityCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// TODO
Worker *w = worker();
if (w) {
//static constexpr const char *ISMAS_CONNECTED{"connected"};
//static constexpr const char *ISMAS_NOT_CONNECTED{"not connected"};
//static constexpr const char *ISMAS_CONNECTION_IN_PROGRESS{"connecting"};
emit w->showISMASConnectivity(UpdateCommand::ISMAS_CONNECTED);
}
}
}

View File

@ -9,6 +9,8 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // CHECK_ISMAS_CONNECTIVITY_COMMAND_H_INCLUDED

View File

@ -1,5 +1,7 @@
#include "process/check_update_activation_command.h"
#include "worker.h"
#include <QDebug>
CheckUpdateActivationCommand::CheckUpdateActivationCommand(QString const &command,
Worker *worker,
@ -7,3 +9,19 @@ CheckUpdateActivationCommand::CheckUpdateActivationCommand(QString const &comman
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void CheckUpdateActivationCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// TODO
Worker *w = worker();
if (w) {
//static constexpr const char *UPDATE_NOT_NECESSARY{"not necessary"};
//static constexpr const char *UPDATE_NOT_REQUESTED{"not requested"};
//static constexpr const char *UPDATE_REQUESTED{"requested"};
emit w->showUpdateRequest(UpdateCommand::UPDATE_REQUESTED);
}
}
}

View File

@ -9,6 +9,8 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // CHECK_UPDATE_ACTIVATION_COMMAND_H_INCLUDED

View File

@ -38,6 +38,8 @@ void Command::readyReadStandardOutput() {
if (p) {
QString s = p->readAllStandardOutput();
// qCritical() << __func__ << ":" << __LINE__ << s;
if (m_worker) {
int i = -1;
if ((i = s.indexOf("<DC-VERSION>")) != -1) {

View File

@ -43,10 +43,12 @@ public:
int exitCode() const { return m_exitCode; }
void setWorker(Worker *worker) {m_worker = worker; }
Worker const *worker() const { return m_worker; }
Worker *worker() { return m_worker; }
protected slots:
void readyReadStandardOutput();
void readyReadStandardError();
virtual void readyReadStandardOutput();
virtual void readyReadStandardError();
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus);
};

View File

@ -1,5 +1,5 @@
#include "process/exec_opkg_command.h"
#include "worker.h"
ExecOpkgCommand::ExecOpkgCommand(QString const &command,
Worker *worker,
@ -7,5 +7,19 @@ ExecOpkgCommand::ExecOpkgCommand(QString const &command,
int start_timeout,
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout)
, m_noaction(m_noaction) {
, m_noaction(noaction) {
}
void ExecOpkgCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// TODO
Worker *w = worker();
if (w) {
// static constexpr const char *EXEC_OPKG_COMMANDS_SUCCESS{"success"};
emit w->showExecOpkgStatus(UpdateCommand::EXEC_OPKG_COMMANDS_SUCCESS);
}
}
}

View File

@ -12,6 +12,8 @@ public:
bool noaction,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // EXEC_OPKG_COMMAND_H_INCLUDED

View File

@ -1,4 +1,5 @@
#include "process/show_software_status_command.h"
#include "worker.h"
ShowSoftwareStatusCommand::ShowSoftwareStatusCommand(QString const &command,
@ -7,3 +8,17 @@ ShowSoftwareStatusCommand::ShowSoftwareStatusCommand(QString const &command,
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void ShowSoftwareStatusCommand::readyReadStandardOutput() {
//QProcess *p = (QProcess *)sender();
//if (p) {
// QString s = p->readAllStandardOutput();
//
// TODO
// Worker *w = worker();
//if (w) {
// static constexpr const char *EXEC_OPKG_COMMANDS_SUCCESS{"success"};
// emit w->showExecOpkgStatus(UpdateCommand::EXEC_OPKG_COMMANDS_SUCCESS);
// }
//}
}

View File

@ -9,5 +9,7 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // SHOW_SOFTWARE_STATUS_COMMAND_H_INCLUDED

View File

@ -6,6 +6,19 @@
class Worker;
class UpdateCommand : public Command {
public:
static constexpr const char *UPDATE_NOT_NECESSARY{"not necessary"};
static constexpr const char *UPDATE_NOT_REQUESTED{"not requested"};
static constexpr const char *UPDATE_REQUESTED{"requested"};
static constexpr const char *ISMAS_CONNECTED{"connected"};
static constexpr const char *ISMAS_NOT_CONNECTED{"not connected"};
static constexpr const char *ISMAS_CONNECTION_IN_PROGRESS{"connecting"};
static constexpr const char *GIT_CUSTOMER_REPO_UP_TO_DATE{"up to date"};
static constexpr const char *EXEC_OPKG_COMMANDS_SUCCESS{"success"};
static constexpr const char *UPDATE_DC_JSON_FILES_SUCCESS{"success"};
static constexpr const char *SYNC_CUSTOMER_REPO_FILES_SUCCESS{"success"};
static constexpr const char *UPDATE_DC_FIRMARE_SUCCESS{"success"};
explicit UpdateCommand(QString const &command,
Worker *worker,
int start_timeout = 100000,

View File

@ -1,4 +1,5 @@
#include "process/update_dc_command.h"
#include "worker.h"
UpdateDCCommand::UpdateDCCommand(QString const &command,
Worker *worker,
@ -6,3 +7,17 @@ UpdateDCCommand::UpdateDCCommand(QString const &command,
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void UpdateDCCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// TODO
Worker *w = worker();
if (w) {
// static constexpr const char *UPDATE_DC_FIRMARE_SUCCESS"success"};
emit w->showUpdateDCFirmware(UpdateCommand::UPDATE_DC_FIRMARE_SUCCESS);
}
}
}

View File

@ -9,6 +9,8 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // UPDATE_DC_COMMAND_H_INCLUDED

View File

@ -1,4 +1,5 @@
#include "process/update_filesystem_command.h"
#include "worker.h"
UpdateFileSystemCommand::UpdateFileSystemCommand(QString const &command,
Worker *worker,
@ -6,3 +7,17 @@ UpdateFileSystemCommand::UpdateFileSystemCommand(QString const &command,
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void UpdateFileSystemCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// TODO
Worker *w = worker();
if (w) {
// static constexpr const char *SYNC_CUSTOMER_REPO_FILES_SUCCESS{"success"};
emit w->showSyncCustRepoStatus(UpdateCommand::SYNC_CUSTOMER_REPO_FILES_SUCCESS);
}
}
}

View File

@ -9,6 +9,8 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // UPDATE_FS_COMMAND_H_INCLUDED

View File

@ -1,4 +1,8 @@
#include "process/update_json_command.h"
#include "worker.h"
#include <QDebug>
UpdateJsonCommand::UpdateJsonCommand(QString const &command,
Worker *worker,
@ -6,3 +10,14 @@ UpdateJsonCommand::UpdateJsonCommand(QString const &command,
int finish_timeout)
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
}
void UpdateJsonCommand::readyReadStandardOutput() {
QProcess *p = (QProcess *)sender();
if (p) {
QString s = p->readAllStandardOutput();
// qCritical() << __func__ << ":" << __LINE__ << s;
// static constexpr const char *UPDATE_DC_JSON_FILES_SUCCESS{"success"};
emit m_worker->showDownloadDCJsonFilesStatus(UpdateCommand::UPDATE_DC_JSON_FILES_SUCCESS);
}
}

View File

@ -9,6 +9,8 @@ public:
Worker *worker,
int start_timeout = 100000,
int finish_timeout = 100000);
protected slots:
virtual void readyReadStandardOutput() override;
};
#endif // UPDATE_JSON_HANDLER_H_INCLUDED