mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-25 19:07:47 +00:00
fix: defer filesystem and camera abstractions
This commit is contained in:
@@ -207,6 +207,8 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
|
||||
Bind(wxEVT_SHOW, onShowHide);
|
||||
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);
|
||||
|
||||
m_lan_user = "bblp";
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
m_waiting_support = false;
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
if (agent && (m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
|
||||
agent->get_file_transfer_url(
|
||||
m_machine,
|
||||
[this, wfs](FileTransferURLResult result) {
|
||||
CallAfter([this, wfs, result = std::move(result)] {
|
||||
auto fs = wfs.lock();
|
||||
if (!fs || fs != m_image_grid->GetFileSystem())
|
||||
return;
|
||||
fs->SetUrl(result.is_success ? result.url : std::to_string(result.error_code));
|
||||
});
|
||||
},
|
||||
{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});
|
||||
std::string agent_version = agent ? agent->get_version() : "";
|
||||
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;
|
||||
url += "&device=" + m_machine;
|
||||
url += "&net_ver=" + agent_version;
|
||||
url += "&dev_ver=" + m_dev_ver;
|
||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||
fs->SetUrl(url);
|
||||
return;
|
||||
}
|
||||
if (!m_remote_proto && m_local_proto) { // not support tutk
|
||||
@@ -496,15 +494,15 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||
return;
|
||||
}
|
||||
if (agent) {
|
||||
agent->get_file_transfer_url(
|
||||
m_machine,
|
||||
[this, wfs, m = m_machine](FileTransferURLResult result) {
|
||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||
[this, wfs](CameraURLResult result) {
|
||||
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([=] {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
});
|
||||
},
|
||||
{URL_TUTK, "", "", "", m_machine, agent->get_version(), m_dev_ver,
|
||||
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
|
||||
}, 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});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ private:
|
||||
|
||||
std::string m_machine;
|
||||
std::string m_lan_ip;
|
||||
std::string m_lan_user;
|
||||
std::string m_lan_passwd;
|
||||
std::string m_dev_ver;
|
||||
bool m_lan_mode = false;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "I18N.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "DownloadProgressDialog.hpp"
|
||||
#include "slic3r/Utils/BBLNetworkPlugin.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->GetParent()->GetParent()->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
|
||||
|
||||
m_lan_user = "bblp";
|
||||
m_lan_passwd = "bblp";
|
||||
|
||||
}
|
||||
|
||||
MediaPlayCtrl::~MediaPlayCtrl()
|
||||
@@ -156,10 +160,8 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
m_device_busy = obj->is_camera_busy_off();
|
||||
m_tutk_state = obj->tutk_state;
|
||||
|
||||
auto *agent = wxGetApp().getAgent();
|
||||
if (agent && !agent->supports_remote_liveview(obj->printer_type)) {
|
||||
// The selected printer agent may force local mode for incompatible
|
||||
// plugin/printer combinations.
|
||||
if (DevPrinterConfigUtil::get_printer_series_str(obj->printer_type) == "series_o" && BBLNetworkPlugin::instance().use_legacy_network()) {
|
||||
// Legacy plugin cannot support remote play for H2D, force using local mode
|
||||
m_remote_proto = LiveviewRemote::LVR_None;
|
||||
}
|
||||
} else {
|
||||
@@ -287,21 +289,20 @@ void MediaPlayCtrl::Play()
|
||||
return;
|
||||
}
|
||||
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()) {
|
||||
m_disable_lan = m_remote_proto && !m_lan_mode; // try remote next time
|
||||
std::string url = agent->get_local_camera_url({
|
||||
m_lan_ip,
|
||||
lan_user,
|
||||
m_lan_passwd,
|
||||
LiveviewLocal(m_lan_proto),
|
||||
into_u8(m_machine),
|
||||
agent_version,
|
||||
m_dev_ver,
|
||||
"",
|
||||
wxGetApp().app_config->get("slicer_uuid"),
|
||||
SLIC3R_VERSION
|
||||
});
|
||||
std::string url;
|
||||
if (m_lan_proto == LiveviewLocal::LVL_Local)
|
||||
url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
|
||||
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=" + m_machine;
|
||||
url += "&net_ver=" + agent_version;
|
||||
url += "&dev_ver=" + m_dev_ver;
|
||||
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});
|
||||
m_url = url;
|
||||
load();
|
||||
@@ -527,10 +528,15 @@ void MediaPlayCtrl::ToggleStream()
|
||||
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()) {
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
if (!agent) return;
|
||||
std::string url = agent->get_local_camera_url({m_lan_ip, agent->default_lan_username(), m_lan_passwd, LiveviewLocal(m_lan_proto),
|
||||
into_u8(m_machine), agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
|
||||
std::string url;
|
||||
if (m_lan_proto == LiveviewLocal::LVL_Local)
|
||||
url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
|
||||
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});
|
||||
std::string file_url = data_dir() + "/cameratools/url.txt";
|
||||
boost::nowide::ofstream file(file_url);
|
||||
|
||||
@@ -80,6 +80,7 @@ private:
|
||||
std::string m_machine;
|
||||
int m_lan_proto = 0;
|
||||
std::string m_lan_ip;
|
||||
std::string m_lan_user;
|
||||
std::string m_lan_passwd;
|
||||
std::string m_dev_ver;
|
||||
std::string m_tutk_state;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "PartSkipDialog.hpp"
|
||||
#include "SkipPartCanvas.hpp"
|
||||
#include "MediaPlayCtrl.h"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
|
||||
#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_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();
|
||||
if (!agent) {
|
||||
fs->SetUrl("3");
|
||||
return;
|
||||
}
|
||||
|
||||
auto url_state = m_url_state;
|
||||
if (obj->is_lan_mode_printer()) { url_state = URL_TCP; }
|
||||
|
||||
FileTransferURLParams params;
|
||||
params.url_state = url_state;
|
||||
params.ip_address = obj->get_dev_ip();
|
||||
params.username = agent->default_lan_username();
|
||||
params.password = obj->get_access_code();
|
||||
params.device_id = dev_id;
|
||||
params.network_version = agent->get_version();
|
||||
params.device_version = dev_ver;
|
||||
params.refresh_url = boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||
params.client_id = wxGetApp().app_config->get("slicer_uuid");
|
||||
params.client_version = SLIC3R_VERSION;
|
||||
|
||||
agent->get_file_transfer_url(
|
||||
dev_id,
|
||||
[this, wfs](FileTransferURLResult result) {
|
||||
switch (url_state) {
|
||||
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());
|
||||
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");
|
||||
});
|
||||
},
|
||||
std::move(params));
|
||||
}, 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});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// controller
|
||||
void PartSkipDialog::OnFileSystemEvent(wxCommandEvent &e)
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <wx/dcgraph.h>
|
||||
#include <wx/simplebook.h>
|
||||
|
||||
#include "NetworkAgent.hpp"
|
||||
#include "Widgets/Label.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
#include "Widgets/Button.hpp"
|
||||
@@ -30,6 +29,11 @@ namespace Slic3r { namespace GUI {
|
||||
|
||||
class SkipPartCanvas;
|
||||
|
||||
enum URL_STATE {
|
||||
URL_TCP,
|
||||
URL_TUTK,
|
||||
};
|
||||
|
||||
class PartSkipConfirmDialog : public DPIDialog
|
||||
{
|
||||
private:
|
||||
@@ -118,7 +122,7 @@ private:
|
||||
std::map<uint32_t, std::string> m_parts_name;
|
||||
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();
|
||||
bool is_drag_mode();
|
||||
@@ -156,4 +160,4 @@ private:
|
||||
void OnApplyDialog(wxCommandEvent &event);
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
@@ -19,7 +19,7 @@ BBLPrinterAgent::~BBLPrinterAgent() = default;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -250,86 +250,6 @@ int BBLPrinterAgent::send_message_to_printer(std::string dev_id, std::string jso
|
||||
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
|
||||
// ============================================================================
|
||||
|
||||
@@ -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 disconnect_printer() 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"; }
|
||||
|
||||
// Certificates
|
||||
@@ -108,7 +103,6 @@ private:
|
||||
// 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);
|
||||
|
||||
std::shared_ptr<ICloudServiceAgent> m_cloud_agent;
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
|
||||
#include "PrinterNetworkTypes.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class ICloudServiceAgent;
|
||||
@@ -112,33 +110,6 @@ public:
|
||||
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode)
|
||||
{ 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.
|
||||
* Returns an empty string if the agent has no fixed default (e.g. caller must supply one).
|
||||
|
||||
@@ -854,38 +854,6 @@ int NetworkAgent::send_message_to_printer(std::string dev_id, std::string json_s
|
||||
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
|
||||
{
|
||||
if (m_printer_agent)
|
||||
|
||||
@@ -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 disconnect_printer();
|
||||
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;
|
||||
int check_cert();
|
||||
void install_device_cert(std::string dev_id, bool lan_only);
|
||||
|
||||
@@ -31,11 +31,6 @@ enum FileRemote {
|
||||
FR_TutkAgora
|
||||
};
|
||||
|
||||
enum URL_STATE {
|
||||
URL_TCP,
|
||||
URL_TUTK,
|
||||
};
|
||||
|
||||
struct CameraURLParams {
|
||||
std::string ip_address;
|
||||
std::string user;
|
||||
@@ -56,23 +51,4 @@ struct CameraURLResult {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user