ENH:optimize the detection of FTP connection status

Change-Id: I9e7095959f3933e5fa22a0b274d221b1c2c42878
This commit is contained in:
tao wang 2023-02-17 17:30:17 +08:00 committed by Lane.Wei
parent 9b59fb4cbc
commit 875c851b61
3 changed files with 26 additions and 25 deletions

View file

@ -130,35 +130,33 @@ void SendJob::process()
params.use_ssl = m_local_use_ssl; params.use_ssl = m_local_use_ssl;
// check access code and ip address // check access code and ip address
if (m_is_check_mode) { params.dev_id = m_dev_id;
params.dev_id = m_dev_id; params.project_name = "verify_job";
params.project_name = "verify_job"; params.filename = job_data._temp_path.string();
params.filename = job_data._temp_path.string(); params.connection_type = this->connection_type;
params.connection_type = this->connection_type;
result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr); result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr);
if (result != 0) { if (result != 0) {
BOOST_LOG_TRIVIAL(error) << "access code is invalid"; BOOST_LOG_TRIVIAL(error) << "access code is invalid";
m_enter_ip_address_fun_fail(); m_enter_ip_address_fun_fail();
m_job_finished = true; m_job_finished = true;
return; return;
}
else {
if (!m_chck_and_continue) {
m_enter_ip_address_fun_success();
m_job_finished = true;
return;
}
}
} }
/* display info */ else if(m_is_check_mode && !m_check_and_continue){
m_enter_ip_address_fun_success();
m_job_finished = true;
return;
}
if (this->connection_type == "lan") { /* display info */
msg = _L("Sending gcode file over LAN");
/* if (this->connection_type == "lan") {
msg = _L("Sending gcode file over LAN"); msg = _L("Sending gcode file over LAN");
} }
else { else {
msg = _L("Sending gcode file through cloud service"); msg = _L("Sending gcode file through cloud service");
} }*/
int total_plate_num = m_plater->get_partplate_list().get_plate_count(); int total_plate_num = m_plater->get_partplate_list().get_plate_count();

View file

@ -21,7 +21,7 @@ class SendJob : public PlaterJob
bool m_job_finished{ false }; bool m_job_finished{ false };
int m_print_job_completed_id = 0; int m_print_job_completed_id = 0;
bool m_is_check_mode{false}; bool m_is_check_mode{false};
bool m_chck_and_continue{false}; bool m_check_and_continue{false};
std::function<void()> m_success_fun{nullptr}; std::function<void()> m_success_fun{nullptr};
std::function<void()> m_enter_ip_address_fun_fail{nullptr}; std::function<void()> m_enter_ip_address_fun_fail{nullptr};
std::function<void()> m_enter_ip_address_fun_success{nullptr}; std::function<void()> m_enter_ip_address_fun_success{nullptr};
@ -55,7 +55,7 @@ public:
wxString get_http_error_msg(unsigned int status, std::string body); wxString get_http_error_msg(unsigned int status, std::string body);
void set_check_mode() {m_is_check_mode = true;}; void set_check_mode() {m_is_check_mode = true;};
void check_and_continue() {m_chck_and_continue = true;}; void check_and_continue() {m_check_and_continue = true;};
bool is_finished() { return m_job_finished; } bool is_finished() { return m_job_finished; }
void process() override; void process() override;
void on_success(std::function<void()> success); void on_success(std::function<void()> success);

View file

@ -751,8 +751,11 @@ void SelectMachinePopup::update_user_devices()
} }
op->Bind(EVT_UNBIND_MACHINE, [this, dev, mobj](wxCommandEvent& e) { op->Bind(EVT_UNBIND_MACHINE, [this, dev, mobj](wxCommandEvent& e) {
dev->set_selected_machine(""); dev->set_selected_machine("");
if (mobj) if (mobj) {
mobj->set_access_code(""); mobj->set_access_code("");
mobj->set_user_access_code("");
}
MessageDialog msg_wingow(nullptr, _L("Log out successful."), "", wxAPPLY | wxOK); MessageDialog msg_wingow(nullptr, _L("Log out successful."), "", wxAPPLY | wxOK);
if (msg_wingow.ShowModal() == wxOK) { return; } if (msg_wingow.ShowModal() == wxOK) { return; }
}); });