ENH:Add a network disconnection state to the sending module

jira:[STUDIO-11839]

Change-Id: I87d68f87a2fcb87110c20faa589b863c6cc34ce5
This commit is contained in:
milk 2025-05-20 14:21:23 +08:00 committed by lane.wei
parent 1735817a24
commit d5be32428a
2 changed files with 17 additions and 9 deletions

View File

@ -1733,7 +1733,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
} else if (status == PrintStatusTPUUnsupportAutoCali) { } else if (status == PrintStatusTPUUnsupportAutoCali) {
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
Enable_Send_Button(false); Enable_Send_Button(false);
} else if (status == PrintStatusHasFilamentInBlackListError) { //this war } else if (status == PrintStatusHasFilamentInBlackListError) {
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
Enable_Send_Button(false); Enable_Send_Button(false);
} else if (status == PrintStatusWarningKvalueNotUsed) { } else if (status == PrintStatusWarningKvalueNotUsed) {

View File

@ -312,6 +312,7 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
OutputDebugStringA(std::to_string(i).c_str()); OutputDebugStringA(std::to_string(i).c_str());
OutputDebugStringA("\n");*/ OutputDebugStringA("\n");*/
m_file_sys->Retry(); m_file_sys->Retry();
wxLogMessage(_L("click to retry"));
} }
}); });
@ -775,6 +776,8 @@ void SendToPrinterDialog::on_cancel(wxCloseEvent &event)
m_task_timer->Stop(); m_task_timer->Stop();
m_task_timer.reset(); m_task_timer.reset();
} }
m_file_sys->Stop(true);
m_file_sys.reset();
} }
m_tcp_try_connect = true; m_tcp_try_connect = true;
m_tutk_try_connect = false; m_tutk_try_connect = false;
@ -1243,6 +1246,7 @@ void SendToPrinterDialog::update_show_status()
if (!agent) return; if (!agent) return;
if (!dev) return; if (!dev) return;
MachineObject* obj_ = dev->get_my_machine(m_printer_last_select); MachineObject* obj_ = dev->get_my_machine(m_printer_last_select);
if (!obj_) { if (!obj_) {
if (agent) { if (agent) {
if (agent->is_user_login()) { if (agent->is_user_login()) {
@ -1252,6 +1256,9 @@ void SendToPrinterDialog::update_show_status()
return; return;
} }
/* check cloud machine connections */ /* check cloud machine connections */
if (!obj_->is_lan_mode_printer()) { if (!obj_->is_lan_mode_printer()) {
if (!agent->is_server_connected()) { if (!agent->is_server_connected()) {
@ -1261,7 +1268,7 @@ void SendToPrinterDialog::update_show_status()
} }
} }
if (!obj_->is_info_ready()) { if (!obj_->is_info_ready() || !obj_->is_online() || !obj_->is_connected()) {
if (is_timeout()) { if (is_timeout()) {
show_status(PrintDialogStatus::PrintStatusReadingTimeout); show_status(PrintDialogStatus::PrintStatusReadingTimeout);
return; return;
@ -1313,7 +1320,7 @@ void SendToPrinterDialog::update_show_status()
m_file_sys->Stop(true); m_file_sys->Stop(true);
m_file_sys.reset(); m_file_sys.reset();
} }
BOOST_LOG_TRIVIAL(info) << "m_ftp_try_connect is" << m_ftp_try_connect; BOOST_LOG_TRIVIAL(info) << "m_ftp_try_connect is ok" << m_ftp_try_connect;
// add log // add log
show_status(PrintDialogStatus::PrintStatusReadingFinished); show_status(PrintDialogStatus::PrintStatusReadingFinished);
@ -1387,12 +1394,13 @@ void SendToPrinterDialog::update_show_status()
} }
} }
BOOST_LOG_TRIVIAL(info) << "connect failed" ; BOOST_LOG_TRIVIAL(info) << "connect failed" ;
BOOST_LOG_TRIVIAL(info) << "m_ftp_try_connect is " << m_ftp_try_connect; BOOST_LOG_TRIVIAL(info) << "m_ftp_try_connect1 is " << m_ftp_try_connect;
BOOST_LOG_TRIVIAL(info) << "m_tutk_try_connect is " << m_tutk_try_connect ; BOOST_LOG_TRIVIAL(info) << "m_tutk_try_connect1 is " << m_tutk_try_connect ;
BOOST_LOG_TRIVIAL(info) << "m_tcp_try_connect is " << m_tcp_try_connect; BOOST_LOG_TRIVIAL(info) << "m_tcp_try_connect1 is " << m_tcp_try_connect;
} }
else else
msg = _L("Please check the network and try again, You can restart or update the printer if the issue persists."); msg = _L("Please check the network and try again, You can restart or update the printer if the issue persists.");
fs->Stop(); fs->Stop();
m_connect_try_times++; m_connect_try_times++;
BOOST_LOG_TRIVIAL(info) << "m_connect_try_times is " << m_connect_try_times; BOOST_LOG_TRIVIAL(info) << "m_connect_try_times is " << m_connect_try_times;
@ -1578,7 +1586,7 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
if (status == PrintDialogStatus::PrintStatusInit) { if (status == PrintDialogStatus::PrintStatusInit) {
update_print_status_msg(wxEmptyString, false, false); update_print_status_msg(wxEmptyString, false, false);
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(false); Enable_Refresh_Button(true);
} }
else if (status == PrintDialogStatus::PrintStatusInvalidPrinter) { else if (status == PrintDialogStatus::PrintStatusInvalidPrinter) {
update_print_status_msg(wxEmptyString, true, true); update_print_status_msg(wxEmptyString, true, true);