From 1162fa840e792f81cb6fc0f060f059de151b272a Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Sun, 18 Feb 2024 14:59:59 +0800 Subject: [PATCH] FIX: liveview error message Change-Id: Ie437e07916d7b6feae2dbcfa166c4e73bdcf31a1 Jira: STUDIO-6107 --- src/slic3r/GUI/DeviceManager.cpp | 6 +++--- src/slic3r/GUI/DeviceManager.hpp | 1 + src/slic3r/GUI/MediaPlayCtrl.cpp | 15 ++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index c26e32fb3..9893c09a7 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -3563,8 +3563,8 @@ int MachineObject::parse_json(std::string payload) camera_resolution_supported.swap(resolution_supported); } if (ipcam.contains("liveview")) { - char const *local_protos[] = { "none", "local", "rtsps", "rtsp" }; - liveview_local = enum_index_of(ipcam["liveview"].value("local", "none").c_str(), local_protos, 4, LiveviewLocal::LVL_None); + char const *local_protos[] = {"none", "disabled", "local", "rtsps", "rtsp"}; + liveview_local = enum_index_of(ipcam["liveview"].value("local", "none").c_str(), local_protos, 5, LiveviewLocal::LVL_None); liveview_remote = ipcam["liveview"].value("remote", "disabled") == "enabled"; } if (ipcam.contains("file")) { @@ -3576,7 +3576,7 @@ int MachineObject::parse_json(std::string payload) if (ipcam.contains("rtsp_url")) { local_rtsp_url = ipcam["rtsp_url"].get(); liveview_local = local_rtsp_url.empty() ? LVL_None : local_rtsp_url == "disable" - ? LVL_None : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? LVL_Rtsps : LVL_Rtsp; + ? LVL_Disable : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? LVL_Rtsps : LVL_Rtsp; } if (ipcam.contains("tutk_server")) { tutk_state = ipcam["tutk_server"].get(); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index f5270c19b..388f68124 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -697,6 +697,7 @@ public: std::string tutk_state; enum LiveviewLocal { LVL_None, + LVL_Disable, LVL_Local, LVL_Rtsps, LVL_Rtsp diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index 97ec3e3b7..436a6ff62 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -263,7 +263,7 @@ void MediaPlayCtrl::Play() m_button_play->SetIcon("media_stop"); NetworkAgent *agent = wxGetApp().getAgent(); std::string agent_version = agent ? agent->get_version() : ""; - if (m_lan_proto > MachineObject::LVL_None && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { + if (m_lan_proto > MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { m_disable_lan = m_remote_support && !m_lan_mode; // try remote next time if (m_lan_proto == MachineObject::LVL_Local) m_url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; @@ -279,13 +279,18 @@ void MediaPlayCtrl::Play() return; } + // m_lan_mode && m_lan_proto > LVL_Disable (use local tunnel) + // m_lan_mode && m_lan_proto == LVL_Disable (*) // m_lan_mode && m_lan_proto == LVL_None (x) - // !m_lan_mode && m_remote_support + // !m_lan_mode && m_remote_support (go on) // !m_lan_mode && !m_remote_support && m_lan_proto > LVL_None (use local tunnel) + // !m_lan_mode && !m_remote_support && m_lan_proto == LVL_Disable (*) // !m_lan_mode && !m_remote_support && m_lan_proto == LVL_None (x) - if (m_lan_proto == MachineObject::LVL_None && !m_remote_support) { - Stop(_L("Please update the printer firmware and try again.")); + if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support)) { + Stop(m_lan_proto == MachineObject::LVL_None + ? _L("Problem occured. Please update the printer firmware and try again.") + : _L("LAN Only Liveview is off. Please turn on the liveview on printer screen.")); return; } @@ -501,7 +506,7 @@ void MediaPlayCtrl::ToggleStream() wxGetApp().app_config->set("not_show_vcamera_stop_prev", "1"); if (res == wxID_CANCEL) return; } - if (m_lan_proto > MachineObject::LVL_None && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { + if (m_lan_proto > MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { std::string url; if (m_lan_proto == MachineObject::LVL_Local) url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;