Files
OrcaSlicer/src/slic3r/Utils/BBLCloudServiceAgent.hpp
T
HanifKoh 84657ff11e Add Missing Includes Across the Remaining Sources and Tests (#16071)
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
2026-10-03 13:45:21 +08:00

144 lines
7.3 KiB
C++

#ifndef __BBL_CLOUD_SERVICE_AGENT_HPP__
#define __BBL_CLOUD_SERVICE_AGENT_HPP__
#include "CloudProvider.hpp"
#include "ICloudServiceAgent.hpp"
#include "bambu_networking.hpp"
#include <functional>
#include "libslic3r/ProjectTask.hpp"
#include <string>
#include <map>
#include <vector>
namespace Slic3r {
/**
* BBLCloudServiceAgent - BBL DLL wrapper implementation of ICloudServiceAgent.
*
* Delegates all cloud service and authentication operations to the proprietary
* BBL network DLL through function pointers obtained from BBLNetworkPlugin singleton.
* This class combines the functionality of the former BBLAuthAgent and BBLCloudServiceAgent.
*/
class BBLCloudServiceAgent : public ICloudServiceAgent {
public:
BBLCloudServiceAgent();
~BBLCloudServiceAgent() override;
std::string get_id() const override { return BBL_CLOUD_PROVIDER; }
// ========================================================================
// ICloudServiceAgent Interface Implementation - Auth Methods
// ========================================================================
// Lifecycle
int init_log() override;
int set_config_dir(std::string config_dir) override;
int set_cert_file(std::string folder, std::string filename) override;
int set_country_code(std::string country_code) override;
int start() override;
// User Session Management
int change_user(std::string user_info) override;
bool is_user_login() override;
int user_logout(bool request = false) override;
std::string get_user_id() override;
std::string get_user_name() override;
std::string get_user_avatar() override;
std::string get_user_nickname() override;
// Login UI Support
std::string build_login_cmd() override;
std::string build_logout_cmd() override;
std::string build_login_info() override;
// Token Access (BBL manages tokens internally)
std::string get_access_token() const override;
std::string get_refresh_token() const override;
bool ensure_token_fresh(const std::string& reason) override;
// ========================================================================
// ICloudServiceAgent Interface Implementation - Cloud Methods
// ========================================================================
// Server Connectivity
std::string get_cloud_service_host() override;
std::string get_cloud_login_url(const std::string& language = "") override;
int connect_server() override;
bool is_server_connected() override;
int refresh_connection() override;
int start_subscribe(std::string module) override;
int stop_subscribe(std::string module) override;
int add_subscribe(std::vector<std::string> dev_list) override;
int del_subscribe(std::vector<std::string> dev_list) override;
void enable_multi_machine(bool enable) override;
// Settings Synchronization
int get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets) override;
std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code) override;
int put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code, bool force = false) override;
int get_setting_list(std::string bundle_version, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr) override;
int get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr) override;
int delete_setting(std::string setting_id) override;
// Cloud User Services
int get_my_message(int type, int after, int limit, unsigned int* http_code, std::string* http_body) override;
int check_user_task_report(int* task_id, bool* printable) override;
int get_user_print_info(unsigned int* http_code, std::string* http_body) override;
int get_user_tasks(TaskQueryParams params, std::string* http_body) override;
int get_printer_firmware(std::string dev_id, unsigned* http_code, std::string* http_body) override;
int get_task_plate_index(std::string task_id, int* plate_index) override;
int get_user_info(int* identifier) override;
int get_subtask_info(std::string subtask_id, std::string* task_json, unsigned int* http_code, std::string* http_body) override;
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json) override;
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body) override;
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_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;
int get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn) override;
int get_model_mall_home_url(std::string* url) override;
int get_model_mall_detail_url(std::string* url, std::string id) override;
int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body) override;
int get_my_token(std::string ticket, unsigned int* http_code, std::string* http_body) override;
// Analytics & Tracking
int track_enable(bool enable) override;
int track_remove_files() override;
int track_event(std::string evt_key, std::string content) override;
int track_header(std::string header) override;
int track_update_property(std::string name, std::string value, std::string type = "string") override;
int track_get_property(std::string name, std::string& value, std::string type = "string") override;
bool get_track_enable() override;
// Ratings & Reviews
int put_model_mall_rating(int design_id, int score, std::string content, std::vector<std::string> images, unsigned int& http_code, std::string& http_error) override;
int get_oss_config(std::string& config, std::string country_code, unsigned int& http_code, std::string& http_error) override;
int put_rating_picture_oss(std::string& config, std::string& pic_oss_path, std::string model_id, int profile_id, unsigned int& http_code, std::string& http_error) override;
int get_model_mall_rating_result(int job_id, std::string& rating_result, unsigned int& http_code, std::string& http_error) override;
// Extra Features
int get_mw_user_preference(std::function<void(std::string)> callback) override;
int get_mw_user_4ulist(int seed, int limit, std::function<void(std::string)> callback) override;
std::string get_version() override;
// Cloud Callbacks
int set_on_server_connected_fn(AppOnServerConnectedFn fn) override;
int set_on_http_error_fn(AppOnHttpErrorFn fn) override;
int set_get_country_code_fn(GetCountryCodeFn fn) override;
int set_queue_on_main_fn(QueueOnMainFn fn) override;
private:
int set_extra_http_header();
static std::map<std::string, std::string> get_extra_header();
bool m_enable_track{false};
AppOnServerConnectedFn m_app_on_server_connected_fn;
AppOnHttpErrorFn m_app_on_http_error_fn;
};
} // namespace Slic3r
#endif // __BBL_CLOUD_SERVICE_AGENT_HPP__