mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-26 04:12:07 +00:00
Introducing Orca Cloud: https://cloud.orcaslicer.com (#13414)
* Add OrcaCloud sync platform and preset bundle sharing system Introduce OrcaCloud, a cloud sync platform for user presets, alongside a preset bundle system that enables sharing printer/filament/process profiles as local exportable bundles or subscribed cloud bundles. OrcaCloud platform: - Auth to Orca Cloud - Encrypted token storage (file-based or system keychain) - User preset sync with - Profile migration from default/bambu folders on first login - Homepage integration with entrance to cloud.orcaslicer.com Preset bundles: - Local bundle import/export with bundle_structure.json metadata - Subscribed cloud bundles with version-based update checking - Thread-safe concurrent bundle access with read-write mutex - Canonical bundle preset naming (_local/<id>/... and _subscribed/<id>/...) - Bundle presets are read-only; grouped under subheaders in combo boxes - PresetBundleDialog with auto-sync toggle, refresh, update notifications - Hyperlinked bundle names to cloud bundle pages Co-authored-by: Sabriel Koh <sabrielkcr@gmail.com> Co-authored-by: Derrick <derrick992110@gmail.com> Co-authored-by: Mykola Nahirnyi <mnahirnyi@amcbridge.com> Co-authored-by: Ian Chua <iancrb00@gmail.com> Co-authored-by: Draginraptor <draginraptor@gmail.com> Co-authored-by: ExPikaPaka <112851715+ExPikaPaka@users.noreply.github.com> Co-authored-by: Ian Bassi <ian.bassi@outlook.com> Co-authored-by: Ocraftyone <Ocraftyone@users.noreply.github.com> Co-authored-by: yw4z <ywsyildiz@gmail.com> Co-authored-by: peterm-m <101202951+peterm-m@users.noreply.github.com> * Fixed an issue on Windows it failed to login Orca Cloud with Google account
This commit is contained in:
@@ -18,6 +18,28 @@ namespace Slic3r
|
||||
{
|
||||
class MachineObject;
|
||||
|
||||
/**
|
||||
* DevAmsTray - Represents a single filament tray/slot in an AMS unit or virtual tray.
|
||||
*
|
||||
* Data Population:
|
||||
* ================
|
||||
* This class is used in two contexts with different population paths:
|
||||
*
|
||||
* 1. AMS Trays (within DevFilaSystem):
|
||||
* NetworkAgent → MachineObject::parse_json() → DevFilaSystemParser::ParseV1_0()
|
||||
*
|
||||
* 2. Virtual Trays (MachineObject::vt_slot for external/manual filament):
|
||||
* NetworkAgent → MachineObject::parse_json() → MachineObject::parse_vt_tray()
|
||||
*
|
||||
* Key Fields Used by build_filament_ams_list():
|
||||
* - setting_id: Filament preset identifier (tray_info_idx from printer)
|
||||
* - tag_uid: RFID tag unique ID for identifying filament spools
|
||||
* - m_fila_type: Filament material type (e.g., "PLA", "ABS", "PETG")
|
||||
* - color: Hex color string without '#' prefix (e.g., "FF0000")
|
||||
* - cols: Multi-color component list for gradient/multi-color filaments
|
||||
* - ctype: Color type indicator
|
||||
* - is_exists: Whether filament is currently loaded in the tray
|
||||
*/
|
||||
class DevAmsTray
|
||||
{
|
||||
public:
|
||||
@@ -83,6 +105,27 @@ public:
|
||||
static wxColour decode_color(const std::string& color);
|
||||
};
|
||||
|
||||
/**
|
||||
* DevAms - Represents a single AMS (Automatic Material System) unit.
|
||||
*
|
||||
* An AMS unit is a physical hardware component that holds multiple filament trays.
|
||||
* Different printer models support different AMS variants with varying slot counts
|
||||
* and capabilities.
|
||||
*
|
||||
* Data Population:
|
||||
* ================
|
||||
* Populated by DevFilaSystemParser from printer JSON messages received via NetworkAgent.
|
||||
*
|
||||
* Key Properties:
|
||||
* - m_ams_id: Unique identifier for this AMS unit (string, typically "0", "1", etc.)
|
||||
* - m_ext_id: Which extruder this AMS is connected to (for multi-extruder setups)
|
||||
* - m_trays: Map of tray IDs to DevAmsTray pointers containing filament data
|
||||
*
|
||||
* AMS Type Variants:
|
||||
* - AMS (type 1): Standard 4-slot AMS with humidity control
|
||||
* - AMS_LITE (type 2): Simplified version
|
||||
* - N3F/N3S (types 3,4): Newer variants with different humidity/drying support
|
||||
*/
|
||||
class DevAms
|
||||
{
|
||||
friend class DevFilaSystemParser;
|
||||
@@ -146,6 +189,36 @@ private:
|
||||
int m_left_dry_time = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* DevFilaSystem - Central manager for all AMS-related data on a printer.
|
||||
*
|
||||
* This class owns and manages the hierarchy of AMS units (DevAms) and their trays (DevAmsTray).
|
||||
* It provides the primary interface for querying filament/AMS state used by the GUI.
|
||||
*
|
||||
* Data Flow Architecture:
|
||||
* =======================
|
||||
* Printer Device (sends status via MQTT/LAN)
|
||||
* ↓
|
||||
* NetworkAgent (receives JSON, invokes registered callbacks)
|
||||
* ↓
|
||||
* MachineObject::parse_json() (delegates to DevFilaSystemParser)
|
||||
* ↓
|
||||
* DevFilaSystemParser::ParseV1_0() (populates this DevFilaSystem instance)
|
||||
* ↓
|
||||
* GUI functions like build_filament_ams_list() read from here
|
||||
*
|
||||
* Key Methods:
|
||||
* - GetAmsList(): Returns map of all AMS units (ams_id -> DevAms*)
|
||||
* - GetAmsTray(): Retrieves specific tray by AMS ID and tray ID
|
||||
* - HasAms(): Checks if any AMS units are connected
|
||||
*
|
||||
* Ownership:
|
||||
* - Owned by MachineObject (m_fila_system member)
|
||||
* - Owns all DevAms instances which in turn own DevAmsTray instances
|
||||
*
|
||||
* Note: This class does NOT directly communicate with NetworkAgent.
|
||||
* It is a passive data store populated by the parsing layer.
|
||||
*/
|
||||
class DevFilaSystem
|
||||
{
|
||||
friend class DevFilaSystemParser;
|
||||
@@ -200,6 +273,18 @@ private:
|
||||
};// class DevFilaSystem
|
||||
|
||||
|
||||
/**
|
||||
* DevFilaSystemParser - Parses printer JSON messages to populate DevFilaSystem.
|
||||
*
|
||||
* This is the bridge between NetworkAgent's raw JSON data and the structured
|
||||
* DevFilaSystem/DevAms/DevAmsTray hierarchy.
|
||||
*
|
||||
* Called from MachineObject::parse_json() when AMS-related fields are present
|
||||
* in printer status messages received via MQTT or LAN communication.
|
||||
*
|
||||
* @see MachineObject::parse_json() - Entry point for JSON parsing
|
||||
* @see DevFilaSystem - Target data structure
|
||||
*/
|
||||
class DevFilaSystemParser
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace Slic3r
|
||||
return obj;
|
||||
}
|
||||
|
||||
int DeviceManager::query_bind_status(std::string& msg)
|
||||
int DeviceManager::query_bind_status(std::string& msg, const std::string& provider)
|
||||
{
|
||||
if (!m_agent)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ namespace Slic3r
|
||||
|
||||
unsigned int http_code;
|
||||
std::string http_body;
|
||||
int result = m_agent->query_bind_status(query_list, &http_code, &http_body);
|
||||
int result = m_agent->query_bind_status(query_list, &http_code, &http_body, provider);
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
@@ -419,9 +419,9 @@ namespace Slic3r
|
||||
return result;
|
||||
}
|
||||
|
||||
MachineObject* DeviceManager::get_user_machine(std::string dev_id)
|
||||
MachineObject* DeviceManager::get_user_machine(std::string dev_id, const std::string& provider)
|
||||
{
|
||||
if (!m_agent || !m_agent->is_user_login())
|
||||
if (!m_agent || !m_agent->is_user_login(provider))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -442,14 +442,13 @@ namespace Slic3r
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DeviceManager::clean_user_info()
|
||||
void DeviceManager::clean_user_info(bool keep_local_selection)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace) << "DeviceManager::clean_user_info";
|
||||
// reset selected_machine
|
||||
selected_machine = "";
|
||||
local_selected_machine = "";
|
||||
|
||||
OnSelectedMachineChanged(selected_machine, "");
|
||||
const std::string previous_selected_machine = selected_machine;
|
||||
const bool keep_selected_machine = keep_local_selection &&
|
||||
!selected_machine.empty() &&
|
||||
localMachineList.find(selected_machine) != localMachineList.end();
|
||||
|
||||
// clean user list
|
||||
for (auto it = userMachineList.begin(); it != userMachineList.end(); it++)
|
||||
@@ -462,6 +461,13 @@ namespace Slic3r
|
||||
}
|
||||
}
|
||||
userMachineList.clear();
|
||||
|
||||
if (!keep_selected_machine) {
|
||||
selected_machine = "";
|
||||
local_selected_machine = "";
|
||||
}
|
||||
|
||||
OnSelectedMachineChanged(previous_selected_machine, selected_machine);
|
||||
}
|
||||
|
||||
bool DeviceManager::set_selected_machine(std::string dev_id)
|
||||
@@ -566,7 +572,7 @@ namespace Slic3r
|
||||
{
|
||||
if (selected_machine.empty()) return nullptr;
|
||||
|
||||
MachineObject* obj = get_user_machine(selected_machine);
|
||||
MachineObject* obj = get_user_machine(selected_machine, GUI::wxGetApp().get_printer_cloud_provider());
|
||||
if (obj)
|
||||
return obj;
|
||||
|
||||
@@ -683,15 +689,15 @@ namespace Slic3r
|
||||
return "";
|
||||
}
|
||||
|
||||
void DeviceManager::modify_device_name(std::string dev_id, std::string dev_name)
|
||||
void DeviceManager::modify_device_name(std::string dev_id, std::string dev_name, const std::string& provider)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace) << "modify_device_name";
|
||||
if (m_agent)
|
||||
{
|
||||
int result = m_agent->modify_printer_name(dev_id, dev_name);
|
||||
int result = m_agent->modify_printer_name(dev_id, dev_name, provider);
|
||||
if (result == 0)
|
||||
{
|
||||
update_user_machine_list_info();
|
||||
update_user_machine_list_info(provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,6 +718,7 @@ namespace Slic3r
|
||||
try
|
||||
{
|
||||
json j = json::parse(body);
|
||||
const std::string provider = GUI::wxGetApp().get_printer_cloud_provider();
|
||||
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << j;
|
||||
@@ -740,7 +747,7 @@ namespace Slic3r
|
||||
obj = new MachineObject(this, m_agent, "", "", "");
|
||||
if (m_agent)
|
||||
{
|
||||
obj->set_bind_status(m_agent->get_user_name());
|
||||
obj->set_bind_status(m_agent->get_user_name(provider));
|
||||
}
|
||||
|
||||
if (obj->get_dev_ip().empty())
|
||||
@@ -806,14 +813,14 @@ namespace Slic3r
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::update_user_machine_list_info()
|
||||
void DeviceManager::update_user_machine_list_info(const std::string& provider)
|
||||
{
|
||||
if (!m_agent) return;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "update_user_machine_list_info";
|
||||
unsigned int http_code;
|
||||
std::string body;
|
||||
int result = m_agent->get_user_print_info(&http_code, &body);
|
||||
int result = m_agent->get_user_print_info(&http_code, &body, provider);
|
||||
if (result == 0)
|
||||
{
|
||||
parse_user_print_info(body);
|
||||
@@ -906,7 +913,7 @@ namespace Slic3r
|
||||
}
|
||||
|
||||
// do some refresh
|
||||
if (Slic3r::GUI::wxGetApp().is_user_login())
|
||||
if (Slic3r::GUI::wxGetApp().is_user_login(Slic3r::GUI::wxGetApp().get_printer_cloud_provider()))
|
||||
{
|
||||
m_manager->check_pushing();
|
||||
try
|
||||
@@ -922,4 +929,4 @@ namespace Slic3r
|
||||
// certificate
|
||||
agent->install_device_cert(obj->get_dev_id(), obj->is_lan_mode_printer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +65,14 @@ public:
|
||||
std::map<std::string, MachineObject*> get_user_machinelist() const { return userMachineList; }
|
||||
std::string get_first_online_user_machine() const;
|
||||
void erase_user_machine(std::string dev_id) { userMachineList.erase(dev_id); }
|
||||
void clean_user_info();
|
||||
void clean_user_info(bool keep_local_selection = false);
|
||||
|
||||
void load_last_machine();
|
||||
void update_user_machine_list_info();
|
||||
void update_user_machine_list_info(const std::string& provider);
|
||||
void parse_user_print_info(std::string body);
|
||||
void reload_printer_settings();
|
||||
|
||||
MachineObject* get_user_machine(std::string dev_id);
|
||||
MachineObject* get_user_machine(std::string dev_id, const std::string& provider);
|
||||
|
||||
// subscribe
|
||||
void add_user_subscribe();
|
||||
@@ -83,11 +83,11 @@ public:
|
||||
MachineObject* get_my_machine(std::string dev_id);
|
||||
std::map<std::string, MachineObject*> get_my_machine_list();
|
||||
std::map<std::string, MachineObject*> get_my_cloud_machine_list();
|
||||
void modify_device_name(std::string dev_id, std::string dev_name);
|
||||
void modify_device_name(std::string dev_id, std::string dev_name, const std::string& provider);
|
||||
|
||||
/* create machine or update machine properties */
|
||||
void on_machine_alive(std::string json_str);
|
||||
int query_bind_status(std::string& msg);
|
||||
int query_bind_status(std::string& msg, const std::string& provider);
|
||||
|
||||
// mutil-device
|
||||
void EnableMultiMachine(bool enable = true);
|
||||
|
||||
Reference in New Issue
Block a user