FIX: liveview error message

Change-Id: Ie437e07916d7b6feae2dbcfa166c4e73bdcf31a1
Jira: STUDIO-6107
This commit is contained in:
chunmao.guo 2024-02-18 14:59:59 +08:00 committed by Lane.Wei
parent 87a98ce1fa
commit 1162fa840e
3 changed files with 14 additions and 8 deletions

View File

@ -3563,8 +3563,8 @@ int MachineObject::parse_json(std::string payload)
camera_resolution_supported.swap(resolution_supported); camera_resolution_supported.swap(resolution_supported);
} }
if (ipcam.contains("liveview")) { if (ipcam.contains("liveview")) {
char const *local_protos[] = { "none", "local", "rtsps", "rtsp" }; char const *local_protos[] = {"none", "disabled", "local", "rtsps", "rtsp"};
liveview_local = enum_index_of(ipcam["liveview"].value<std::string>("local", "none").c_str(), local_protos, 4, LiveviewLocal::LVL_None); liveview_local = enum_index_of(ipcam["liveview"].value<std::string>("local", "none").c_str(), local_protos, 5, LiveviewLocal::LVL_None);
liveview_remote = ipcam["liveview"].value<std::string>("remote", "disabled") == "enabled"; liveview_remote = ipcam["liveview"].value<std::string>("remote", "disabled") == "enabled";
} }
if (ipcam.contains("file")) { if (ipcam.contains("file")) {
@ -3576,7 +3576,7 @@ int MachineObject::parse_json(std::string payload)
if (ipcam.contains("rtsp_url")) { if (ipcam.contains("rtsp_url")) {
local_rtsp_url = ipcam["rtsp_url"].get<std::string>(); local_rtsp_url = ipcam["rtsp_url"].get<std::string>();
liveview_local = local_rtsp_url.empty() ? LVL_None : local_rtsp_url == "disable" 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")) { if (ipcam.contains("tutk_server")) {
tutk_state = ipcam["tutk_server"].get<std::string>(); tutk_state = ipcam["tutk_server"].get<std::string>();

View File

@ -697,6 +697,7 @@ public:
std::string tutk_state; std::string tutk_state;
enum LiveviewLocal { enum LiveviewLocal {
LVL_None, LVL_None,
LVL_Disable,
LVL_Local, LVL_Local,
LVL_Rtsps, LVL_Rtsps,
LVL_Rtsp LVL_Rtsp

View File

@ -263,7 +263,7 @@ void MediaPlayCtrl::Play()
m_button_play->SetIcon("media_stop"); m_button_play->SetIcon("media_stop");
NetworkAgent *agent = wxGetApp().getAgent(); NetworkAgent *agent = wxGetApp().getAgent();
std::string agent_version = agent ? agent->get_version() : ""; 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 m_disable_lan = m_remote_support && !m_lan_mode; // try remote next time
if (m_lan_proto == MachineObject::LVL_Local) if (m_lan_proto == MachineObject::LVL_Local)
m_url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; 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; 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_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_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) // !m_lan_mode && !m_remote_support && m_lan_proto == LVL_None (x)
if (m_lan_proto == MachineObject::LVL_None && !m_remote_support) { if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support)) {
Stop(_L("Please update the printer firmware and try again.")); 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; return;
} }
@ -501,7 +506,7 @@ void MediaPlayCtrl::ToggleStream()
wxGetApp().app_config->set("not_show_vcamera_stop_prev", "1"); wxGetApp().app_config->set("not_show_vcamera_stop_prev", "1");
if (res == wxID_CANCEL) return; 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; std::string url;
if (m_lan_proto == MachineObject::LVL_Local) if (m_lan_proto == MachineObject::LVL_Local)
url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;