mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-10 15:28:45 -07:00
NEW:optimizing error info for network requests
Change-Id: I8656c2f899b086b5ab52d94b7186e64df1625e3e
This commit is contained in:
parent
7b12dcb6ea
commit
8b490adc51
27 changed files with 1133 additions and 637 deletions
|
|
@ -16,22 +16,6 @@ static wxString waiting_auth_str = _L("Logging in");
|
|||
static wxString login_failed_str = _L("Login failed");
|
||||
|
||||
|
||||
wxString get_login_fail_reason(std::string fail_reason)
|
||||
{
|
||||
if (fail_reason == "NO Regions")
|
||||
return _L("The region parameter is incorrrect");
|
||||
else if (fail_reason == "Cloud Timeout")
|
||||
return _L("Failure of printer login");
|
||||
else if (fail_reason == "Ticket Failed")
|
||||
return _L("Failed to get ticket");
|
||||
else if (fail_reason == "Wait Auth Timeout")
|
||||
return _L("User authorization timeout");
|
||||
else if (fail_reason == "Bind Failure")
|
||||
return _L("Failure of bind");
|
||||
else
|
||||
return _L("Unknown Failure");
|
||||
}
|
||||
|
||||
BindJob::BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link)
|
||||
: PlaterJob{std::move(pri), plater},
|
||||
m_dev_id(dev_id),
|
||||
|
|
@ -59,7 +43,6 @@ void BindJob::on_success(std::function<void()> success)
|
|||
void BindJob::update_status(int st, const wxString &msg)
|
||||
{
|
||||
GUI::Job::update_status(st, msg);
|
||||
//post_event(wxCommandEvent(EVT_BIND_UPDATE_MESSAGE), msg);
|
||||
wxCommandEvent event(EVT_BIND_UPDATE_MESSAGE);
|
||||
event.SetString(msg);
|
||||
event.SetEventObject(m_event_handle);
|
||||
|
|
@ -68,6 +51,9 @@ void BindJob::update_status(int st, const wxString &msg)
|
|||
|
||||
void BindJob::process()
|
||||
{
|
||||
int result_code = 0;
|
||||
std::string result_info;
|
||||
|
||||
/* display info */
|
||||
wxString msg = waiting_auth_str;
|
||||
int curr_percent = 0;
|
||||
|
|
@ -81,7 +67,11 @@ void BindJob::process()
|
|||
std::string timezone = get_timezone_utc_hm(offset);
|
||||
|
||||
int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone,
|
||||
[this, &curr_percent, &msg](int stage, int code, std::string info) {
|
||||
[this, &curr_percent, &msg, &result_code, &result_info](int stage, int code, std::string info) {
|
||||
|
||||
result_code = code;
|
||||
result_info = info;
|
||||
|
||||
if (stage == BBL::BindJobStage::LoginStageConnect) {
|
||||
curr_percent = 15;
|
||||
msg = _L("Logging in");
|
||||
|
|
@ -103,8 +93,9 @@ void BindJob::process()
|
|||
} else {
|
||||
msg = _L("Logging in");
|
||||
}
|
||||
|
||||
if (code != 0) {
|
||||
msg = _L("Login failed") + wxString::Format("(code=%d,info=%s). ", code, info);
|
||||
msg = _L("Login failed");
|
||||
if (code == BAMBU_NETWORK_ERR_TIMEOUT) {
|
||||
msg += _L("Please check the printer network connection.");
|
||||
}
|
||||
|
|
@ -115,14 +106,14 @@ void BindJob::process()
|
|||
|
||||
if (result < 0) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "login: result = " << result;
|
||||
post_fail_event();
|
||||
post_fail_event(result_code, result_info);
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "login: dev is null";
|
||||
post_fail_event();
|
||||
post_fail_event(result_code, result_info);
|
||||
return;
|
||||
}
|
||||
dev->update_user_machine_list_info();
|
||||
|
|
@ -145,9 +136,11 @@ void BindJob::set_event_handle(wxWindow *hanle)
|
|||
m_event_handle = hanle;
|
||||
}
|
||||
|
||||
void BindJob::post_fail_event()
|
||||
void BindJob::post_fail_event(int code, std::string info)
|
||||
{
|
||||
wxCommandEvent event(EVT_BIND_MACHINE_FAIL);
|
||||
event.SetInt(code);
|
||||
event.SetString(info);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
void process() override;
|
||||
void finalize() override;
|
||||
void set_event_handle(wxWindow* hanle);
|
||||
void post_fail_event();
|
||||
void post_fail_event(int code, std::string info);
|
||||
};
|
||||
|
||||
wxDECLARE_EVENT(EVT_BIND_UPDATE_MESSAGE, wxCommandEvent);
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ void GUI::Job::update_percent_finish()
|
|||
m_progress->clear_percent();
|
||||
}
|
||||
|
||||
void GUI::Job::show_networking_test(wxString msg)
|
||||
void GUI::Job::show_error_info(wxString msg, int code, wxString description, wxString extra)
|
||||
{
|
||||
m_progress->show_networking_test(msg);
|
||||
m_progress->show_error_info(msg, code, description, extra);
|
||||
}
|
||||
|
||||
GUI::Job::Job(std::shared_ptr<ProgressIndicator> pri)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ protected:
|
|||
|
||||
void update_percent_finish();
|
||||
|
||||
void show_networking_test(wxString msg);
|
||||
void show_error_info(wxString msg, int code, wxString description, wxString extra);
|
||||
|
||||
bool was_canceled() const { return m_canceled.load(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ void NotificationProgressIndicator::clear_percent()
|
|||
|
||||
}
|
||||
|
||||
void NotificationProgressIndicator::show_networking_test(wxString msg)
|
||||
void NotificationProgressIndicator::show_error_info(wxString msg, int code, wxString description, wxString extra)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
explicit NotificationProgressIndicator(NotificationManager *nm);
|
||||
|
||||
void clear_percent() override;
|
||||
void show_networking_test(wxString msg) override;
|
||||
void show_error_info(wxString msg, int code, wxString description, wxString extra) override;
|
||||
void set_range(int range) override;
|
||||
void set_cancel_callback(CancelFn = CancelFn()) override;
|
||||
void set_progress(int pr) override;
|
||||
|
|
|
|||
|
|
@ -2,27 +2,31 @@
|
|||
#include "libslic3r/MTUtils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/PresetBundle.hpp"
|
||||
#include "bambu_networking.hpp"
|
||||
#include "slic3r/GUI/Plater.hpp"
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "bambu_networking.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again");
|
||||
static wxString printjob_cancel_str = _L("Task canceled");
|
||||
static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network problem and try again");
|
||||
static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again.");
|
||||
static wxString printjob_cancel_str = _L("Task canceled.");
|
||||
static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again.");
|
||||
static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again.");
|
||||
static wxString file_is_not_exists_str = _L("Print file not found, please slice again");
|
||||
static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again");
|
||||
static wxString print_canceled_str = _L("Task canceled");
|
||||
static wxString upload_failed_str = _L("Failed uploading print file");
|
||||
static wxString upload_login_failed_str = _L("Wrong Access code");
|
||||
static wxString file_is_not_exists_str = _L("Print file not found. please slice again.");
|
||||
static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.");
|
||||
static wxString print_canceled_str = _L("Task canceled.");
|
||||
static wxString send_print_failed_str = _L("Failed to send the print job. Please try again.");
|
||||
static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again.");
|
||||
|
||||
static wxString desc_network_error = _L("Check the current status of the bambu server by clicking on the link above.");
|
||||
static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again.");
|
||||
static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing.");
|
||||
static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again.");
|
||||
|
||||
static wxString sending_over_lan_str = _L("Sending print job over LAN");
|
||||
static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
|
||||
static wxString sending_over_lan_str = _L("Sending print job over LAN");
|
||||
static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
|
||||
|
||||
PrintJob::PrintJob(std::shared_ptr<ProgressIndicator> pri, Plater* plater, std::string dev_id)
|
||||
: PlaterJob{ std::move(pri), plater },
|
||||
|
|
@ -262,7 +266,16 @@ void PrintJob::process()
|
|||
bool is_try_lan_mode = false;
|
||||
bool is_try_lan_mode_failed = false;
|
||||
|
||||
auto update_fn = [this, &is_try_lan_mode, &is_try_lan_mode_failed, &msg, &error_str, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) {
|
||||
auto update_fn = [this,
|
||||
&is_try_lan_mode,
|
||||
&is_try_lan_mode_failed,
|
||||
&msg,
|
||||
&error_str,
|
||||
&curr_percent,
|
||||
&error_text,
|
||||
StagePercentPoint
|
||||
](int stage, int code, std::string info) {
|
||||
|
||||
if (stage == BBL::SendingPrintJobStage::PrintingStageCreate && !is_try_lan_mode_failed) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _L("Sending print job over LAN");
|
||||
|
|
@ -318,13 +331,21 @@ void PrintJob::process()
|
|||
}
|
||||
}
|
||||
|
||||
if (code > 100 || code < 0) {
|
||||
error_text = this->get_http_error_msg(code, info);
|
||||
error_str = wxString::Format("[%s]", error_text);
|
||||
} else {
|
||||
error_str = wxEmptyString;
|
||||
//get errors
|
||||
if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) {
|
||||
if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) {
|
||||
m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info);
|
||||
}else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST){
|
||||
m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info);
|
||||
}else if (code == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info);
|
||||
}else {
|
||||
m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->update_status(curr_percent, msg);
|
||||
}
|
||||
this->update_status(curr_percent, msg + error_str);
|
||||
};
|
||||
|
||||
auto cancel_fn = [this]() {
|
||||
|
|
@ -373,10 +394,7 @@ void PrintJob::process()
|
|||
if (result == 0) {
|
||||
params.comments = "";
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
|
||||
params.comments = "wrong_code";
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
|
||||
else if (result == BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_FTP_FAILED) {
|
||||
params.comments = "upload_failed";
|
||||
}
|
||||
else {
|
||||
|
|
@ -407,41 +425,27 @@ void PrintJob::process()
|
|||
}
|
||||
|
||||
if (result < 0) {
|
||||
if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
|
||||
msg_text = _L("Failed to send the print job. Please try again.");
|
||||
} if (result == BAMBU_NETWORK_ERR_FILE_NOT_EXIST) {
|
||||
curr_percent = -1;
|
||||
|
||||
if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
|
||||
msg_text = file_is_not_exists_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_FILE_OVER_SIZE) {
|
||||
} else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
|
||||
msg_text = file_over_size_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_CHECK_MD5_FAILED) {
|
||||
} else if (result == BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) {
|
||||
msg_text = failed_in_cloud_service_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_INVALID_PARAMS) {
|
||||
msg_text = _L("Failed to send the print job. Please try again.");
|
||||
} else if (result == BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
msg_text = upload_ftp_failed_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_CANCELED) {
|
||||
msg_text = print_canceled_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_TIMEOUT) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
|
||||
msg_text = _L("Failed to send the print job. Please try again.");
|
||||
} else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
|
||||
msg_text = _L("Failed to send the print job. Please try again.");
|
||||
} else {
|
||||
update_status(curr_percent, failed_in_cloud_service_str);
|
||||
}
|
||||
if (!error_text.IsEmpty()) {
|
||||
curr_percent = 0;
|
||||
msg_text += wxString::Format("[%d][%s]", result, error_text);
|
||||
}
|
||||
|
||||
|
||||
if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
|
||||
this->show_networking_test(msg_text);
|
||||
}
|
||||
else {
|
||||
update_status(curr_percent, msg_text);
|
||||
msg_text = send_print_failed_str;
|
||||
}
|
||||
|
||||
this->show_error_info(msg_text, 0, "", "");
|
||||
BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result;
|
||||
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";
|
||||
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ class PrintJob : public PlaterJob
|
|||
std::function<void()> m_enter_ip_address_fun_success{ nullptr };
|
||||
|
||||
protected:
|
||||
|
||||
void prepare() override;
|
||||
|
||||
void on_exception(const std::exception_ptr &) override;
|
||||
public:
|
||||
PrintJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id = "");
|
||||
|
|
@ -43,17 +41,18 @@ public:
|
|||
std::string m_project_name;
|
||||
std::string m_dev_ip;
|
||||
std::string m_ftp_folder;
|
||||
bool m_local_use_ssl { true };
|
||||
std::string m_access_code;
|
||||
std::string task_bed_type;
|
||||
std::string task_ams_mapping;
|
||||
std::string task_ams_mapping_info;
|
||||
std::string connection_type;
|
||||
|
||||
bool m_local_use_ssl { true };
|
||||
bool task_bed_leveling;
|
||||
bool task_flow_cali;
|
||||
bool task_vibration_cali;
|
||||
bool task_record_timelapse;
|
||||
bool task_layer_inspect;
|
||||
std::string task_ams_mapping;
|
||||
std::string task_ams_mapping_info;
|
||||
std::string connection_type;
|
||||
bool cloud_print_only { false };
|
||||
bool has_sdcard { false };
|
||||
bool task_use_ams { true };
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual ~ProgressIndicator() = default;
|
||||
|
||||
virtual void clear_percent() = 0;
|
||||
virtual void show_networking_test(wxString msg) = 0;
|
||||
virtual void show_error_info(wxString msg, int code, wxString description, wxString extra) = 0;
|
||||
virtual void set_range(int range) = 0;
|
||||
virtual void set_cancel_callback(CancelFn = CancelFn()) = 0;
|
||||
virtual void set_progress(int pr) = 0;
|
||||
|
|
|
|||
|
|
@ -9,20 +9,23 @@
|
|||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again");
|
||||
static wxString printjob_cancel_str = _L("Task canceled");
|
||||
static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network problem and try again");
|
||||
static wxString failed_in_cloud_service_str = _L("Send to Printer failed. Please try again.");
|
||||
static wxString file_is_not_exists_str = _L("Print file not found, please slice again");
|
||||
static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again");
|
||||
static wxString print_canceled_str = _L("Task canceled");
|
||||
static wxString upload_failed_str = _L("Failed uploading print file");
|
||||
static wxString upload_login_failed_str = _L("Wrong Access code");
|
||||
static wxString upload_no_space_left_str = _L("No space left on Printer SD card");
|
||||
static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again.");
|
||||
static wxString printjob_cancel_str = _L("Task canceled.");
|
||||
static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again.");
|
||||
static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again.");
|
||||
static wxString file_is_not_exists_str = _L("Print file not found. please slice again.");
|
||||
static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.");
|
||||
static wxString print_canceled_str = _L("Task canceled.");
|
||||
static wxString send_print_failed_str = _L("Failed to send the print job. Please try again.");
|
||||
static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again.");
|
||||
|
||||
static wxString desc_network_error = _L("Check the current status of the bambu server by clicking on the link above.");
|
||||
static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again.");
|
||||
static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing.");
|
||||
static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again.");
|
||||
|
||||
static wxString sending_over_lan_str = _L("Sending gcode file over LAN");
|
||||
static wxString sending_over_cloud_str = _L("Sending gcode file through cloud service");
|
||||
static wxString sending_over_lan_str = _L("Sending print job over LAN");
|
||||
static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
|
||||
|
||||
SendJob::SendJob(std::shared_ptr<ProgressIndicator> pri, Plater* plater, std::string dev_id)
|
||||
: PlaterJob{ std::move(pri), plater },
|
||||
|
|
@ -271,11 +274,24 @@ void SendJob::process()
|
|||
}
|
||||
}
|
||||
|
||||
if (code < 0 || code > 100) {
|
||||
error_text = this->get_http_error_msg(code, info);
|
||||
msg += wxString::Format("[%s]", error_text);
|
||||
//get errors
|
||||
if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) {
|
||||
if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) {
|
||||
m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info);
|
||||
}
|
||||
else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
|
||||
m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info);
|
||||
}
|
||||
else if (code == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info);
|
||||
}
|
||||
else {
|
||||
m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->update_status(curr_percent, msg);
|
||||
}
|
||||
this->update_status(curr_percent, msg);
|
||||
};
|
||||
|
||||
auto cancel_fn = [this]() {
|
||||
|
|
@ -300,9 +316,7 @@ void SendJob::process()
|
|||
BOOST_LOG_TRIVIAL(info) << "send_job: try to send gcode to printer";
|
||||
this->update_status(curr_percent, _L("Sending gcode file over LAN"));
|
||||
result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn);
|
||||
if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
|
||||
params.comments = "wrong_code";
|
||||
} else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
|
||||
if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
|
||||
params.comments = "upload_failed";
|
||||
} else {
|
||||
params.comments = (boost::format("failed(%1%)") % result).str();
|
||||
|
|
@ -332,50 +346,38 @@ void SendJob::process()
|
|||
}
|
||||
|
||||
if (result < 0) {
|
||||
if (result == BAMBU_NETWORK_ERR_NO_SPACE_LEFT_ON_DEVICE) {
|
||||
msg_text = upload_no_space_left_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
|
||||
msg_text = upload_login_failed_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_FILE_NOT_EXIST) {
|
||||
curr_percent = -1;
|
||||
|
||||
if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
|
||||
msg_text = file_is_not_exists_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_FILE_OVER_SIZE) {
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
|
||||
msg_text = file_over_size_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_CHECK_MD5_FAILED) {
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) {
|
||||
msg_text = failed_in_cloud_service_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_INVALID_PARAMS) {
|
||||
msg_text = upload_failed_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_CANCELED) {
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
msg_text = upload_ftp_failed_str;
|
||||
}
|
||||
else if (result == BAMBU_NETWORK_ERR_CANCELED) {
|
||||
msg_text = print_canceled_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_TIMEOUT) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
|
||||
msg_text = upload_failed_str;
|
||||
} else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
|
||||
msg_text = upload_failed_str;
|
||||
} else {
|
||||
update_status(curr_percent, failed_in_cloud_service_str);
|
||||
}
|
||||
else {
|
||||
msg_text = send_print_failed_str;
|
||||
}
|
||||
|
||||
if (!error_text.IsEmpty()) {
|
||||
if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
|
||||
msg_text += ". ";
|
||||
msg_text += _L("Please log out and login to the printer again.");
|
||||
}
|
||||
else {
|
||||
msg_text += wxString::Format("[%s]", error_text);
|
||||
}
|
||||
}
|
||||
|
||||
if (result == BAMBU_NETWORK_ERR_WRONG_IP_ADDRESS) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
}
|
||||
|
||||
update_status(curr_percent, msg_text);
|
||||
this->show_error_info(msg_text, 0, "", "");
|
||||
BOOST_LOG_TRIVIAL(error) << "send_job: failed, result = " << result;
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(error) << "send_job: send ok.";
|
||||
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
|
||||
evt->SetString(from_u8(params.project_name));
|
||||
evt->SetString(m_dev_id);
|
||||
wxQueueEvent(m_plater, evt);
|
||||
m_job_finished = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue