mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: live_view: check camera exist and show ttcode request error
Change-Id: I036006ec4efddf0a5801a6b1d304c9e81555a284
This commit is contained in:
parent
ccd7b7fd7b
commit
e87860e033
2 changed files with 23 additions and 12 deletions
|
@ -71,11 +71,13 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
|||
{
|
||||
std::string machine = obj ? obj->dev_id : "";
|
||||
if (obj && obj->is_function_supported(PrinterFunction::FUNC_CAMERA_VIDEO)) {
|
||||
m_lan_mode = obj->is_lan_mode_printer();
|
||||
m_camera_exists = obj->has_ipcam;
|
||||
m_lan_mode = obj->is_lan_mode_printer();
|
||||
m_lan_ip = obj->is_function_supported(PrinterFunction::FUNC_LOCAL_TUNNEL) ? obj->dev_ip : "";
|
||||
m_lan_passwd = obj->access_code;
|
||||
m_lan_passwd = obj->is_function_supported(PrinterFunction::FUNC_LOCAL_TUNNEL) ? obj->access_code : "";
|
||||
m_tutk_support = obj->is_function_supported(PrinterFunction::FUNC_REMOTE_TUNNEL);
|
||||
} else {
|
||||
m_camera_exists = false;
|
||||
m_lan_mode = false;
|
||||
m_lan_ip.clear();
|
||||
m_lan_passwd.clear();
|
||||
|
@ -102,12 +104,15 @@ void MediaPlayCtrl::Play()
|
|||
return;
|
||||
if (!IsShownOnScreen())
|
||||
return;
|
||||
if (m_last_state != MEDIASTATE_IDLE) {
|
||||
return;
|
||||
}
|
||||
if (m_machine.empty()) {
|
||||
Stop();
|
||||
SetStatus(_L("Initialize failed (No Device)!"));
|
||||
return;
|
||||
}
|
||||
if (m_last_state != MEDIASTATE_IDLE) {
|
||||
if (!m_camera_exists) {
|
||||
SetStatus(_L("Initialize failed (No Camera Device)!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -135,9 +140,15 @@ void MediaPlayCtrl::Play()
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_lan_mode && !m_tutk_support) { // not support tutk
|
||||
Stop();
|
||||
SetStatus(_L("Initialize failed (Not supported)!"));
|
||||
if (m_lan_mode) {
|
||||
SetStatus(m_lan_passwd.empty()
|
||||
? _L("Initialize failed (Not supported with LAN-only mode)!")
|
||||
: _L("Initialize failed (Not accessible in LAN-only mode)!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_tutk_support) { // not support tutk
|
||||
SetStatus(_L("Initialize failed (Not supported without remote video tunnel)!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,14 +156,13 @@ void MediaPlayCtrl::Play()
|
|||
if (agent) {
|
||||
agent->get_camera_url(m_machine, [this, m = m_machine](std::string url) {
|
||||
BOOST_LOG_TRIVIAL(info) << "camera_url: " << url;
|
||||
if (m != m_machine) return;
|
||||
CallAfter([this, url] {
|
||||
CallAfter([this, m, url] {
|
||||
if (m != m_machine) return;
|
||||
m_url = url;
|
||||
if (m_last_state == MEDIASTATE_INITIALIZING) {
|
||||
if (url.empty()) {
|
||||
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
|
||||
Stop();
|
||||
m_failed_code = 1;
|
||||
SetStatus(_L("Initialize failed [%d]!"));
|
||||
SetStatus(wxString::Format(_L("Initialize failed (%s)!"), url.empty() ? _L("Network unreachable") : from_u8(url)));
|
||||
} else {
|
||||
m_last_state = MEDIASTATE_LOADING;
|
||||
SetStatus(_L("Loading..."));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue