ENH: liveview remote protocols with agora
Change-Id: Id86aa4bfa5f5e09675a6fe627668c63d20c7d1bf Jira: none
This commit is contained in:
parent
07e4aa213a
commit
46eba0048b
|
@ -6,10 +6,10 @@
|
||||||
"resolution_supported": [ "720p", "1080p" ],
|
"resolution_supported": [ "720p", "1080p" ],
|
||||||
"virtual_camera": "enabled",
|
"virtual_camera": "enabled",
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled",
|
"remote": "tutk",
|
||||||
"model_download": "enabled"
|
"model_download": "enabled"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
"resolution_supported": [ "720p", "1080p" ],
|
"resolution_supported": [ "720p", "1080p" ],
|
||||||
"virtual_camera": "enabled",
|
"virtual_camera": "enabled",
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled",
|
"remote": "tutk",
|
||||||
"model_download": "enabled"
|
"model_download": "enabled"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
"print": {
|
"print": {
|
||||||
"ipcam": {
|
"ipcam": {
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
"print": {
|
"print": {
|
||||||
"ipcam": {
|
"ipcam": {
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support_user_preset":true
|
"support_user_preset":true
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"print": {
|
"print": {
|
||||||
"ipcam": {
|
"ipcam": {
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support_mqtt_alive":true,
|
"support_mqtt_alive":true,
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
"print": {
|
"print": {
|
||||||
"ipcam": {
|
"ipcam": {
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support_user_preset":true
|
"support_user_preset":true
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
"resolution_supported": [ "720p", "1080p" ],
|
"resolution_supported": [ "720p", "1080p" ],
|
||||||
"virtual_camera": "enabled",
|
"virtual_camera": "enabled",
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled",
|
"remote": "tutk",
|
||||||
"model_download": "enabled"
|
"model_download": "enabled"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"resolution_supported": [ "720p" ],
|
"resolution_supported": [ "720p" ],
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"local": "local",
|
"local": "local",
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support_motor_noise_cali":true,
|
"support_motor_noise_cali":true,
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
"print": {
|
"print": {
|
||||||
"ipcam": {
|
"ipcam": {
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support_user_preset":true
|
"support_user_preset":true
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"resolution_supported": [ "720p" ],
|
"resolution_supported": [ "720p" ],
|
||||||
"liveview": {
|
"liveview": {
|
||||||
"local": "local",
|
"local": "local",
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"support_motor_noise_cali":true,
|
"support_motor_noise_cali":true,
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
"print": {
|
"print": {
|
||||||
"ipcam": {
|
"ipcam": {
|
||||||
"file": {
|
"file": {
|
||||||
"remote": "enabled"
|
"remote": "tutk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1420,6 +1420,10 @@ void MachineObject::parse_status(int flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11);
|
sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11);
|
||||||
|
|
||||||
|
is_support_agora = ((flag >> 30) & 0x1) != 0;
|
||||||
|
if (is_support_agora)
|
||||||
|
is_support_tunnel_mqtt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintingSpeedLevel MachineObject::_parse_printing_speed_lvl(int lvl)
|
PrintingSpeedLevel MachineObject::_parse_printing_speed_lvl(int lvl)
|
||||||
|
@ -2945,7 +2949,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key_field_only) {
|
if (!key_field_only) {
|
||||||
if (!DeviceManager::EnableMultiMachine) {
|
if (!DeviceManager::EnableMultiMachine && !is_support_agora) {
|
||||||
if (jj.contains("support_tunnel_mqtt")) {
|
if (jj.contains("support_tunnel_mqtt")) {
|
||||||
if (jj["support_tunnel_mqtt"].is_boolean()) {
|
if (jj["support_tunnel_mqtt"].is_boolean()) {
|
||||||
is_support_tunnel_mqtt = jj["support_tunnel_mqtt"].get<bool>();
|
is_support_tunnel_mqtt = jj["support_tunnel_mqtt"].get<bool>();
|
||||||
|
@ -3740,11 +3744,18 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||||
if (ipcam.contains("liveview")) {
|
if (ipcam.contains("liveview")) {
|
||||||
char const *local_protos[] = {"none", "disabled", "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, 5, 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";
|
char const *remote_protos[] = {"none", "tutk", "agora", "tutk_agaro"};
|
||||||
|
liveview_remote = enum_index_of(ipcam["liveview"].value<std::string>("remote", "none").c_str(), remote_protos, 4, LiveviewRemote::LVR_None);
|
||||||
|
if (is_support_agora)
|
||||||
|
liveview_remote = liveview_remote == LVR_None ? LVR_Agora : liveview_remote == LVR_Tutk ? LVR_TutkAgora : liveview_remote;
|
||||||
}
|
}
|
||||||
if (ipcam.contains("file")) {
|
if (ipcam.contains("file")) {
|
||||||
file_local = ipcam["file"].value<std::string>("local", "disabled") == "enabled";
|
char const *local_protos[] = {"none", "local"};
|
||||||
file_remote = ipcam["file"].value<std::string>("remote", "disabled") == "enabled";
|
file_local = enum_index_of(ipcam["file"].value<std::string>("local", "none").c_str(), local_protos, 2, FileLocal::FL_None);
|
||||||
|
char const *remote_protos[] = {"none", "tutk", "agora", "tutk_agaro"};
|
||||||
|
file_remote = enum_index_of(ipcam["file"].value<std::string>("remote", "none").c_str(), remote_protos, 4, FileRemote::FR_None);
|
||||||
|
if (is_support_agora)
|
||||||
|
file_remote = file_remote == FR_None ? FR_Agora : file_remote == FR_Tutk ? FR_TutkAgora : file_remote;
|
||||||
file_model_download = ipcam["file"].value<std::string>("model_download", "disabled") == "enabled";
|
file_model_download = ipcam["file"].value<std::string>("model_download", "disabled") == "enabled";
|
||||||
}
|
}
|
||||||
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
|
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
|
||||||
|
|
|
@ -708,9 +708,22 @@ public:
|
||||||
LVL_Rtsps,
|
LVL_Rtsps,
|
||||||
LVL_Rtsp
|
LVL_Rtsp
|
||||||
} liveview_local{ LVL_None };
|
} liveview_local{ LVL_None };
|
||||||
bool liveview_remote{false};
|
enum LiveviewRemote {
|
||||||
bool file_local{false};
|
LVR_None,
|
||||||
bool file_remote{false};
|
LVR_Tutk,
|
||||||
|
LVR_Agora,
|
||||||
|
LVR_TutkAgora
|
||||||
|
} liveview_remote{ LVR_None };
|
||||||
|
enum FileLocal {
|
||||||
|
FL_None,
|
||||||
|
FL_Local
|
||||||
|
} file_local{ FL_None };
|
||||||
|
enum FileRemote {
|
||||||
|
FR_None,
|
||||||
|
FR_Tutk,
|
||||||
|
FR_Agora,
|
||||||
|
FR_TutkAgora
|
||||||
|
} file_remote{ FR_None };
|
||||||
bool file_model_download{false};
|
bool file_model_download{false};
|
||||||
bool virtual_camera{false};
|
bool virtual_camera{false};
|
||||||
|
|
||||||
|
@ -763,6 +776,7 @@ public:
|
||||||
bool is_support_nozzle_blob_detection{false};
|
bool is_support_nozzle_blob_detection{false};
|
||||||
bool is_support_air_print_detection{false};
|
bool is_support_air_print_detection{false};
|
||||||
bool is_support_filament_setting_inprinting{false};
|
bool is_support_filament_setting_inprinting{false};
|
||||||
|
bool is_support_agora{false};
|
||||||
|
|
||||||
int nozzle_max_temperature = -1;
|
int nozzle_max_temperature = -1;
|
||||||
int bed_temperature_limit = -1;
|
int bed_temperature_limit = -1;
|
||||||
|
|
|
@ -1351,8 +1351,10 @@ void GUI_App::post_init()
|
||||||
for (auto& it : boost::filesystem::directory_iterator(log_folder)) {
|
for (auto& it : boost::filesystem::directory_iterator(log_folder)) {
|
||||||
auto temp_path = it.path();
|
auto temp_path = it.path();
|
||||||
try {
|
try {
|
||||||
|
if (it.status().type() == boost::filesystem::regular_file) {
|
||||||
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
|
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
|
||||||
files_vec.push_back({ lw_t, temp_path.filename().string() });
|
files_vec.push_back({ lw_t, temp_path.filename().string() });
|
||||||
|
}
|
||||||
} catch (const std::exception &ex) {
|
} catch (const std::exception &ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,8 +221,8 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||||
m_dev_ver = obj->get_ota_version();
|
m_dev_ver = obj->get_ota_version();
|
||||||
m_device_busy = obj->is_camera_busy_off();
|
m_device_busy = obj->is_camera_busy_off();
|
||||||
m_sdcard_exist = obj->has_sdcard();
|
m_sdcard_exist = obj->has_sdcard();
|
||||||
m_local_support = obj->file_local;
|
m_local_proto = obj->file_local;
|
||||||
m_remote_support = obj->file_remote;
|
m_remote_proto = obj->file_remote;
|
||||||
m_model_download_support = obj->file_model_download;
|
m_model_download_support = obj->file_model_download;
|
||||||
} else {
|
} else {
|
||||||
m_lan_mode = false;
|
m_lan_mode = false;
|
||||||
|
@ -231,13 +231,13 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||||
m_dev_ver.clear();
|
m_dev_ver.clear();
|
||||||
m_sdcard_exist = false;
|
m_sdcard_exist = false;
|
||||||
m_device_busy = false;
|
m_device_busy = false;
|
||||||
m_local_support = false;
|
m_local_proto = 0;
|
||||||
m_remote_support = false;
|
m_remote_proto = 0;
|
||||||
m_model_download_support = false;
|
m_model_download_support = false;
|
||||||
}
|
}
|
||||||
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
|
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
|
||||||
if (machine == m_machine) {
|
if (machine == m_machine) {
|
||||||
if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_support || m_remote_support))) {
|
if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_proto || m_remote_proto))) {
|
||||||
auto fs = m_image_grid->GetFileSystem();
|
auto fs = m_image_grid->GetFileSystem();
|
||||||
if (fs) fs->Retry();
|
if (fs) fs->Retry();
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_waiting_enable = false;
|
m_waiting_enable = false;
|
||||||
if (!m_local_support && !m_remote_support) {
|
if (!m_local_proto && !m_remote_proto) {
|
||||||
m_waiting_support = true;
|
m_waiting_support = true;
|
||||||
m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in SD card is not supported in current firmware. Please update the printer firmware."));
|
m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in SD card is not supported in current firmware. Please update the printer firmware."));
|
||||||
fs->SetUrl("0");
|
fs->SetUrl("0");
|
||||||
|
@ -471,7 +471,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||||
m_waiting_support = false;
|
m_waiting_support = false;
|
||||||
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_mode || !m_remote_support) && m_local_support && !m_lan_ip.empty()) {
|
if ((m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
|
||||||
std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
|
std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
|
||||||
url += "&device=" + m_machine;
|
url += "&device=" + m_machine;
|
||||||
url += "&net_ver=" + agent_version;
|
url += "&net_ver=" + agent_version;
|
||||||
|
@ -481,7 +481,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||||
fs->SetUrl(url);
|
fs->SetUrl(url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!m_remote_support && m_local_support) { // not support tutk
|
if (!m_remote_proto && m_local_proto) { // not support tutk
|
||||||
m_image_grid->SetStatus(m_bmp_failed, _L("Please enter the IP of printer to connect."));
|
m_image_grid->SetStatus(m_bmp_failed, _L("Please enter the IP of printer to connect."));
|
||||||
fs->SetUrl("0");
|
fs->SetUrl("0");
|
||||||
fs.reset();
|
fs.reset();
|
||||||
|
@ -497,12 +497,14 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (agent) {
|
if (agent) {
|
||||||
agent->get_camera_url(m_machine,
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
[this, wfs, m = m_machine, v = agent->get_version(), dv = m_dev_ver](std::string url) {
|
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||||
|
[this, wfs, m = m_machine, v = agent->get_version(), dv = m_dev_ver, agent](std::string url) {
|
||||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
url += "&device=" + m;
|
url += "&device=" + m;
|
||||||
url += "&net_ver=" + v;
|
url += "&net_ver=" + v;
|
||||||
url += "&dev_ver=" + dv;
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&network_agent=" + boost::lexical_cast<std::string>(agent->get_network_agent());
|
||||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,8 @@ private:
|
||||||
std::string m_dev_ver;
|
std::string m_dev_ver;
|
||||||
bool m_lan_mode = false;
|
bool m_lan_mode = false;
|
||||||
bool m_sdcard_exist = false;
|
bool m_sdcard_exist = false;
|
||||||
bool m_local_support = false;
|
int m_local_proto = false;
|
||||||
bool m_remote_support = false;
|
int m_remote_proto = false;
|
||||||
bool m_model_download_support = false;
|
bool m_model_download_support = false;
|
||||||
bool m_device_busy = false;
|
bool m_device_busy = false;
|
||||||
bool m_waiting_enable = false;
|
bool m_waiting_enable = false;
|
||||||
|
|
|
@ -156,7 +156,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||||
m_dev_ver = obj->get_ota_version();
|
m_dev_ver = obj->get_ota_version();
|
||||||
m_lan_mode = obj->is_lan_mode_printer();
|
m_lan_mode = obj->is_lan_mode_printer();
|
||||||
m_lan_proto = obj->liveview_local;
|
m_lan_proto = obj->liveview_local;
|
||||||
m_remote_support = obj->liveview_remote;
|
m_remote_proto = obj->liveview_remote;
|
||||||
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_device_busy = obj->is_camera_busy_off();
|
m_device_busy = obj->is_camera_busy_off();
|
||||||
|
@ -169,7 +169,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||||
m_lan_passwd.clear();
|
m_lan_passwd.clear();
|
||||||
m_dev_ver.clear();
|
m_dev_ver.clear();
|
||||||
m_tutk_state.clear();
|
m_tutk_state.clear();
|
||||||
m_remote_support = false;
|
m_remote_proto = 0;
|
||||||
m_device_busy = false;
|
m_device_busy = false;
|
||||||
}
|
}
|
||||||
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
|
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
|
||||||
|
@ -290,8 +290,8 @@ void MediaPlayCtrl::Play()
|
||||||
|
|
||||||
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_Disable && (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_proto) && !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_proto && !m_lan_mode; // try remote next time
|
||||||
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;
|
||||||
|
@ -314,12 +314,12 @@ void MediaPlayCtrl::Play()
|
||||||
// m_lan_mode && m_lan_proto > LVL_Disable (use local tunnel)
|
// 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_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 (go on)
|
// !m_lan_mode && m_remote_proto (go on)
|
||||||
// !m_lan_mode && !m_remote_support && m_lan_proto > LVL_None (use local tunnel)
|
// !m_lan_mode && !m_remote_proto && m_lan_proto > LVL_None (use local tunnel)
|
||||||
// !m_lan_mode && !m_remote_support && m_lan_proto == LVL_Disable (*)
|
// !m_lan_mode && !m_remote_proto && m_lan_proto == LVL_Disable (*)
|
||||||
// !m_lan_mode && !m_remote_support && m_lan_proto == LVL_None (x)
|
// !m_lan_mode && !m_remote_proto && m_lan_proto == LVL_None (x)
|
||||||
|
|
||||||
if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support)) {
|
if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_proto)) {
|
||||||
Stop(m_lan_proto == MachineObject::LVL_None
|
Stop(m_lan_proto == MachineObject::LVL_None
|
||||||
? _L("Problem occured. Please update the printer firmware and try again.")
|
? _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."));
|
: _L("LAN Only Liveview is off. Please turn on the liveview on printer screen."));
|
||||||
|
@ -343,12 +343,14 @@ void MediaPlayCtrl::Play()
|
||||||
m_play_timer = std::chrono::system_clock::now();
|
m_play_timer = std::chrono::system_clock::now();
|
||||||
|
|
||||||
if (agent) {
|
if (agent) {
|
||||||
agent->get_camera_url(m_machine,
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
[this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) {
|
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||||
|
[this, m = m_machine, v = agent_version, dv = m_dev_ver, agent](std::string url) {
|
||||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
url += "&device=" + into_u8(m);
|
url += "&device=" + into_u8(m);
|
||||||
url += "&net_ver=" + v;
|
url += "&net_ver=" + v;
|
||||||
url += "&dev_ver=" + dv;
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&network_agent=" + boost::lexical_cast<std::string>(agent->get_network_agent());
|
||||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
}
|
}
|
||||||
|
@ -362,7 +364,7 @@ void MediaPlayCtrl::Play()
|
||||||
if (m_last_state == MEDIASTATE_INITIALIZING) {
|
if (m_last_state == MEDIASTATE_INITIALIZING) {
|
||||||
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
|
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
m_failed_code = 3;
|
m_failed_code = 3;
|
||||||
Stop(_L("Connection Failed. Please check the network and try again"));
|
Stop(_L("Connection Failed. Please check the network and try again"), from_u8(url));
|
||||||
} else {
|
} else {
|
||||||
m_url = url;
|
m_url = url;
|
||||||
load();
|
load();
|
||||||
|
@ -377,7 +379,7 @@ void MediaPlayCtrl::Play()
|
||||||
|
|
||||||
void start_ping_test();
|
void start_ping_test();
|
||||||
|
|
||||||
void MediaPlayCtrl::Stop(wxString const &msg)
|
void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2)
|
||||||
{
|
{
|
||||||
int last_state = m_last_state;
|
int last_state = m_last_state;
|
||||||
|
|
||||||
|
@ -440,6 +442,8 @@ void MediaPlayCtrl::Stop(wxString const &msg)
|
||||||
j["tutk_state"] = m_tutk_state;
|
j["tutk_state"] = m_tutk_state;
|
||||||
}
|
}
|
||||||
j["msg"] = into_u8(msg);
|
j["msg"] = into_u8(msg);
|
||||||
|
if (!msg2.IsEmpty())
|
||||||
|
j["msg2"] = into_u8(msg2);
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
if (agent)
|
if (agent)
|
||||||
agent->track_event("start_liveview", j.dump());
|
agent->track_event("start_liveview", j.dump());
|
||||||
|
@ -558,7 +562,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_Disable && (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_proto) && !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;
|
||||||
|
@ -579,11 +583,12 @@ void MediaPlayCtrl::ToggleStream()
|
||||||
}
|
}
|
||||||
NetworkAgent *agent = wxGetApp().getAgent();
|
NetworkAgent *agent = wxGetApp().getAgent();
|
||||||
if (!agent) return;
|
if (!agent) return;
|
||||||
agent->get_camera_url(m_machine, [this, m = m_machine, v = agent->get_version(), dv = m_dev_ver](std::string url) {
|
agent->get_camera_url(m_machine, [this, m = m_machine, v = agent->get_version(), dv = m_dev_ver, agent](std::string url) {
|
||||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
url += "&device=" + m;
|
url += "&device=" + m;
|
||||||
url += "&net_ver=" + v;
|
url += "&net_ver=" + v;
|
||||||
url += "&dev_ver=" + dv;
|
url += "&dev_ver=" + dv;
|
||||||
|
url += "&network_agent=" + boost::lexical_cast<std::string>(agent->get_network_agent());
|
||||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ protected:
|
||||||
|
|
||||||
void Play();
|
void Play();
|
||||||
|
|
||||||
void Stop(wxString const &msg = {});
|
void Stop(wxString const &msg = {}, wxString const &msg2 = {});
|
||||||
|
|
||||||
void TogglePlay();
|
void TogglePlay();
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ private:
|
||||||
std::string m_tutk_state;
|
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;
|
int m_remote_proto = 0;
|
||||||
bool m_device_busy = false;
|
bool m_device_busy = false;
|
||||||
bool m_disable_lan = false;
|
bool m_disable_lan = false;
|
||||||
wxString m_url;
|
wxString m_url;
|
||||||
|
|
|
@ -227,6 +227,7 @@ public:
|
||||||
|
|
||||||
int get_mw_user_preference(std::function<void(std::string)> callback);
|
int get_mw_user_preference(std::function<void(std::string)> callback);
|
||||||
int get_mw_user_4ulist(int seed, int limit, std::function<void(std::string)> callback);
|
int get_mw_user_4ulist(int seed, int limit, std::function<void(std::string)> callback);
|
||||||
|
void *get_network_agent() { return network_agent; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool enable_track = false;
|
bool enable_track = false;
|
||||||
|
|
Loading…
Reference in New Issue