OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::OrcaPrinterAgent Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/OrcaPrinterAgent.hpp>

Inheritance diagram for Slic3r::OrcaPrinterAgent:
Collaboration diagram for Slic3r::OrcaPrinterAgent:

Public Member Functions

 OrcaPrinterAgent (std::string log_dir)
 ~OrcaPrinterAgent () override
void set_cloud_agent (std::shared_ptr< ICloudServiceAgent > cloud) override
int send_message (std::string dev_id, std::string json_str, int qos, int flag) override
int connect_printer (const PrinterConnectionParams &params) override
int disconnect_printer () override
int send_message_to_printer (std::string dev_id, std::string json_str, int qos, int flag) override
bool start_discovery (bool start, bool sending) override
int bind_detect (std::string dev_ip, std::string sec_link, detectResult &detect) override
int set_server_callback (OnServerErrFn fn) override
std::string get_user_selected_machine () override
int set_user_selected_machine (std::string dev_id) override
AgentInfo get_agent_info () override
int start_print (PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn) override
int start_local_print_with_record (PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn) override
int start_send_gcode_to_sdcard (PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn) override
int start_local_print (PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn) override
int start_sdcard_print (PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn) override
int set_on_ssdp_msg_fn (OnMsgArrivedFn fn) override
int set_on_printer_connected_fn (OnPrinterConnectedFn fn) override
int set_on_subscribe_failure_fn (GetSubscribeFailureFn fn) override
int set_on_message_fn (OnMessageFn fn) override
int set_on_user_message_fn (OnMessageFn fn) override
int set_on_local_connect_fn (OnLocalConnectedFn fn) override
int set_on_local_message_fn (OnMessageFn fn) override
int set_queue_on_main_fn (QueueOnMainFn fn) override
virtual int command_ams_refresh_rfid (std::string, int, int, int, bool)
virtual int command_ams_calibrate (std::string, int, int, bool)
virtual int command_ams_select_tray (std::string, std::string, int, bool)
virtual int command_start_camera (std::string)
virtual int command_xyz_abs (std::string dev_id, int sequence_id, bool lan_mode)
virtual int command_auto_leveling (std::string dev_id, int sequence_id, bool lan_mode)
virtual int command_go_home (std::string dev_id, bool is_printing, bool supports_mqtt_homing, int sequence_id, bool lan_mode)
virtual int command_set_bed (std::string dev_id, int temp, bool supports_mqtt_bed_ctrl, int sequence_id, bool lan_mode)
virtual int command_set_nozzle (std::string dev_id, int temp, int sequence_id, bool lan_mode)
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)
virtual std::string default_lan_username () const
virtual int check_cert ()
virtual void install_device_cert (std::string dev_id, bool lan_only)
virtual int ping_bind (std::string ping_code)
virtual int bind (std::string dev_ip, std::string dev_id, std::string dev_model, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn)
virtual int unbind (std::string dev_id)
virtual int request_bind_ticket (std::string *ticket)
virtual int get_hms_snapshot (std::string dev_id, std::string file_name, std::function< void(std::string, int)> callback)
virtual int start_subscribe (std::string module)
virtual int stop_subscribe (std::string module)
virtual int add_subscribe (std::vector< std::string > dev_list)
virtual int del_subscribe (std::vector< std::string > dev_list)
virtual FilamentSyncMode get_filament_sync_mode () const
virtual CameraStreamMode get_camera_stream_mode () const
virtual bool fetch_filament_info (std::string dev_id, FilamentSyncMode sync_mode=FilamentSyncMode::pull)
virtual std::string to_orca_filament_id (const std::string &printer_filament_id) const
virtual std::string from_orca_filament_id (const std::string &orca_filament_id) const
virtual std::string get_camera_url () const

Static Public Member Functions

static AgentInfo get_agent_info_static ()

Private Member Functions

int publish_command_json (std::string dev_id, const nlohmann::json &j, bool lan_mode)

Private Attributes

std::string log_dir
std::string selected_machine
std::shared_ptr< ICloudServiceAgent > m_cloud_agent
OnMsgArrivedFn on_ssdp_msg_fn
OnPrinterConnectedFn on_printer_connected_fn
GetSubscribeFailureFn on_subscribe_failure_fn
OnMessageFn on_message_fn
OnMessageFn on_user_message_fn
OnLocalConnectedFn on_local_connect_fn
OnMessageFn on_local_message_fn
QueueOnMainFn queue_on_main_fn
OnServerErrFn on_server_err_fn
std::mutex state_mutex

Detailed Description

OrcaPrinterAgent - Stub implementation for printer operations.

All printer-related operations are currently stubs that return success. Actual printer connectivity requires the BBL SDK or future Orca implementation.

Constructor & Destructor Documentation

◆ OrcaPrinterAgent()

Slic3r::OrcaPrinterAgent::OrcaPrinterAgent ( std::string log_dir)
explicit
16 : log_dir(std::move(log_dir))
17{
18}
std::string log_dir
Definition OrcaPrinterAgent.hpp:74

References log_dir.

◆ ~OrcaPrinterAgent()

Slic3r::OrcaPrinterAgent::~OrcaPrinterAgent ( )
overridedefault

Member Function Documentation

◆ add_subscribe()

virtual int Slic3r::IPrinterAgent::add_subscribe ( std::vector< std::string > dev_list)
inlinevirtualinherited

Subscribe to push streams for specific device identifiers.

Reimplemented in Slic3r::BBLPrinterAgent.

353{ (void) dev_list; return BAMBU_NETWORK_SUCCESS; }
#define BAMBU_NETWORK_SUCCESS
Definition bambu_networking.hpp:16

References BAMBU_NETWORK_SUCCESS.

◆ bind()

virtual int Slic3r::IPrinterAgent::bind ( std::string dev_ip,
std::string dev_id,
std::string dev_model,
std::string sec_link,
std::string timezone,
bool improved,
OnUpdateStatusFn update_fn )
inlinevirtualinherited

Execute the multi-stage printer binding workflow.

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

276 {
277 (void) dev_ip;
278 (void) dev_id;
279 (void) dev_model;
280 (void) sec_link;
281 (void) timezone;
282 (void) improved;
283 (void) update_fn;
285 }

References BAMBU_NETWORK_SUCCESS.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ bind_detect()

int Slic3r::OrcaPrinterAgent::bind_detect ( std::string dev_ip,
std::string sec_link,
detectResult & detect )
overridevirtual

Perform binding detection/handshake on a LAN printer.

Implements Slic3r::IPrinterAgent.

62{
64}

References BAMBU_NETWORK_SUCCESS.

◆ check_cert()

virtual int Slic3r::IPrinterAgent::check_cert ( )
inlinevirtualinherited

Validate current user certificates for the printer.

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

235{ return BAMBU_NETWORK_SUCCESS; }

References BAMBU_NETWORK_SUCCESS.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ command_ams_calibrate()

virtual int Slic3r::IPrinterAgent::command_ams_calibrate ( std::string ,
int ,
int ,
bool  )
inlinevirtualinherited

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

#define ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED
Definition IPrinterAgent.hpp:10

References ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ command_ams_refresh_rfid()

virtual int Slic3r::IPrinterAgent::command_ams_refresh_rfid ( std::string ,
int ,
int ,
int ,
bool  )
inlinevirtualinherited

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

References ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ command_ams_select_tray()

virtual int Slic3r::IPrinterAgent::command_ams_select_tray ( std::string ,
std::string ,
int ,
bool  )
inlinevirtualinherited

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

References ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ command_auto_leveling()

virtual int Slic3r::IPrinterAgent::command_auto_leveling ( std::string dev_id,
int sequence_id,
bool lan_mode )
inlinevirtualinherited

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

141 {
142 nlohmann::json j;
143 j["print"]["command"] = "gcode_line";
144 j["print"]["param"] = "G29 \n";
145 j["print"]["sequence_id"] = std::to_string(sequence_id);
146 return publish_command_json(dev_id, j, lan_mode);
147 }
int publish_command_json(std::string dev_id, const nlohmann::json &j, bool lan_mode)
Definition IPrinterAgent.hpp:125

References publish_command_json().

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_axis_control()

virtual int Slic3r::IPrinterAgent::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 )
inlinevirtualinherited

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

184 {
185 (void) supports_mqtt_axis_control;
186
187 double value = input_val;
188 if (!is_core_xy && (axis == "Y" || axis == "Z"))
189 value = -input_val;
190
191 std::string value_str = (boost::format("%.1f") % (value * unit)).str();
192 std::string gcode;
193 if (axis == "X" || axis == "Y" || axis == "Z") {
194 gcode = (boost::format("G91 \nG1 %1%%2% F%3%\nG90 \n") % axis % value_str % speed).str();
195 } else if (axis == "E") {
196 gcode = (boost::format("M83 \nG0 %1%%2% F%3%\n") % axis % value_str % speed).str();
197 } else {
198 return -1;
199 }
200
201 nlohmann::json j;
202 j["print"]["command"] = "gcode_line";
203 j["print"]["param"] = gcode;
204 j["print"]["sequence_id"] = std::to_string(sequence_id);
205 return publish_command_json(dev_id, j, lan_mode);
206 }
@ gcode
Definition Time.hpp:14

References publish_command_json().

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_go_home()

virtual int Slic3r::IPrinterAgent::command_go_home ( std::string dev_id,
bool is_printing,
bool supports_mqtt_homing,
int sequence_id,
bool lan_mode )
inlinevirtualinherited

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

149 {
150 nlohmann::json j;
151 j["print"]["sequence_id"] = std::to_string(sequence_id);
152 if (supports_mqtt_homing) {
153 j["print"]["command"] = "back_to_center";
154 } else {
155 j["print"]["command"] = "gcode_line";
156 j["print"]["param"] = is_printing ? "G28 X\n" : "G28 \n";
157 }
158 return publish_command_json(dev_id, j, lan_mode);
159 }

References publish_command_json().

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_set_bed()

virtual int Slic3r::IPrinterAgent::command_set_bed ( std::string dev_id,
int temp,
bool supports_mqtt_bed_ctrl,
int sequence_id,
bool lan_mode )
inlinevirtualinherited

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

161 {
162 nlohmann::json j;
163 j["print"]["sequence_id"] = std::to_string(sequence_id);
164 if (supports_mqtt_bed_ctrl) {
165 j["print"]["command"] = "set_bed_temp";
166 j["print"]["temp"] = temp;
167 } else {
168 j["print"]["command"] = "gcode_line";
169 j["print"]["param"] = (boost::format("M140 S%1%\n") % temp).str();
170 }
171 return publish_command_json(dev_id, j, lan_mode);
172 }

References publish_command_json().

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_set_nozzle()

virtual int Slic3r::IPrinterAgent::command_set_nozzle ( std::string dev_id,
int temp,
int sequence_id,
bool lan_mode )
inlinevirtualinherited

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

174 {
175 nlohmann::json j;
176 j["print"]["command"] = "gcode_line";
177 j["print"]["param"] = (boost::format("M104 S%1%\n") % temp).str();
178 j["print"]["sequence_id"] = std::to_string(sequence_id);
179 return publish_command_json(dev_id, j, lan_mode);
180 }

References publish_command_json().

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_start_camera()

virtual int Slic3r::IPrinterAgent::command_start_camera ( std::string )
inlinevirtualinherited

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

References ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ command_xyz_abs()

virtual int Slic3r::IPrinterAgent::command_xyz_abs ( std::string dev_id,
int sequence_id,
bool lan_mode )
inlinevirtualinherited

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

133 {
134 nlohmann::json j;
135 j["print"]["command"] = "gcode_line";
136 j["print"]["param"] = "G90 \n";
137 j["print"]["sequence_id"] = std::to_string(sequence_id);
138 return publish_command_json(dev_id, j, lan_mode);
139 }

References publish_command_json().

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connect_printer()

int Slic3r::OrcaPrinterAgent::connect_printer ( const PrinterConnectionParams & params)
overridevirtual

Establish a direct LAN connection to a printer.

Implements Slic3r::IPrinterAgent.

38{
40}

References BAMBU_NETWORK_SUCCESS.

◆ default_lan_username()

virtual std::string Slic3r::IPrinterAgent::default_lan_username ( ) const
inlinevirtualinherited

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).

Reimplemented in Slic3r::BBLPrinterAgent.

212{ return {}; }

◆ del_subscribe()

virtual int Slic3r::IPrinterAgent::del_subscribe ( std::vector< std::string > dev_list)
inlinevirtualinherited

Remove device-level subscriptions.

Reimplemented in Slic3r::BBLPrinterAgent.

358{ (void) dev_list; return BAMBU_NETWORK_SUCCESS; }

References BAMBU_NETWORK_SUCCESS.

◆ disconnect_printer()

int Slic3r::OrcaPrinterAgent::disconnect_printer ( )
overridevirtual

Tear down the active LAN printer connection.

Implements Slic3r::IPrinterAgent.

43{
45}

References BAMBU_NETWORK_SUCCESS.

◆ fetch_filament_info()

virtual bool Slic3r::IPrinterAgent::fetch_filament_info ( std::string dev_id,
FilamentSyncMode sync_mode = FilamentSyncMode::pull )
inlinevirtualinherited

Refresh filament info from the printer synchronously. Should only be called when get_filament_sync_mode() returns FilamentSyncMode::pull. Populates the MachineObject's DevFilaSystem with fetched filament data.

Reimplemented in Slic3r::CrealityPrintAgent, Slic3r::MoonrakerPrinterAgent, Slic3r::PyPrinterAgentPluginCapabilityTrampoline, Slic3r::QidiPrinterAgent, and Slic3r::SnapmakerPrinterAgent.

462{ return false; }

References Slic3r::pull.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ from_orca_filament_id()

virtual std::string Slic3r::IPrinterAgent::from_orca_filament_id ( const std::string & orca_filament_id) const
inlinevirtualinherited

Reimplemented in Slic3r::BBLPrinterAgent.

472{ return orca_filament_id; }

◆ get_agent_info()

AgentInfo Slic3r::OrcaPrinterAgent::get_agent_info ( )
inlineoverridevirtual

Get agent information.

Implements Slic3r::IPrinterAgent.

54{ return get_agent_info_static(); }
static AgentInfo get_agent_info_static()
Definition OrcaPrinterAgent.cpp:93

References get_agent_info_static().

Here is the call graph for this function:

◆ get_agent_info_static()

AgentInfo Slic3r::OrcaPrinterAgent::get_agent_info_static ( )
static

Get agent information.

Returns
AgentInfo struct containing agent identification and descriptive information
94{
95 return AgentInfo{ORCA_PRINTER_AGENT_ID, "Orca", OrcaPrinterAgent_VERSION, "Orca Printer Communication Protocol Agent"};
96}
const std::string OrcaPrinterAgent_VERSION
Definition OrcaPrinterAgent.cpp:14
static constexpr char ORCA_PRINTER_AGENT_ID[]
Definition NetworkAgentFactory.hpp:19

References Slic3r::ORCA_PRINTER_AGENT_ID, and Slic3r::OrcaPrinterAgent_VERSION.

Referenced by get_agent_info().

Here is the caller graph for this function:

◆ get_camera_stream_mode()

virtual CameraStreamMode Slic3r::IPrinterAgent::get_camera_stream_mode ( ) const
inlinevirtualinherited

Get the camera stream mode for this agent. This value can be deterministic and derived at runtime if the printer supports multiple camera stream modes. E.g. LAN => HTTP/HTTPS/RTSP, Cloud => WebRTC.

Returns
CameraStreamMode indicating how the camera stream is obtained or used:

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

455{ return CameraStreamMode::none; }
@ none
Definition IPrinterAgent.hpp:63

References Slic3r::none.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ get_camera_url()

virtual std::string Slic3r::IPrinterAgent::get_camera_url ( ) const
inlinevirtualinherited

Get the current camera stream URL for this agent's active machine. Only meaningful when get_camera_stream_mode() returns an HTTP, HTTPS, or RTSP mode.

Reimplemented in Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

478{ return {}; }

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ get_filament_sync_mode()

virtual FilamentSyncMode Slic3r::IPrinterAgent::get_filament_sync_mode ( ) const
inlinevirtualinherited

Get the filament synchronization mode for this agent.

Returns
FilamentSyncMode indicating how filament data is obtained:
  • subscription: Real-time push updates via MQTT (no fetch needed)
  • pull: On-demand fetch via REST API (call fetch_filament_info())
  • none: Filament synchronization not supported

Reimplemented in Slic3r::BBLPrinterAgent, Slic3r::MoonrakerPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

447{ return FilamentSyncMode::none; }
@ none
Filament synchronization not supported.
Definition IPrinterAgent.hpp:57

References Slic3r::none.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ get_hms_snapshot()

virtual int Slic3r::IPrinterAgent::get_hms_snapshot ( std::string dev_id,
std::string file_name,
std::function< void(std::string, int)> callback )
inlinevirtualinherited

Fetch the cloud snapshot image captured at a print failure. Returns 0 if the request was dispatched; the image body arrives via callback(body, http_status).

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

312 {
313 (void) dev_id;
314 (void) file_name;
315 (void) callback;
316 return -1;
317 }

◆ get_user_selected_machine()

std::string Slic3r::OrcaPrinterAgent::get_user_selected_machine ( )
overridevirtual

Return the currently selected printer ID.

Implements Slic3r::IPrinterAgent.

78{
79 std::lock_guard<std::mutex> lock(state_mutex);
80 return selected_machine;
81}
std::string selected_machine
Definition OrcaPrinterAgent.hpp:75
std::mutex state_mutex
Definition OrcaPrinterAgent.hpp:89
@ lock
Definition GLGizmoEmboss.cpp:209

References selected_machine, and state_mutex.

◆ install_device_cert()

virtual void Slic3r::IPrinterAgent::install_device_cert ( std::string dev_id,
bool lan_only )
inlinevirtualinherited

Install or refresh device certificate for LAN TLS.

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

241 {
242 (void) dev_id;
243 (void) lan_only;
244 }

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ ping_bind()

virtual int Slic3r::IPrinterAgent::ping_bind ( std::string ping_code)
inlinevirtualinherited

Ping the binding endpoint to check printer readiness.

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

261 {
262 (void) ping_code;
264 }

References BAMBU_NETWORK_SUCCESS.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

◆ publish_command_json()

int Slic3r::IPrinterAgent::publish_command_json ( std::string dev_id,
const nlohmann::json & j,
bool lan_mode )
inlineprivateinherited
126 {
127 return lan_mode ? send_message_to_printer(dev_id, j.dump(), 0, 0)
128 : send_message(dev_id, j.dump(), 0, 0);
129 }
virtual int send_message(std::string dev_id, std::string json_str, int qos, int flag)=0
virtual int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag)=0
size_t dump(const PresetBundle &bundle, const Sections &sections, std::ostream &out)
Definition profile_include_dump.cpp:96

References send_message(), and send_message_to_printer().

Referenced by command_auto_leveling(), command_axis_control(), command_go_home(), command_set_bed(), command_set_nozzle(), and command_xyz_abs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_bind_ticket()

virtual int Slic3r::IPrinterAgent::request_bind_ticket ( std::string * ticket)
inlinevirtualinherited

Request a one-time bind ticket from the server.

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

300 {
301 if (ticket)
302 *ticket = {};
304 }

References BAMBU_NETWORK_SUCCESS.

◆ send_message()

int Slic3r::OrcaPrinterAgent::send_message ( std::string dev_id,
std::string json_str,
int qos,
int flag )
overridevirtual

Publish a JSON command to a printer through cloud relay.

Implements Slic3r::IPrinterAgent.

33{
35}

References BAMBU_NETWORK_SUCCESS.

◆ send_message_to_printer()

int Slic3r::OrcaPrinterAgent::send_message_to_printer ( std::string dev_id,
std::string json_str,
int qos,
int flag )
overridevirtual

Send a JSON command to a LAN printer (bypassing cloud).

Implements Slic3r::IPrinterAgent.

48{
50}

References BAMBU_NETWORK_SUCCESS.

◆ set_cloud_agent()

void Slic3r::OrcaPrinterAgent::set_cloud_agent ( std::shared_ptr< ICloudServiceAgent > cloud)
overridevirtual

Set the cloud agent used for token access. Must be called before any cloud-relay operations.

Implements Slic3r::IPrinterAgent.

23{
24 std::lock_guard<std::mutex> lock(state_mutex);
25 m_cloud_agent = cloud;
26}
std::shared_ptr< ICloudServiceAgent > m_cloud_agent
Definition OrcaPrinterAgent.hpp:76

References m_cloud_agent, and state_mutex.

◆ set_on_local_connect_fn()

int Slic3r::OrcaPrinterAgent::set_on_local_connect_fn ( OnLocalConnectedFn fn)
overridevirtual

Register LAN connection status callback.

Implements Slic3r::IPrinterAgent.

170{
171 std::lock_guard<std::mutex> lock(state_mutex);
174}
OnLocalConnectedFn on_local_connect_fn
Definition OrcaPrinterAgent.hpp:84

References BAMBU_NETWORK_SUCCESS, on_local_connect_fn, and state_mutex.

◆ set_on_local_message_fn()

int Slic3r::OrcaPrinterAgent::set_on_local_message_fn ( OnMessageFn fn)
overridevirtual

Register LAN message callback.

Implements Slic3r::IPrinterAgent.

177{
178 std::lock_guard<std::mutex> lock(state_mutex);
181}
OnMessageFn on_local_message_fn
Definition OrcaPrinterAgent.hpp:85

References BAMBU_NETWORK_SUCCESS, on_local_message_fn, and state_mutex.

◆ set_on_message_fn()

int Slic3r::OrcaPrinterAgent::set_on_message_fn ( OnMessageFn fn)
overridevirtual

Register cloud device message callback.

Implements Slic3r::IPrinterAgent.

156{
157 std::lock_guard<std::mutex> lock(state_mutex);
158 on_message_fn = fn;
160}
OnMessageFn on_message_fn
Definition OrcaPrinterAgent.hpp:82

References BAMBU_NETWORK_SUCCESS, on_message_fn, and state_mutex.

◆ set_on_printer_connected_fn()

int Slic3r::OrcaPrinterAgent::set_on_printer_connected_fn ( OnPrinterConnectedFn fn)
overridevirtual

Register printer MQTT connection callback.

Implements Slic3r::IPrinterAgent.

142{
143 std::lock_guard<std::mutex> lock(state_mutex);
146}
OnPrinterConnectedFn on_printer_connected_fn
Definition OrcaPrinterAgent.hpp:80

References BAMBU_NETWORK_SUCCESS, on_printer_connected_fn, and state_mutex.

◆ set_on_ssdp_msg_fn()

int Slic3r::OrcaPrinterAgent::set_on_ssdp_msg_fn ( OnMsgArrivedFn fn)
overridevirtual

Register SSDP discovery callback.

Implements Slic3r::IPrinterAgent.

135{
136 std::lock_guard<std::mutex> lock(state_mutex);
137 on_ssdp_msg_fn = fn;
139}
OnMsgArrivedFn on_ssdp_msg_fn
Definition OrcaPrinterAgent.hpp:79

References BAMBU_NETWORK_SUCCESS, on_ssdp_msg_fn, and state_mutex.

◆ set_on_subscribe_failure_fn()

int Slic3r::OrcaPrinterAgent::set_on_subscribe_failure_fn ( GetSubscribeFailureFn fn)
overridevirtual

Register subscription failure callback.

Implements Slic3r::IPrinterAgent.

149{
150 std::lock_guard<std::mutex> lock(state_mutex);
153}
GetSubscribeFailureFn on_subscribe_failure_fn
Definition OrcaPrinterAgent.hpp:81

References BAMBU_NETWORK_SUCCESS, on_subscribe_failure_fn, and state_mutex.

◆ set_on_user_message_fn()

int Slic3r::OrcaPrinterAgent::set_on_user_message_fn ( OnMessageFn fn)
overridevirtual

Register user-scoped message callback.

Implements Slic3r::IPrinterAgent.

163{
164 std::lock_guard<std::mutex> lock(state_mutex);
167}
OnMessageFn on_user_message_fn
Definition OrcaPrinterAgent.hpp:83

References BAMBU_NETWORK_SUCCESS, on_user_message_fn, and state_mutex.

◆ set_queue_on_main_fn()

int Slic3r::OrcaPrinterAgent::set_queue_on_main_fn ( QueueOnMainFn fn)
overridevirtual

Provide main thread queue callback.

Implements Slic3r::IPrinterAgent.

184{
185 std::lock_guard<std::mutex> lock(state_mutex);
186 queue_on_main_fn = fn;
188}
QueueOnMainFn queue_on_main_fn
Definition OrcaPrinterAgent.hpp:86

References BAMBU_NETWORK_SUCCESS, queue_on_main_fn, and state_mutex.

◆ set_server_callback()

int Slic3r::OrcaPrinterAgent::set_server_callback ( OnServerErrFn fn)
overridevirtual

Register callback for fatal HTTP errors.

Implements Slic3r::IPrinterAgent.

67{
68 std::lock_guard<std::mutex> lock(state_mutex);
71}
OnServerErrFn on_server_err_fn
Definition OrcaPrinterAgent.hpp:87

References BAMBU_NETWORK_SUCCESS, on_server_err_fn, and state_mutex.

◆ set_user_selected_machine()

int Slic3r::OrcaPrinterAgent::set_user_selected_machine ( std::string dev_id)
overridevirtual

Update the selected cloud machine preference.

Implements Slic3r::IPrinterAgent.

84{
85 std::lock_guard<std::mutex> lock(state_mutex);
86 selected_machine = dev_id;
88}

References BAMBU_NETWORK_SUCCESS, selected_machine, and state_mutex.

◆ start_discovery()

bool Slic3r::OrcaPrinterAgent::start_discovery ( bool start,
bool sending )
overridevirtual

Start or stop SSDP discovery.

Implements Slic3r::IPrinterAgent.

57{
58 return true;
59}

◆ start_local_print()

int Slic3r::OrcaPrinterAgent::start_local_print ( PrintParams params,
OnUpdateStatusFn update_fn,
WasCancelledFn cancel_fn )
overridevirtual

Start a LAN-only print.

Implements Slic3r::IPrinterAgent.

121{
123}

References BAMBU_NETWORK_SUCCESS.

◆ start_local_print_with_record()

int Slic3r::OrcaPrinterAgent::start_local_print_with_record ( PrintParams params,
OnUpdateStatusFn update_fn,
WasCancelledFn cancel_fn,
OnWaitFn wait_fn )
overridevirtual

Start a local print with cloud record.

Implements Slic3r::IPrinterAgent.

111{
113}

References BAMBU_NETWORK_SUCCESS.

◆ start_print()

int Slic3r::OrcaPrinterAgent::start_print ( PrintParams params,
OnUpdateStatusFn update_fn,
WasCancelledFn cancel_fn,
OnWaitFn wait_fn )
overridevirtual

Start a fully managed cloud print.

Implements Slic3r::IPrinterAgent.

103{
105}

References BAMBU_NETWORK_SUCCESS.

◆ start_sdcard_print()

int Slic3r::OrcaPrinterAgent::start_sdcard_print ( PrintParams params,
OnUpdateStatusFn update_fn,
WasCancelledFn cancel_fn )
overridevirtual

Start a print from printer's SD card.

Implements Slic3r::IPrinterAgent.

126{
128}

References BAMBU_NETWORK_SUCCESS.

◆ start_send_gcode_to_sdcard()

int Slic3r::OrcaPrinterAgent::start_send_gcode_to_sdcard ( PrintParams params,
OnUpdateStatusFn update_fn,
WasCancelledFn cancel_fn,
OnWaitFn wait_fn )
overridevirtual

Upload gcode to printer's SD card without starting.

Implements Slic3r::IPrinterAgent.

116{
118}

References BAMBU_NETWORK_SUCCESS.

◆ start_subscribe()

virtual int Slic3r::IPrinterAgent::start_subscribe ( std::string module)
inlinevirtualinherited

Subscribe to a logical module (for example app- or tunnel-scoped streams).

Reimplemented in Slic3r::BBLPrinterAgent.

343{ (void) module; return BAMBU_NETWORK_SUCCESS; }
FileTransferModule & module()
Definition FileTransferUtils.hpp:248

References BAMBU_NETWORK_SUCCESS, and Slic3r::module().

Here is the call graph for this function:

◆ stop_subscribe()

virtual int Slic3r::IPrinterAgent::stop_subscribe ( std::string module)
inlinevirtualinherited

Stop listening to a formerly subscribed module.

Reimplemented in Slic3r::BBLPrinterAgent.

348{ (void) module; return BAMBU_NETWORK_SUCCESS; }

References BAMBU_NETWORK_SUCCESS, and Slic3r::module().

Here is the call graph for this function:

◆ to_orca_filament_id()

virtual std::string Slic3r::IPrinterAgent::to_orca_filament_id ( const std::string & printer_filament_id) const
inlinevirtualinherited

Translate one filament id across the printer boundary.

Orca content-addresses every system filament; a printer, its AMS and its vendor cloud know only that vendor's own catalog ids. An agent whose printers already speak Orca's ids leaves them alone, and so does an id with no mapping.

Reimplemented in Slic3r::BBLPrinterAgent.

471{ return printer_filament_id; }

◆ unbind()

virtual int Slic3r::IPrinterAgent::unbind ( std::string dev_id)
inlinevirtualinherited

Remove the association between account and printer.

Reimplemented in Slic3r::BBLPrinterAgent, and Slic3r::PyPrinterAgentPluginCapabilityTrampoline.

291 {
292 (void) dev_id;
294 }

References BAMBU_NETWORK_SUCCESS.

Referenced by Slic3r::PrinterAgentPluginCapability::RegisterBindings().

Here is the caller graph for this function:

Member Data Documentation

◆ log_dir

std::string Slic3r::OrcaPrinterAgent::log_dir
private

Referenced by OrcaPrinterAgent().

◆ m_cloud_agent

std::shared_ptr<ICloudServiceAgent> Slic3r::OrcaPrinterAgent::m_cloud_agent
private

Referenced by set_cloud_agent().

◆ on_local_connect_fn

OnLocalConnectedFn Slic3r::OrcaPrinterAgent::on_local_connect_fn
private

Referenced by set_on_local_connect_fn().

◆ on_local_message_fn

OnMessageFn Slic3r::OrcaPrinterAgent::on_local_message_fn
private

Referenced by set_on_local_message_fn().

◆ on_message_fn

OnMessageFn Slic3r::OrcaPrinterAgent::on_message_fn
private

Referenced by set_on_message_fn().

◆ on_printer_connected_fn

OnPrinterConnectedFn Slic3r::OrcaPrinterAgent::on_printer_connected_fn
private

◆ on_server_err_fn

OnServerErrFn Slic3r::OrcaPrinterAgent::on_server_err_fn
private

Referenced by set_server_callback().

◆ on_ssdp_msg_fn

OnMsgArrivedFn Slic3r::OrcaPrinterAgent::on_ssdp_msg_fn
private

Referenced by set_on_ssdp_msg_fn().

◆ on_subscribe_failure_fn

GetSubscribeFailureFn Slic3r::OrcaPrinterAgent::on_subscribe_failure_fn
private

◆ on_user_message_fn

OnMessageFn Slic3r::OrcaPrinterAgent::on_user_message_fn
private

Referenced by set_on_user_message_fn().

◆ queue_on_main_fn

QueueOnMainFn Slic3r::OrcaPrinterAgent::queue_on_main_fn
private

Referenced by set_queue_on_main_fn().

◆ selected_machine

std::string Slic3r::OrcaPrinterAgent::selected_machine
private

◆ state_mutex


The documentation for this class was generated from the following files: