NEW: add comments for print job

Change-Id: Ie7a65a76d535dc210268842704fdaf4a7475135a
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-08-29 11:28:06 +08:00 committed by Lane.Wei
parent de712b08f1
commit 346480005a
2 changed files with 18 additions and 0 deletions

View file

@ -221,9 +221,19 @@ void PrintJob::process()
return was_canceled();
};
NetworkAgent* m_agent = wxGetApp().getAgent();
if (params.connection_type != "lan") {
if (params.dev_ip.empty())
params.comments = "no_ip";
else if (this->cloud_print_only)
params.comments = "low_version";
else if (!this->has_sdcard)
params.comments = "no_sdcard";
else if (params.password.empty())
params.comments = "no_password";
if (!this->cloud_print_only
&& !params.password.empty()
&& !params.dev_ip.empty()
@ -232,6 +242,13 @@ void PrintJob::process()
BOOST_LOG_TRIVIAL(info) << "print_job: try to start local print with record";
this->update_status(curr_percent, _L("Sending print job over LAN"));
result = m_agent->start_local_print_with_record(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) {
params.comments = "upload_failed";
} else {
params.comments = (boost::format("failed(%1%)") % result).str();
}
if (result < 0) {
// try to send with cloud
BOOST_LOG_TRIVIAL(warning) << "print_job: try to send with cloud";