mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 16:52:29 +00:00
Show the print-failure snapshot in the device error dialog
When a print fails, DeviceErrorDialog now fetches the printer's captured camera frame of the failure and shows it in place of the generic HMS illustration, falling back to the local image and a drawn placeholder on older plugins or errors. - Agent: add get_hms_snapshot through NetworkAgent / IPrinterAgent (BBL calls the bound plugin symbol; other agents no-op, so old plugins degrade gracefully). - DeviceManager: parse and clear m_print_error_img_id from the print-error message. - Dialog: tiered cloud/local/placeholder image reusing the single image widget, with a liveness-guarded async callback decoded on the UI thread.
This commit is contained in:
@@ -171,6 +171,19 @@ int BBLPrinterAgent::request_bind_ticket(std::string* ticket)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int BBLPrinterAgent::get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback)
|
||||
{
|
||||
auto& plugin = BBLNetworkPlugin::instance();
|
||||
auto agent = plugin.get_agent();
|
||||
auto func = plugin.get_get_hms_snapshot();
|
||||
// dev_id/file_name are passed as lvalues to bind the plugin's std::string& params.
|
||||
// A null func (older plugin without this symbol) falls through to -1 so callers degrade gracefully.
|
||||
if (func && agent) {
|
||||
return func(agent, dev_id, file_name, callback);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int BBLPrinterAgent::set_server_callback(OnServerErrFn fn)
|
||||
{
|
||||
auto& plugin = BBLNetworkPlugin::instance();
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
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) override;
|
||||
int unbind(std::string dev_id) override;
|
||||
int request_bind_ticket(std::string* ticket) override;
|
||||
int get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback) override;
|
||||
int set_server_callback(OnServerErrFn fn) override;
|
||||
|
||||
// Machine Selection
|
||||
|
||||
@@ -139,6 +139,12 @@ public:
|
||||
*/
|
||||
virtual int request_bind_ticket(std::string* ticket) = 0;
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
virtual int get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback) = 0;
|
||||
|
||||
/**
|
||||
* Register callback for fatal HTTP errors.
|
||||
*/
|
||||
|
||||
@@ -254,6 +254,15 @@ int MoonrakerPrinterAgent::request_bind_ticket(std::string* ticket)
|
||||
return BAMBU_NETWORK_SUCCESS;
|
||||
}
|
||||
|
||||
int MoonrakerPrinterAgent::get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback)
|
||||
{
|
||||
// No BBL cloud snapshot source; report failure so the caller falls back.
|
||||
(void) dev_id;
|
||||
(void) file_name;
|
||||
(void) callback;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MoonrakerPrinterAgent::set_server_callback(OnServerErrFn fn)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(state_mutex);
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
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) override;
|
||||
int unbind(std::string dev_id) override;
|
||||
int request_bind_ticket(std::string* ticket) override;
|
||||
int get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback) override;
|
||||
int set_server_callback(OnServerErrFn fn) override;
|
||||
|
||||
// Machine Selection
|
||||
|
||||
@@ -937,4 +937,11 @@ int NetworkAgent::request_bind_ticket(std::string* ticket)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int NetworkAgent::get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback)
|
||||
{
|
||||
if (m_printer_agent)
|
||||
return m_printer_agent->get_hms_snapshot(dev_id, file_name, callback);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -166,6 +166,7 @@ public:
|
||||
FilamentSyncMode get_filament_sync_mode() const;
|
||||
bool fetch_filament_info(std::string dev_id);
|
||||
int request_bind_ticket(std::string* ticket);
|
||||
int get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback);
|
||||
|
||||
private:
|
||||
struct PrinterCallbacks {
|
||||
|
||||
@@ -95,6 +95,15 @@ int OrcaPrinterAgent::request_bind_ticket(std::string* ticket)
|
||||
return BAMBU_NETWORK_SUCCESS;
|
||||
}
|
||||
|
||||
int OrcaPrinterAgent::get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback)
|
||||
{
|
||||
// No BBL cloud snapshot source; report failure so the caller falls back.
|
||||
(void) dev_id;
|
||||
(void) file_name;
|
||||
(void) callback;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int OrcaPrinterAgent::set_server_callback(OnServerErrFn fn)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(state_mutex);
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
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) override;
|
||||
int unbind(std::string dev_id) override;
|
||||
int request_bind_ticket(std::string* ticket) override;
|
||||
int get_hms_snapshot(std::string dev_id, std::string file_name, std::function<void(std::string, int)> callback) override;
|
||||
int set_server_callback(OnServerErrFn fn) override;
|
||||
|
||||
// Machine Selection
|
||||
|
||||
Reference in New Issue
Block a user