badge support
This commit is contained in:
@@ -2342,6 +2342,7 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
||||
{
|
||||
bool valid{false};
|
||||
bool is_map{false};
|
||||
bool is_placeholder{false};
|
||||
std::string filament_color = "";
|
||||
std::string filament_color_type = "";
|
||||
std::string filament_preset = "";
|
||||
@@ -2359,7 +2360,8 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
||||
auto filament_multi_color = ams.opt<ConfigOptionStrings>("filament_multi_colour")->values;
|
||||
auto ams_id = ams.opt_string("ams_id", 0u);
|
||||
auto slot_id = ams.opt_string("slot_id", 0u);
|
||||
ams_infos.push_back({filament_id.empty() ? false : true,false, filament_color});
|
||||
auto is_placeholder = ams.has("filament_slot_placeholder") && ams.opt_bool("filament_slot_placeholder", 0u);
|
||||
ams_infos.push_back({filament_id.empty() ? false : true, false, is_placeholder, filament_color});
|
||||
AMSMapInfo temp = {ams_id, slot_id};
|
||||
ams_array_maps.push_back(temp);
|
||||
index++;
|
||||
@@ -2378,6 +2380,12 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
||||
filament_multi_color.push_back(default_unknown_color);
|
||||
}
|
||||
ams_multi_color_filment.push_back(filament_multi_color);
|
||||
} else if (is_placeholder) {
|
||||
// Orca: push placeholders to keep index alignment with ams_infos
|
||||
ams_filament_presets.push_back("");
|
||||
ams_filament_colors.push_back("");
|
||||
ams_filament_color_types.push_back("");
|
||||
ams_multi_color_filment.push_back({});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -2556,18 +2564,68 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
||||
filament_map->values.resize(exist_filament_presets.size(), 1);
|
||||
}
|
||||
else {//overwrite;
|
||||
filament_color->values = ams_filament_colors;
|
||||
filament_color_type->values = ams_filament_color_types;
|
||||
this->filament_presets = ams_filament_presets;
|
||||
filament_map->values.resize(ams_filament_colors.size(), 1);
|
||||
bool has_placeholders = std::any_of(ams_infos.begin(), ams_infos.end(),
|
||||
[](const AmsInfo& a) { return a.is_placeholder; });
|
||||
if (has_placeholders) {
|
||||
// Orca: merge — keep existing filaments for empty slots
|
||||
auto exist_colors = filament_color->values;
|
||||
auto exist_color_types = filament_color_type->values;
|
||||
auto exist_presets = this->filament_presets;
|
||||
|
||||
size_t tray_count = ams_filament_presets.size();
|
||||
size_t total = std::max(tray_count, exist_presets.size());
|
||||
|
||||
std::vector<std::string> result_colors;
|
||||
std::vector<std::string> result_color_types;
|
||||
std::vector<std::string> result_presets;
|
||||
std::vector<std::vector<std::string>> result_multi_colors;
|
||||
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
bool is_loaded = (i < ams_infos.size() && ams_infos[i].valid);
|
||||
|
||||
if (is_loaded) {
|
||||
// Loaded tray: use tray's filament data
|
||||
result_colors.push_back(ams_filament_colors[i]);
|
||||
result_color_types.push_back(ams_filament_color_types[i]);
|
||||
result_presets.push_back(ams_filament_presets[i]);
|
||||
result_multi_colors.push_back(
|
||||
i < ams_multi_color_filment.size() ? ams_multi_color_filment[i]
|
||||
: std::vector<std::string>{ams_filament_colors[i]});
|
||||
} else if (i < exist_presets.size()) {
|
||||
// Empty tray or beyond tray count: keep existing filament
|
||||
result_colors.push_back(exist_colors[i]);
|
||||
result_color_types.push_back(exist_color_types[i]);
|
||||
result_presets.push_back(exist_presets[i]);
|
||||
result_multi_colors.push_back({exist_colors[i]});
|
||||
} else {
|
||||
// New slot beyond existing count: use first visible filament as fallback
|
||||
result_colors.push_back("#CECECE");
|
||||
result_color_types.push_back("1");
|
||||
result_presets.push_back(this->filaments.first_visible().name);
|
||||
result_multi_colors.push_back({"#CECECE"});
|
||||
}
|
||||
}
|
||||
|
||||
filament_color->values = result_colors;
|
||||
filament_color_type->values = result_color_types;
|
||||
this->filament_presets = result_presets;
|
||||
ams_multi_color_filment = result_multi_colors;
|
||||
filament_map->values.resize(total, 1);
|
||||
} else {
|
||||
// BBL: existing wholesale replace
|
||||
filament_color->values = ams_filament_colors;
|
||||
filament_color_type->values = ams_filament_color_types;
|
||||
this->filament_presets = ams_filament_presets;
|
||||
filament_map->values.resize(ams_filament_colors.size(), 1);
|
||||
}
|
||||
|
||||
auto& print_config = this->prints.get_edited_preset().config;
|
||||
auto support_filament_opt = print_config.option<ConfigOptionInt>("support_filament");
|
||||
auto support_interface_filament_opt = print_config.option<ConfigOptionInt>("support_interface_filament");
|
||||
if (support_filament_opt->value > ams_filament_color_types.size())
|
||||
if (support_filament_opt->value > filament_color_type->values.size())
|
||||
support_filament_opt->value = 0;
|
||||
|
||||
if (support_interface_filament_opt->value > ams_filament_color_types.size())
|
||||
if (support_interface_filament_opt->value > filament_color_type->values.size())
|
||||
support_interface_filament_opt->value = 0;
|
||||
}
|
||||
// Update ams_multi_color_filment
|
||||
|
||||
@@ -612,6 +612,9 @@ void DevFilaSystemParser::ParseV1_0(const json& jj, MachineObject* obj, DevFilaS
|
||||
{
|
||||
curr_tray->remain = -1;
|
||||
}
|
||||
if (tray_it->contains("tray_slot_placeholder")) {
|
||||
curr_tray->is_slot_placeholder = true;
|
||||
}
|
||||
int ams_id_int = 0;
|
||||
int tray_id_int = 0;
|
||||
try
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
wxColour wx_color;
|
||||
bool is_bbl;
|
||||
bool is_exists = false;
|
||||
bool is_slot_placeholder = false; // Orca: True for empty tray slots from pull-mode agents
|
||||
int hold_count = 0;
|
||||
int remain = 0; // filament remain: 0 ~ 100
|
||||
|
||||
|
||||
@@ -3469,16 +3469,25 @@ unsigned GUI_App::get_colour_approx_luma(const wxColour &colour)
|
||||
));
|
||||
}
|
||||
|
||||
void GUI_App::switch_printer_agent(const std::string& agent_id)
|
||||
void GUI_App::switch_printer_agent()
|
||||
{
|
||||
if (!m_agent) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": no agent exists";
|
||||
return;
|
||||
}
|
||||
|
||||
std::string agent_id;
|
||||
|
||||
const DynamicPrintConfig& config = preset_bundle->printers.get_edited_preset().config;
|
||||
if (config.has("printer_agent")) {
|
||||
std::string value = config.option<ConfigOptionString>("printer_agent")->value;
|
||||
if (!value.empty()) {
|
||||
agent_id = value;
|
||||
}
|
||||
}
|
||||
// Use registry to validate and create agent
|
||||
// If empty, use default
|
||||
std::string effective_agent_id = agent_id.empty() ? NetworkAgentFactory::get_default_printer_agent_id() : agent_id;
|
||||
std::string effective_agent_id = agent_id.empty() ? ORCA_PRINTER_AGENT_ID : agent_id;
|
||||
|
||||
// Check if agent is registered
|
||||
if (!NetworkAgentFactory::is_printer_agent_registered(effective_agent_id)) {
|
||||
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
NetworkAgent* getAgent() { return m_agent; }
|
||||
|
||||
// Dynamic printer agent switching
|
||||
void switch_printer_agent(const std::string& agent_id);
|
||||
void switch_printer_agent();
|
||||
|
||||
FilamentColorCodeQuery* get_filament_color_code_query();
|
||||
bool is_editor() const { return m_app_mode == EAppMode::Editor; }
|
||||
|
||||
@@ -177,13 +177,13 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||
std::string selected_agent = current_agent;
|
||||
|
||||
if (selected_agent.empty()) {
|
||||
selected_agent = NetworkAgentFactory::get_default_printer_agent_id();
|
||||
selected_agent = ORCA_PRINTER_AGENT_ID;
|
||||
}
|
||||
|
||||
// Verify selected agent is valid
|
||||
auto it = std::find_if(agents.begin(), agents.end(), [&selected_agent](const auto& a) { return a.id == selected_agent; });
|
||||
if (it == agents.end()) {
|
||||
selected_agent = NetworkAgentFactory::get_default_printer_agent_id();
|
||||
selected_agent = ORCA_PRINTER_AGENT_ID;
|
||||
}
|
||||
|
||||
// Set default value for the enum (using the index)
|
||||
|
||||
@@ -3230,6 +3230,7 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
|
||||
tray_config.set_key_value("filament_multi_colour", new ConfigOptionStrings{});
|
||||
tray_config.set_key_value("filament_colour_type", new ConfigOptionStrings{std::to_string(tray.ctype)});
|
||||
tray_config.set_key_value("filament_exist", new ConfigOptionBools{tray.is_exists});
|
||||
tray_config.set_key_value("filament_slot_placeholder", new ConfigOptionBools{tray.is_slot_placeholder});
|
||||
std::optional<FilamentBaseInfo> info;
|
||||
if (wxGetApp().preset_bundle) {
|
||||
info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray.setting_id);
|
||||
@@ -3520,8 +3521,15 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
|
||||
{ // badge ams filament
|
||||
clear_combos_filament_badge();
|
||||
if (sync_result.direct_sync) {
|
||||
for (auto &c : p->combos_filament) {
|
||||
badge_combox_filament(c);
|
||||
auto& ams_list = wxGetApp().preset_bundle->filament_ams_list;
|
||||
size_t tray_idx = 0;
|
||||
for (auto& entry : ams_list) {
|
||||
if (tray_idx >= p->combos_filament.size()) break;
|
||||
auto filament_id = entry.second.opt_string("filament_id", 0u);
|
||||
if (!filament_id.empty()) {
|
||||
badge_combox_filament(p->combos_filament[tray_idx]);
|
||||
}
|
||||
tray_idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2136,22 +2136,7 @@ void Tab::on_presets_changed()
|
||||
|
||||
void Tab::update_printer_agent_if_needed()
|
||||
{
|
||||
std::string agent_id = "orca";
|
||||
if (m_preset_bundle) {
|
||||
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
|
||||
agent_id = "bbl";
|
||||
} else if (wxGetApp().preset_bundle->is_qidi_vendor()) {
|
||||
agent_id = "qidi";
|
||||
}
|
||||
}
|
||||
|
||||
const DynamicPrintConfig& config = m_preset_bundle->printers.get_edited_preset().config;
|
||||
if (config.has("printer_agent")) {
|
||||
std::string value = config.option<ConfigOptionString>("printer_agent")->value;
|
||||
if (!value.empty()) {
|
||||
agent_id = value;
|
||||
}
|
||||
}
|
||||
// Switch agent in GUI_App
|
||||
wxGetApp().switch_printer_agent(agent_id);
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ int MoonrakerPrinterAgent::set_queue_on_main_fn(QueueOnMainFn fn)
|
||||
return BAMBU_NETWORK_SUCCESS;
|
||||
}
|
||||
|
||||
void MoonrakerPrinterAgent::build_ams_payload(int ams_count, const std::vector<AmsTrayData>& trays)
|
||||
void MoonrakerPrinterAgent::build_ams_payload(int ams_count, int max_lane_index, const std::vector<AmsTrayData>& trays)
|
||||
{
|
||||
|
||||
// Look up MachineObject via DeviceManager
|
||||
@@ -520,7 +520,8 @@ void MoonrakerPrinterAgent::build_ams_payload(int ams_count, const std::vector<A
|
||||
ams_unit["info"] = "0002"; // treat as AMS_LITE
|
||||
|
||||
nlohmann::json tray_array = nlohmann::json::array();
|
||||
for (int slot_id = 0; slot_id < 4; ++slot_id) {
|
||||
int max_slot_in_this_ams = std::min(3, max_lane_index - ams_id * 4);
|
||||
for (int slot_id = 0; slot_id <= max_slot_in_this_ams; ++slot_id) {
|
||||
int slot_index = ams_id * 4 + slot_id;
|
||||
|
||||
// Find tray with matching slot_index
|
||||
@@ -554,6 +555,7 @@ void MoonrakerPrinterAgent::build_ams_payload(int ams_count, const std::vector<A
|
||||
tray_json["tray_info_idx"] = "";
|
||||
tray_json["tray_type"] = "";
|
||||
tray_json["tray_color"] = "00000000";
|
||||
tray_json["tray_slot_placeholder"] = "1";
|
||||
}
|
||||
|
||||
tray_array.push_back(tray_json);
|
||||
@@ -717,7 +719,7 @@ bool MoonrakerPrinterAgent::fetch_filament_info(std::string dev_id)
|
||||
int ams_count = (max_lane_index + 4) / 4;
|
||||
|
||||
// Build and parse the AMS payload
|
||||
build_ams_payload(ams_count, trays);
|
||||
build_ams_payload(ams_count, max_lane_index, trays);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ protected:
|
||||
bool use_ssl = false;
|
||||
} device_info;
|
||||
|
||||
// Shared tray data for AMS payload building (used by derived classes like QidiPrinterAgent)
|
||||
// Tray data for AMS payload building
|
||||
struct AmsTrayData {
|
||||
int slot_index = 0; // 0-based slot index
|
||||
bool has_filament = false;
|
||||
@@ -100,7 +100,7 @@ protected:
|
||||
};
|
||||
|
||||
// Build ams JSON and call parser
|
||||
void build_ams_payload(int ams_count, const std::vector<AmsTrayData>& trays);
|
||||
void build_ams_payload(int ams_count, int max_lane_index, const std::vector<AmsTrayData>& trays);
|
||||
|
||||
// Methods that derived classes may need to override or access
|
||||
virtual bool init_device_info(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "QidiPrinterAgent.hpp"
|
||||
#include "MoonrakerPrinterAgent.hpp"
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
namespace Slic3r {
|
||||
namespace {
|
||||
@@ -18,10 +20,22 @@ std::map<std::string, PrinterAgentInfo>& get_printer_agents()
|
||||
return agents;
|
||||
}
|
||||
|
||||
std::string& get_default_agent_id()
|
||||
// Helper to register a printer agent type with the standard factory pattern.
|
||||
// AgentTypes that take a log_dir constructor arg use the default; BBLPrinterAgent
|
||||
// (no log_dir) is registered separately.
|
||||
template<typename T>
|
||||
void register_agent()
|
||||
{
|
||||
static std::string default_id;
|
||||
return default_id;
|
||||
auto info = T::get_agent_info_static();
|
||||
NetworkAgentFactory::register_printer_agent(
|
||||
info.id, info.name,
|
||||
[](std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
const std::string& log_dir) -> std::shared_ptr<IPrinterAgent> {
|
||||
auto agent = std::make_shared<T>(log_dir);
|
||||
if (cloud_agent)
|
||||
agent->set_cloud_agent(cloud_agent);
|
||||
return agent;
|
||||
});
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -30,18 +44,7 @@ bool NetworkAgentFactory::register_printer_agent(const std::string& id, const st
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_registry_mutex);
|
||||
auto& agents = get_printer_agents();
|
||||
|
||||
auto result = agents.emplace(id, PrinterAgentInfo(id, display_name, std::move(factory)));
|
||||
|
||||
if (result.second) {
|
||||
auto& default_id = get_default_agent_id();
|
||||
if (default_id.empty()) {
|
||||
default_id = id;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return agents.emplace(id, PrinterAgentInfo(id, display_name, std::move(factory))).second;
|
||||
}
|
||||
|
||||
bool NetworkAgentFactory::is_printer_agent_registered(const std::string& id)
|
||||
@@ -51,14 +54,6 @@ bool NetworkAgentFactory::is_printer_agent_registered(const std::string& id)
|
||||
return agents.find(id) != agents.end();
|
||||
}
|
||||
|
||||
const PrinterAgentInfo* NetworkAgentFactory::get_printer_agent_info(const std::string& id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_registry_mutex);
|
||||
auto& agents = get_printer_agents();
|
||||
auto it = agents.find(id);
|
||||
return (it != agents.end()) ? &it->second : nullptr;
|
||||
}
|
||||
|
||||
std::vector<PrinterAgentInfo> NetworkAgentFactory::get_registered_printer_agents()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_registry_mutex);
|
||||
@@ -89,80 +84,24 @@ std::shared_ptr<IPrinterAgent> NetworkAgentFactory::create_printer_agent_by_id(c
|
||||
return it->second.factory(cloud_agent, log_dir);
|
||||
}
|
||||
|
||||
std::string NetworkAgentFactory::get_default_printer_agent_id()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_registry_mutex);
|
||||
return get_default_agent_id();
|
||||
}
|
||||
|
||||
void NetworkAgentFactory::set_default_printer_agent_id(const std::string& id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_registry_mutex);
|
||||
auto& agents = get_printer_agents();
|
||||
|
||||
if (agents.find(id) != agents.end()) {
|
||||
get_default_agent_id() = id;
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkAgentFactory::register_all_agents()
|
||||
{
|
||||
// Register Orca printer agent
|
||||
{
|
||||
auto info = OrcaPrinterAgent::get_agent_info_static();
|
||||
register_printer_agent(info.id, info.name,
|
||||
[](std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
const std::string& log_dir) -> std::shared_ptr<IPrinterAgent> {
|
||||
auto agent = std::make_shared<OrcaPrinterAgent>(log_dir);
|
||||
if (cloud_agent) {
|
||||
agent->set_cloud_agent(cloud_agent);
|
||||
}
|
||||
return agent;
|
||||
});
|
||||
}
|
||||
register_agent<OrcaPrinterAgent>();
|
||||
register_agent<QidiPrinterAgent>();
|
||||
register_agent<MoonrakerPrinterAgent>();
|
||||
|
||||
// Register Qidi printer agent
|
||||
{
|
||||
auto info = QidiPrinterAgent::get_agent_info_static();
|
||||
register_printer_agent(info.id, info.name,
|
||||
[](std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
const std::string& log_dir) -> std::shared_ptr<IPrinterAgent> {
|
||||
auto agent = std::make_shared<QidiPrinterAgent>(log_dir);
|
||||
if (cloud_agent) {
|
||||
agent->set_cloud_agent(cloud_agent);
|
||||
}
|
||||
return agent;
|
||||
});
|
||||
}
|
||||
|
||||
// Register Moonraker printer agent
|
||||
{
|
||||
auto info = MoonrakerPrinterAgent::get_agent_info_static();
|
||||
register_printer_agent(info.id, info.name,
|
||||
[](std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
const std::string& log_dir) -> std::shared_ptr<IPrinterAgent> {
|
||||
auto agent = std::make_shared<MoonrakerPrinterAgent>(log_dir);
|
||||
if (cloud_agent) {
|
||||
agent->set_cloud_agent(cloud_agent);
|
||||
}
|
||||
return agent;
|
||||
});
|
||||
}
|
||||
|
||||
// Register BBL printer agent (only if bbl network agent is available)
|
||||
// BBLPrinterAgent takes no constructor args, so register manually
|
||||
{
|
||||
auto info = BBLPrinterAgent::get_agent_info_static();
|
||||
register_printer_agent(info.id, info.name,
|
||||
[](std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
const std::string& log_dir) -> std::shared_ptr<IPrinterAgent> {
|
||||
const std::string& /*log_dir*/) -> std::shared_ptr<IPrinterAgent> {
|
||||
auto agent = std::make_shared<BBLPrinterAgent>();
|
||||
if (cloud_agent) {
|
||||
if (cloud_agent)
|
||||
agent->set_cloud_agent(cloud_agent);
|
||||
}
|
||||
return agent;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<NetworkAgent> create_agent_from_config(const std::string& log_dir, AppConfig* app_config)
|
||||
@@ -187,9 +126,8 @@ std::unique_ptr<NetworkAgent> create_agent_from_config(const std::string& log_di
|
||||
}
|
||||
}
|
||||
|
||||
// Create NetworkAgent with cloud agent only (printer agent added later)
|
||||
// We will create the printer agent later when the printer is selected, so we pass nullptr for the printer agent here.
|
||||
auto agent = NetworkAgentFactory::create_from_agents(std::move(cloud_agent), nullptr);
|
||||
// Create NetworkAgent with cloud agent only (printer agent added later when printer is selected)
|
||||
auto agent = std::make_unique<NetworkAgent>(std::move(cloud_agent), nullptr);
|
||||
|
||||
if (agent && app_config && use_orca_cloud) {
|
||||
auto* orca_cloud = dynamic_cast<OrcaCloudServiceAgent*>(agent->get_cloud_agent().get());
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -99,11 +97,6 @@ public:
|
||||
*/
|
||||
static bool is_printer_agent_registered(const std::string& id);
|
||||
|
||||
/**
|
||||
* Get info about a registered agent
|
||||
*/
|
||||
static const PrinterAgentInfo* get_printer_agent_info(const std::string& id);
|
||||
|
||||
/**
|
||||
* Get all registered printer agents (for UI population)
|
||||
*/
|
||||
@@ -121,16 +114,6 @@ public:
|
||||
std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
const std::string& log_dir);
|
||||
|
||||
/**
|
||||
* Get default printer agent ID
|
||||
*/
|
||||
static std::string get_default_printer_agent_id();
|
||||
|
||||
/**
|
||||
* Set a specific agent as the default
|
||||
*/
|
||||
static void set_default_printer_agent_id(const std::string& id);
|
||||
|
||||
// ========================================================================
|
||||
// Cloud Agent Factory
|
||||
// ========================================================================
|
||||
@@ -164,23 +147,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// NetworkAgent Facade Creation
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Create a NetworkAgent from pre-created sub-agents
|
||||
*
|
||||
* @param cloud_agent Cloud service agent (required, includes auth)
|
||||
* @param printer_agent Printer agent (optional, can be nullptr)
|
||||
* @return Unique pointer to NetworkAgent facade
|
||||
*/
|
||||
static std::unique_ptr<NetworkAgent> create_from_agents(std::shared_ptr<ICloudServiceAgent> cloud_agent,
|
||||
std::shared_ptr<IPrinterAgent> printer_agent)
|
||||
{
|
||||
return std::make_unique<NetworkAgent>(std::move(cloud_agent), std::move(printer_agent));
|
||||
}
|
||||
|
||||
private:
|
||||
// Factory is not instantiable
|
||||
NetworkAgentFactory() = delete;
|
||||
|
||||
@@ -49,7 +49,7 @@ bool QidiPrinterAgent::fetch_filament_info(std::string dev_id)
|
||||
}
|
||||
|
||||
// 4. Build the AMS payload
|
||||
build_ams_payload(box_count, trays);
|
||||
build_ams_payload(box_count, box_count * 4 - 1, trays);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user