mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
NEW: support send to sd card with cloud
JIRA: STUDIO-7378 Change-Id: I95fee50db29825e508d276d52c7a3e85e1347ebd (cherry picked from commit 13db95ceb4f18b8cbce1e67447eeaa6ee36cc8ad)
This commit is contained in:
@@ -29,12 +29,13 @@ namespace GUI {
|
||||
#define LIST_REFRESH_INTERVAL 200
|
||||
#define MACHINE_LIST_REFRESH_INTERVAL 2000
|
||||
|
||||
constexpr int timeout_period = 15000; // ms
|
||||
|
||||
wxDEFINE_EVENT(EVT_UPDATE_USER_MACHINE_LIST, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_PRINT_JOB_CANCEL, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_SEND_JOB_SUCCESS, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_CLEAR_IPADDRESS, wxCommandEvent);
|
||||
|
||||
|
||||
void SendToPrinterDialog::stripWhiteSpace(std::string& str)
|
||||
{
|
||||
if (str == "") { return; }
|
||||
@@ -260,6 +261,14 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
|
||||
m_button_refresh->Bind(wxEVT_BUTTON, &SendToPrinterDialog::on_refresh, this);
|
||||
m_sizer_printer->Add(m_button_refresh, 0, wxALL | wxLEFT, FromDIP(5));
|
||||
|
||||
|
||||
/*select storage*/
|
||||
m_storage_panel = new wxPanel(this);
|
||||
m_storage_panel->SetBackgroundColour(*wxWHITE);
|
||||
m_storage_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_storage_panel->SetSizer(m_storage_sizer);
|
||||
m_storage_panel->Layout();
|
||||
|
||||
m_statictext_printer_msg = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
|
||||
m_statictext_printer_msg->SetFont(::Label::Body_13);
|
||||
m_statictext_printer_msg->SetForegroundColour(*wxBLACK);
|
||||
@@ -517,6 +526,7 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
|
||||
m_sizer_main->Add(m_line_materia, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
|
||||
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizer_main->Add(m_sizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
|
||||
m_sizer_main->Add(m_storage_panel, 0, wxALIGN_CENTER|wxTOP, FromDIP(8));
|
||||
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(11));
|
||||
m_sizer_main->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(22));
|
||||
@@ -538,6 +548,49 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
std::string SendToPrinterDialog::get_storage_selected()
|
||||
{
|
||||
for (const auto& radio : m_storage_radioBox) {
|
||||
if (radio->GetValue()) {
|
||||
return radio->GetLabel().ToStdString();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::update_storage_list(std::vector<std::string> storages)
|
||||
{
|
||||
m_storage_radioBox.clear();
|
||||
m_storage_panel->DestroyChildren();
|
||||
|
||||
for (int i=0; i < storages.size(); i++) {
|
||||
RadioBox* radiobox = new RadioBox(m_storage_panel);
|
||||
Label* storage_text = new Label(m_storage_panel, storages[i]);
|
||||
radiobox->SetLabel(storages[i]);
|
||||
radiobox->Bind(wxEVT_LEFT_DOWN, [this, radiobox](auto& e) {
|
||||
for (const auto& radio : m_storage_radioBox) {
|
||||
radio->SetValue(false);
|
||||
}
|
||||
radiobox->SetValue(true);
|
||||
});
|
||||
|
||||
if (m_storage_radioBox.size() > 0) {
|
||||
m_storage_sizer->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(6));
|
||||
auto radio = m_storage_radioBox.front();
|
||||
radio->SetValue(true);
|
||||
}
|
||||
|
||||
m_storage_sizer->Add(radiobox, 0, wxALIGN_CENTER, 0);
|
||||
m_storage_sizer->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(6));
|
||||
m_storage_sizer->Add(storage_text, 0, wxALIGN_CENTER,0);
|
||||
m_storage_radioBox.push_back(radiobox);
|
||||
}
|
||||
|
||||
m_storage_panel->Layout();
|
||||
m_storage_panel->Fit();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
void SendToPrinterDialog::update_print_error_info(int code, std::string msg, std::string extra)
|
||||
{
|
||||
m_print_error_code = code;
|
||||
@@ -669,6 +722,15 @@ void SendToPrinterDialog::init_timer()
|
||||
void SendToPrinterDialog::on_cancel(wxCloseEvent &event)
|
||||
{
|
||||
m_worker->cancel_all();
|
||||
if (m_file_sys) {
|
||||
m_file_sys->CancelUploadTask();
|
||||
|
||||
if (m_task_timer && m_task_timer->IsRunning()) {
|
||||
m_task_timer->Stop();
|
||||
m_task_timer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
this->EndModal(wxID_CANCEL);
|
||||
}
|
||||
|
||||
@@ -706,6 +768,9 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
||||
m_status_bar->set_cancel_callback_fina([this]() {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: enter canceled";
|
||||
m_worker->cancel_all();
|
||||
if (m_file_sys) {
|
||||
m_file_sys->CancelUploadTask();
|
||||
}
|
||||
m_is_canceled = true;
|
||||
wxCommandEvent* event = new wxCommandEvent(EVT_PRINT_JOB_CANCEL);
|
||||
wxQueueEvent(this, event);
|
||||
@@ -760,42 +825,70 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
||||
fs::path default_output_file_path = boost::filesystem::path(default_output_file.c_str());
|
||||
file_name = default_output_file_path.filename().string();
|
||||
}*/
|
||||
if (obj_->is_lan_mode_printer()) {
|
||||
update_print_status_msg(wxEmptyString, false, false);
|
||||
if (m_file_sys) {
|
||||
PrintPrepareData print_data;
|
||||
m_plater->get_print_job_data(&print_data);
|
||||
std::string project_name = m_current_project_name.utf8_string() + ".3mf";
|
||||
std::string _3mf_path = print_data._3mf_path.string();
|
||||
m_file_sys->SetUploadFile(_3mf_path, project_name, get_storage_selected());
|
||||
m_file_sys->RequestUploadFile();
|
||||
|
||||
// time out
|
||||
if (m_task_timer && m_task_timer->IsRunning())
|
||||
m_task_timer->Stop();
|
||||
|
||||
m_task_timer.reset(new wxTimer());
|
||||
m_task_timer->SetOwner(this);
|
||||
|
||||
auto m_send_job = std::make_unique<SendJob>(m_printer_last_select);
|
||||
m_send_job->m_dev_ip = obj_->dev_ip;
|
||||
m_send_job->m_access_code = obj_->get_access_code();
|
||||
this->Bind(
|
||||
wxEVT_TIMER,
|
||||
[this, wfs = boost::weak_ptr(m_file_sys)](auto e) {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicUploadFiled);
|
||||
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
fs->CancelUploadTask(false);
|
||||
update_print_status_msg(_L("Upload file timeout, please check if the firmware version supports it."), false, true);
|
||||
},
|
||||
m_task_timer->GetId());
|
||||
m_task_timer->StartOnce(timeout_period);
|
||||
}
|
||||
} else {
|
||||
auto m_send_job = std::make_unique<SendJob>(m_printer_last_select);
|
||||
m_send_job->m_dev_ip = obj_->dev_ip;
|
||||
m_send_job->m_access_code = obj_->get_access_code();
|
||||
|
||||
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
m_send_job->m_local_use_ssl_for_ftp = wxGetApp().app_config->get("enable_ssl_for_ftp") == "true" ? true : false;
|
||||
m_send_job->m_local_use_ssl_for_mqtt = wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false;
|
||||
m_send_job->m_local_use_ssl_for_ftp = wxGetApp().app_config->get("enable_ssl_for_ftp") == "true" ? true : false;
|
||||
m_send_job->m_local_use_ssl_for_mqtt = wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false;
|
||||
#else
|
||||
m_send_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
|
||||
m_send_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
|
||||
m_send_job->m_local_use_ssl_for_ftp = obj_->local_use_ssl_for_ftp;
|
||||
m_send_job->m_local_use_ssl_for_mqtt = obj_->local_use_ssl_for_mqtt;
|
||||
#endif
|
||||
|
||||
m_send_job->connection_type = obj_->connection_type();
|
||||
m_send_job->cloud_print_only = true;
|
||||
m_send_job->has_sdcard = obj_->get_sdcard_state() == MachineObject::SdcardState::HAS_SDCARD_NORMAL;
|
||||
m_send_job->set_project_name(m_current_project_name.utf8_string());
|
||||
m_send_job->connection_type = obj_->connection_type();
|
||||
m_send_job->cloud_print_only = true;
|
||||
m_send_job->has_sdcard = obj_->get_sdcard_state() == MachineObject::SdcardState::HAS_SDCARD_NORMAL;
|
||||
m_send_job->set_project_name(m_current_project_name.utf8_string());
|
||||
|
||||
enable_prepare_mode = false;
|
||||
enable_prepare_mode = false;
|
||||
|
||||
m_send_job->on_check_ip_address_fail([this](int result) {
|
||||
wxCommandEvent* evt = new wxCommandEvent(EVT_CLEAR_IPADDRESS);
|
||||
wxQueueEvent(this, evt);
|
||||
wxGetApp().show_ip_address_enter_dialog();
|
||||
});
|
||||
m_send_job->on_check_ip_address_fail([this](int result) {
|
||||
wxCommandEvent *evt = new wxCommandEvent(EVT_CLEAR_IPADDRESS);
|
||||
wxQueueEvent(this, evt);
|
||||
wxGetApp().show_ip_address_enter_dialog();
|
||||
});
|
||||
|
||||
if (obj_->is_lan_mode_printer()) {
|
||||
m_send_job->set_check_mode();
|
||||
m_send_job->check_and_continue();
|
||||
if (obj_->is_lan_mode_printer()) {
|
||||
m_send_job->set_check_mode();
|
||||
m_send_job->check_and_continue();
|
||||
}
|
||||
|
||||
replace_job(*m_worker, std::move(m_send_job));
|
||||
}
|
||||
|
||||
replace_job(*m_worker, std::move(m_send_job));
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "send_job: send print job";
|
||||
}
|
||||
|
||||
@@ -837,9 +930,10 @@ void SendToPrinterDialog::update_user_machine_list()
|
||||
void SendToPrinterDialog::on_refresh(wxCommandEvent &event)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "m_printer_last_select: on_refresh";
|
||||
show_status(PrintDialogStatus::PrintStatusRefreshingMachineList);
|
||||
|
||||
update_user_machine_list();
|
||||
/* show_status(PrintDialogStatus::PrintStatusRefreshingMachineList);
|
||||
update_user_machine_list();*/
|
||||
/*todo refresh*/
|
||||
if (m_file_sys) { m_file_sys->Retry(); }
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::on_print_job_cancel(wxCommandEvent &evt)
|
||||
@@ -991,8 +1085,11 @@ void SendToPrinterDialog::on_selection_changed(wxCommandEvent &event)
|
||||
obj->command_request_push_all();
|
||||
if (!dev->get_selected_machine()) {
|
||||
dev->set_selected_machine(m_printer_last_select, true);
|
||||
if (m_file_sys) m_file_sys.reset();
|
||||
}else if (dev->get_selected_machine()->dev_id != m_printer_last_select) {
|
||||
update_storage_list(std::vector<std::string>());
|
||||
dev->set_selected_machine(m_printer_last_select, true);
|
||||
if (m_file_sys) m_file_sys.reset();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1076,8 +1173,137 @@ void SendToPrinterDialog::update_show_status()
|
||||
}
|
||||
|
||||
if (!m_is_in_sending_mode) {
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
return;
|
||||
if (obj_->connection_type() == "lan") {
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
return;
|
||||
} else if (obj_->connection_type() == "cloud") {
|
||||
Enable(obj_ && obj_->is_connected() && obj_->m_push_count > 0);
|
||||
std::string dev_id = obj_->dev_ip;
|
||||
if (m_file_sys) {
|
||||
if (dev_id == m_device_select) {
|
||||
if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && obj_->file_remote))
|
||||
m_file_sys->Retry();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_device_select.swap(dev_id);
|
||||
m_file_sys = boost::make_shared<PrinterFileSystem>();
|
||||
m_file_sys->Attached();
|
||||
|
||||
m_file_sys->Bind(EVT_STATUS_CHANGED, [this, wfs = boost::weak_ptr(m_file_sys)](auto e) {
|
||||
e.Skip();
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
|
||||
wxString msg;
|
||||
int status = e.GetInt();
|
||||
int extra = e.GetExtraLong();
|
||||
switch (status) {
|
||||
case PrinterFileSystem::Initializing:
|
||||
case PrinterFileSystem::Connecting: show_status(PrintDialogStatus::PrintStatusReading); break;
|
||||
case PrinterFileSystem::ListSyncing: {
|
||||
show_status(PrintDialogStatus::PrintStatusReading);
|
||||
boost::uint32_t seq = fs->RequestMediaAbility(3);
|
||||
|
||||
if (m_task_timer && m_task_timer->IsRunning())
|
||||
m_task_timer->Stop();
|
||||
|
||||
m_task_timer.reset(new wxTimer());
|
||||
m_task_timer->SetOwner(this);
|
||||
|
||||
this->Bind(wxEVT_TIMER, [this, wfs_1 = boost::weak_ptr(fs), seq](auto e) {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicUploadFiled);
|
||||
boost::shared_ptr fs_1(wfs_1.lock());
|
||||
if (!fs_1) return;
|
||||
fs_1->CancelUploadTask(false);
|
||||
update_print_status_msg(_L("Media capability acquisition timeout, please check if the firmware version supports it."), false, true);
|
||||
}, m_task_timer->GetId());
|
||||
m_task_timer->StartOnce(timeout_period);
|
||||
|
||||
break;
|
||||
}
|
||||
case PrinterFileSystem::Failed: msg = _L("Please check the network and try again, You can restart or update the printer if the issue persists."); break;
|
||||
}
|
||||
|
||||
if (!msg.empty()) {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicInitFailed);
|
||||
update_print_status_msg(msg, false, true);
|
||||
}
|
||||
|
||||
if (e.GetInt() == PrinterFileSystem::Initializing) {
|
||||
CallAfter([=] {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
fetchUrl(boost::weak_ptr(fs));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
m_file_sys->Bind(EVT_MEDIA_ABILITY_CHANGED, [this, wfs = boost::weak_ptr(m_file_sys)](auto e) {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
|
||||
if (m_task_timer && m_task_timer->IsRunning()) {
|
||||
m_task_timer->Stop();
|
||||
m_task_timer.reset();
|
||||
}
|
||||
|
||||
m_ability_list = fs->GetMediaAbilityList();
|
||||
|
||||
if (e.GetInt() == PrinterFileSystem::RequestMediaAbilityStatus::S_SUCCESS) {
|
||||
update_storage_list(m_ability_list);
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
} else {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicInitFailed);
|
||||
update_print_status_msg(e.GetString(), false, true);
|
||||
}
|
||||
});
|
||||
|
||||
m_file_sys->Bind(EVT_UPLOADING, [this, wfs = boost::weak_ptr(m_file_sys)](auto e) {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
int progress = e.GetInt();
|
||||
m_status_bar->set_progress(10 + std::floor(progress * 0.9));
|
||||
|
||||
if (m_task_timer && m_task_timer->IsRunning()) m_task_timer->Stop();
|
||||
|
||||
if (progress == 99) {
|
||||
m_task_timer.reset(new wxTimer());
|
||||
m_task_timer->SetOwner(this);
|
||||
|
||||
this->Bind(
|
||||
wxEVT_TIMER,
|
||||
[this, wfs = boost::weak_ptr(m_file_sys)](auto e) {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicUploadFiled);
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
fs->CancelUploadTask(false);
|
||||
update_print_status_msg(_L("Upload file timeout, please check if the firmware version supports it."), false, true);
|
||||
},
|
||||
m_task_timer->GetId());
|
||||
m_task_timer->StartOnce(timeout_period);
|
||||
}
|
||||
});
|
||||
m_file_sys->Bind(EVT_UPLOAD_CHANGED, [this, wfs = boost::weak_ptr(m_file_sys)](auto e) {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
|
||||
if (e.GetInt() == PrinterFileSystem::FF_UPLOADDONE) {
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
wxCommandEvent *evt = new wxCommandEvent(m_plater->get_send_finished_event());
|
||||
evt->SetString(from_u8(m_current_project_name.utf8_string()));
|
||||
wxQueueEvent(m_plater, evt);
|
||||
} else if (PrinterFileSystem::FF_UPLOADCANCEL) {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicUploadFiled);
|
||||
wxString err_msg = e.GetString();
|
||||
if (err_msg.IsEmpty())
|
||||
err_msg = _u8L("Sending failed, please try again!");
|
||||
update_print_status_msg(err_msg, false, true);
|
||||
}
|
||||
});
|
||||
m_file_sys->Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1139,7 +1365,7 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
if (status == PrintDialogStatus::PrintStatusInit) {
|
||||
update_print_status_msg(wxEmptyString, false, false);
|
||||
Enable_Send_Button(false);
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Refresh_Button(false);
|
||||
}
|
||||
else if (status == PrintDialogStatus::PrintStatusNoUserLogin) {
|
||||
wxString msg_text = _L("No login account, only printers in LAN mode are displayed");
|
||||
@@ -1217,6 +1443,13 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
update_print_status_msg(msg_text, true, true);
|
||||
Enable_Send_Button(false);
|
||||
Enable_Refresh_Button(true);
|
||||
} else if (status == PrintDialogStatus::PrintStatusPublicInitFailed) {
|
||||
Enable_Send_Button(false);
|
||||
Enable_Refresh_Button(true);
|
||||
} else if (status == PrintDialogStatus::PrintStatusPublicUploadFiled) {
|
||||
prepare_mode();
|
||||
Enable_Send_Button(true);
|
||||
Enable_Refresh_Button(true);
|
||||
}
|
||||
else {
|
||||
Enable_Send_Button(true);
|
||||
@@ -1369,6 +1602,7 @@ bool SendToPrinterDialog::Show(bool show)
|
||||
|
||||
// set default value when show this dialog
|
||||
if (show) {
|
||||
update_storage_list(std::vector<std::string>());
|
||||
wxGetApp().reset_to_active();
|
||||
set_default();
|
||||
update_user_machine_list();
|
||||
@@ -1383,12 +1617,84 @@ bool SendToPrinterDialog::Show(bool show)
|
||||
Layout();
|
||||
Fit();
|
||||
if (show) { CenterOnParent(); }
|
||||
|
||||
if (m_file_sys) {
|
||||
show ? m_file_sys->Start() : m_file_sys->Stop();
|
||||
}
|
||||
|
||||
return DPIDialog::Show(show);
|
||||
}
|
||||
|
||||
extern wxString hide_passwd(wxString url, std::vector<wxString> const &passwords);
|
||||
extern void refresh_agora_url(char const *device, char const *dev_ver, char const *channel, void *context, void (*callback)(void *context, char const *url));
|
||||
|
||||
void SendToPrinterDialog::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||
{
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
|
||||
if (!IsEnabled()) {
|
||||
m_waiting_enable = true;
|
||||
fs->SetUrl("0");
|
||||
return;
|
||||
}
|
||||
|
||||
m_waiting_enable = false;
|
||||
DeviceManager *dm = GUI::wxGetApp().getDeviceManager();
|
||||
MachineObject *obj = dm->get_selected_machine();
|
||||
|
||||
std::string dev_ver = obj->get_ota_version();
|
||||
std::string dev_id = obj->dev_id;
|
||||
int remote_proto = obj->file_remote;
|
||||
if (!remote_proto) {
|
||||
m_waiting_support = true;
|
||||
fs->SetUrl("0");
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj->is_camera_busy_off()) {
|
||||
fs->SetUrl("0");
|
||||
return;
|
||||
}
|
||||
|
||||
m_waiting_support = false;
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
std::string agent_version = agent ? agent->get_version() : "";
|
||||
|
||||
if (agent) {
|
||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||
agent->get_camera_url(obj->dev_id + "|" + dev_ver + "|" + protocols[remote_proto],
|
||||
[this, wfs, m = dev_id, v = agent->get_version(), dv = dev_ver](std::string url) {
|
||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||
url += "&device=" + m;
|
||||
url += "&net_ver=" + v;
|
||||
url += "&dev_ver=" + dv;
|
||||
url += "&refresh_url=" + boost::lexical_cast<std::string>(&refresh_agora_url);
|
||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "SendToPrinter::fetchUrl: camera_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="});
|
||||
std::cout << "SendToPrinter::fetchUrl: camera_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="});
|
||||
CallAfter([=] {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||
fs->SetUrl(url);
|
||||
} else {
|
||||
fs->SetUrl("3");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SendToPrinterDialog::~SendToPrinterDialog()
|
||||
{
|
||||
delete m_refresh_timer;
|
||||
if (m_task_timer && m_task_timer->IsRunning())
|
||||
m_task_timer->Stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user