mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 00:07:52 -06:00
FIX: rstp proto mode & tutk state
Change-Id: I3d8b4a278426644bb716f18d7b8259032d22e444
This commit is contained in:
parent
eb3a97f55b
commit
e4d4ac01d6
5 changed files with 41 additions and 6 deletions
|
@ -1415,8 +1415,9 @@ void MachineObject::parse_version_func()
|
||||||
}
|
}
|
||||||
|
|
||||||
is_support_remote_tunnel = true;
|
is_support_remote_tunnel = true;
|
||||||
local_camera_proto = (ota_version->second.sw_ver.compare("01.03.01.04") >= 0
|
local_camera_proto = (local_rtsp_url.empty() || local_rtsp_url == "disable") ? 0
|
||||||
|| (rv1126_version != module_vers.end() && rv1126_version->second.sw_ver.compare("00.00.20.39") >= 0)) ? 2 : 0;
|
: boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3;
|
||||||
|
file_proto = 2;
|
||||||
}
|
}
|
||||||
} else if (printer_type == "C11") {
|
} else if (printer_type == "C11") {
|
||||||
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
|
if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
|
||||||
|
@ -2377,6 +2378,18 @@ int MachineObject::get_local_camera_proto()
|
||||||
return 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)
|
int MachineObject::publish_json(std::string json_str, int qos)
|
||||||
{
|
{
|
||||||
if (is_lan_mode_printer()) {
|
if (is_lan_mode_printer()) {
|
||||||
|
@ -2961,6 +2974,12 @@ int MachineObject::parse_json(std::string payload)
|
||||||
camera_resolution = jj["ipcam"]["resolution"].get<std::string>();
|
camera_resolution = jj["ipcam"]["resolution"].get<std::string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (jj["ipcam"].contains("rtsp_url")) {
|
||||||
|
local_rtsp_url = jj["ipcam"]["rtsp_url"].get<std::string>();
|
||||||
|
}
|
||||||
|
if (jj["ipcam"].contains("tutk_server")) {
|
||||||
|
tutk_state = jj["ipcam"]["tutk_server"].get<std::string>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
|
|
@ -635,6 +635,9 @@ public:
|
||||||
bool xcam_first_layer_inspector { false };
|
bool xcam_first_layer_inspector { false };
|
||||||
int xcam_first_layer_hold_count = 0;
|
int xcam_first_layer_hold_count = 0;
|
||||||
int local_camera_proto = 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 is_support_remote_tunnel{false};
|
||||||
|
|
||||||
bool xcam_ai_monitoring{ false };
|
bool xcam_ai_monitoring{ false };
|
||||||
|
@ -789,6 +792,8 @@ public:
|
||||||
bool is_support_print_with_timelapse();
|
bool is_support_print_with_timelapse();
|
||||||
bool is_camera_busy_off();
|
bool is_camera_busy_off();
|
||||||
int get_local_camera_proto();
|
int get_local_camera_proto();
|
||||||
|
bool has_local_file_proto();
|
||||||
|
bool has_remote_file_proto();
|
||||||
|
|
||||||
/* Msg for display MsgFn */
|
/* Msg for display MsgFn */
|
||||||
typedef std::function<void(std::string topic, std::string payload)> MsgFn;
|
typedef std::function<void(std::string topic, std::string payload)> MsgFn;
|
||||||
|
|
|
@ -203,8 +203,8 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||||
m_lan_mode = obj->is_lan_mode_printer();
|
m_lan_mode = obj->is_lan_mode_printer();
|
||||||
m_lan_ip = obj->dev_ip;
|
m_lan_ip = obj->dev_ip;
|
||||||
m_lan_passwd = obj->get_access_code();
|
m_lan_passwd = obj->get_access_code();
|
||||||
m_local_support = obj->is_function_supported(PrinterFunction::FUNC_LOCAL_TUNNEL);
|
m_local_support = obj->has_local_file_proto();
|
||||||
m_remote_support = obj->is_function_supported(PrinterFunction::FUNC_REMOTE_TUNNEL);
|
m_remote_support = obj->has_remote_file_proto();
|
||||||
} else {
|
} else {
|
||||||
m_supported = false;
|
m_supported = false;
|
||||||
m_lan_mode = false;
|
m_lan_mode = false;
|
||||||
|
|
|
@ -85,12 +85,14 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||||
m_lan_passwd = obj->get_access_code();
|
m_lan_passwd = obj->get_access_code();
|
||||||
m_remote_support = obj->is_function_supported(PrinterFunction::FUNC_REMOTE_TUNNEL);
|
m_remote_support = obj->is_function_supported(PrinterFunction::FUNC_REMOTE_TUNNEL);
|
||||||
m_device_busy = obj->is_camera_busy_off();
|
m_device_busy = obj->is_camera_busy_off();
|
||||||
|
m_tutk_state = obj->tutk_state;
|
||||||
} else {
|
} else {
|
||||||
m_camera_exists = false;
|
m_camera_exists = false;
|
||||||
m_lan_mode = false;
|
m_lan_mode = false;
|
||||||
m_lan_proto = 0;
|
m_lan_proto = 0;
|
||||||
m_lan_ip.clear();
|
m_lan_ip.clear();
|
||||||
m_lan_passwd.clear();
|
m_lan_passwd.clear();
|
||||||
|
m_tutk_state.clear();
|
||||||
m_remote_support = true;
|
m_remote_support = true;
|
||||||
m_device_busy = false;
|
m_device_busy = false;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +159,9 @@ void MediaPlayCtrl::Play()
|
||||||
if (m_lan_proto == 1)
|
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;
|
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)
|
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;
|
m_last_state = MEDIASTATE_LOADING;
|
||||||
SetStatus(_L("Loading..."));
|
SetStatus(_L("Loading..."));
|
||||||
if (wxGetApp().app_config->get("internal_developer_mode") == "true") {
|
if (wxGetApp().app_config->get("internal_developer_mode") == "true") {
|
||||||
|
@ -253,6 +257,7 @@ void MediaPlayCtrl::Stop(wxString const &msg)
|
||||||
m_failed_code = 0;
|
m_failed_code = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (last_state != wxMEDIASTATE_PLAYING && 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_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end()
|
||||||
&& (m_user_triggered || m_failed_retry > 3)) {
|
&& (m_user_triggered || m_failed_retry > 3)) {
|
||||||
|
@ -262,8 +267,11 @@ void MediaPlayCtrl::Stop(wxString const &msg)
|
||||||
j["dev_ip"] = m_lan_ip;
|
j["dev_ip"] = m_lan_ip;
|
||||||
j["result"] = "failed";
|
j["result"] = "failed";
|
||||||
j["user_triggered"] = m_user_triggered;
|
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;
|
j["code"] = m_failed_code;
|
||||||
|
if (remote)
|
||||||
|
j["tutk_state"] = m_tutk_state;
|
||||||
j["msg"] = into_u8(msg);
|
j["msg"] = into_u8(msg);
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
if (agent)
|
if (agent)
|
||||||
|
@ -271,6 +279,7 @@ void MediaPlayCtrl::Stop(wxString const &msg)
|
||||||
m_last_failed_codes.insert(m_failed_code);
|
m_last_failed_codes.insert(m_failed_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_url.clear();
|
||||||
++m_failed_retry;
|
++m_failed_retry;
|
||||||
if (m_failed_code != 0 && (!m_remote_support || m_lan_mode) && (m_failed_retry > 1 || m_user_triggered)) {
|
if (m_failed_code != 0 && (!m_remote_support || m_lan_mode) && (m_failed_retry > 1 || m_user_triggered)) {
|
||||||
m_next_retry = wxDateTime(); // stop retry
|
m_next_retry = wxDateTime(); // stop retry
|
||||||
|
@ -423,6 +432,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event)
|
||||||
|
|
||||||
m_failed_retry = 0;
|
m_failed_retry = 0;
|
||||||
m_failed_code = 0;
|
m_failed_code = 0;
|
||||||
|
m_disable_lan = false;
|
||||||
boost::unique_lock lock(m_mutex);
|
boost::unique_lock lock(m_mutex);
|
||||||
m_tasks.push_back("<play>");
|
m_tasks.push_back("<play>");
|
||||||
m_cond.notify_all();
|
m_cond.notify_all();
|
||||||
|
|
|
@ -73,6 +73,7 @@ private:
|
||||||
std::string m_lan_ip;
|
std::string m_lan_ip;
|
||||||
std::string m_lan_user;
|
std::string m_lan_user;
|
||||||
std::string m_lan_passwd;
|
std::string m_lan_passwd;
|
||||||
|
std::string m_tutk_state;
|
||||||
bool m_camera_exists = false;
|
bool m_camera_exists = false;
|
||||||
bool m_lan_mode = false;
|
bool m_lan_mode = false;
|
||||||
bool m_remote_support = false;
|
bool m_remote_support = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue