diff --git a/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.cpp b/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.cpp index 80c5f27..bc42aa6 100644 --- a/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.cpp +++ b/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.cpp @@ -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); + } + } +} diff --git a/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.h b/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.h index 6d48ba1..2c43a5b 100644 --- a/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.h +++ b/UpdatePTUDevCtrl/process/check_and_fetch_customer_repository_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.cpp b/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.cpp index c88a1ca..dd94aa9 100644 --- a/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.cpp +++ b/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.cpp @@ -1,5 +1,7 @@ #include "process/check_ismas_connectivity_command.h" +#include "worker.h" +#include 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); + } + } +} diff --git a/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.h b/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.h index 161a79c..cf4bb78 100644 --- a/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.h +++ b/UpdatePTUDevCtrl/process/check_ismas_connectivity_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/check_update_activation_command.cpp b/UpdatePTUDevCtrl/process/check_update_activation_command.cpp index a325678..1d7960f 100644 --- a/UpdatePTUDevCtrl/process/check_update_activation_command.cpp +++ b/UpdatePTUDevCtrl/process/check_update_activation_command.cpp @@ -1,5 +1,7 @@ #include "process/check_update_activation_command.h" +#include "worker.h" +#include 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); + } + } +} diff --git a/UpdatePTUDevCtrl/process/check_update_activation_command.h b/UpdatePTUDevCtrl/process/check_update_activation_command.h index 40ae287..a738630 100644 --- a/UpdatePTUDevCtrl/process/check_update_activation_command.h +++ b/UpdatePTUDevCtrl/process/check_update_activation_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/command.cpp b/UpdatePTUDevCtrl/process/command.cpp index 0ae462c..c75a1b9 100644 --- a/UpdatePTUDevCtrl/process/command.cpp +++ b/UpdatePTUDevCtrl/process/command.cpp @@ -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("")) != -1) { diff --git a/UpdatePTUDevCtrl/process/command.h b/UpdatePTUDevCtrl/process/command.h index bf9ccb6..d96e40e 100644 --- a/UpdatePTUDevCtrl/process/command.h +++ b/UpdatePTUDevCtrl/process/command.h @@ -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); }; diff --git a/UpdatePTUDevCtrl/process/exec_opkg_command.cpp b/UpdatePTUDevCtrl/process/exec_opkg_command.cpp index a86698b..d428d47 100644 --- a/UpdatePTUDevCtrl/process/exec_opkg_command.cpp +++ b/UpdatePTUDevCtrl/process/exec_opkg_command.cpp @@ -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); + } + } } diff --git a/UpdatePTUDevCtrl/process/exec_opkg_command.h b/UpdatePTUDevCtrl/process/exec_opkg_command.h index 6effab5..3ae124c 100644 --- a/UpdatePTUDevCtrl/process/exec_opkg_command.h +++ b/UpdatePTUDevCtrl/process/exec_opkg_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/show_software_status_command.cpp b/UpdatePTUDevCtrl/process/show_software_status_command.cpp index 2032d6d..588081c 100644 --- a/UpdatePTUDevCtrl/process/show_software_status_command.cpp +++ b/UpdatePTUDevCtrl/process/show_software_status_command.cpp @@ -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); + // } + //} +} diff --git a/UpdatePTUDevCtrl/process/show_software_status_command.h b/UpdatePTUDevCtrl/process/show_software_status_command.h index 1049be3..a13739b 100644 --- a/UpdatePTUDevCtrl/process/show_software_status_command.h +++ b/UpdatePTUDevCtrl/process/show_software_status_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/update_command.h b/UpdatePTUDevCtrl/process/update_command.h index a843b2d..334e5e5 100644 --- a/UpdatePTUDevCtrl/process/update_command.h +++ b/UpdatePTUDevCtrl/process/update_command.h @@ -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, diff --git a/UpdatePTUDevCtrl/process/update_dc_command.cpp b/UpdatePTUDevCtrl/process/update_dc_command.cpp index 6e46012..2b83ccc 100644 --- a/UpdatePTUDevCtrl/process/update_dc_command.cpp +++ b/UpdatePTUDevCtrl/process/update_dc_command.cpp @@ -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); + } + } +} diff --git a/UpdatePTUDevCtrl/process/update_dc_command.h b/UpdatePTUDevCtrl/process/update_dc_command.h index d9c3c41..18754b2 100644 --- a/UpdatePTUDevCtrl/process/update_dc_command.h +++ b/UpdatePTUDevCtrl/process/update_dc_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/update_filesystem_command.cpp b/UpdatePTUDevCtrl/process/update_filesystem_command.cpp index e509c78..089d5b4 100644 --- a/UpdatePTUDevCtrl/process/update_filesystem_command.cpp +++ b/UpdatePTUDevCtrl/process/update_filesystem_command.cpp @@ -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); + } + } +} diff --git a/UpdatePTUDevCtrl/process/update_filesystem_command.h b/UpdatePTUDevCtrl/process/update_filesystem_command.h index 3022c79..1858a45 100644 --- a/UpdatePTUDevCtrl/process/update_filesystem_command.h +++ b/UpdatePTUDevCtrl/process/update_filesystem_command.h @@ -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 diff --git a/UpdatePTUDevCtrl/process/update_json_command.cpp b/UpdatePTUDevCtrl/process/update_json_command.cpp index 81b8fac..80d3cc6 100644 --- a/UpdatePTUDevCtrl/process/update_json_command.cpp +++ b/UpdatePTUDevCtrl/process/update_json_command.cpp @@ -1,4 +1,8 @@ #include "process/update_json_command.h" +#include "worker.h" + +#include + 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); + } +} diff --git a/UpdatePTUDevCtrl/process/update_json_command.h b/UpdatePTUDevCtrl/process/update_json_command.h index 06e3989..a87f915 100644 --- a/UpdatePTUDevCtrl/process/update_json_command.h +++ b/UpdatePTUDevCtrl/process/update_json_command.h @@ -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