mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-25 02:47:46 +00:00
fix: remove redundant cache
This commit is contained in:
@@ -2569,7 +2569,7 @@ void MachineObject::set_print_state(std::string status)
|
||||
int MachineObject::connect(bool use_openssl)
|
||||
{
|
||||
if (get_dev_ip().empty()) return -1;
|
||||
std::string username = "bblp";
|
||||
std::string username = m_agent ? m_agent->default_lan_username() : std::string();
|
||||
std::string password = get_access_code();
|
||||
|
||||
if (m_agent) {
|
||||
|
||||
@@ -207,7 +207,6 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
|
||||
Bind(wxEVT_SHOW, onShowHide);
|
||||
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);
|
||||
|
||||
m_lan_user = wxGetApp().getAgent()->default_lan_username();
|
||||
}
|
||||
|
||||
MediaFilePanel::~MediaFilePanel()
|
||||
@@ -467,7 +466,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||
m_waiting_support = false;
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
if (agent && (m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
|
||||
std::string url = agent->get_local_camera_url({m_lan_ip, m_lan_user, m_lan_passwd, LVL_None,
|
||||
std::string url = agent->get_local_camera_url({m_lan_ip, agent->default_lan_username(), m_lan_passwd, LVL_None,
|
||||
m_machine, agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
|
||||
fs->SetUrl(url);
|
||||
return;
|
||||
|
||||
@@ -80,7 +80,6 @@ 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,7 +7,6 @@
|
||||
#include "I18N.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "DownloadProgressDialog.hpp"
|
||||
#include "slic3r/Utils/BBLNetworkPlugin.hpp"
|
||||
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@@ -127,8 +126,6 @@ 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()
|
||||
@@ -159,8 +156,10 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
m_device_busy = obj->is_camera_busy_off();
|
||||
m_tutk_state = obj->tutk_state;
|
||||
|
||||
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
|
||||
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.
|
||||
m_remote_proto = LiveviewRemote::LVR_None;
|
||||
}
|
||||
} else {
|
||||
@@ -283,12 +282,17 @@ void MediaPlayCtrl::Play()
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::Play: " << m_lan_proto << m_remote_proto << m_disable_lan;
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
std::string agent_version = agent ? agent->get_version() : "";
|
||||
if (!agent) {
|
||||
Stop(_L("Please confirm if the printer is connected."));
|
||||
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,
|
||||
m_lan_user,
|
||||
lan_user,
|
||||
m_lan_passwd,
|
||||
LiveviewLocal(m_lan_proto),
|
||||
into_u8(m_machine),
|
||||
@@ -525,7 +529,7 @@ void MediaPlayCtrl::ToggleStream()
|
||||
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, m_lan_user, m_lan_passwd, LiveviewLocal(m_lan_proto),
|
||||
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});
|
||||
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";
|
||||
|
||||
@@ -80,7 +80,6 @@ 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;
|
||||
|
||||
@@ -1797,7 +1797,6 @@ void SendToPrinterDialog::show_file_transfer_error(PrintDialogStatus status, wxS
|
||||
if (m_url_timer && m_url_timer->IsRunning())
|
||||
m_url_timer->Stop();
|
||||
m_connection_status = ConnectionStatus::CONNECTION_FAILED;
|
||||
GetConnection();
|
||||
show_status(status);
|
||||
update_print_status_msg(message, false, true);
|
||||
}
|
||||
|
||||
@@ -468,6 +468,15 @@ std::string BBLPrinterAgent::get_local_file_transfer_url(const FileTransferURLPa
|
||||
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)
|
||||
{
|
||||
@@ -490,14 +499,14 @@ int BBLPrinterAgent::get_file_transfer_url(std::string dev_id, std::function<voi
|
||||
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 camera_result) {
|
||||
[callback = std::move(callback)](CameraURLResult result) {
|
||||
if (!callback)
|
||||
return;
|
||||
FileTransferURLResult result;
|
||||
result.is_success = camera_result.is_success;
|
||||
result.url = std::move(camera_result.url);
|
||||
result.error_code = camera_result.error_code;
|
||||
callback(std::move(result));
|
||||
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{
|
||||
"",
|
||||
|
||||
@@ -118,6 +118,7 @@ public:
|
||||
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"; }
|
||||
|
||||
@@ -197,6 +197,14 @@ public:
|
||||
*/
|
||||
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)
|
||||
|
||||
@@ -868,6 +868,14 @@ std::string NetworkAgent::get_local_file_transfer_url(const FileTransferURLParam
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -207,6 +207,7 @@ public:
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user