mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-01 06:16:58 +00:00
fix: clear up some unrelated changes
This commit is contained in:
@@ -288,7 +288,7 @@ void PrintJob::process(Ctl &ctl)
|
|||||||
if (v == "0" || v == "false")
|
if (v == "0" || v == "false")
|
||||||
disable_emmc = false;
|
disable_emmc = false;
|
||||||
}
|
}
|
||||||
params.try_emmc_print = this->could_emmc_print && !disable_emmc;
|
params.try_emmc_print = this->could_emmc_print && !disable_emmc;
|
||||||
|
|
||||||
if (m_print_type == "from_sdcard_view") {
|
if (m_print_type == "from_sdcard_view") {
|
||||||
params.dst_file = m_dst_path;
|
params.dst_file = m_dst_path;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "Widgets/ProgressDialog.hpp"
|
#include "Widgets/ProgressDialog.hpp"
|
||||||
#include <libslic3r/Model.hpp>
|
#include <libslic3r/Model.hpp>
|
||||||
#include <libslic3r/Format/bbs_3mf.hpp>
|
#include <libslic3r/Format/bbs_3mf.hpp>
|
||||||
#include <slic3r/GUI/DeviceManager.hpp>
|
|
||||||
#include "DeviceCore/DevStorage.h"
|
#include "DeviceCore/DevStorage.h"
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@@ -208,7 +207,6 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
|
|||||||
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);
|
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);
|
||||||
|
|
||||||
m_lan_user = "bblp";
|
m_lan_user = "bblp";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaFilePanel::~MediaFilePanel()
|
MediaFilePanel::~MediaFilePanel()
|
||||||
@@ -467,7 +465,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
|||||||
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: " << m_local_proto << m_remote_proto;
|
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: " << m_local_proto << m_remote_proto;
|
||||||
m_waiting_support = false;
|
m_waiting_support = false;
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
std::string agent_version = agent ? agent->get_version() : "";
|
std::string agent_version = agent ? agent->get_version() : "";
|
||||||
if ((m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
|
if ((m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
|
||||||
std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
|
std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
|
||||||
url += "&device=" + m_machine;
|
url += "&device=" + m_machine;
|
||||||
@@ -496,23 +494,33 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
|||||||
if (agent) {
|
if (agent) {
|
||||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||||
[this, wfs](CameraURLResult result) {
|
[this, wfs, m = m_machine, v = agent->get_version(), dv = m_dev_ver](std::string url) {
|
||||||
std::string url = std::move(result.url);
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
|
url += "&device=" + m;
|
||||||
|
url += "&net_ver=" + v;
|
||||||
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&refresh_url=" + boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||||
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: camera_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="});
|
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: camera_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="});
|
||||||
CallAfter([=] {
|
CallAfter([=] {
|
||||||
boost::shared_ptr fs(wfs.lock());
|
boost::shared_ptr fs(wfs.lock());
|
||||||
if (!fs || fs != m_image_grid->GetFileSystem()) return;
|
if (!fs || fs != m_image_grid->GetFileSystem()) return;
|
||||||
if (result.is_success && boost::algorithm::starts_with(url, "bambu:///")) {
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
fs->SetUrl(url);
|
fs->SetUrl(url);
|
||||||
} else {
|
} else {
|
||||||
m_image_grid->SetStatus(m_bmp_failed, _L("Connection Failed. Please check the network and try again"));
|
m_image_grid->SetStatus(m_bmp_failed, _L("Connection Failed. Please check the network and try again"));
|
||||||
std::string res = result.error_code >= 0 ? std::to_string(result.error_code) : "3";
|
std::string res = "3";
|
||||||
|
if (boost::ends_with(url, "]")) {
|
||||||
|
size_t n = url.find_last_of('[');
|
||||||
|
if (n != std::string::npos)
|
||||||
|
res = url.substr(n + 1, url.length() - n - 2);
|
||||||
|
}
|
||||||
fs->SetUrl(res);
|
fs->SetUrl(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, wxGetApp().get_printer_cloud_provider(),
|
}, wxGetApp().get_printer_cloud_provider());
|
||||||
CameraURLParams{"", "", "", LVL_None, m_machine, agent->get_version(), m_dev_ver,
|
|
||||||
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
|
|||||||
|
|
||||||
m_lan_user = "bblp";
|
m_lan_user = "bblp";
|
||||||
m_lan_passwd = "bblp";
|
m_lan_passwd = "bblp";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPlayCtrl::~MediaPlayCtrl()
|
MediaPlayCtrl::~MediaPlayCtrl()
|
||||||
@@ -249,8 +248,8 @@ void refresh_agora_url(char const* device, char const* dev_ver, char const* chan
|
|||||||
device2 += dev_ver;
|
device2 += dev_ver;
|
||||||
device2 += "|\"agora\"|";
|
device2 += "|\"agora\"|";
|
||||||
device2 += channel;
|
device2 += channel;
|
||||||
wxGetApp().getAgent()->get_camera_url(device2, [context, callback](CameraURLResult result) {
|
wxGetApp().getAgent()->get_camera_url(device2, [context, callback](std::string url) {
|
||||||
callback(context, result.url.c_str());
|
callback(context, url.c_str());
|
||||||
}, wxGetApp().get_printer_cloud_provider());
|
}, wxGetApp().get_printer_cloud_provider());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,11 +283,7 @@ void MediaPlayCtrl::Play()
|
|||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::Play: " << m_lan_proto << m_remote_proto << m_disable_lan;
|
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::Play: " << m_lan_proto << m_remote_proto << m_disable_lan;
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
if (!agent) {
|
std::string agent_version = agent ? agent->get_version() : "";
|
||||||
Stop(_L("Please confirm if the printer is connected."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::string agent_version = agent->get_version();
|
|
||||||
if (m_lan_proto > LiveviewLocal::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
|
if (m_lan_proto > LiveviewLocal::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
|
||||||
m_disable_lan = m_remote_proto && !m_lan_mode; // try remote next time
|
m_disable_lan = m_remote_proto && !m_lan_mode; // try remote next time
|
||||||
std::string url;
|
std::string url;
|
||||||
@@ -342,39 +337,46 @@ void MediaPlayCtrl::Play()
|
|||||||
|
|
||||||
if (agent) {
|
if (agent) {
|
||||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
agent->get_camera_url(
|
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||||
m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
[this, m = m_machine, v = agent_version, dv = m_dev_ver, token = std::weak_ptr(m_token)](std::string url) {
|
||||||
[this, m = m_machine, token = std::weak_ptr(m_token)](CameraURLResult result) {
|
if (token.expired()) {
|
||||||
std::string url = std::move(result.url);
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": token has been expired";
|
||||||
const bool success = result.is_success;
|
return;
|
||||||
const int error_code = result.error_code;
|
}
|
||||||
if (token.expired()) {
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": token has been expired";
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
|
url += "&device=" + into_u8(m);
|
||||||
|
url += "&net_ver=" + v;
|
||||||
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&refresh_url=" + boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||||
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
|
}
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url,
|
||||||
|
{"?uid=", "authkey=", "passwd=", "license=", "token="});
|
||||||
|
CallAfter([this, m, url] {
|
||||||
|
if (m != m_machine) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (m_last_state == MEDIASTATE_INITIALIZING) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url, {"?uid=", "authkey=", "passwd=", "license=", "token="});
|
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
CallAfter([this, m, url, success, error_code] {
|
m_failed_code = 3;
|
||||||
if (m != m_machine) {
|
if (boost::ends_with(url, "]")) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m;
|
size_t n = url.find_last_of('[');
|
||||||
return;
|
if (n != std::string::npos)
|
||||||
}
|
m_failed_code = std::atoi(url.substr(n + 1, url.length() - n - 2).c_str());
|
||||||
if (m_last_state == MEDIASTATE_INITIALIZING) {
|
|
||||||
if (!success) {
|
|
||||||
m_failed_code = error_code >= 0 ? error_code : 3;
|
|
||||||
Stop(_L("Connection Failed. Please check the network and try again"), from_u8(url));
|
|
||||||
} else {
|
|
||||||
m_url = url;
|
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
Stop(_L("Connection Failed. Please check the network and try again"), from_u8(url));
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for state: " << m_last_state;
|
m_url = url;
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
},
|
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for state: " << m_last_state;
|
||||||
wxGetApp().get_printer_cloud_provider(),
|
}
|
||||||
CameraURLParams{"", "", "", LVL_None, into_u8(m_machine), agent_version, m_dev_ver,
|
});
|
||||||
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
|
}, wxGetApp().get_printer_cloud_provider());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,14 +552,20 @@ void MediaPlayCtrl::ToggleStream()
|
|||||||
if (!agent) return;
|
if (!agent) return;
|
||||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||||
[this, m = m_machine](CameraURLResult result) {
|
[this, m = m_machine, v = agent->get_version(), dv = m_dev_ver](std::string url) {
|
||||||
std::string url = std::move(result.url);
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
const bool success = result.is_success;
|
url += "&device=" + m;
|
||||||
|
url += "&net_ver=" + v;
|
||||||
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&refresh_url=" + boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||||
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url,
|
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url,
|
||||||
{"?uid=", "authkey=", "passwd=", "license=", "token="});
|
{"?uid=", "authkey=", "passwd=", "license=", "token="});
|
||||||
CallAfter([this, m, url, success] {
|
CallAfter([this, m, url] {
|
||||||
if (m != m_machine) return;
|
if (m != m_machine) return;
|
||||||
if (!success) {
|
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
MessageDialog(this->GetParent(), wxString::Format(_L("Virtual camera initialize failed (%s)!"), url.empty() ? _L("Network unreachable") : from_u8(url)), _L("Information"),
|
MessageDialog(this->GetParent(), wxString::Format(_L("Virtual camera initialize failed (%s)!"), url.empty() ? _L("Network unreachable") : from_u8(url)), _L("Information"),
|
||||||
wxICON_INFORMATION)
|
wxICON_INFORMATION)
|
||||||
.ShowModal();
|
.ShowModal();
|
||||||
@@ -570,8 +578,7 @@ void MediaPlayCtrl::ToggleStream()
|
|||||||
file.close();
|
file.close();
|
||||||
m_streaming = true;
|
m_streaming = true;
|
||||||
});
|
});
|
||||||
}, wxGetApp().get_printer_cloud_provider(), CameraURLParams{"", "", "", LVL_None, into_u8(m_machine), agent->get_version(), m_dev_ver,
|
}, wxGetApp().get_printer_cloud_provider());
|
||||||
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaPlayCtrl::msw_rescale() {
|
void MediaPlayCtrl::msw_rescale() {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "PartSkipDialog.hpp"
|
#include "PartSkipDialog.hpp"
|
||||||
#include "SkipPartCanvas.hpp"
|
#include "SkipPartCanvas.hpp"
|
||||||
#include "MediaPlayCtrl.h"
|
#include "MediaPlayCtrl.h"
|
||||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
|
||||||
|
|
||||||
#include "DeviceCore/DevManager.h"
|
#include "DeviceCore/DevManager.h"
|
||||||
|
|
||||||
@@ -434,41 +433,57 @@ void PartSkipDialog::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
|||||||
}
|
}
|
||||||
std::string dev_ver = obj->get_ota_version();
|
std::string dev_ver = obj->get_ota_version();
|
||||||
std::string dev_id = obj->get_dev_id();
|
std::string dev_id = obj->get_dev_id();
|
||||||
|
// int remote_proto = obj->get_file_remote();
|
||||||
|
|
||||||
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
|
std::string agent_version = agent ? agent->get_version() : "";
|
||||||
|
|
||||||
auto url_state = m_url_state;
|
auto url_state = m_url_state;
|
||||||
if (obj->is_lan_mode_printer()) { url_state = URL_TCP; }
|
if (obj->is_lan_mode_printer()) { url_state = URL_TCP; }
|
||||||
|
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
if (agent) {
|
||||||
if (!agent) {
|
switch (url_state) {
|
||||||
fs->SetUrl("3");
|
case URL_TCP: {
|
||||||
return;
|
std::string devIP = obj->get_dev_ip();
|
||||||
}
|
std::string accessCode = obj->get_access_code();
|
||||||
|
std::string tcp_url = "bambu:///local/" + devIP + "?port=6000&user=" + "bblp" + "&passwd=" + accessCode;
|
||||||
switch (url_state) {
|
CallAfter([=] {
|
||||||
case URL_TCP: {
|
|
||||||
std::string tcp_url = "bambu:///local/" + obj->get_dev_ip() + "?port=6000&user=bblp&passwd=" + obj->get_access_code();
|
|
||||||
CallAfter([wfs, tcp_url = std::move(tcp_url)] {
|
|
||||||
if (auto fs = wfs.lock())
|
|
||||||
fs->SetUrl(boost::algorithm::starts_with(tcp_url, "bambu:///") ? tcp_url : "3");
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case URL_TUTK: {
|
|
||||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
|
||||||
agent->get_camera_url(dev_id + "|" + dev_ver + "|" + protocols[3],
|
|
||||||
[this, wfs](CameraURLResult result) {
|
|
||||||
CallAfter([wfs, result = std::move(result)]() mutable {
|
|
||||||
boost::shared_ptr fs(wfs.lock());
|
boost::shared_ptr fs(wfs.lock());
|
||||||
if (!fs) return;
|
if (!fs) return;
|
||||||
fs->SetUrl(result.is_success && boost::algorithm::starts_with(result.url, "bambu:///") ? result.url : "3");
|
if (boost::algorithm::starts_with(tcp_url, "bambu:///")) {
|
||||||
|
fs->SetUrl(tcp_url);
|
||||||
|
} else {
|
||||||
|
fs->SetUrl("3");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, wxGetApp().get_printer_cloud_provider(),
|
break;
|
||||||
CameraURLParams{"", "", "", LVL_None, dev_id, agent->get_version(), dev_ver,
|
}
|
||||||
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
|
case URL_TUTK: {
|
||||||
break;
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
}
|
agent->get_camera_url(obj->get_dev_id() + "|" + dev_ver + "|" + protocols[3], [this, wfs, m = dev_id, v = agent->get_version(), dv = dev_ver](std::string url)
|
||||||
default:
|
{
|
||||||
break;
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
|
url += "&device=" + m;
|
||||||
|
url += "&net_ver=" + v;
|
||||||
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&refresh_url=" + boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||||
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
|
}
|
||||||
|
CallAfter([=] {
|
||||||
|
boost::shared_ptr fs(wfs.lock());
|
||||||
|
if (!fs) return;
|
||||||
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
|
fs->SetUrl(url);
|
||||||
|
} else {
|
||||||
|
fs->SetUrl("3");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// controller
|
// controller
|
||||||
|
|||||||
@@ -868,12 +868,12 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
|||||||
if (wxGetApp().plater()->using_exported_file()) {
|
if (wxGetApp().plater()->using_exported_file()) {
|
||||||
m_plater->set_print_job_plate_idx(m_print_plate_idx);
|
m_plater->set_print_job_plate_idx(m_print_plate_idx);
|
||||||
result = 0;
|
result = 0;
|
||||||
} else {
|
}
|
||||||
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool& cancel) {
|
else {
|
||||||
if (this->m_is_canceled)
|
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool &cancel) {
|
||||||
return;
|
if (this->m_is_canceled) return;
|
||||||
bool cancelled = false;
|
bool cancelled = false;
|
||||||
wxString msg = _L("Preparing print job");
|
wxString msg = _L("Preparing print job");
|
||||||
m_status_bar->update_status(msg, cancelled, 10, true);
|
m_status_bar->update_status(msg, cancelled, 10, true);
|
||||||
m_export_3mf_cancel = cancel = cancelled;
|
m_export_3mf_cancel = cancel = cancelled;
|
||||||
});
|
});
|
||||||
@@ -1728,8 +1728,15 @@ void SendToPrinterDialog::GetConnection()
|
|||||||
else if (m_tutk_try_connect)
|
else if (m_tutk_try_connect)
|
||||||
{
|
{
|
||||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
agent->get_camera_url(obj->get_dev_id() + "|" + dev_ver + "|" + protocols[1], [this, m = dev_id](CameraURLResult result) {
|
agent->get_camera_url(obj->get_dev_id() + "|" + dev_ver + "|" + protocols[1], [this, m = dev_id, v = agent->get_version(), dv = dev_ver](std::string url) {
|
||||||
std::string url = std::move(result.url);
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
|
url += "&device=" + m;
|
||||||
|
url += "&net_ver=" + v;
|
||||||
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&refresh_url=" + boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||||
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_url_timer && m_url_timer->IsRunning())
|
if (m_url_timer && m_url_timer->IsRunning())
|
||||||
{
|
{
|
||||||
@@ -1741,7 +1748,7 @@ void SendToPrinterDialog::GetConnection()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (result.is_success)
|
if (boost::algorithm::starts_with(url, "bambu:///"))
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Connect method tutk";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Connect method tutk";
|
||||||
m_filetransfer_tunnel = std::make_unique<FileTransferTunnel>(module(), url);
|
m_filetransfer_tunnel = std::make_unique<FileTransferTunnel>(module(), url);
|
||||||
@@ -1761,9 +1768,7 @@ void SendToPrinterDialog::GetConnection()
|
|||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " : Tutk url error: ress = " << res;
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " : Tutk url error: ress = " << res;
|
||||||
}
|
}
|
||||||
}, wxGetApp().get_printer_cloud_provider(),
|
});
|
||||||
CameraURLParams{"", "", "", LVL_None, dev_id, agent->get_version(), dev_ver,
|
|
||||||
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "BBLCloudServiceAgent.hpp"
|
#include "BBLCloudServiceAgent.hpp"
|
||||||
#include "BBLNetworkPlugin.hpp"
|
#include "BBLNetworkPlugin.hpp"
|
||||||
#include "NetworkAgent.hpp"
|
|
||||||
|
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include "Http.hpp"
|
#include "Http.hpp"
|
||||||
@@ -607,47 +606,13 @@ int BBLCloudServiceAgent::modify_printer_name(std::string dev_id, std::string de
|
|||||||
// Model Mall & Publishing
|
// Model Mall & Publishing
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
int BBLCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params)
|
int BBLCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(std::string)> callback)
|
||||||
{
|
{
|
||||||
auto& plugin = BBLNetworkPlugin::instance();
|
auto& plugin = BBLNetworkPlugin::instance();
|
||||||
auto agent = plugin.get_agent();
|
auto agent = plugin.get_agent();
|
||||||
auto func = plugin.get_get_camera_url();
|
auto func = plugin.get_get_camera_url();
|
||||||
if (func && agent) {
|
if (func && agent) {
|
||||||
auto make_result = [](std::string url) {
|
return func(agent, dev_id, callback);
|
||||||
CameraURLResult result;
|
|
||||||
result.url = std::move(url);
|
|
||||||
result.is_success = result.url.rfind("bambu:///", 0) == 0;
|
|
||||||
if (result.is_success) {
|
|
||||||
result.error_code = 0;
|
|
||||||
} else if (!result.url.empty() && result.url.back() == ']') {
|
|
||||||
const auto start = result.url.rfind('[');
|
|
||||||
if (start != std::string::npos && start + 1 < result.url.size() - 1) {
|
|
||||||
try {
|
|
||||||
result.error_code = std::stoi(result.url.substr(start + 1, result.url.size() - start - 2));
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
if (params.apply_meta) {
|
|
||||||
auto decorated_callback = [callback = std::move(callback), params = std::move(params), make_result](std::string url) {
|
|
||||||
CameraURLResult result = make_result(std::move(url));
|
|
||||||
if (result.is_success) {
|
|
||||||
result.url += "&device=" + params.device;
|
|
||||||
result.url += "&net_ver=" + params.network_version;
|
|
||||||
result.url += "&dev_ver=" + params.device_version;
|
|
||||||
result.url += "&refresh_url=" + params.refresh_url;
|
|
||||||
result.url += "&cli_id=" + params.client_id;
|
|
||||||
result.url += "&cli_ver=" + params.client_version;
|
|
||||||
}
|
|
||||||
callback(std::move(result));
|
|
||||||
};
|
|
||||||
return func(agent, std::move(dev_id), std::move(decorated_callback));
|
|
||||||
}
|
|
||||||
return func(agent, std::move(dev_id), [callback = std::move(callback), make_result](std::string url) {
|
|
||||||
callback(make_result(std::move(url)));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
int modify_printer_name(std::string dev_id, std::string dev_name) override;
|
int modify_printer_name(std::string dev_id, std::string dev_name) override;
|
||||||
|
|
||||||
// Model Mall & Publishing
|
// Model Mall & Publishing
|
||||||
int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params) override;
|
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
|
||||||
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
|
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
|
||||||
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
||||||
int get_model_publish_url(std::string* url) override;
|
int get_model_publish_url(std::string* url) override;
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ struct CloudEvent {
|
|||||||
using AppOnServerConnectedFn = std::function<void(CloudEvent event, int return_code, int reason_code)>;
|
using AppOnServerConnectedFn = std::function<void(CloudEvent event, int return_code, int reason_code)>;
|
||||||
using AppOnHttpErrorFn = std::function<void(CloudEvent event, unsigned http_code, std::string http_body)>;
|
using AppOnHttpErrorFn = std::function<void(CloudEvent event, unsigned http_code, std::string http_body)>;
|
||||||
|
|
||||||
struct CameraURLParams;
|
|
||||||
struct CameraURLResult;
|
|
||||||
|
|
||||||
class ICloudServiceAgent {
|
class ICloudServiceAgent {
|
||||||
public:
|
public:
|
||||||
virtual ~ICloudServiceAgent() = default;
|
virtual ~ICloudServiceAgent() = default;
|
||||||
@@ -331,8 +328,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Request live camera streaming URL.
|
* Request live camera streaming URL.
|
||||||
*/
|
*/
|
||||||
virtual int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback,
|
virtual int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) = 0;
|
||||||
CameraURLParams params) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch staff-picked designs from model mall.
|
* Fetch staff-picked designs from model mall.
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ public:
|
|||||||
* Populates the MachineObject's DevFilaSystem with fetched filament data.
|
* Populates the MachineObject's DevFilaSystem with fetched filament data.
|
||||||
*/
|
*/
|
||||||
virtual bool fetch_filament_info(std::string dev_id) { return false; }
|
virtual bool fetch_filament_info(std::string dev_id) { return false; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|||||||
@@ -508,12 +508,11 @@ int NetworkAgent::modify_printer_name(std::string dev_id, std::string dev_name,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NetworkAgent::get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback,
|
int NetworkAgent::get_camera_url(std::string dev_id, std::function<void(std::string)> callback, const std::string& provider)
|
||||||
const std::string& provider, CameraURLParams params)
|
|
||||||
{
|
{
|
||||||
const auto cloud_agent = get_cloud_agent(provider);
|
const auto cloud_agent = get_cloud_agent(provider);
|
||||||
if (cloud_agent)
|
if (cloud_agent)
|
||||||
return cloud_agent->get_camera_url(std::move(dev_id), std::move(callback), std::move(params));
|
return cloud_agent->get_camera_url(std::move(dev_id), std::move(callback));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "libslic3r/ProjectTask.hpp"
|
#include "libslic3r/ProjectTask.hpp"
|
||||||
#include "ICloudServiceAgent.hpp"
|
#include "ICloudServiceAgent.hpp"
|
||||||
#include "PrinterNetworkTypes.hpp"
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -113,8 +112,7 @@ public:
|
|||||||
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
int modify_printer_name(std::string dev_id, std::string dev_name, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int modify_printer_name(std::string dev_id, std::string dev_name, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback,
|
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
const std::string& provider = ORCA_CLOUD_PROVIDER, CameraURLParams params = {});
|
|
||||||
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
int get_model_publish_url(std::string* url, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int get_model_publish_url(std::string* url, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "OrcaCloudServiceAgent.hpp"
|
#include "OrcaCloudServiceAgent.hpp"
|
||||||
#include "NetworkAgent.hpp"
|
|
||||||
#include "Http.hpp"
|
#include "Http.hpp"
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
@@ -2699,12 +2698,11 @@ int OrcaCloudServiceAgent::modify_printer_name(std::string dev_id, std::string d
|
|||||||
return BAMBU_NETWORK_SUCCESS;
|
return BAMBU_NETWORK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OrcaCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params)
|
int OrcaCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(std::string)> callback)
|
||||||
{
|
{
|
||||||
(void) params;
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: get_camera_url (stub)";
|
BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: get_camera_url (stub)";
|
||||||
if (callback)
|
if (callback)
|
||||||
callback({});
|
callback("");
|
||||||
return BAMBU_NETWORK_SUCCESS;
|
return BAMBU_NETWORK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ public:
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
// ICloudServiceAgent Interface Implementation - Model Mall & Publishing
|
// ICloudServiceAgent Interface Implementation - Model Mall & Publishing
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params) override;
|
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
|
||||||
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
|
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
|
||||||
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
||||||
int get_model_publish_url(std::string* url) override;
|
int get_model_publish_url(std::string* url) override;
|
||||||
|
|||||||
@@ -31,24 +31,4 @@ enum FileRemote {
|
|||||||
FR_TutkAgora
|
FR_TutkAgora
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CameraURLParams {
|
|
||||||
std::string ip_address;
|
|
||||||
std::string user;
|
|
||||||
std::string password;
|
|
||||||
LiveviewLocal protocol;
|
|
||||||
std::string device;
|
|
||||||
std::string network_version;
|
|
||||||
std::string device_version;
|
|
||||||
std::string refresh_url;
|
|
||||||
std::string client_id;
|
|
||||||
std::string client_version;
|
|
||||||
bool apply_meta{false};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CameraURLResult {
|
|
||||||
bool is_success{false};
|
|
||||||
std::string url;
|
|
||||||
int error_code{-1};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
#include "PythonInterpreter.hpp"
|
#include "PythonInterpreter.hpp"
|
||||||
|
#include "PluginFsUtils.hpp"
|
||||||
#include "PluginConfig.hpp"
|
#include "PluginConfig.hpp"
|
||||||
#include "host/PluginHost.hpp"
|
#include "host/PluginHost.hpp"
|
||||||
#include "PyPluginPackage.hpp"
|
#include "PyPluginPackage.hpp"
|
||||||
|
|||||||
Reference in New Issue
Block a user