mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-04 22:31:02 +00:00
* Add developer flag for printer agents
* Parse user print info on the UI thread to prevent heap corruption (#119)
get_user_print_info()'s HTTP fetch can run on a worker thread (e.g. BindJob),
but parse_user_print_info() mutates userMachineList (insert/erase/delete
MachineObject). on_machine_alive (SSDP) mutates the same maps on the UI thread
without locking, so parsing off-thread races the map and frees MachineObjects
out from under it -> heap corruption.
Keep all device-list mutation on the UI thread: parse inline when already on
the main thread, otherwise marshal via CallAfter so it stays serialized with
on_machine_alive.
* Prevent loss of user access code on LAN reselect
Keep user access code intact to maintain access rights even if
device slot is unpopulated, ensuring continuous connection
and status message reception.
* Harden send flow and separate upload failure recovery (#111)
* fix(send): harden FT send path + IP pre-flight UX
* Remove early returns
* Working Moonraker and Qidi printer agent transport (#104)
Folds the Qidi AMS box-mapping print
overrides (apply_box_mapping +
start_* wrappers) that the transport
fix builds on.
* Add support for runtime error status in plugins
Distinguish a loaded plugin whose
capability errored (RuntimeError,
warn-styled, stays checked) from a
load-time Error. Status now derives
via resolve_plugin_status(); enum
ordinal keeps dialog sort priority.
Unloading clears stale errors.
* Resolve duplicate agent ID conflicts
Reject a printer-agent capability
whose agent ID is already owned by
another capability or built-in:
flag the plugin error, disable the
capability, and warn the user
instead of silently ignoring it.
* fix: checkbox should depend on plugin is_loaded status
* Replace fake-enum printer agent dropdown (#121)
A dedicated PrinterAgentChoice field
reads rows straight from the live
agent registry and stores the agent
id string, replacing the fake-coEnum
index mapping. The field moves to
TabPrinter and registers with the
searcher so UnsavedChanges renders
it; the PhysicalPrinterDialog copy
and its update hook are removed
(#125). switch_printer_agent now
resolves ids via
resolve_printer_agent_id.
* Reset device selection on agent swap or unload (#124)
set_live_printer_agent centralizes
the swap: deselect the machine,
clear stale sidebar state and the
previous agent's Other Devices, then
install the new agent (or null when
its provider vanished). Plugin
load/unload callbacks refresh the
dropdown and re-run agent selection.
load_last_machine no longer falls
back to the first available machine.
* Gate agent mode behind use_printer_agents toggle
Replace per-printer auto-activation
(is_current_printer_agent_plugin)
with a global experimental AppConfig
toggle, default off: legacy
print-host behavior is unchanged
until the user opts in. The toggle
drives device-tab routing, print
button defaults, connect-button
visibility and sidebar layout, and
dedups machine-select dialog opens.
* Track BBLPrinterAgentPlugin.py
* Add printer-agent and plugin status tests
Ports the agent lifecycle, duplicate
agent-id, built-in-id clash and
status-resolution tests. The loader
runs on a detached worker thread, so
the lifecycle tests live in their own
executable. Tests install the
production unload-side registry
wiring themselves (no GUI in the
test binary) and register agents
manually so concurrent loads stay
deterministic.
* fix: pin HTTP to prevent connection refusal
Set `use_ssl` to false to ensure Moonraker
connectivity, as the service uses HTTP rather
than HTTPS, preventing connection issues. Initialize
device info early for reliable name resolution.
* Bring Moonraker device panel to feature parity
The monitor panel showed wrong or missing
data for Moonraker printers, and its
controls did nothing.
Push payload now carries layer number and
total layers. Remaining time replaces the
wrong total_duration - print_duration
formula. The chamber light toggle maps to
Klipper SET_PIN / SET_LED, and pause,
resume and stop post to
/printer/print/{action}. Task thumbnails
resolve via /server/files/thumbnails onto
a new MachineObject thumbnail url.
Filament sync switches to pull mode so the
agent is queried on demand.
Not compiled or run.
* Stop blocking print on unreported nozzle data
* fix: make Klipper macro lamp control reliable
* Surface Moonraker webcams and gate unrunnable controls
* Keep Bambu AMS dialect out of the agent waist
M620 is Bambu firmware dialect, not a
neutral command. Composing it in
MachineObject let non-Bambu agents
(Moonraker/Klipper) forward it and
report success on firmware that
cannot run it.
Agents now own the dialect: the
default refusal on IPrinterAgent
returns not-supported so the UI
can say so; BBLPrinterAgent keeps
the byte-identical composition.
* Fix multi-color filament logic
Reuse color decoding across functions to improve
code readability and maintain consistency in
multi-color filament handling.
* Move Moonraker commands off the UI thread
Pause/resume/stop, g-code sends, temps, and
light ran synchronous HTTP on the UI thread,
freezing the app up to 10s per click on slow
or unreachable printers.
Run them on a single agent-owned FIFO worker
so g-code ordering is preserved, while command
translation stays synchronous so unsupported-
command dialogs still work.
Add a pending-disabled state to the pause,
resume, and abort buttons for Moonraker-family
printers: the icon only flips once the
WebSocket reports the real state, which also
rules out double-click races.
* Show Snapmaker U1 camera in Device tab
The U1 exposes no /server/webcams/list entry;
its camera only captures after an explicit
camera.start_monitor RPC, which the Moonraker
websocket executes unauthenticated but only
answers over MQTT - so the call is fire and
forget.
Start the camera when the camera view is
shown and renew every 300 s: the printer
retires the capture task at ~362 s and
stop_monitor is accepted but ineffective,
so teardown is simply to stop renewing.
Frames land in monitor.jpg as still JPEGs
(~2 fps at interval 0), so the webview loads
a local HTML wrapper that repolls with a
cache buster.
* fix: start stream when camera URL changes
* fix: stop Qidi slot parse throwing on null
* Keep printer-agent progress in sync
Keep the shared task progress aligned with agent
reports that lack Bambu cloud task identity.
Release the lazily allocated task during reset to
avoid leaks when machine objects reconnect.
* docs: document the printer-agent subsystem
* fix: merge access codes into one
* Reconcile implementation split with PR tip
* feat: abstract remaining gcode commands in devicemanager
* refactor: abstract bambu specific protocol to printer agent
* refactor: push bbl workflows to bbl printer agent
* remove unused
* fix: default impl
* fix callback error
* fix: remove redundant cache
* specify api for getting file transfer url
* revert file transfer abstraction
* fix: ams filament mapping workflow
* feat: update qidi to use subscription based filament sync mode
* fix: resolve stubgen byte header conflict
* fix: ams sync info and periodic ams sync via subscription workflow
* fix: skip filament sync dialog if filamentSyncMode is none
* feat: parse nozzle information for qidi and moonraker printer agents
* fix: extend access code requirements t 0, 8 or more characters.
* remove irrelevant docs
* fix: remove heavy includes from IPrinterAgent
* fix: defer filesystem and camera abstractions
* fix: remote do_fetch_filament_info from tests
* cleanup moonraker and snapmaker printer agents
* fix: access codes regression
* fix: tests
* fix: printer agent switching on preset change
* fix: remove unused variable
* fix: snapmaker U1 SelectMachineDialog blocking print
* fix: merge artifact
* fix: clear up some unrelated changes
* feat: connect to cloud printer and monitor
* feat: connect to cloud printer and monitor
* feat: generic camera stream support for http snapshot and rtsp
* fix: build & access code UI
* feat: generic camera stream support for http snapshot and rtsp
* fix: build & access code UI
* feat: connect to cloud printer and monitor
* feat: connect to cloud printer and monitor
* fix: build errors
* feat: camera via webrtc
* fix: build
* fix: cmake
* feat: remove frame assembler and change config to set protocol
* fix: orcaprinteragent refactor
* fix: LAN paths and camera stream
* feat: use ffmpeg to render http camera stream
* fix: make model_id/dev_type optional instead of blocking
* fix: connect via ip dialog
* feat: LAN impl for Orca Printer Agent
* fix: model_id resolution method for non bambu printers
* fix: ffmpeg http camera stream jittering due to incomplete frames
* fix: revert sdcard check
* feat: check printer storage status before sending
* fix: moonraker printer agent hang on printer power cut
* fix: shim layer for any compatibiliity changes
* fix: cloud printers were using the wrong MQTT endpoint
* feat: cloud download via HTTP
* temp: doc for intended change
* fix: warnings
* fix: warnings
* fix: camera auto-play on startup
* fix: split infra from impl
* fix: uninitialized ams state blocking print
* Fixes nullptr deref
* Log first before std::move
* fix: printer agent virutal optional functions
* fix: parameterize orcaslicer_copy_test_dlls() for printer_agent_plugin_tests
* Revert "fix: parameterize orcaslicer_copy_test_dlls() for printer_agent_plugin_tests"
This reverts commit 2f566e3779.
* Guard libdatachannel. Remove unused code
* fix: unit tests & unused variables
* fix(ci): deps build order for datachannel
* Resolve printer agent first before getting cloud printer agent
* fix(ci): set depends openssl
* fix: re-include apply header guarded by ifdef __APPLE__
* fix(ci): add libdatachannel to flatpak manifest
* fix: add internal_developer_mode chekc back to MediaPlayCtrl::load()
* fix: invoke js clearInterval on WebMediaController::stop
* fix: change rtc log level
* fix: inject provider, agent id and generation to get_user_print_info to ensure correct metadata
* fix: revert moonraker specific behavior
* fix: remove stale comment
* fix: use ORCA_CLOUD_PROVIDER instead of hardcoded string
* fix: remove hardcoded ICE servers
* feat: enable https camera stream mode
* fix: move non-mandatory printer agent function stubs to IPrinterAgent
* fix: dedupe compatible printer type check
* fix: stop the correct media controller
* fix: scope get_my_machine_list to printers listed under the current printer agent
* fix: move printer agent plugin tests into test_plugin_lifecycle.cpp
* fix: always build bundled DataChannel dep
* fix: disable unused DataChannel media support
* revert: filament sync work
* fix: wrap command_* with small wrapper
* fix: regression bug, connecting to bambu needs bblp username
* fix: default impl for vendor agnostic gcode commansd
* refactor: media controller playback routing and ownership
* fix: bump libdatachannel ver & update flatpak to use tar instead
* fix: stop flatpak DataChannel build from re-cloning over the sandboxed network
* fix: update windows ffmpeg prebuild
* fix: update printer agent plugin API
* fix: shift camera signaling channel to network agent
* fix: follow external-packages for flatpak libdatachannel deps & add flatpak path to use source_dir
* feat: add printer-agent.md doc to HLSD
* fix: guard DeviceManager command dispatch when no printer agent is bound
* fix: port BBL implementations from #15711
* refactor: connect_printer api and dialog
* fix(tests): make omitted printer agent operations answer like a missing agent
* fix: preserve printer agent defaults in PrinterAgentPluginCapabilityTrampoline
* test: cover printer agent default command dispatch
* fix: validate windows FFmpeg avformat library
* feat: extend optional printer model warnings to calibration & ams workflows
* fix: handle malformed printer progress values safely
* fix: clear webview document on stop
* chore: reduce diagnostic logging level to trace
* refactor: centralize printer compatibility checks
* tests: add device manager integration coverage
* tests: cover WebMediaController lifecycle with wxWebView stub
* fix: make integration tests headless
* refactor: collapse command_ams_refresh_rfid and command_ams_refresh_rfid2
* refactor: make printer connection SSL agent-specific
* fix: persist input printer host and port
* fix: use correct device id for Moonraker connections
* fix: make moonraker gcode commands asynchronous
* fix: preserve moonraker device names
* fix: add include for non BBL_RELEASE_TO_PUBLIC path in BBLPrinterAgent
---------
Co-authored-by: Andrew <159703254+andrewsoonqn@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
Co-authored-by: Lam Wei Lun <weilun.lam@gmail.com>
491 lines
16 KiB
C++
491 lines
16 KiB
C++
#ifndef __I_CLOUD_SERVICE_AGENT_HPP__
|
|
#define __I_CLOUD_SERVICE_AGENT_HPP__
|
|
|
|
#include "ICameraSignalingChannel.hpp"
|
|
#include "bambu_networking.hpp"
|
|
#include "CloudProvider.hpp"
|
|
#include "../../libslic3r/ProjectTask.hpp"
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
#include <functional>
|
|
#include <memory>
|
|
|
|
namespace Slic3r {
|
|
|
|
/**
|
|
* ICloudServiceAgent - Interface for authentication and cloud service operations.
|
|
*
|
|
* This interface encapsulates all cloud-related functionality including authentication:
|
|
* - Lifecycle methods for agent initialization
|
|
* - User session management (login/logout)
|
|
* - Token access for dependent agents (IPrinterAgent)
|
|
* - Login UI command builders for WebView integration
|
|
* - Server connectivity and subscription management
|
|
* - Settings synchronization (presets upload/download)
|
|
* - Cloud user services (messages, tasks, firmware)
|
|
* - Model mall and publishing
|
|
* - Analytics and telemetry
|
|
* - Ratings and reviews
|
|
*
|
|
* Implementations:
|
|
* - OrcaCloudServiceAgent: Native implementation for Orca Cloud (includes OAuth PKCE)
|
|
* - BBLCloudServiceAgent: Wrapper around Bambu Lab's proprietary DLL
|
|
*
|
|
* Token Sharing Pattern:
|
|
* IPrinterAgent receives an ICloudServiceAgent instance via set_cloud_agent() to
|
|
* access tokens for cloud-relay operations without coupling to a specific auth
|
|
* implementation.
|
|
*/
|
|
|
|
struct CloudEvent {
|
|
std::string provider; // ORCA_CLOUD_PROVIDER or BBL_CLOUD_PROVIDER
|
|
};
|
|
|
|
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)>;
|
|
|
|
class ICloudServiceAgent {
|
|
public:
|
|
virtual ~ICloudServiceAgent() = default;
|
|
|
|
// ========================================================================
|
|
// Lifecycle Methods
|
|
// ========================================================================
|
|
/**
|
|
* Initialize the logging backend for the agent.
|
|
* Call after set_config_dir() so logs have a destination.
|
|
*/
|
|
virtual int init_log() = 0;
|
|
|
|
/**
|
|
* Provide the writable configuration directory for storing auth state.
|
|
* Must be called before start().
|
|
*/
|
|
virtual int set_config_dir(std::string config_dir) = 0;
|
|
|
|
/**
|
|
* Register the client certificate file for TLS authentication.
|
|
* May be unused by some implementations (e.g., OrcaCloudServiceAgent).
|
|
*/
|
|
virtual int set_cert_file(std::string folder, std::string filename) = 0;
|
|
|
|
/**
|
|
* Set the country code for region-specific backend selection.
|
|
*/
|
|
virtual int set_country_code(std::string country_code) = 0;
|
|
|
|
virtual std::string get_id() const = 0;
|
|
/**
|
|
* Start the agent, performing any expensive initialization.
|
|
* Typically regenerates PKCE bundles and attempts silent sign-in.
|
|
*/
|
|
virtual int start() = 0;
|
|
|
|
// ========================================================================
|
|
// User Session Management
|
|
// ========================================================================
|
|
/**
|
|
* Authenticate the user with the provided JSON payload.
|
|
*
|
|
* Supported formats:
|
|
* 1. Traditional: {"username": "...", "password": "..."}
|
|
* 2. WebView/OAuth: {"command": "user_login", "data": {...}}
|
|
* 3. Token format: {"data": {"token": "...", "refresh_token": "...", "user": {...}}}
|
|
*
|
|
*/
|
|
virtual int change_user(std::string user_info) = 0;
|
|
|
|
/**
|
|
* Check whether a valid authenticated session exists.
|
|
*/
|
|
virtual bool is_user_login() = 0;
|
|
|
|
/**
|
|
* Terminate the current session.
|
|
* @param request If true, also notify the backend to invalidate the session.
|
|
*/
|
|
virtual int user_logout(bool request = false) = 0;
|
|
|
|
/**
|
|
* Return the backend-generated user ID for the current session.
|
|
*/
|
|
virtual std::string get_user_id() = 0;
|
|
|
|
/**
|
|
* Return the display name for the current user.
|
|
*/
|
|
virtual std::string get_user_name() = 0;
|
|
|
|
/**
|
|
* Return the avatar URL/path for the current user.
|
|
*/
|
|
virtual std::string get_user_avatar() = 0;
|
|
|
|
/**
|
|
* Return the nickname for the current user.
|
|
*/
|
|
virtual std::string get_user_nickname() = 0;
|
|
|
|
// ========================================================================
|
|
// Login UI Support
|
|
// ========================================================================
|
|
/**
|
|
* Build a JSON command for the WebView login flow.
|
|
* Contains backend URL, API key, and PKCE parameters.
|
|
*/
|
|
virtual std::string build_login_cmd() = 0;
|
|
|
|
/**
|
|
* Build a JSON command for WebView logout.
|
|
*/
|
|
virtual std::string build_logout_cmd() = 0;
|
|
|
|
/**
|
|
* Return a JSON snapshot of the active session (user info, no tokens).
|
|
* Used by WebView to display current user state.
|
|
*/
|
|
virtual std::string build_login_info() = 0;
|
|
|
|
// ========================================================================
|
|
// Token Access (for dependent agents)
|
|
// ========================================================================
|
|
/**
|
|
* Return the current access token for API calls.
|
|
* Cloud and printer agents use this for Authorization headers.
|
|
*/
|
|
virtual std::string get_access_token() const = 0;
|
|
|
|
/**
|
|
* Return the current refresh token (if available).
|
|
*/
|
|
virtual std::string get_refresh_token() const = 0;
|
|
|
|
/**
|
|
* Ensure the access token is fresh, refreshing if necessary.
|
|
* Call before making API requests to avoid 401 errors.
|
|
*
|
|
* @param reason Descriptive string for logging (e.g., "connect_server")
|
|
* @return true if the token is fresh or was successfully refreshed
|
|
*/
|
|
virtual bool ensure_token_fresh(const std::string& reason) = 0;
|
|
|
|
// ========================================================================
|
|
// Server Connectivity
|
|
// ========================================================================
|
|
/**
|
|
* Return the base hostname for cloud API calls (varies by region).
|
|
* Helpful for diagnostics and when building browser URLs.
|
|
*/
|
|
virtual std::string get_cloud_service_host() = 0;
|
|
|
|
/**
|
|
* Return the login URL for the cloud service.
|
|
* @param language Optional language code (e.g., "en-US", "zh-CN") for localized login page.
|
|
* If empty, returns the default (non-localized) login URL.
|
|
* @return The full URL to the login page, or a local file:// URL for native implementations.
|
|
*/
|
|
virtual std::string get_cloud_login_url(const std::string& language = "") = 0;
|
|
|
|
/**
|
|
* Perform a health check against the configured backend.
|
|
* Updates is_server_connected() state and triggers OnServerConnectedFn.
|
|
*/
|
|
virtual int connect_server() = 0;
|
|
|
|
/**
|
|
* Return whether the server is currently reachable.
|
|
*/
|
|
virtual bool is_server_connected() = 0;
|
|
|
|
/**
|
|
* Force a server state recheck, clearing any cached state.
|
|
*/
|
|
virtual int refresh_connection() = 0;
|
|
|
|
/**
|
|
* Subscribe to a logical module (e.g., "printer", "user").
|
|
*/
|
|
virtual int start_subscribe(std::string module) = 0;
|
|
|
|
/**
|
|
* Stop listening to a formerly subscribed module.
|
|
*/
|
|
virtual int stop_subscribe(std::string module) = 0;
|
|
|
|
/**
|
|
* Subscribe to push streams for specific device identifiers.
|
|
*/
|
|
virtual int add_subscribe(std::vector<std::string> dev_list) = 0;
|
|
|
|
/**
|
|
* Remove device-level subscriptions.
|
|
*/
|
|
virtual int del_subscribe(std::vector<std::string> dev_list) = 0;
|
|
|
|
/**
|
|
* Enable or disable multi-machine mode.
|
|
*/
|
|
virtual void enable_multi_machine(bool enable) = 0;
|
|
|
|
// ========================================================================
|
|
// Settings Synchronization
|
|
// ========================================================================
|
|
/**
|
|
* Fetch all presets owned by the logged-in user.
|
|
* @param user_presets Map populated with [type][setting_id] = json
|
|
*/
|
|
virtual int get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets) = 0;
|
|
|
|
/**
|
|
* Request a new preset identifier from the server.
|
|
*/
|
|
virtual std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code) = 0;
|
|
|
|
/**
|
|
* Update or create a preset with a known setting_id.
|
|
*/
|
|
virtual 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) = 0;
|
|
|
|
/**
|
|
* Trigger bulk download of user presets.
|
|
*/
|
|
virtual int get_setting_list(std::string bundle_version, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr) = 0;
|
|
|
|
/**
|
|
* Enhanced preset sync with per-item validation.
|
|
*/
|
|
virtual int get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr) = 0;
|
|
|
|
/**
|
|
* Delete a remote preset.
|
|
*/
|
|
virtual int delete_setting(std::string setting_id) = 0;
|
|
|
|
// ========================================================================
|
|
// Cloud User Services
|
|
// ========================================================================
|
|
/**
|
|
* Retrieve inbox/notification messages.
|
|
*/
|
|
virtual int get_my_message(int type, int after, int limit, unsigned int* http_code, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Check for pending task reports.
|
|
*/
|
|
virtual int check_user_task_report(int* task_id, bool* printable) = 0;
|
|
|
|
/**
|
|
* Fetch aggregated print statistics.
|
|
*/
|
|
virtual int get_user_print_info(unsigned int* http_code, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Query user's tasks/prints.
|
|
*/
|
|
virtual int get_user_tasks(TaskQueryParams params, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Fetch firmware information for a printer.
|
|
*/
|
|
virtual int get_printer_firmware(std::string dev_id, unsigned* http_code, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Get plate index for a cloud task.
|
|
*/
|
|
virtual int get_task_plate_index(std::string task_id, int* plate_index) = 0;
|
|
|
|
/**
|
|
* Retrieve extended user profile info.
|
|
*/
|
|
virtual int get_user_info(int* identifier) = 0;
|
|
|
|
/**
|
|
* Fetch subtask information.
|
|
*/
|
|
virtual int get_subtask_info(std::string subtask_id, std::string* task_json, unsigned int* http_code, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Retrieve slicing job info.
|
|
*/
|
|
virtual int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json) = 0;
|
|
|
|
/**
|
|
* Query binding status for multiple devices.
|
|
*/
|
|
virtual int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Update printer name in cloud profile.
|
|
*/
|
|
virtual int modify_printer_name(std::string dev_id, std::string dev_name) = 0;
|
|
|
|
// ========================================================================
|
|
// Model Mall & Publishing
|
|
// ========================================================================
|
|
/**
|
|
* Request live camera streaming URL.
|
|
*/
|
|
virtual int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) = 0;
|
|
|
|
/**
|
|
* Create a camera signaling channel object for P2P camera streaming over WebRTC.
|
|
*
|
|
*/
|
|
virtual std::unique_ptr<ICameraSignalingChannel>
|
|
create_camera_signaling_channel(const std::string& dev_id)
|
|
{
|
|
(void) dev_id;
|
|
return nullptr;
|
|
}
|
|
|
|
/**
|
|
* Fetch staff-picked designs from model mall.
|
|
*/
|
|
virtual int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) = 0;
|
|
|
|
/**
|
|
* Run multi-stage publishing workflow.
|
|
*/
|
|
virtual int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) = 0;
|
|
|
|
/**
|
|
* Get model publish URL.
|
|
*/
|
|
virtual int get_model_publish_url(std::string* url) = 0;
|
|
|
|
/**
|
|
* Fetch publishing subtask information.
|
|
*/
|
|
virtual int get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn) = 0;
|
|
|
|
/**
|
|
* Get model mall home URL.
|
|
*/
|
|
virtual int get_model_mall_home_url(std::string* url) = 0;
|
|
|
|
/**
|
|
* Build model detail page URL.
|
|
*/
|
|
virtual int get_model_mall_detail_url(std::string* url, std::string id) = 0;
|
|
|
|
/**
|
|
* Retrieve user's model mall profile.
|
|
*/
|
|
virtual int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body) = 0;
|
|
|
|
/**
|
|
* Exchange a one-time login ticket (from a third-party OAuth callback)
|
|
* for token + profile JSON. Used by the localhost callback handler when
|
|
* the auth server redirects with ?ticket=...&redirect_url=... instead of
|
|
* passing tokens directly in the URL.
|
|
*/
|
|
virtual int get_my_token(std::string ticket, unsigned int* http_code, std::string* http_body) = 0;
|
|
|
|
// ========================================================================
|
|
// Analytics & Tracking
|
|
// ========================================================================
|
|
/**
|
|
* Enable/disable telemetry.
|
|
*/
|
|
virtual int track_enable(bool enable) = 0;
|
|
|
|
/**
|
|
* Delete telemetry files.
|
|
*/
|
|
virtual int track_remove_files() = 0;
|
|
|
|
/**
|
|
* Report a custom analytics event.
|
|
*/
|
|
virtual int track_event(std::string evt_key, std::string content) = 0;
|
|
|
|
/**
|
|
* Set telemetry headers.
|
|
*/
|
|
virtual int track_header(std::string header) = 0;
|
|
|
|
/**
|
|
* Update a tracked user property.
|
|
*/
|
|
virtual int track_update_property(std::string name, std::string value, std::string type = "string") = 0;
|
|
|
|
/**
|
|
* Read a tracked user property.
|
|
*/
|
|
virtual int track_get_property(std::string name, std::string& value, std::string type = "string") = 0;
|
|
|
|
/**
|
|
* Check if tracking is enabled.
|
|
*/
|
|
virtual bool get_track_enable() = 0;
|
|
|
|
// ========================================================================
|
|
// Ratings & Reviews
|
|
// ========================================================================
|
|
/**
|
|
* Submit a review for a marketplace design.
|
|
*/
|
|
virtual 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) = 0;
|
|
|
|
/**
|
|
* Get OSS configuration for image uploads.
|
|
*/
|
|
virtual int get_oss_config(std::string& config, std::string country_code, unsigned int& http_code, std::string& http_error) = 0;
|
|
|
|
/**
|
|
* Upload rating images to OSS.
|
|
*/
|
|
virtual 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) = 0;
|
|
|
|
/**
|
|
* Poll for rating result.
|
|
*/
|
|
virtual int get_model_mall_rating_result(int job_id, std::string& rating_result, unsigned int& http_code, std::string& http_error) = 0;
|
|
|
|
// ========================================================================
|
|
// Extra Features
|
|
// ========================================================================
|
|
/**
|
|
* Fetch MakerWorld user preferences.
|
|
*/
|
|
virtual int get_mw_user_preference(std::function<void(std::string)> callback) = 0;
|
|
|
|
/**
|
|
* Retrieve MakerWorld "For You" list.
|
|
*/
|
|
virtual int get_mw_user_4ulist(int seed, int limit, std::function<void(std::string)> callback) = 0;
|
|
|
|
/**
|
|
* Return the version of the cloud service implementation.
|
|
*/
|
|
virtual std::string get_version() = 0;
|
|
|
|
// ========================================================================
|
|
// Callback Registration
|
|
// ========================================================================
|
|
/**
|
|
* Register server connection status callback.
|
|
*/
|
|
virtual int set_on_server_connected_fn(AppOnServerConnectedFn fn) = 0;
|
|
|
|
/**
|
|
* Register HTTP error callback.
|
|
*/
|
|
virtual int set_on_http_error_fn(AppOnHttpErrorFn fn) = 0;
|
|
|
|
/**
|
|
* Provide country code getter callback.
|
|
*/
|
|
virtual int set_get_country_code_fn(GetCountryCodeFn fn) = 0;
|
|
|
|
/**
|
|
* Provide main thread queue callback.
|
|
*/
|
|
virtual int set_queue_on_main_fn(QueueOnMainFn fn) = 0;
|
|
};
|
|
|
|
} // namespace Slic3r
|
|
|
|
#endif // __I_CLOUD_SERVICE_AGENT_HPP__
|