From aa44d57eac62b2eaa40f99a4764bcff69f28b13f Mon Sep 17 00:00:00 2001 From: SoftFever Date: Thu, 16 Jul 2026 00:48:56 +0800 Subject: [PATCH] Bind the 02.08.01.52 plugin's new ABI symbols Add the 11 functions the newer plugin exports (HMS snapshot, GoLive camera URL, consent report, cloud filament-spool CRUD, AMS-filament sync, login-state and studio-info hooks) plus their four parameter structs. Everything resolves to null on older plugins and no caller invokes them yet, so this is inert ABI surface for later features. --- src/slic3r/Utils/BBLNetworkPlugin.cpp | 25 ++++++++++++++++ src/slic3r/Utils/BBLNetworkPlugin.hpp | 35 ++++++++++++++++++++++ src/slic3r/Utils/bambu_networking.hpp | 43 +++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/src/slic3r/Utils/BBLNetworkPlugin.cpp b/src/slic3r/Utils/BBLNetworkPlugin.cpp index 142b2a41cc..8e531eb990 100644 --- a/src/slic3r/Utils/BBLNetworkPlugin.cpp +++ b/src/slic3r/Utils/BBLNetworkPlugin.cpp @@ -639,6 +639,19 @@ void BBLNetworkPlugin::load_all_function_pointers() m_get_model_mall_rating_result = reinterpret_cast(get_function("bambu_network_get_model_mall_rating")); m_get_mw_user_preference = reinterpret_cast(get_function("bambu_network_get_mw_user_preference")); m_get_mw_user_4ulist = reinterpret_cast(get_function("bambu_network_get_mw_user_4ulist")); + + // Added by the 02.08.01.52 plugin ABI; resolve to null on older plugins so callers no-op. + m_set_on_user_login_fn = reinterpret_cast(get_function("bambu_network_set_on_user_login_fn")); + m_get_studio_info_url = reinterpret_cast(get_function("bambu_network_get_studio_info_url")); + m_report_consent = reinterpret_cast(get_function("bambu_network_report_consent")); + m_get_camera_url_for_golive = reinterpret_cast(get_function("bambu_network_get_camera_url_for_golive")); + m_get_hms_snapshot = reinterpret_cast(get_function("bambu_network_get_hms_snapshot")); + m_get_filament_spools = reinterpret_cast(get_function("bambu_network_get_filament_spools")); + m_create_filament_spool = reinterpret_cast(get_function("bambu_network_create_filament_spool")); + m_update_filament_spool = reinterpret_cast(get_function("bambu_network_update_filament_spool")); + m_delete_filament_spools = reinterpret_cast(get_function("bambu_network_delete_filament_spools")); + m_get_filament_config = reinterpret_cast(get_function("bambu_network_get_filament_config")); + m_sync_ams_filaments = reinterpret_cast(get_function("bambu_network_sync_ams_filaments")); } void BBLNetworkPlugin::clear_all_function_pointers() @@ -741,6 +754,18 @@ void BBLNetworkPlugin::clear_all_function_pointers() m_get_model_mall_rating_result = nullptr; m_get_mw_user_preference = nullptr; m_get_mw_user_4ulist = nullptr; + + m_set_on_user_login_fn = nullptr; + m_get_studio_info_url = nullptr; + m_report_consent = nullptr; + m_get_camera_url_for_golive = nullptr; + m_get_hms_snapshot = nullptr; + m_get_filament_spools = nullptr; + m_create_filament_spool = nullptr; + m_update_filament_spool = nullptr; + m_delete_filament_spools = nullptr; + m_get_filament_config = nullptr; + m_sync_ams_filaments = nullptr; } std::vector get_all_available_versions() diff --git a/src/slic3r/Utils/BBLNetworkPlugin.hpp b/src/slic3r/Utils/BBLNetworkPlugin.hpp index f650f23546..7ca989c129 100644 --- a/src/slic3r/Utils/BBLNetworkPlugin.hpp +++ b/src/slic3r/Utils/BBLNetworkPlugin.hpp @@ -128,6 +128,19 @@ typedef int (*func_start_sdcard_print_legacy)(void* agent, PrintParams_Legacy pa typedef int (*func_send_message_legacy)(void* agent, std::string dev_id, std::string json_str, int qos); typedef int (*func_send_message_to_printer_legacy)(void* agent, std::string dev_id, std::string json_str, int qos); +// Added by the 02.08.01.52 plugin ABI (null on older plugins). +typedef int (*func_set_on_user_login_fn)(void *agent, OnUserLoginFn fn); +typedef std::string (*func_get_studio_info_url)(void *agent); +typedef int (*func_report_consent)(void *agent, std::string expand); +typedef int (*func_get_camera_url_for_golive)(void *agent, std::string dev_id, std::string sdev_id, std::function callback); +typedef int (*func_get_hms_snapshot)(void *agent, std::string& dev_id, std::string& file_name, std::function callback); +typedef int (*func_get_filament_spools)(void *agent, FilamentQueryParams params, std::string* http_body); +typedef int (*func_create_filament_spool)(void *agent, std::string request_body, std::string* http_body); +typedef int (*func_update_filament_spool)(void *agent, std::string spool_id, std::string request_body, std::string* http_body); +typedef int (*func_delete_filament_spools)(void *agent, FilamentDeleteParams params, std::string* http_body); +typedef int (*func_get_filament_config)(void *agent, std::string* http_body); +typedef int (*func_sync_ams_filaments)(void *agent, AmsSyncParams params, std::string* http_body); + /** * BBLNetworkPlugin - Singleton managing the Bambu Lab network DLL. * @@ -372,6 +385,17 @@ public: func_get_model_mall_rating_result get_get_model_mall_rating_result() const { return m_get_model_mall_rating_result; } func_get_mw_user_preference get_get_mw_user_preference() const { return m_get_mw_user_preference; } func_get_mw_user_4ulist get_get_mw_user_4ulist() const { return m_get_mw_user_4ulist; } + func_set_on_user_login_fn get_set_on_user_login_fn() const { return m_set_on_user_login_fn; } + func_get_studio_info_url get_get_studio_info_url() const { return m_get_studio_info_url; } + func_report_consent get_report_consent() const { return m_report_consent; } + func_get_camera_url_for_golive get_get_camera_url_for_golive() const { return m_get_camera_url_for_golive; } + func_get_hms_snapshot get_get_hms_snapshot() const { return m_get_hms_snapshot; } + func_get_filament_spools get_get_filament_spools() const { return m_get_filament_spools; } + func_create_filament_spool get_create_filament_spool() const { return m_create_filament_spool; } + func_update_filament_spool get_update_filament_spool() const { return m_update_filament_spool; } + func_delete_filament_spools get_delete_filament_spools() const { return m_delete_filament_spools; } + func_get_filament_config get_get_filament_config() const { return m_get_filament_config; } + func_sync_ams_filaments get_sync_ams_filaments() const { return m_sync_ams_filaments; } // ======================================================================== // Legacy Helper @@ -506,6 +530,17 @@ private: func_get_model_mall_rating_result m_get_model_mall_rating_result{nullptr}; func_get_mw_user_preference m_get_mw_user_preference{nullptr}; func_get_mw_user_4ulist m_get_mw_user_4ulist{nullptr}; + func_set_on_user_login_fn m_set_on_user_login_fn{nullptr}; + func_get_studio_info_url m_get_studio_info_url{nullptr}; + func_report_consent m_report_consent{nullptr}; + func_get_camera_url_for_golive m_get_camera_url_for_golive{nullptr}; + func_get_hms_snapshot m_get_hms_snapshot{nullptr}; + func_get_filament_spools m_get_filament_spools{nullptr}; + func_create_filament_spool m_create_filament_spool{nullptr}; + func_update_filament_spool m_update_filament_spool{nullptr}; + func_delete_filament_spools m_delete_filament_spools{nullptr}; + func_get_filament_config m_get_filament_config{nullptr}; + func_sync_ams_filaments m_sync_ams_filaments{nullptr}; }; } // namespace Slic3r diff --git a/src/slic3r/Utils/bambu_networking.hpp b/src/slic3r/Utils/bambu_networking.hpp index 4049fd21f8..7ae94841ab 100644 --- a/src/slic3r/Utils/bambu_networking.hpp +++ b/src/slic3r/Utils/bambu_networking.hpp @@ -128,6 +128,7 @@ typedef std::function GetSubscribeFailureFn; typedef std::function OnUpdateStatusFn; typedef std::function WasCancelledFn; typedef std::function OnWaitFn; +typedef std::function OnUserLoginFn; // local callbacks typedef std::function OnMsgArrivedFn; // queue call to main thread @@ -291,6 +292,48 @@ struct TaskQueryParams int limit = 20; }; +struct FilamentQueryParams +{ + std::string category; + std::string status; + std::string spool_id; + std::string rfid; + int offset = 0; + int limit = 20; +}; + +struct FilamentDeleteParams +{ + std::vector ids; + std::vector rfids; +}; + +struct AmsSyncItem { + std::string RFID; + std::string filamentVendor; + std::string filamentType; + std::string filamentName; + std::string filamentId; + bool isSupport = false; + std::string color; + int colorType = 0; + std::vector colors; + int netWeight = 0; + int totalNetWeight = 0; + std::string trayIdName; + std::string note; + std::string amsSn; + std::string slotId; + int amsId = 0; + int amsType = 0; + bool createNew = false; +}; + +struct AmsSyncParams { + std::string devId; + std::vector items; +}; + struct PublishParams { std::string project_name; std::string project_3mf_file;