Compare commits

...

22 Commits

Author SHA1 Message Date
Ian Chua
41c16436bf Merge branch 'main' into refactor/printer-agent-interface 2026-08-20 16:09:10 +08:00
Ian Chua
2bbb229c91 Merge branch 'main' into refactor/printer-agent-interface 2026-08-19 23:30:22 +08:00
Ian Chua
6e6ffe13f8 Merge branch 'refactor/printer-agent-interface' of https://github.com/OrcaSlicer/OrcaSlicer into refactor/printer-agent-interface 2026-08-19 17:11:14 +08:00
Ian Chua
eb96d127b0 fix: resolve stubgen byte header conflict 2026-08-19 17:11:10 +08:00
SoftFever
60421c33f4 Merge branch 'main' into refactor/printer-agent-interface 2026-08-19 14:32:42 +08:00
SoftFever
300c4b8afb Merge branch 'main' into refactor/printer-agent-interface 2026-08-18 20:44:56 +08:00
Ian Chua
9415812d85 Merge branch 'main' into refactor/printer-agent-interface 2026-08-17 14:24:23 +08:00
Ian Chua
d3c728557e Merge 'main' into 'refactor/printer-agent-interface' 2026-08-17 14:24:05 +08:00
Ian Chua
6558c52849 revert file transfer abstraction 2026-08-17 14:19:41 +08:00
Ian Chua
a34d056de2 specify api for getting file transfer url 2026-08-14 15:31:42 +08:00
Ian Chua
7ba5718be6 fix: remove redundant cache 2026-08-12 18:41:51 +08:00
Ian Chua
c1163ce7e5 Merge branch 'refactor/printer-agent-interface' of https://github.com/OrcaSlicer/OrcaSlicer into refactor/printer-agent-interface 2026-08-12 15:29:56 +08:00
Ian Chua
da187eaaf9 fix callback error 2026-08-12 15:29:50 +08:00
Ian Chua
de0268ce86 Merge branch 'main' into refactor/printer-agent-interface 2026-08-12 15:28:53 +08:00
Ian Chua
108923bdaa fix: default impl 2026-08-12 14:02:04 +08:00
Ian Chua
44793f7a21 remove unused 2026-08-12 13:51:54 +08:00
Ian Chua
7cb1805272 refactor: push bbl workflows to bbl printer agent 2026-08-12 13:50:47 +08:00
Ian Chua
d5c528b7c7 Merge branch 'refactor/printer-agent-interface' of https://github.com/OrcaSlicer/OrcaSlicer into refactor/printer-agent-interface 2026-08-11 15:00:42 +08:00
Ian Chua
742cb712d8 refactor: abstract bambu specific protocol to printer agent 2026-08-11 15:00:34 +08:00
Ian Chua
fd1c5d826c Merge branch 'main' into refactor/printer-agent-interface 2026-08-07 18:37:56 +08:00
Ian Chua
58be7f4861 feat: abstract remaining gcode commands in devicemanager 2026-08-07 18:36:38 +08:00
Ian Chua
4031b00915 Merge branch 'main' into refactor/printer-agent-interface 2026-08-06 16:27:57 +08:00
26 changed files with 799 additions and 300 deletions

View File

@@ -14,6 +14,8 @@
#include "libslic3r/Time.hpp"
#include "IPrinterAgent.hpp"
using namespace nlohmann;
namespace {

View File

@@ -51,6 +51,7 @@
#include "DeviceCore/DevStatus.h"
#include "DeviceCore/DevUpgrade.h"
#include "IPrinterAgent.hpp"
#define CALI_DEBUG
#define MINUTE_30 1800000 //ms
@@ -1469,26 +1470,29 @@ int MachineObject::command_upgrade_module(std::string url, std::string module_ty
int MachineObject::command_xyz_abs()
{
return this->publish_gcode("G90 \n");
if (!m_agent) return -1;
int rtn = m_agent->command_xyz_abs(get_dev_id(), MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_auto_leveling()
{
return this->publish_gcode("G29 \n");
if (!m_agent) return -1;
int rtn = m_agent->command_auto_leveling(get_dev_id(), MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_go_home()
{
if (m_support_mqtt_homing)
{
json j;
j["print"]["command"] = "back_to_center";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j);
}
// gcode command
return this->is_in_printing() ? this->publish_gcode("G28 X\n") : this->publish_gcode("G28 \n");
if (!m_agent) return -1;
int rtn = m_agent->command_go_home(get_dev_id(), this->is_in_printing(), m_support_mqtt_homing, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_task_partskip(std::vector<int> part_ids)
@@ -1610,23 +1614,20 @@ int MachineObject::command_stop_buzzer()
int MachineObject::command_set_bed(int temp)
{
if (m_support_mqtt_bet_ctrl)
{
json j;
j["print"]["command"] = "set_bed_temp";
j["print"]["temp"] = temp;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j);
}
std::string gcode_str = (boost::format("M140 S%1%\n") % temp).str();
return this->publish_gcode(gcode_str);
if (!m_agent) return -1;
int rtn = m_agent->command_set_bed(get_dev_id(), temp, m_support_mqtt_bet_ctrl, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_set_nozzle(int temp)
{
std::string gcode_str = (boost::format("M104 S%1%\n") % temp).str();
return this->publish_gcode(gcode_str);
if (!m_agent) return -1;
int rtn = m_agent->command_set_nozzle(get_dev_id(), temp, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_set_nozzle_new(int nozzle_id, int temp)
@@ -1731,9 +1732,11 @@ int MachineObject::command_ams_user_settings(bool start_read_opt, bool tray_read
int MachineObject::command_ams_calibrate(int ams_id)
{
std::string gcode_cmd = (boost::format("M620 C%1% \n") % ams_id).str();
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode_cmd;
return this->publish_gcode(gcode_cmd);
if (!m_agent) return -1;
int rtn = m_agent->command_ams_calibrate(get_dev_id(), ams_id, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_ams_filament_settings(int ams_id, int slot_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max)
@@ -1771,9 +1774,11 @@ int MachineObject::command_ams_filament_settings(int ams_id, int slot_id, std::s
int MachineObject::command_ams_refresh_rfid(std::string tray_id)
{
std::string gcode_cmd = (boost::format("M620 R%1% \n") % tray_id).str();
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode_cmd;
return this->publish_gcode(gcode_cmd);
if (!m_agent) return -1;
int rtn = m_agent->command_ams_refresh_rfid(get_dev_id(), tray_id, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_ams_refresh_rfid2(int ams_id, int slot_id)
@@ -1789,9 +1794,11 @@ int MachineObject::command_ams_refresh_rfid2(int ams_id, int slot_id)
int MachineObject::command_ams_select_tray(std::string tray_id)
{
std::string gcode_cmd = (boost::format("M620 P%1% \n") % tray_id).str();
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode_cmd;
return this->publish_gcode(gcode_cmd);
if (!m_agent) return -1;
int rtn = m_agent->command_ams_select_tray(get_dev_id(), tray_id, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_ams_control(std::string action)
@@ -1950,47 +1957,12 @@ int MachineObject::command_ams_air_print_detect(bool air_print_detect)
int MachineObject::command_axis_control(std::string axis, double unit, double input_val, int speed)
{
if (m_support_mqtt_axis_control)
{
int dir = input_val > 0 ? 1 : -1;
// i3-arch printers move the bed for Y/Z, so the on-screen direction is
// reversed — same negation the g-code fallback below applies.
if (!is_core_xy() && (axis.compare("Y") == 0 || axis.compare("Z") == 0)) {
dir = -dir;
}
json j;
j["print"]["command"] = "xyz_ctrl";
j["print"]["axis"] = axis;
j["print"]["dir"] = dir;
j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j);
}
double value = input_val;
if (!is_core_xy()) {
if ( axis.compare("Y") == 0
|| axis.compare("Z") == 0) {
value = -1.0 * input_val;
}
}
char cmd[256];
if (axis.compare("X") == 0
|| axis.compare("Y") == 0
|| axis.compare("Z") == 0) {
sprintf(cmd, "M211 S \nM211 X1 Y1 Z1\nM1002 push_ref_mode\nG91 \nG1 %s%0.1f F%d\nM1002 pop_ref_mode\nM211 R\n", axis.c_str(), value * unit, speed);
}
else if (axis.compare("E") == 0) {
sprintf(cmd, "M83 \nG0 %s%0.1f F%d\n", axis.c_str(), value * unit, speed);
}
else {
return -1;
}
return this->publish_gcode(cmd);
if (!m_agent) return -1;
int rtn = m_agent->command_axis_control(get_dev_id(), axis, unit, input_val, speed, is_core_xy(),
m_support_mqtt_axis_control, MachineObject::m_sequence_id++, is_lan_mode_printer());
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
show_unsupported_dlg(rtn);
return rtn;
}
int MachineObject::command_extruder_control(int nozzle_id, double val)
@@ -2628,7 +2600,7 @@ void MachineObject::set_print_state(std::string status)
int MachineObject::connect(bool use_openssl)
{
if (get_dev_ip().empty()) return -1;
std::string username = "bblp";
std::string username = m_agent ? m_agent->default_lan_username() : std::string();
std::string password = get_access_code();
if (m_agent) {

View File

@@ -100,6 +100,32 @@ struct DevPrintTaskRatingInfo;
// given nozzle diameter (mm), bucketed per nozzle size to mirror the printer firmware.
bool is_stringing_prone_filament(const std::string& filament_id, float nozzle_diameter);
enum LiveviewLocal {
LVL_None,
LVL_Disable,
LVL_Local,
LVL_Rtsps,
LVL_Rtsp
};
enum LiveviewRemote {
LVR_None,
LVR_Tutk,
LVR_Agora,
LVR_TutkAgora
};
enum FileLocal {
FL_None,
FL_Local
};
enum FileRemote {
FR_None,
FR_Tutk,
FR_Agora,
FR_TutkAgora
};
class MachineObject
{
@@ -548,29 +574,10 @@ public:
time_t xcam_first_layer_hold_start = 0;
std::string local_rtsp_url;
std::string tutk_state;
enum LiveviewLocal {
LVL_None,
LVL_Disable,
LVL_Local,
LVL_Rtsps,
LVL_Rtsp
} liveview_local{ LVL_None };
enum LiveviewRemote {
LVR_None,
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 };
LiveviewLocal liveview_local{ LiveviewLocal::LVL_None };
LiveviewRemote liveview_remote{ LiveviewRemote::LVR_None};
FileLocal file_local{ FileLocal::FL_None };
FileRemote file_remote{ FileRemote::FR_None };
enum PlateMakerDectect : int
{

View File

@@ -14,6 +14,7 @@
#include "slic3r/Utils/FileTransferUtils.hpp"
#include "slic3r/Utils/BBLNetworkPlugin.hpp"
#include "NetworkAgent.hpp"
namespace Slic3r {
namespace GUI {
@@ -204,7 +205,7 @@ void PrintJob::process(Ctl &ctl)
params.dev_ip = m_dev_ip;
params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
params.use_ssl_for_mqtt = m_local_use_ssl;
params.username = "bblp";
params.username = m_agent->default_lan_username();
params.password = m_access_code;
// check access code and ip address
@@ -287,7 +288,7 @@ void PrintJob::process(Ctl &ctl)
if (v == "0" || v == "false")
disable_emmc = false;
}
params.try_emmc_print = this->could_emmc_print && !disable_emmc;
params.try_emmc_print = this->could_emmc_print && !disable_emmc;
if (m_print_type == "from_sdcard_view") {
params.dst_file = m_dst_path;

View File

@@ -124,7 +124,7 @@ void SendJob::process(Ctl &ctl)
if (m_is_check_mode) {
PrintParams verify_params;
verify_params.dev_ip = m_dev_ip;
verify_params.username = "bblp";
verify_params.username = agent->default_lan_username();
verify_params.password = m_access_code;
verify_params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
verify_params.use_ssl_for_mqtt = m_local_use_ssl;
@@ -209,7 +209,7 @@ void SendJob::process(Ctl &ctl)
// local print access
params.dev_ip = m_dev_ip;
params.username = "bblp";
params.username = agent->default_lan_username();
params.password = m_access_code;
params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
params.use_ssl_for_mqtt = m_local_use_ssl;

View File

@@ -11,6 +11,7 @@
#include "Widgets/ProgressDialog.hpp"
#include <libslic3r/Model.hpp>
#include <libslic3r/Format/bbs_3mf.hpp>
#include <slic3r/GUI/DeviceManager.hpp>
#include "DeviceCore/DevStorage.h"
#ifdef __WXMSW__
@@ -206,7 +207,6 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
Bind(wxEVT_SHOW, onShowHide);
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);
m_lan_user = "bblp";
}
MediaFilePanel::~MediaFilePanel()
@@ -465,15 +465,19 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: " << m_local_proto << m_remote_proto;
m_waiting_support = false;
NetworkAgent *agent = wxGetApp().getAgent();
std::string agent_version = agent ? agent->get_version() : "";
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;
url += "&device=" + m_machine;
url += "&net_ver=" + agent_version;
url += "&dev_ver=" + m_dev_ver;
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
fs->SetUrl(url);
if (agent && (m_lan_mode || !m_remote_proto) && m_local_proto && !m_lan_ip.empty()) {
agent->get_file_transfer_url(
m_machine,
[this, wfs](FileTransferURLResult result) {
CallAfter([this, wfs, result = std::move(result)] {
auto fs = wfs.lock();
if (!fs || fs != m_image_grid->GetFileSystem())
return;
fs->SetUrl(result.is_success ? result.url : std::to_string(result.error_code));
});
},
{URL_TCP, m_lan_ip, agent->default_lan_username(), m_lan_passwd,
m_machine, agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
return;
}
if (!m_remote_proto && m_local_proto) { // not support tutk
@@ -492,35 +496,25 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
return;
}
if (agent) {
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
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](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) << "MediaFilePanel::fetchUrl: camera_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="});
agent->get_file_transfer_url(
m_machine,
[this, wfs, m = m_machine](FileTransferURLResult result) {
std::string url = std::move(result.url);
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: file_system_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="});
CallAfter([=] {
boost::shared_ptr fs(wfs.lock());
if (!fs || fs != m_image_grid->GetFileSystem()) return;
if (boost::algorithm::starts_with(url, "bambu:///")) {
if (result.is_success) {
fs->SetUrl(url);
} else {
m_image_grid->SetStatus(m_bmp_failed, _L("Connection Failed. Please check the network and try again"));
std::string res = "3";
if (boost::ends_with(url, "]")) {
size_t n = url.find_last_of('[');
if (n != std::string::npos)
res = url.substr(n + 1, url.length() - n - 2);
}
std::string res = result.error_code >= 0 ? std::to_string(result.error_code) : "3";
fs->SetUrl(res);
}
});
}, wxGetApp().get_printer_cloud_provider());
},
{URL_TUTK, "", "", "", m_machine, agent->get_version(), m_dev_ver,
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
}
}

View File

@@ -80,7 +80,6 @@ private:
std::string m_machine;
std::string m_lan_ip;
std::string m_lan_user;
std::string m_lan_passwd;
std::string m_dev_ver;
bool m_lan_mode = false;

View File

@@ -7,13 +7,13 @@
#include "I18N.hpp"
#include "MsgDialog.hpp"
#include "DownloadProgressDialog.hpp"
#include "slic3r/Utils/BBLNetworkPlugin.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>
#include <boost/nowide/utf8_codecvt.hpp>
#include <slic3r/GUI/DeviceManager.hpp>
#undef pid_t
#include <boost/process.hpp>
#ifdef __WIN32__
@@ -126,8 +126,6 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
parent->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
parent->GetParent()->GetParent()->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
m_lan_user = "bblp";
m_lan_passwd = "bblp";
}
MediaPlayCtrl::~MediaPlayCtrl()
@@ -158,14 +156,16 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
m_device_busy = obj->is_camera_busy_off();
m_tutk_state = obj->tutk_state;
if (DevPrinterConfigUtil::get_printer_series_str(obj->printer_type) == "series_o" && BBLNetworkPlugin::instance().use_legacy_network()) {
// Legacy plugin cannot support remote play for H2D, force using local mode
m_remote_proto = MachineObject::LVR_None;
auto *agent = wxGetApp().getAgent();
if (agent && !agent->supports_remote_liveview(obj->printer_type)) {
// The selected printer agent may force local mode for incompatible
// plugin/printer combinations.
m_remote_proto = LiveviewRemote::LVR_None;
}
} else {
m_camera_exists = false;
m_lan_mode = false;
m_lan_proto = MachineObject::LVL_None;
m_lan_proto = LiveviewLocal::LVL_None;
m_lan_ip.clear();
m_lan_passwd.clear();
m_dev_ver.clear();
@@ -247,8 +247,8 @@ void refresh_agora_url(char const* device, char const* dev_ver, char const* chan
device2 += dev_ver;
device2 += "|\"agora\"|";
device2 += channel;
wxGetApp().getAgent()->get_camera_url(device2, [context, callback](std::string url) {
callback(context, url.c_str());
wxGetApp().getAgent()->get_camera_url(device2, [context, callback](CameraURLResult result) {
callback(context, result.url.c_str());
}, wxGetApp().get_printer_cloud_provider());
}
@@ -282,21 +282,26 @@ void MediaPlayCtrl::Play()
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::Play: " << m_lan_proto << m_remote_proto << m_disable_lan;
NetworkAgent *agent = wxGetApp().getAgent();
std::string agent_version = agent ? agent->get_version() : "";
if (m_lan_proto > MachineObject::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
if (!agent) {
Stop(_L("Please confirm if the printer is connected."));
return;
}
std::string agent_version = agent->get_version();
const std::string lan_user = agent->default_lan_username();
if (m_lan_proto > LiveviewLocal::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
m_disable_lan = m_remote_proto && !m_lan_mode; // try remote next time
std::string url;
if (m_lan_proto == MachineObject::LVL_Local)
url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
else if (m_lan_proto == MachineObject::LVL_Rtsps)
url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps";
else if (m_lan_proto == MachineObject::LVL_Rtsp)
url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp";
url += "&device=" + m_machine;
url += "&net_ver=" + agent_version;
url += "&dev_ver=" + m_dev_ver;
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
std::string url = agent->get_local_camera_url({
m_lan_ip,
lan_user,
m_lan_passwd,
LiveviewLocal(m_lan_proto),
into_u8(m_machine),
agent_version,
m_dev_ver,
"",
wxGetApp().app_config->get("slicer_uuid"),
SLIC3R_VERSION
});
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd});
m_url = url;
load();
@@ -312,8 +317,8 @@ void MediaPlayCtrl::Play()
// !m_lan_mode && !m_remote_proto && m_lan_proto == LVL_Disable (*)
// !m_lan_mode && !m_remote_proto && m_lan_proto == LVL_None (x)
if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_proto)) {
Stop(m_lan_proto == MachineObject::LVL_None
if (m_lan_proto <= LiveviewLocal::LVL_Disable && (m_lan_mode || !m_remote_proto)) {
Stop(m_lan_proto == LiveviewLocal::LVL_None
? _L("A problem occurred. Please update the printer firmware and try again.")
: _L("LAN Only Liveview is off. Please turn on the liveview on printer screen."));
return;
@@ -336,46 +341,39 @@ void MediaPlayCtrl::Play()
if (agent) {
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
[this, m = m_machine, v = agent_version, dv = m_dev_ver, token = std::weak_ptr(m_token)](std::string url) {
if (token.expired()) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": token has been expired";
return;
}
if (boost::algorithm::starts_with(url, "bambu:///")) {
url += "&device=" + into_u8(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) << "MediaPlayCtrl: " << hide_passwd(url,
{"?uid=", "authkey=", "passwd=", "license=", "token="});
CallAfter([this, m, url] {
if (m != m_machine) {
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m;
agent->get_camera_url(
m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
[this, m = m_machine, token = std::weak_ptr(m_token)](CameraURLResult result) {
std::string url = std::move(result.url);
const bool success = result.is_success;
const int error_code = result.error_code;
if (token.expired()) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": token has been expired";
return;
}
if (m_last_state == MEDIASTATE_INITIALIZING) {
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
m_failed_code = 3;
if (boost::ends_with(url, "]")) {
size_t n = url.find_last_of('[');
if (n != std::string::npos)
m_failed_code = std::atoi(url.substr(n + 1, url.length() - n - 2).c_str());
}
Stop(_L("Connection Failed. Please check the network and try again"), from_u8(url));
} else {
m_url = url;
load();
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url, {"?uid=", "authkey=", "passwd=", "license=", "token="});
CallAfter([this, m, url, success, error_code] {
if (m != m_machine) {
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m;
return;
}
} else {
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for state: " << m_last_state;
}
});
}, wxGetApp().get_printer_cloud_provider());
if (m_last_state == MEDIASTATE_INITIALIZING) {
if (!success) {
m_failed_code = error_code >= 0 ? error_code : 3;
Stop(_L("Connection Failed. Please check the network and try again"), from_u8(url));
} else {
m_url = url;
load();
}
} else {
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for state: " << m_last_state;
}
});
},
wxGetApp().get_printer_cloud_provider(),
CameraURLParams{"", "", "", LVL_None, into_u8(m_machine), agent_version, m_dev_ver,
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
}
}
@@ -528,16 +526,11 @@ void MediaPlayCtrl::ToggleStream()
wxGetApp().app_config->set("not_show_vcamera_stop_prev", "1");
if (res == wxID_CANCEL) return;
}
if (m_lan_proto > MachineObject::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
std::string url;
if (m_lan_proto == MachineObject::LVL_Local)
url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd;
else if (m_lan_proto == MachineObject::LVL_Rtsps)
url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps";
else if (m_lan_proto == MachineObject::LVL_Rtsp)
url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp";
url += "&device=" + into_u8(m_machine);
url += "&dev_ver=" + m_dev_ver;
if (m_lan_proto > LiveviewLocal::LVL_Disable && (m_lan_mode || !m_remote_proto) && !m_disable_lan && !m_lan_ip.empty()) {
NetworkAgent *agent = wxGetApp().getAgent();
if (!agent) return;
std::string url = agent->get_local_camera_url({m_lan_ip, agent->default_lan_username(), m_lan_passwd, LiveviewLocal(m_lan_proto),
into_u8(m_machine), agent->get_version(), m_dev_ver, "", wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION});
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd});
std::string file_url = data_dir() + "/cameratools/url.txt";
boost::nowide::ofstream file(file_url);
@@ -551,20 +544,14 @@ void MediaPlayCtrl::ToggleStream()
if (!agent) return;
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
[this, m = m_machine, v = agent->get_version(), dv = m_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);
}
[this, m = m_machine](CameraURLResult result) {
std::string url = std::move(result.url);
const bool success = result.is_success;
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url,
{"?uid=", "authkey=", "passwd=", "license=", "token="});
CallAfter([this, m, url] {
CallAfter([this, m, url, success] {
if (m != m_machine) return;
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
if (!success) {
MessageDialog(this->GetParent(), wxString::Format(_L("Virtual camera initialize failed (%s)!"), url.empty() ? _L("Network unreachable") : from_u8(url)), _L("Information"),
wxICON_INFORMATION)
.ShowModal();
@@ -577,7 +564,8 @@ void MediaPlayCtrl::ToggleStream()
file.close();
m_streaming = true;
});
}, wxGetApp().get_printer_cloud_provider());
}, wxGetApp().get_printer_cloud_provider(), CameraURLParams{"", "", "", LVL_None, into_u8(m_machine), agent->get_version(), m_dev_ver,
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
}
void MediaPlayCtrl::msw_rescale() {

View File

@@ -80,7 +80,6 @@ private:
std::string m_machine;
int m_lan_proto = 0;
std::string m_lan_ip;
std::string m_lan_user;
std::string m_lan_passwd;
std::string m_dev_ver;
std::string m_tutk_state;

View File

@@ -433,58 +433,38 @@ void PartSkipDialog::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
}
std::string dev_ver = obj->get_ota_version();
std::string dev_id = obj->get_dev_id();
// int remote_proto = obj->get_file_remote();
NetworkAgent *agent = wxGetApp().getAgent();
std::string agent_version = agent ? agent->get_version() : "";
NetworkAgent *agent = wxGetApp().getAgent();
if (!agent) {
fs->SetUrl("3");
return;
}
auto url_state = m_url_state;
if (obj->is_lan_mode_printer()) { url_state = URL_TCP; }
if (agent) {
switch (url_state) {
case URL_TCP: {
std::string devIP = obj->get_dev_ip();
std::string accessCode = obj->get_access_code();
std::string tcp_url = "bambu:///local/" + devIP + "?port=6000&user=" + "bblp" + "&passwd=" + accessCode;
CallAfter([=] {
FileTransferURLParams params;
params.url_state = url_state;
params.ip_address = obj->get_dev_ip();
params.username = agent->default_lan_username();
params.password = obj->get_access_code();
params.device_id = dev_id;
params.network_version = agent->get_version();
params.device_version = dev_ver;
params.refresh_url = boost::lexical_cast<std::string>(&refresh_agora_url);
params.client_id = wxGetApp().app_config->get("slicer_uuid");
params.client_version = SLIC3R_VERSION;
agent->get_file_transfer_url(
dev_id,
[this, wfs](FileTransferURLResult result) {
CallAfter([wfs, result = std::move(result)]() mutable {
boost::shared_ptr fs(wfs.lock());
if (!fs) return;
if (boost::algorithm::starts_with(tcp_url, "bambu:///")) {
fs->SetUrl(tcp_url);
} else {
fs->SetUrl("3");
}
fs->SetUrl(result.is_success ? result.url : "3");
});
break;
}
case URL_TUTK: {
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
agent->get_camera_url(obj->get_dev_id() + "|" + dev_ver + "|" + protocols[3], [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);
}
CallAfter([=] {
boost::shared_ptr fs(wfs.lock());
if (!fs) return;
if (boost::algorithm::starts_with(url, "bambu:///")) {
fs->SetUrl(url);
} else {
fs->SetUrl("3");
}
});
});
break;
}
default: break;
}
}
},
std::move(params));
}
// controller
void PartSkipDialog::OnFileSystemEvent(wxCommandEvent &e)

View File

@@ -14,6 +14,7 @@
#include <wx/dcgraph.h>
#include <wx/simplebook.h>
#include "NetworkAgent.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/CheckBox.hpp"
#include "Widgets/Button.hpp"
@@ -29,11 +30,6 @@ namespace Slic3r { namespace GUI {
class SkipPartCanvas;
enum URL_STATE {
URL_TCP,
URL_TUTK,
};
class PartSkipConfirmDialog : public DPIDialog
{
private:
@@ -122,7 +118,7 @@ private:
std::map<uint32_t, std::string> m_parts_name;
std::vector<int> m_partskip_ids;
enum URL_STATE m_url_state = URL_STATE::URL_TCP;
URL_STATE m_url_state = URL_STATE::URL_TCP;
PartsInfo GetPartsInfo();
bool is_drag_mode();

View File

@@ -1801,6 +1801,8 @@ void InputIpAddressDialog::on_ok(wxMouseEvent& evt)
m_trouble_shoot->Hide();
std::string str_ip = m_input_ip->GetTextCtrl()->GetValue().ToStdString();
std::string str_access_code = m_input_access_code->GetTextCtrl()->GetValue().ToStdString();
if (str_access_code.empty())
str_access_code = "88888888";
std::string str_name = m_input_printer_name->GetTextCtrl()->GetValue().Strip(wxString::both).ToStdString();
// Serial number should not contain lower case letters, and bambu_network plugin crashes
// if user entered the wrong serial number, so we call `Upper()` here.
@@ -1835,6 +1837,8 @@ void InputIpAddressDialog::on_send_retry()
Fit();
wxString ip = m_input_ip->GetTextCtrl()->GetValue();
wxString str_access_code = m_input_access_code->GetTextCtrl()->GetValue();
if (str_access_code.empty())
str_access_code = "88888888";
// check support function
if (!m_obj) return;
@@ -2058,6 +2062,7 @@ void InputIpAddressDialog::on_text(wxCommandEvent &evt)
if (str_access_code.empty()) {
str_access_code = "88888888";
m_input_access_code->GetTextCtrl()->SetValue(str_access_code);
}
auto str_name = m_input_printer_name->GetTextCtrl()->GetValue().Strip(wxString::both);

View File

@@ -868,12 +868,12 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
if (wxGetApp().plater()->using_exported_file()) {
m_plater->set_print_job_plate_idx(m_print_plate_idx);
result = 0;
}
else {
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool &cancel) {
if (this->m_is_canceled) return;
bool cancelled = false;
wxString msg = _L("Preparing print job");
} else {
result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool& cancel) {
if (this->m_is_canceled)
return;
bool cancelled = false;
wxString msg = _L("Preparing print job");
m_status_bar->update_status(msg, cancelled, 10, true);
m_export_3mf_cancel = cancel = cancelled;
});
@@ -1728,15 +1728,8 @@ void SendToPrinterDialog::GetConnection()
else if (m_tutk_try_connect)
{
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
agent->get_camera_url(obj->get_dev_id() + "|" + dev_ver + "|" + protocols[1], [this, 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);
}
agent->get_camera_url(obj->get_dev_id() + "|" + dev_ver + "|" + protocols[1], [this, m = dev_id](CameraURLResult result) {
std::string url = std::move(result.url);
if (m_url_timer && m_url_timer->IsRunning())
{
@@ -1748,7 +1741,7 @@ void SendToPrinterDialog::GetConnection()
#endif
if (boost::algorithm::starts_with(url, "bambu:///"))
if (result.is_success)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Connect method tutk";
m_filetransfer_tunnel = std::make_unique<FileTransferTunnel>(module(), url);
@@ -1768,7 +1761,9 @@ void SendToPrinterDialog::GetConnection()
}
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " : Tutk url error: ress = " << res;
}
});
}, wxGetApp().get_printer_cloud_provider(),
CameraURLParams{"", "", "", LVL_None, dev_id, agent->get_version(), dev_ver,
boost::lexical_cast<std::string>(&refresh_agora_url), wxGetApp().app_config->get("slicer_uuid"), SLIC3R_VERSION, true});
}
}
}

View File

@@ -1,5 +1,6 @@
#include "BBLCloudServiceAgent.hpp"
#include "BBLNetworkPlugin.hpp"
#include "NetworkAgent.hpp"
#include <boost/log/trivial.hpp>
#include "Http.hpp"
@@ -606,13 +607,47 @@ int BBLCloudServiceAgent::modify_printer_name(std::string dev_id, std::string de
// Model Mall & Publishing
// ============================================================================
int BBLCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(std::string)> callback)
int BBLCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params)
{
auto& plugin = BBLNetworkPlugin::instance();
auto agent = plugin.get_agent();
auto func = plugin.get_get_camera_url();
if (func && agent) {
return func(agent, dev_id, callback);
auto make_result = [](std::string url) {
CameraURLResult result;
result.url = std::move(url);
result.is_success = result.url.rfind("bambu:///", 0) == 0;
if (result.is_success) {
result.error_code = 0;
} else if (!result.url.empty() && result.url.back() == ']') {
const auto start = result.url.rfind('[');
if (start != std::string::npos && start + 1 < result.url.size() - 1) {
try {
result.error_code = std::stoi(result.url.substr(start + 1, result.url.size() - start - 2));
} catch (...) {
}
}
}
return result;
};
if (params.apply_meta) {
auto decorated_callback = [callback = std::move(callback), params = std::move(params), make_result](std::string url) {
CameraURLResult result = make_result(std::move(url));
if (result.is_success) {
result.url += "&device=" + params.device;
result.url += "&net_ver=" + params.network_version;
result.url += "&dev_ver=" + params.device_version;
result.url += "&refresh_url=" + params.refresh_url;
result.url += "&cli_id=" + params.client_id;
result.url += "&cli_ver=" + params.client_version;
}
callback(std::move(result));
};
return func(agent, std::move(dev_id), std::move(decorated_callback));
}
return func(agent, std::move(dev_id), [callback = std::move(callback), make_result](std::string url) {
callback(make_result(std::move(url)));
});
}
return -1;
}

View File

@@ -89,7 +89,7 @@ public:
int modify_printer_name(std::string dev_id, std::string dev_name) override;
// Model Mall & Publishing
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params) override;
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
int get_model_publish_url(std::string* url) override;

View File

@@ -1,8 +1,15 @@
#include "BBLPrinterAgent.hpp"
#include "BBLNetworkPlugin.hpp"
#include "IPrinterAgent.hpp"
#include "NetworkAgentFactory.hpp"
#include "NetworkAgent.hpp"
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <memory>
#include <nlohmann/json.hpp>
#include <cmath>
#include <slic3r/GUI/DeviceManager.hpp>
namespace Slic3r {
@@ -20,6 +27,163 @@ void BBLPrinterAgent::set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud)
// Communication
// ============================================================================
std::string BBLPrinterAgent::ams_refresh_rfid_gcode(const std::string& tray_id)
{
return (boost::format("M620 R%1% \n") % tray_id).str();
}
std::string BBLPrinterAgent::ams_calibrate_gcode(int ams_id)
{
return (boost::format("M620 C%1% \n") % ams_id).str();
}
std::string BBLPrinterAgent::ams_select_tray_gcode(const std::string& tray_id)
{
return (boost::format("M620 P%1% \n") % tray_id).str();
}
int BBLPrinterAgent::command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
{
const std::string gcode = ams_refresh_rfid_gcode(tray_id);
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode;
nlohmann::json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = gcode;
j["print"]["sequence_id"] = std::to_string(sequence_id);
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode)
{
const std::string gcode = ams_calibrate_gcode(ams_id);
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode;
nlohmann::json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = gcode;
j["print"]["sequence_id"] = std::to_string(sequence_id);
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
{
const std::string gcode = ams_select_tray_gcode(tray_id);
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode;
nlohmann::json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = gcode;
j["print"]["sequence_id"] = std::to_string(sequence_id);
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_xyz_abs(std::string dev_id, int sequence_id, bool lan_mode)
{
nlohmann::json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = "G90 \n";
j["print"]["sequence_id"] = std::to_string(sequence_id);
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_auto_leveling(std::string dev_id, int sequence_id, bool lan_mode)
{
nlohmann::json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = "G29 \n";
j["print"]["sequence_id"] = std::to_string(sequence_id);
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_go_home(std::string dev_id, bool is_printing, bool supports_mqtt_homing, int sequence_id, bool lan_mode)
{
nlohmann::json j;
j["print"]["sequence_id"] = std::to_string(sequence_id);
if (supports_mqtt_homing) {
j["print"]["command"] = "back_to_center";
return publish(dev_id, j, lan_mode);
}
j["print"]["command"] = "gcode_line";
j["print"]["param"] = is_printing ? "G28 X\n" : "G28 \n";
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_set_bed(std::string dev_id, int temp, bool supports_mqtt_bed_ctrl, int sequence_id, bool lan_mode)
{
nlohmann::json j;
j["print"]["sequence_id"] = std::to_string(sequence_id);
if (supports_mqtt_bed_ctrl) {
j["print"]["command"] = "set_bed_temp";
j["print"]["temp"] = temp;
return publish(dev_id, j, lan_mode);
}
j["print"]["command"] = "gcode_line";
j["print"]["param"] = (boost::format("M140 S%1%\n") % temp).str();
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_set_nozzle(std::string dev_id, int temp, int sequence_id, bool lan_mode)
{
nlohmann::json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = (boost::format("M104 S%1%\n") % temp).str();
j["print"]["sequence_id"] = std::to_string(sequence_id);
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::command_axis_control(std::string dev_id, std::string axis, double unit, double input_val, int speed,
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode)
{
nlohmann::json j;
j["print"]["sequence_id"] = std::to_string(sequence_id);
if (supports_mqtt_axis_control) {
int dir = input_val > 0 ? 1 : -1;
// i3-arch printers move the bed for Y/Z, so the on-screen direction is
// reversed -- same negation the g-code fallback below applies.
if (!is_core_xy && (axis == "Y" || axis == "Z")) {
dir = -dir;
}
j["print"]["command"] = "xyz_ctrl";
j["print"]["axis"] = axis;
j["print"]["dir"] = dir;
j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0;
return publish(dev_id, j, lan_mode);
}
double value = input_val;
if (!is_core_xy && (axis == "Y" || axis == "Z")) {
value = -1.0 * input_val;
}
std::string value_str = (boost::format("%.1f") % (value * unit)).str();
std::string gcode;
if (axis == "X" || axis == "Y" || axis == "Z") {
gcode = (boost::format("M211 S \nM211 X1 Y1 Z1\nM1002 push_ref_mode\nG91 \nG1 %1%%2% F%3%\nM1002 pop_ref_mode\nM211 R\n")
% axis % value_str % speed).str();
} else if (axis == "E") {
gcode = (boost::format("M83 \nG0 %1%%2% F%3%\n") % axis % value_str % speed).str();
} else {
return -1;
}
j["print"]["command"] = "gcode_line";
j["print"]["param"] = gcode;
return publish(dev_id, j, lan_mode);
}
int BBLPrinterAgent::publish(const std::string& dev_id, const nlohmann::json& j, bool lan_mode)
{
const int rtn = lan_mode ? send_message_to_printer(dev_id, j.dump(), 0, 0) : send_message(dev_id, j.dump(), 0, 0);
if (rtn == 0) {
BOOST_LOG_TRIVIAL(info) << "publish_json: " << j.dump() << " code: " << rtn;
} else {
BOOST_LOG_TRIVIAL(error) << "publish_json: " << j.dump() << " code: " << rtn;
}
return rtn;
}
int BBLPrinterAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
{
auto& plugin = BBLNetworkPlugin::instance();
@@ -86,6 +250,86 @@ int BBLPrinterAgent::send_message_to_printer(std::string dev_id, std::string jso
return -1;
}
std::string BBLPrinterAgent::get_local_camera_url(CameraURLParams params)
{
std::string url;
if (params.protocol == LVL_Local)
url = "bambu:///local/" + params.ip_address + ".?port=6000&user=" + params.user + "&passwd=" + params.password;
else if (params.protocol == LVL_Rtsps)
url = "bambu:///rtsps___" + params.user + ":" + params.password + "@" + params.ip_address + "/streaming/live/1?proto=rtsps";
else if (params.protocol == LVL_Rtsp)
url = "bambu:///rtsp___" + params.user + ":" + params.password + "@" + params.ip_address + "/streaming/live/1?proto=rtsp";
else
url = "bambu:///local/" + params.ip_address + ".?port=6000&user=" + params.user + "&passwd=" + params.password;
url += "&device=" + params.device;
url += "&net_ver=" + params.network_version;
url += "&dev_ver=" + params.device_version;
url += "&cli_id=" + params.client_id;
url += "&cli_ver=" + params.client_version;
return url;
}
std::string BBLPrinterAgent::get_local_file_transfer_url(const FileTransferURLParams& params)
{
// Keep the historical PartSkipDialog URL unchanged. It is a file-transfer
// tunnel URL, not a camera URL, so it intentionally has no camera metadata
// suffix and no dot before the query string.
return "bambu:///local/" + params.ip_address + "?port=6000&user=" + params.username + "&passwd=" + params.password;
}
bool BBLPrinterAgent::supports_remote_liveview(const std::string& printer_type) const
{
// The legacy Bambu networking plugin cannot provide remote live view for
// the O-series printers. Keep this compatibility rule in the Bambu agent
// instead of exposing plugin/version details to GUI code.
return !(DevPrinterConfigUtil::get_printer_series_str(printer_type) == "series_o" &&
BBLNetworkPlugin::instance().use_legacy_network());
}
int BBLPrinterAgent::get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params)
{
if (params.url_state == URL_TCP) {
FileTransferURLResult result;
result.url = get_local_file_transfer_url(params);
result.is_success = !result.url.empty();
result.error_code = result.is_success ? 0 : -1;
if (callback)
callback(std::move(result));
return result.is_success ? 0 : -1;
}
if (!m_cloud_agent) {
if (callback)
callback({});
return -1;
}
const std::string protocols = "\"tutk\",\"agora\"";
return m_cloud_agent->get_camera_url(
std::move(dev_id) + "|" + params.device_version + "|" + protocols,
[callback = std::move(callback)](CameraURLResult result) {
if (!callback)
return;
FileTransferURLResult transfer_result;
transfer_result.is_success = result.is_success;
transfer_result.url = std::move(result.url);
transfer_result.error_code = result.error_code;
callback(std::move(transfer_result));
},
CameraURLParams{
"", "", "", LVL_None,
params.device_id,
params.network_version,
params.device_version,
params.refresh_url,
params.client_id,
params.client_version,
true
});
}
// ============================================================================
// Certificates
// ============================================================================
@@ -349,8 +593,15 @@ int BBLPrinterAgent::start_local_print_with_record(PrintParams params, OnUpdateS
int BBLPrinterAgent::start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn)
{
return dispatch_start<func_start_send_gcode_to_sdcard_legacy, func_start_send_gcode_to_sdcard_0203>(
int result = dispatch_start<func_start_send_gcode_to_sdcard_legacy, func_start_send_gcode_to_sdcard_0203>(
BBLNetworkPlugin::instance().get_start_send_gcode_to_sdcard(), params, update_fn, cancel_fn, wait_fn);
if (result != 0) {
BOOST_LOG_TRIVIAL(error) << "start_send_gcode_to_sdcard failed: result=" << result
<< ", try_emmc_print=" << params.try_emmc_print
<< ", legacy_mode=" << BBLNetworkPlugin::instance().use_legacy_network()
<< ", dev_ip=" << params.dev_ip << ", dev_id=" << params.dev_id;
}
return result;
}
int BBLPrinterAgent::start_local_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)

View File

@@ -5,6 +5,7 @@
#include "ICloudServiceAgent.hpp"
#include <string>
#include <memory>
#include <nlohmann/json.hpp>
namespace Slic3r {
@@ -28,9 +29,28 @@ public:
// Communication
int send_message(std::string dev_id, std::string json_str, int qos, int flag) override;
static std::string ams_refresh_rfid_gcode(const std::string& tray_id);
static std::string ams_calibrate_gcode(int ams_id);
static std::string ams_select_tray_gcode(const std::string& tray_id);
int command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode) override;
int command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode) override;
int command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode) override;
int command_xyz_abs(std::string dev_id, int sequence_id, bool lan_mode) override;
int command_auto_leveling(std::string dev_id, int sequence_id, bool lan_mode) override;
int command_go_home(std::string dev_id, bool is_printing, bool supports_mqtt_homing, int sequence_id, bool lan_mode) override;
int command_set_bed(std::string dev_id, int temp, bool supports_mqtt_bed_ctrl, int sequence_id, bool lan_mode) override;
int command_set_nozzle(std::string dev_id, int temp, int sequence_id, bool lan_mode) override;
int command_axis_control(std::string dev_id, std::string axis, double unit, double input_val, int speed,
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode) override;
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl) override;
int disconnect_printer() override;
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag) override;
std::string get_local_camera_url(CameraURLParams params) override;
std::string get_local_file_transfer_url(const FileTransferURLParams& params) override;
bool supports_remote_liveview(const std::string& printer_type) const override;
int get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params) override;
std::string default_lan_username() const override { return "bblp"; }
// Certificates
int check_cert() override;
@@ -85,6 +105,9 @@ public:
FilamentSyncMode get_filament_sync_mode() const override;
private:
// why: the lan/cloud DECISION stays machine-side; keep this mechanical branch in sync with publish_json.
int publish(const std::string& dev_id, const nlohmann::json& j, bool lan_mode);
std::shared_ptr<ICloudServiceAgent> m_cloud_agent;
};

View File

@@ -224,4 +224,4 @@ void FileTransferJob::solve_result(ft_job_result result)
res_json_.assign(result.json ? result.json : "");
}
} // namespace Slic3r
} // namespace Slic3r

View File

@@ -252,4 +252,4 @@ inline FileTransferModule &module()
return *detail::g_mod;
}
} // namespace Slic3r
} // namespace Slic3r

View File

@@ -47,6 +47,9 @@ struct CloudEvent {
using AppOnServerConnectedFn = std::function<void(CloudEvent event, int return_code, int reason_code)>;
using AppOnHttpErrorFn = std::function<void(CloudEvent event, unsigned http_code, std::string http_body)>;
struct CameraURLParams;
struct CameraURLResult;
class ICloudServiceAgent {
public:
virtual ~ICloudServiceAgent() = default;
@@ -328,7 +331,8 @@ public:
/**
* Request live camera streaming URL.
*/
virtual int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) = 0;
virtual int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback,
CameraURLParams params) = 0;
/**
* Fetch staff-picked designs from model mall.

View File

@@ -2,6 +2,7 @@
#define __I_PRINTER_AGENT_HPP__
#include "bambu_networking.hpp"
#include <slic3r/GUI/DeviceManager.hpp>
// why: these extend the BAMBU_NETWORK_* return space rather than opening a new one - the value
// flows through the same int domain callers already compare against BAMBU_NETWORK_SUCCESS.
// They live here and not in bambu_networking.hpp because that file is a vendor header replaced
@@ -11,6 +12,11 @@
#define ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE -7020 // a translation exists; this printer lacks the capability
#include <string>
#include <memory>
#include <vector>
#include <functional>
#include <cstdint>
#include "NetworkAgent.hpp"
namespace Slic3r {
@@ -84,6 +90,62 @@ public:
*/
virtual int send_message(std::string dev_id, std::string json_str, int qos, int flag) = 0;
// why: gcode is firmware dialect, not a waist concept - commands whose body is Bambu-dialect
// gcode live on the agent that speaks it; the default is an honest refusal that MachineObject's
// publish funnel turns into a dialog.
virtual int command_ams_refresh_rfid(std::string, std::string, int, bool)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_ams_calibrate(std::string, int, int, bool)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_ams_select_tray(std::string, std::string, int, bool)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_xyz_abs(std::string dev_id, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_auto_leveling(std::string dev_id, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_go_home(std::string dev_id, bool is_printing, bool supports_mqtt_homing, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_set_bed(std::string dev_id, int temp, bool supports_mqtt_bed_ctrl, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_set_nozzle(std::string dev_id, int temp, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
virtual int command_axis_control(std::string dev_id, std::string axis, double unit, double input_val, int speed,
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode)
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
/**
* Build a ready-to-use local (LAN) camera stream URL for this agent's protocol.
* Returns an empty string if the agent has no local camera stream support.
*/
virtual std::string get_local_camera_url(CameraURLParams params) { return ""; }
/**
* Build a ready-to-use local (LAN) file transfer URL for this agent's protocol.
* Returns an empty string if the agent has no local file transfer support.
*/
virtual std::string get_local_file_transfer_url(const FileTransferURLParams& params) { return ""; }
/**
* Whether remote live view is available for the selected printer and agent
* protocol. Implementations may use their plugin/version compatibility
* rules; the neutral default keeps existing agents permissive.
*/
virtual bool supports_remote_liveview(const std::string& printer_type) const
{ (void) printer_type; return true; }
virtual int get_file_transfer_url(std::string, std::function<void(FileTransferURLResult)> callback, FileTransferURLParams)
{
if (callback)
callback({});
return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED;
}
/**
* Default LAN account username for this agent's protocol, if it has a fixed one.
* Returns an empty string if the agent has no fixed default (e.g. caller must supply one).
*/
virtual std::string default_lan_username() const { return {}; }
/**
* Establish a direct LAN connection to a printer.
*/
@@ -290,6 +352,7 @@ public:
* Populates the MachineObject's DevFilaSystem with fetched filament data.
*/
virtual bool fetch_filament_info(std::string dev_id) { return false; }
};
} // namespace Slic3r

View File

@@ -4,6 +4,7 @@
#include <algorithm>
#include <boost/log/trivial.hpp>
#include "IPrinterAgent.hpp"
#include "libslic3r/Utils.hpp"
#include "NetworkAgent.hpp"
#include "BBLNetworkPlugin.hpp"
@@ -507,11 +508,12 @@ int NetworkAgent::modify_printer_name(std::string dev_id, std::string dev_name,
return -1;
}
int NetworkAgent::get_camera_url(std::string dev_id, std::function<void(std::string)> callback, const std::string& provider)
int NetworkAgent::get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback,
const std::string& provider, CameraURLParams params)
{
const auto cloud_agent = get_cloud_agent(provider);
if (cloud_agent)
return cloud_agent->get_camera_url(std::move(dev_id), std::move(callback));
return cloud_agent->get_camera_url(std::move(dev_id), std::move(callback), std::move(params));
return -1;
}
@@ -767,6 +769,70 @@ int NetworkAgent::send_message(std::string dev_id, std::string json_str, int qos
return -1;
}
int NetworkAgent::command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_ams_refresh_rfid(dev_id, tray_id, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_ams_calibrate(dev_id, ams_id, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_ams_select_tray(dev_id, tray_id, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_xyz_abs(std::string dev_id, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_xyz_abs(dev_id, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_auto_leveling(std::string dev_id, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_auto_leveling(dev_id, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_go_home(std::string dev_id, bool is_printing, bool supports_mqtt_homing, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_go_home(dev_id, is_printing, supports_mqtt_homing, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_set_bed(std::string dev_id, int temp, bool supports_mqtt_bed_ctrl, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_set_bed(dev_id, temp, supports_mqtt_bed_ctrl, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_set_nozzle(std::string dev_id, int temp, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_set_nozzle(dev_id, temp, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::command_axis_control(std::string dev_id, std::string axis, double unit, double input_val, int speed,
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode)
{
if (m_printer_agent)
return m_printer_agent->command_axis_control(dev_id, axis, unit, input_val, speed, is_core_xy, supports_mqtt_axis_control, sequence_id, lan_mode);
return -1;
}
int NetworkAgent::connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl)
{
if (m_printer_agent)
@@ -788,6 +854,45 @@ int NetworkAgent::send_message_to_printer(std::string dev_id, std::string json_s
return -1;
}
std::string NetworkAgent::get_local_camera_url(CameraURLParams params)
{
if (m_printer_agent)
return m_printer_agent->get_local_camera_url(params);
return {};
}
std::string NetworkAgent::get_local_file_transfer_url(const FileTransferURLParams& params)
{
if (m_printer_agent)
return m_printer_agent->get_local_file_transfer_url(params);
return {};
}
bool NetworkAgent::supports_remote_liveview(const std::string& printer_type) const
{
// Preserve the historical permissive behavior while the printer agent is
// being selected. A missing agent must not turn a supported remote
// protocol into LVNone before the Bambu agent has been installed.
return !m_printer_agent || m_printer_agent->supports_remote_liveview(printer_type);
}
int NetworkAgent::get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params)
{
if (m_printer_agent)
return m_printer_agent->get_file_transfer_url(std::move(dev_id), std::move(callback), std::move(params));
if (callback)
callback({});
return -1;
}
std::string NetworkAgent::default_lan_username() const
{
if (m_printer_agent)
return m_printer_agent->default_lan_username();
return {};
}
int NetworkAgent::check_cert()
{
if (m_printer_agent)

View File

@@ -2,9 +2,11 @@
#define __NETWORK_Agent_HPP__
#include "bambu_networking.hpp"
#include "libslic3r/ProjectTask.hpp"
#include "ICloudServiceAgent.hpp"
#include "IPrinterAgent.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <map>
#include <memory>
#include <string>
@@ -12,6 +14,53 @@
namespace Slic3r {
class IPrinterAgent;
enum class FilamentSyncMode;
enum URL_STATE {
URL_TCP,
URL_TUTK,
};
struct CameraURLParams {
std::string ip_address;
std::string user;
std::string password;
LiveviewLocal protocol;
std::string device;
std::string network_version;
std::string device_version;
std::string refresh_url;
std::string client_id;
std::string client_version;
bool apply_meta{false};
};
struct FileTransferURLParams {
URL_STATE url_state{URL_TCP};
std::string ip_address;
std::string username;
std::string password;
std::string device_id;
std::string network_version;
std::string device_version;
std::string refresh_url;
std::string client_id;
std::string client_version;
};
struct FileTransferURLResult {
bool is_success{false};
std::string url;
int error_code{-1};
};
struct CameraURLResult {
bool is_success{false};
std::string url;
int error_code{-1};
};
// Forward declaration
class BBLNetworkPlugin;
@@ -108,7 +157,8 @@ public:
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json, const std::string& provider = ORCA_CLOUD_PROVIDER);
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body, const std::string& provider = ORCA_CLOUD_PROVIDER);
int modify_printer_name(std::string dev_id, std::string dev_name, const std::string& provider = ORCA_CLOUD_PROVIDER);
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback,
const std::string& provider = ORCA_CLOUD_PROVIDER, CameraURLParams params = {});
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out, const std::string& provider = ORCA_CLOUD_PROVIDER);
int get_model_publish_url(std::string* url, const std::string& provider = ORCA_CLOUD_PROVIDER);
@@ -142,9 +192,25 @@ public:
int set_on_local_message_fn(OnMessageFn fn);
int set_server_callback(OnServerErrFn fn);
int send_message(std::string dev_id, std::string json_str, int qos, int flag);
int command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode);
int command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode);
int command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode);
int command_xyz_abs(std::string dev_id, int sequence_id, bool lan_mode);
int command_auto_leveling(std::string dev_id, int sequence_id, bool lan_mode);
int command_go_home(std::string dev_id, bool is_printing, bool supports_mqtt_homing, int sequence_id, bool lan_mode);
int command_set_bed(std::string dev_id, int temp, bool supports_mqtt_bed_ctrl, int sequence_id, bool lan_mode);
int command_set_nozzle(std::string dev_id, int temp, int sequence_id, bool lan_mode);
int command_axis_control(std::string dev_id, std::string axis, double unit, double input_val, int speed,
bool is_core_xy, bool supports_mqtt_axis_control, int sequence_id, bool lan_mode);
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
int disconnect_printer();
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag);
std::string get_local_camera_url(CameraURLParams params);
std::string get_local_file_transfer_url(const FileTransferURLParams& params);
bool supports_remote_liveview(const std::string& printer_type) const;
int get_file_transfer_url(std::string dev_id, std::function<void(FileTransferURLResult)> callback,
FileTransferURLParams params = {});
std::string default_lan_username() const;
int check_cert();
void install_device_cert(std::string dev_id, bool lan_only);
bool start_discovery(bool start, bool sending);

View File

@@ -1,4 +1,5 @@
#include "OrcaCloudServiceAgent.hpp"
#include "NetworkAgent.hpp"
#include "Http.hpp"
#include "libslic3r/Utils.hpp"
#include "slic3r/GUI/GUI_App.hpp"
@@ -2698,11 +2699,12 @@ int OrcaCloudServiceAgent::modify_printer_name(std::string dev_id, std::string d
return BAMBU_NETWORK_SUCCESS;
}
int OrcaCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(std::string)> callback)
int OrcaCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params)
{
(void) params;
BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: get_camera_url (stub)";
if (callback)
callback("");
callback({});
return BAMBU_NETWORK_SUCCESS;
}

View File

@@ -240,7 +240,7 @@ public:
// ========================================================================
// ICloudServiceAgent Interface Implementation - Model Mall & Publishing
// ========================================================================
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
int get_camera_url(std::string dev_id, std::function<void(CameraURLResult)> callback, CameraURLParams params) override;
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
int get_model_publish_url(std::string* url) override;

View File

@@ -1,3 +1,15 @@
#ifdef ORCA_PYTHON_STUBGEN_MODULE
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Windows.h>
#endif
#endif
#include "PythonPluginBridge.hpp"
#include <boost/log/trivial.hpp>