mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-29 21:07:11 +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)
|
int MachineObject::connect(bool use_openssl)
|
||||||
{
|
{
|
||||||
if (get_dev_ip().empty()) return -1;
|
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();
|
std::string password = get_access_code();
|
||||||
|
|
||||||
if (m_agent) {
|
if (m_agent) {
|
||||||
|
|||||||
@@ -207,7 +207,6 @@ 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 = wxGetApp().getAgent()->default_lan_username();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaFilePanel::~MediaFilePanel()
|
MediaFilePanel::~MediaFilePanel()
|
||||||
@@ -467,7 +466,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
|||||||
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()) {
|
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});
|
m_machine, agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
|
||||||
fs->SetUrl(url);
|
fs->SetUrl(url);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ 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;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#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>
|
||||||
@@ -127,8 +126,6 @@ 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()
|
||||||
@@ -159,8 +156,10 @@ 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;
|
||||||
|
|
||||||
if (DevPrinterConfigUtil::get_printer_series_str(obj->printer_type) == "series_o" && BBLNetworkPlugin::instance().use_legacy_network()) {
|
auto *agent = wxGetApp().getAgent();
|
||||||
// Legacy plugin cannot support remote play for H2D, force using local mode
|
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;
|
m_remote_proto = LiveviewRemote::LVR_None;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -283,12 +282,17 @@ 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();
|
||||||
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()) {
|
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 = agent->get_local_camera_url({
|
||||||
m_lan_ip,
|
m_lan_ip,
|
||||||
m_lan_user,
|
lan_user,
|
||||||
m_lan_passwd,
|
m_lan_passwd,
|
||||||
LiveviewLocal(m_lan_proto),
|
LiveviewLocal(m_lan_proto),
|
||||||
into_u8(m_machine),
|
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()) {
|
if (m_lan_proto > LiveviewLocal::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
if (!agent) return;
|
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});
|
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});
|
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";
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ 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;
|
||||||
|
|||||||
@@ -1797,7 +1797,6 @@ void SendToPrinterDialog::show_file_transfer_error(PrintDialogStatus status, wxS
|
|||||||
if (m_url_timer && m_url_timer->IsRunning())
|
if (m_url_timer && m_url_timer->IsRunning())
|
||||||
m_url_timer->Stop();
|
m_url_timer->Stop();
|
||||||
m_connection_status = ConnectionStatus::CONNECTION_FAILED;
|
m_connection_status = ConnectionStatus::CONNECTION_FAILED;
|
||||||
GetConnection();
|
|
||||||
show_status(status);
|
show_status(status);
|
||||||
update_print_status_msg(message, false, true);
|
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;
|
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,
|
int BBLPrinterAgent::get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
|
||||||
FileTransferURLParams params)
|
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\"";
|
const std::string protocols = "\"tutk\",\"agora\"";
|
||||||
return m_cloud_agent->get_camera_url(
|
return m_cloud_agent->get_camera_url(
|
||||||
std::move(dev_id) + "|" + params.device_version + "|" + protocols,
|
std::move(dev_id) + "|" + params.device_version + "|" + protocols,
|
||||||
[callback = std::move(callback)](CameraURLResult camera_result) {
|
[callback = std::move(callback)](CameraURLResult result) {
|
||||||
if (!callback)
|
if (!callback)
|
||||||
return;
|
return;
|
||||||
FileTransferURLResult result;
|
FileTransferURLResult transfer_result;
|
||||||
result.is_success = camera_result.is_success;
|
transfer_result.is_success = result.is_success;
|
||||||
result.url = std::move(camera_result.url);
|
transfer_result.url = std::move(result.url);
|
||||||
result.error_code = camera_result.error_code;
|
transfer_result.error_code = result.error_code;
|
||||||
callback(std::move(result));
|
callback(std::move(transfer_result));
|
||||||
},
|
},
|
||||||
CameraURLParams{
|
CameraURLParams{
|
||||||
"",
|
"",
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public:
|
|||||||
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_camera_url(CameraURLParams params) override;
|
||||||
std::string get_local_file_transfer_url(const FileTransferURLParams& 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,
|
int get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
|
||||||
FileTransferURLParams params) override;
|
FileTransferURLParams params) override;
|
||||||
std::string default_lan_username() const override { return "bblp"; }
|
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 ""; }
|
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)
|
virtual int get_file_transfer_url(std::string, std::function<void(FileTransferURLResult)> callback, FileTransferURLParams)
|
||||||
{
|
{
|
||||||
if (callback)
|
if (callback)
|
||||||
|
|||||||
@@ -868,6 +868,14 @@ std::string NetworkAgent::get_local_file_transfer_url(const FileTransferURLParam
|
|||||||
return {};
|
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,
|
int NetworkAgent::get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
|
||||||
FileTransferURLParams params)
|
FileTransferURLParams params)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ public:
|
|||||||
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_camera_url(CameraURLParams params);
|
||||||
std::string get_local_file_transfer_url(const FileTransferURLParams& 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,
|
int get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
|
||||||
FileTransferURLParams params = {});
|
FileTransferURLParams params = {});
|
||||||
std::string default_lan_username() const;
|
std::string default_lan_username() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user