mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 23:31:19 +00:00
* Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced Generated with include-what-you-use and applied conservatively. Only OrcaSlicer's own headers, the ones under src/ and tests/, are removed or forward-declared; standard-library and third-party includes are left alone. An include is removed only when both the Release and the Debug configuration leave it unused, never from inside a conditional block, and never from a file with platform-specific blocks, which only gain includes. Files whose only use of a header sits behind a feature or debug macro (libvgcode's OpenGL ES and marker code, the ARACHNE/TESTS_EXPORT_SVGS debug output) keep their includes. clonable_ptr.hpp gains #pragma once; it had no include guard and was only safe while Config.hpp was its sole includer. * Remove Unused Project Includes From Files With Platform-Specific Code A Linux include-what-you-use run cannot see the code inside _WIN32, __APPLE__ or __linux__ blocks, so its verdict is only taken where nothing the removed header declares, directly or through what it includes, is named inside those blocks. Removals also have to hold in both the Release and Debug configuration and never touch a line inside a conditional block. * Restore the libslic3r Precompiled Header and Direct Includes Lost in the Platform Pass The platform-file pass treated pchheader.hpp as an ordinary header and emptied it, and left GUI_Preview.hpp and 14 other files relying on headers they no longer reached directly. * Restore MainFrame.hpp in ParamsDialog.cpp for the Windows-Only Reparent Call * Include Headers That Files Reached Through Ones the Cleanup Removed * Drop Includes Duplicated by the Cleanup or by Main's Own Additions * Leave PreciseSeam.cpp as Main Has It After the Precise Seam Rework
191 lines
5.5 KiB
C++
191 lines
5.5 KiB
C++
#include "OrcaPrinterAgent.hpp"
|
|
#include "IPrinterAgent.hpp"
|
|
#include "NetworkAgentFactory.hpp"
|
|
#include <string>
|
|
#include <utility>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include "bambu_networking.hpp"
|
|
|
|
namespace Slic3r { class ICloudServiceAgent; }
|
|
|
|
namespace Slic3r {
|
|
|
|
const std::string OrcaPrinterAgent_VERSION = "0.0.1";
|
|
|
|
OrcaPrinterAgent::OrcaPrinterAgent(std::string log_dir) : log_dir(std::move(log_dir))
|
|
{
|
|
}
|
|
|
|
OrcaPrinterAgent::~OrcaPrinterAgent() = default;
|
|
|
|
void OrcaPrinterAgent::set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
m_cloud_agent = cloud;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Communication - All Stubs
|
|
// ============================================================================
|
|
|
|
int OrcaPrinterAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::connect_printer(const PrinterConnectionParams& params)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::disconnect_printer()
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Discovery - Stub
|
|
// ============================================================================
|
|
|
|
bool OrcaPrinterAgent::start_discovery(bool start, bool sending)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
int OrcaPrinterAgent::bind_detect(std::string dev_ip, std::string sec_link, detectResult& detect)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_server_callback(OnServerErrFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_server_err_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Machine Selection
|
|
// ============================================================================
|
|
|
|
std::string OrcaPrinterAgent::get_user_selected_machine()
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
return selected_machine;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_user_selected_machine(std::string dev_id)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
selected_machine = dev_id;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Agent Information
|
|
// ============================================================================
|
|
AgentInfo OrcaPrinterAgent::get_agent_info_static()
|
|
{
|
|
return AgentInfo{ORCA_PRINTER_AGENT_ID, "Orca", OrcaPrinterAgent_VERSION, "Orca Printer Communication Protocol Agent"};
|
|
}
|
|
|
|
// ============================================================================
|
|
// Print Job Operations - All Stubs
|
|
// ============================================================================
|
|
|
|
int OrcaPrinterAgent::start_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::start_local_print_with_record(PrintParams params,
|
|
OnUpdateStatusFn update_fn,
|
|
WasCancelledFn cancel_fn,
|
|
OnWaitFn wait_fn)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::start_local_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::start_sdcard_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)
|
|
{
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Callback Registration
|
|
// ============================================================================
|
|
|
|
int OrcaPrinterAgent::set_on_ssdp_msg_fn(OnMsgArrivedFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_ssdp_msg_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_on_printer_connected_fn(OnPrinterConnectedFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_printer_connected_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_on_subscribe_failure_fn(GetSubscribeFailureFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_subscribe_failure_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_on_message_fn(OnMessageFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_message_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_on_user_message_fn(OnMessageFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_user_message_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_on_local_connect_fn(OnLocalConnectedFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_local_connect_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_on_local_message_fn(OnMessageFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
on_local_message_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
int OrcaPrinterAgent::set_queue_on_main_fn(QueueOnMainFn fn)
|
|
{
|
|
std::lock_guard<std::mutex> lock(state_mutex);
|
|
queue_on_main_fn = fn;
|
|
return BAMBU_NETWORK_SUCCESS;
|
|
}
|
|
|
|
} // namespace Slic3r
|