fix: defer filesystem and camera abstractions

This commit is contained in:
Ian Chua
2026-08-25 14:34:11 +08:00
parent f16071f083
commit b2a0485139
12 changed files with 82 additions and 243 deletions

View File

@@ -207,6 +207,8 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
Bind(wxEVT_SHOW, onShowHide); Bind(wxEVT_SHOW, onShowHide);
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide); parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);
m_lan_user = "bblp";
} }
MediaFilePanel::~MediaFilePanel() MediaFilePanel::~MediaFilePanel()
@@ -465,19 +467,15 @@ 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();
if (agent && (m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) { std::string agent_version = agent ? agent->get_version() : "";
agent->get_file_transfer_url( if ((m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
m_machine, std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
[this, wfs](FileTransferURLResult result) { url += "&device=" + m_machine;
CallAfter([this, wfs, result = std::move(result)] { url += "&net_ver=" + agent_version;
auto fs = wfs.lock(); url += "&dev_ver=" + m_dev_ver;
if (!fs || fs != m_image_grid->GetFileSystem()) url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
return; url += "&cli_ver=" + std::string(SLIC3R_VERSION);
fs->SetUrl(result.is_success ? result.url : std::to_string(result.error_code)); fs->SetUrl(url);
});
},
{URL_TCP, m_lan_ip, agent->default_lan_username(), m_lan_passwd,
m_machine, agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
return; return;
} }
if (!m_remote_proto && m_local_proto) { // not support tutk if (!m_remote_proto && m_local_proto) { // not support tutk
@@ -496,15 +494,15 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
return; return;
} }
if (agent) { if (agent) {
agent->get_file_transfer_url( std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
m_machine, agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
[this, wfs, m = m_machine](FileTransferURLResult result) { [this, wfs](CameraURLResult result) {
std::string url = std::move(result.url); std::string url = std::move(result.url);
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: file_system_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) { if (result.is_success && 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"));
@@ -512,9 +510,9 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
fs->SetUrl(res); fs->SetUrl(res);
} }
}); });
}, }, wxGetApp().get_printer_cloud_provider(),
{URL_TUTK, "", "", "", m_machine, agent->get_version(), m_dev_ver, 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}); boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
} }
} }

View File

@@ -80,6 +80,7 @@ private:
std::string m_machine; std::string m_machine;
std::string m_lan_ip; std::string m_lan_ip;
std::string m_lan_user;
std::string m_lan_passwd; std::string m_lan_passwd;
std::string m_dev_ver; std::string m_dev_ver;
bool m_lan_mode = false; bool m_lan_mode = false;

View File

@@ -7,6 +7,7 @@
#include "I18N.hpp" #include "I18N.hpp"
#include "MsgDialog.hpp" #include "MsgDialog.hpp"
#include "DownloadProgressDialog.hpp" #include "DownloadProgressDialog.hpp"
#include "slic3r/Utils/BBLNetworkPlugin.hpp"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@@ -126,6 +127,9 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
parent->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this); parent->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
parent->GetParent()->GetParent()->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this); parent->GetParent()->GetParent()->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
m_lan_user = "bblp";
m_lan_passwd = "bblp";
} }
MediaPlayCtrl::~MediaPlayCtrl() MediaPlayCtrl::~MediaPlayCtrl()
@@ -156,10 +160,8 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
m_device_busy = obj->is_camera_busy_off(); m_device_busy = obj->is_camera_busy_off();
m_tutk_state = obj->tutk_state; m_tutk_state = obj->tutk_state;
auto *agent = wxGetApp().getAgent(); if (DevPrinterConfigUtil::get_printer_series_str(obj->printer_type) == "series_o" && BBLNetworkPlugin::instance().use_legacy_network()) {
if (agent && !agent->supports_remote_liveview(obj->printer_type)) { // Legacy plugin cannot support remote play for H2D, force using local mode
// The selected printer agent may force local mode for incompatible
// plugin/printer combinations.
m_remote_proto = LiveviewRemote::LVR_None; m_remote_proto = LiveviewRemote::LVR_None;
} }
} else { } else {
@@ -287,21 +289,20 @@ void MediaPlayCtrl::Play()
return; return;
} }
std::string agent_version = agent->get_version(); std::string agent_version = agent->get_version();
const std::string lan_user = agent->default_lan_username();
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 = agent->get_local_camera_url({ std::string url;
m_lan_ip, if (m_lan_proto == LiveviewLocal::LVL_Local)
lan_user, url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
m_lan_passwd, else if (m_lan_proto == LiveviewLocal::LVL_Rtsps)
LiveviewLocal(m_lan_proto), url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps";
into_u8(m_machine), else if (m_lan_proto == LiveviewLocal::LVL_Rtsp)
agent_version, url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp";
m_dev_ver, url += "&device=" + m_machine;
"", url += "&net_ver=" + agent_version;
wxGetApp().app_config->get("slicer_uuid"), url += "&dev_ver=" + m_dev_ver;
SLIC3R_VERSION url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
}); url += "&cli_ver=" + std::string(SLIC3R_VERSION);
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd}); BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd});
m_url = url; m_url = url;
load(); load();
@@ -527,10 +528,15 @@ void MediaPlayCtrl::ToggleStream()
if (res == wxID_CANCEL) return; if (res == wxID_CANCEL) return;
} }
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()) {
NetworkAgent *agent = wxGetApp().getAgent(); std::string url;
if (!agent) return; if (m_lan_proto == LiveviewLocal::LVL_Local)
std::string url = agent->get_local_camera_url({m_lan_ip, agent->default_lan_username(), m_lan_passwd, LiveviewLocal(m_lan_proto), url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
into_u8(m_machine), agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION}); else if (m_lan_proto == LiveviewLocal::LVL_Rtsps)
url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps";
else if (m_lan_proto == LiveviewLocal::LVL_Rtsp)
url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp";
url += "&device=" + into_u8(m_machine);
url += "&dev_ver=" + m_dev_ver;
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd}); BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd});
std::string file_url = data_dir() + "/cameratools/url.txt"; std::string file_url = data_dir() + "/cameratools/url.txt";
boost::nowide::ofstream file(file_url); boost::nowide::ofstream file(file_url);

View File

@@ -80,6 +80,7 @@ private:
std::string m_machine; std::string m_machine;
int m_lan_proto = 0; int m_lan_proto = 0;
std::string m_lan_ip; std::string m_lan_ip;
std::string m_lan_user;
std::string m_lan_passwd; std::string m_lan_passwd;
std::string m_dev_ver; std::string m_dev_ver;
std::string m_tutk_state; std::string m_tutk_state;

View File

@@ -27,6 +27,7 @@
#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,37 +435,41 @@ 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();
auto url_state = m_url_state;
if (obj->is_lan_mode_printer()) { url_state = URL_TCP; }
NetworkAgent *agent = wxGetApp().getAgent(); NetworkAgent *agent = wxGetApp().getAgent();
if (!agent) { if (!agent) {
fs->SetUrl("3"); fs->SetUrl("3");
return; return;
} }
auto url_state = m_url_state; switch (url_state) {
if (obj->is_lan_mode_printer()) { url_state = URL_TCP; } case URL_TCP: {
std::string tcp_url = "bambu:///local/" + obj->get_dev_ip() + "?port=6000&user=bblp&passwd=" + obj->get_access_code();
FileTransferURLParams params; CallAfter([wfs, tcp_url = std::move(tcp_url)] {
params.url_state = url_state; if (auto fs = wfs.lock())
params.ip_address = obj->get_dev_ip(); fs->SetUrl(boost::algorithm::starts_with(tcp_url, "bambu:///") ? tcp_url : "3");
params.username = agent->default_lan_username(); });
params.password = obj->get_access_code(); break;
params.device_id = dev_id; }
params.network_version = agent->get_version(); case URL_TUTK: {
params.device_version = dev_ver; std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
params.refresh_url = boost::lexical_cast<std::string>(&refresh_agora_url); agent->get_camera_url(dev_id + "|" + dev_ver + "|" + protocols[3],
params.client_id = wxGetApp().app_config->get("slicer_uuid"); [this, wfs](CameraURLResult result) {
params.client_version = SLIC3R_VERSION;
agent->get_file_transfer_url(
dev_id,
[this, wfs](FileTransferURLResult result) {
CallAfter([wfs, result = std::move(result)]() mutable { 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 ? result.url : "3"); fs->SetUrl(result.is_success && boost::algorithm::starts_with(result.url, "bambu:///") ? result.url : "3");
}); });
}, }, wxGetApp().get_printer_cloud_provider(),
std::move(params)); 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});
break;
}
default:
break;
}
} }
// controller // controller
void PartSkipDialog::OnFileSystemEvent(wxCommandEvent &e) void PartSkipDialog::OnFileSystemEvent(wxCommandEvent &e)

View File

@@ -14,7 +14,6 @@
#include <wx/dcgraph.h> #include <wx/dcgraph.h>
#include <wx/simplebook.h> #include <wx/simplebook.h>
#include "NetworkAgent.hpp"
#include "Widgets/Label.hpp" #include "Widgets/Label.hpp"
#include "Widgets/CheckBox.hpp" #include "Widgets/CheckBox.hpp"
#include "Widgets/Button.hpp" #include "Widgets/Button.hpp"
@@ -30,6 +29,11 @@ namespace Slic3r { namespace GUI {
class SkipPartCanvas; class SkipPartCanvas;
enum URL_STATE {
URL_TCP,
URL_TUTK,
};
class PartSkipConfirmDialog : public DPIDialog class PartSkipConfirmDialog : public DPIDialog
{ {
private: private:
@@ -118,7 +122,7 @@ private:
std::map<uint32_t, std::string> m_parts_name; std::map<uint32_t, std::string> m_parts_name;
std::vector<int> m_partskip_ids; std::vector<int> m_partskip_ids;
URL_STATE m_url_state = URL_STATE::URL_TCP; enum URL_STATE m_url_state = URL_STATE::URL_TCP;
PartsInfo GetPartsInfo(); PartsInfo GetPartsInfo();
bool is_drag_mode(); bool is_drag_mode();
@@ -156,4 +160,4 @@ private:
void OnApplyDialog(wxCommandEvent &event); void OnApplyDialog(wxCommandEvent &event);
}; };
}} // namespace Slic3r::GUI }} // namespace Slic3r::GUI

View File

@@ -19,7 +19,7 @@ BBLPrinterAgent::~BBLPrinterAgent() = default;
void BBLPrinterAgent::set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud) void BBLPrinterAgent::set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud)
{ {
m_cloud_agent = cloud; (void) cloud;
// BBL DLL manages tokens internally, so this is just for interface compliance // BBL DLL manages tokens internally, so this is just for interface compliance
} }
@@ -250,86 +250,6 @@ int BBLPrinterAgent::send_message_to_printer(std::string dev_id, std::string jso
return -1; return -1;
} }
std::string BBLPrinterAgent::get_local_camera_url(CameraURLParams params)
{
std::string url;
if (params.protocol == LVL_Local)
url = "bambu:///local/" + params.ip_address + ".?port=6000&user=" + params.user + "&passwd=" + params.password;
else if (params.protocol == LVL_Rtsps)
url = "bambu:///rtsps___" + params.user + ":" + params.password + "@" + params.ip_address + "/streaming/live/1?proto=rtsps";
else if (params.protocol == LVL_Rtsp)
url = "bambu:///rtsp___" + params.user + ":" + params.password + "@" + params.ip_address + "/streaming/live/1?proto=rtsp";
else
url = "bambu:///local/" + params.ip_address + ".?port=6000&user=" + params.user + "&passwd=" + params.password;
url += "&device=" + params.device;
url += "&net_ver=" + params.network_version;
url += "&dev_ver=" + params.device_version;
url += "&cli_id=" + params.client_id;
url += "&cli_ver=" + params.client_version;
return url;
}
std::string BBLPrinterAgent::get_local_file_transfer_url(const FileTransferURLParams& params)
{
// Keep the historical PartSkipDialog URL unchanged. It is a file-transfer
// tunnel URL, not a camera URL, so it intentionally has no camera metadata
// suffix and no dot before the query string.
return "bambu:///local/" + params.ip_address + "?port=6000&user=" + params.username + "&passwd=" + params.password;
}
bool BBLPrinterAgent::supports_remote_liveview(const std::string& printer_type) const
{
// The legacy Bambu networking plugin cannot provide remote live view for
// the O-series printers. Keep this compatibility rule in the Bambu agent
// instead of exposing plugin/version details to GUI code.
return !(DevPrinterConfigUtil::get_printer_series_str(printer_type) == "series_o" &&
BBLNetworkPlugin::instance().use_legacy_network());
}
int BBLPrinterAgent::get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params)
{
if (params.url_state == URL_TCP) {
FileTransferURLResult result;
result.url = get_local_file_transfer_url(params);
result.is_success = !result.url.empty();
result.error_code = result.is_success ? 0 : -1;
if (callback)
callback(std::move(result));
return result.is_success ? 0 : -1;
}
if (!m_cloud_agent) {
if (callback)
callback({});
return -1;
}
const std::string protocols = "\"tutk\",\"agora\"";
return m_cloud_agent->get_camera_url(
std::move(dev_id) + "|" + params.device_version + "|" + protocols,
[callback = std::move(callback)](CameraURLResult result) {
if (!callback)
return;
FileTransferURLResult transfer_result;
transfer_result.is_success = result.is_success;
transfer_result.url = std::move(result.url);
transfer_result.error_code = result.error_code;
callback(std::move(transfer_result));
},
CameraURLParams{
"", "", "", LVL_None,
params.device_id,
params.network_version,
params.device_version,
params.refresh_url,
params.client_id,
params.client_version,
true
});
}
// ============================================================================ // ============================================================================
// Certificates // Certificates
// ============================================================================ // ============================================================================

View File

@@ -45,11 +45,6 @@ public:
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl) override; int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl) override;
int disconnect_printer() override; int disconnect_printer() override;
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag) override; int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag) override;
std::string get_local_camera_url(CameraURLParams params) override;
std::string get_local_file_transfer_url(const FileTransferURLParams& params) override;
bool supports_remote_liveview(const std::string& printer_type) const override;
int get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params) override;
std::string default_lan_username() const override { return "bblp"; } std::string default_lan_username() const override { return "bblp"; }
// Certificates // Certificates
@@ -108,7 +103,6 @@ private:
// why: the lan/cloud DECISION stays machine-side; keep this mechanical branch in sync with publish_json. // why: the lan/cloud DECISION stays machine-side; keep this mechanical branch in sync with publish_json.
int publish(const std::string& dev_id, const nlohmann::json& j, bool lan_mode); int publish(const std::string& dev_id, const nlohmann::json& j, bool lan_mode);
std::shared_ptr<ICloudServiceAgent> m_cloud_agent;
}; };
} // namespace Slic3r } // namespace Slic3r

View File

@@ -15,8 +15,6 @@
#include <functional> #include <functional>
#include <cstdint> #include <cstdint>
#include "PrinterNetworkTypes.hpp"
namespace Slic3r { namespace Slic3r {
class ICloudServiceAgent; class ICloudServiceAgent;
@@ -112,33 +110,6 @@ public:
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode) bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; } { return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
/**
* Build a ready-to-use local (LAN) camera stream URL for this agent's protocol.
* Returns an empty string if the agent has no local camera stream support.
*/
virtual std::string get_local_camera_url(CameraURLParams params) { return ""; }
/**
* Build a ready-to-use local (LAN) file transfer URL for this agent's protocol.
* Returns an empty string if the agent has no local file transfer support.
*/
virtual std::string get_local_file_transfer_url(const FileTransferURLParams& params) { return ""; }
/**
* Whether remote live view is available for the selected printer and agent
* protocol. Implementations may use their plugin/version compatibility
* rules; the neutral default keeps existing agents permissive.
*/
virtual bool supports_remote_liveview(const std::string& printer_type) const
{ (void) printer_type; return true; }
virtual int get_file_transfer_url(std::string, std::function<void(FileTransferURLResult)> callback, FileTransferURLParams)
{
if (callback)
callback({});
return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED;
}
/** /**
* Default LAN account username for this agent's protocol, if it has a fixed one. * Default LAN account username for this agent's protocol, if it has a fixed one.
* Returns an empty string if the agent has no fixed default (e.g. caller must supply one). * Returns an empty string if the agent has no fixed default (e.g. caller must supply one).

View File

@@ -854,38 +854,6 @@ int NetworkAgent::send_message_to_printer(std::string dev_id, std::string json_s
return -1; return -1;
} }
std::string NetworkAgent::get_local_camera_url(CameraURLParams params)
{
if (m_printer_agent)
return m_printer_agent->get_local_camera_url(params);
return {};
}
std::string NetworkAgent::get_local_file_transfer_url(const FileTransferURLParams& params)
{
if (m_printer_agent)
return m_printer_agent->get_local_file_transfer_url(params);
return {};
}
bool NetworkAgent::supports_remote_liveview(const std::string& printer_type) const
{
// Preserve the historical permissive behavior while the printer agent is
// being selected. A missing agent must not turn a supported remote
// protocol into LVNone before the Bambu agent has been installed.
return !m_printer_agent || m_printer_agent->supports_remote_liveview(printer_type);
}
int NetworkAgent::get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params)
{
if (m_printer_agent)
return m_printer_agent->get_file_transfer_url(std::move(dev_id), std::move(callback), std::move(params));
if (callback)
callback({});
return -1;
}
std::string NetworkAgent::default_lan_username() const std::string NetworkAgent::default_lan_username() const
{ {
if (m_printer_agent) if (m_printer_agent)

View File

@@ -161,11 +161,6 @@ public:
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl); int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
int disconnect_printer(); int disconnect_printer();
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag); int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag);
std::string get_local_camera_url(CameraURLParams params);
std::string get_local_file_transfer_url(const FileTransferURLParams& params);
bool supports_remote_liveview(const std::string& printer_type) const;
int get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params = {});
std::string default_lan_username() const; std::string default_lan_username() const;
int check_cert(); int check_cert();
void install_device_cert(std::string dev_id, bool lan_only); void install_device_cert(std::string dev_id, bool lan_only);

View File

@@ -31,11 +31,6 @@ enum FileRemote {
FR_TutkAgora FR_TutkAgora
}; };
enum URL_STATE {
URL_TCP,
URL_TUTK,
};
struct CameraURLParams { struct CameraURLParams {
std::string ip_address; std::string ip_address;
std::string user; std::string user;
@@ -56,23 +51,4 @@ struct CameraURLResult {
int error_code{-1}; int error_code{-1};
}; };
struct FileTransferURLParams {
URL_STATE url_state{URL_TCP};
std::string ip_address;
std::string username;
std::string password;
std::string device_id;
std::string network_version;
std::string device_version;
std::string refresh_url;
std::string client_id;
std::string client_version;
};
struct FileTransferURLResult {
bool is_success{false};
std::string url;
int error_code{-1};
};
} // namespace Slic3r } // namespace Slic3r