diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 2dc370dbd7..9de72a5f79 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1415,8 +1415,9 @@ void MachineObject::parse_version_func() } is_support_remote_tunnel = true; - local_camera_proto = (ota_version->second.sw_ver.compare("01.03.01.04") >= 0 - || (rv1126_version != module_vers.end() && rv1126_version->second.sw_ver.compare("00.00.20.39") >= 0)) ? 2 : 0; + local_camera_proto = (local_rtsp_url.empty() || local_rtsp_url == "disable") ? 0 + : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3; + file_proto = 2; } } else if (printer_type == "C11") { if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) { @@ -2377,6 +2378,18 @@ int MachineObject::get_local_camera_proto() return local_camera_proto; } +bool MachineObject::has_local_file_proto() +{ + parse_version_func(); + return file_proto & 1; +} + +bool MachineObject::has_remote_file_proto() +{ + parse_version_func(); + return file_proto & 2; +} + int MachineObject::publish_json(std::string json_str, int qos) { if (is_lan_mode_printer()) { @@ -2961,6 +2974,12 @@ int MachineObject::parse_json(std::string payload) camera_resolution = jj["ipcam"]["resolution"].get(); } } + if (jj["ipcam"].contains("rtsp_url")) { + local_rtsp_url = jj["ipcam"]["rtsp_url"].get(); + } + if (jj["ipcam"].contains("tutk_server")) { + tutk_state = jj["ipcam"]["tutk_server"].get(); + } } } catch (...) { diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 1231acf9ab..06bbd657a8 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -635,6 +635,9 @@ public: bool xcam_first_layer_inspector { false }; int xcam_first_layer_hold_count = 0; int local_camera_proto = 0; + int file_proto = 0; + std::string local_rtsp_url; + std::string tutk_state; bool is_support_remote_tunnel{false}; bool xcam_ai_monitoring{ false }; @@ -789,6 +792,8 @@ public: bool is_support_print_with_timelapse(); bool is_camera_busy_off(); int get_local_camera_proto(); + bool has_local_file_proto(); + bool has_remote_file_proto(); /* Msg for display MsgFn */ typedef std::function MsgFn; diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index 9f118023de..dbbec2c017 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -203,8 +203,8 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj) m_lan_mode = obj->is_lan_mode_printer(); m_lan_ip = obj->dev_ip; m_lan_passwd = obj->get_access_code(); - m_local_support = obj->is_function_supported(PrinterFunction::FUNC_LOCAL_TUNNEL); - m_remote_support = obj->is_function_supported(PrinterFunction::FUNC_REMOTE_TUNNEL); + m_local_support = obj->has_local_file_proto(); + m_remote_support = obj->has_remote_file_proto(); } else { m_supported = false; m_lan_mode = false; diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index afe62596be..91a9718fba 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -85,12 +85,14 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj) m_lan_passwd = obj->get_access_code(); m_remote_support = obj->is_function_supported(PrinterFunction::FUNC_REMOTE_TUNNEL); m_device_busy = obj->is_camera_busy_off(); + m_tutk_state = obj->tutk_state; } else { m_camera_exists = false; m_lan_mode = false; m_lan_proto = 0; m_lan_ip.clear(); m_lan_passwd.clear(); + m_tutk_state.clear(); m_remote_support = true; m_device_busy = false; } @@ -157,7 +159,9 @@ void MediaPlayCtrl::Play() if (m_lan_proto == 1) m_url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd + "&device=" + m_machine + "&version=" + agent_version; else if (m_lan_proto == 2) - m_url = "bambu:///rtsps___" + m_lan_user +":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?device=" + m_machine + "&version=" + agent_version; + m_url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?device=" + m_machine + "&version=" + agent_version; + else if (m_lan_proto == 3) + m_url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?device=" + m_machine + "&version=" + agent_version; m_last_state = MEDIASTATE_LOADING; SetStatus(_L("Loading...")); if (wxGetApp().app_config->get("internal_developer_mode") == "true") { @@ -253,6 +257,7 @@ void MediaPlayCtrl::Stop(wxString const &msg) m_failed_code = 0; } + if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0 && m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end() && (m_user_triggered || m_failed_retry > 3)) { @@ -262,8 +267,11 @@ void MediaPlayCtrl::Stop(wxString const &msg) j["dev_ip"] = m_lan_ip; j["result"] = "failed"; j["user_triggered"] = m_user_triggered; - j["tunnel"] = m_url.find("/local/") == std::string::npos ? "remote" : "local"; + bool remote = m_url.find("/local/") == wxString::npos; + j["tunnel"] = remote ? "remote" : "local"; j["code"] = m_failed_code; + if (remote) + j["tutk_state"] = m_tutk_state; j["msg"] = into_u8(msg); NetworkAgent *agent = wxGetApp().getAgent(); if (agent) @@ -271,6 +279,7 @@ void MediaPlayCtrl::Stop(wxString const &msg) m_last_failed_codes.insert(m_failed_code); } + m_url.clear(); ++m_failed_retry; if (m_failed_code != 0 && (!m_remote_support || m_lan_mode) && (m_failed_retry > 1 || m_user_triggered)) { m_next_retry = wxDateTime(); // stop retry @@ -423,6 +432,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) m_failed_retry = 0; m_failed_code = 0; + m_disable_lan = false; boost::unique_lock lock(m_mutex); m_tasks.push_back(""); m_cond.notify_all(); diff --git a/src/slic3r/GUI/MediaPlayCtrl.h b/src/slic3r/GUI/MediaPlayCtrl.h index 3710e268ad..77188988c5 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.h +++ b/src/slic3r/GUI/MediaPlayCtrl.h @@ -73,6 +73,7 @@ private: std::string m_lan_ip; std::string m_lan_user; std::string m_lan_passwd; + std::string m_tutk_state; bool m_camera_exists = false; bool m_lan_mode = false; bool m_remote_support = false;