mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-21 16:02:37 +00:00
fix: update printer agent plugin API
This commit is contained in:
@@ -29,7 +29,6 @@ void PrinterAgentPluginCapability::RegisterBindings(pybind11::module_& module)
|
||||
.value("HTTPS", CameraStreamMode::https)
|
||||
.value("HTTP_SNAPSHOT", CameraStreamMode::http_snapshot)
|
||||
.value("RTSP", CameraStreamMode::rtsp)
|
||||
.value("WebRTC", CameraStreamMode::webrtc)
|
||||
.export_values();
|
||||
|
||||
py::class_<AgentInfo>(printer_agent_module, "AgentInfo")
|
||||
@@ -107,6 +106,16 @@ void PrinterAgentPluginCapability::RegisterBindings(pybind11::module_& module)
|
||||
.def("disconnect_printer", &PrinterAgentPluginCapability::disconnect_printer)
|
||||
.def("send_message", &PrinterAgentPluginCapability::send_message)
|
||||
.def("send_message_to_printer", &PrinterAgentPluginCapability::send_message_to_printer)
|
||||
.def("command_ams_refresh_rfid", &PrinterAgentPluginCapability::command_ams_refresh_rfid)
|
||||
.def("command_ams_calibrate", &PrinterAgentPluginCapability::command_ams_calibrate)
|
||||
.def("command_ams_select_tray", &PrinterAgentPluginCapability::command_ams_select_tray)
|
||||
.def("command_start_camera", &PrinterAgentPluginCapability::command_start_camera)
|
||||
.def("command_xyz_abs", &PrinterAgentPluginCapability::command_xyz_abs)
|
||||
.def("command_auto_leveling", &PrinterAgentPluginCapability::command_auto_leveling)
|
||||
.def("command_go_home", &PrinterAgentPluginCapability::command_go_home)
|
||||
.def("command_set_bed", &PrinterAgentPluginCapability::command_set_bed)
|
||||
.def("command_set_nozzle", &PrinterAgentPluginCapability::command_set_nozzle)
|
||||
.def("command_axis_control", &PrinterAgentPluginCapability::command_axis_control)
|
||||
.def("start_discovery", &PrinterAgentPluginCapability::start_discovery)
|
||||
.def("bind_detect", &PrinterAgentPluginCapability::bind_detect)
|
||||
.def("get_user_selected_machine", &PrinterAgentPluginCapability::get_user_selected_machine)
|
||||
|
||||
@@ -50,6 +50,80 @@ public:
|
||||
dev_id, json_str, qos, flag);
|
||||
}
|
||||
|
||||
int command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_ams_refresh_rfid,
|
||||
dev_id, tray_id, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_ams_calibrate,
|
||||
dev_id, ams_id, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_ams_select_tray,
|
||||
dev_id, tray_id, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_start_camera(std::string dev_id) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_start_camera, dev_id);
|
||||
}
|
||||
|
||||
int command_xyz_abs(std::string dev_id, int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_xyz_abs,
|
||||
dev_id, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_auto_leveling(std::string dev_id, int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_auto_leveling,
|
||||
dev_id, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_go_home(std::string dev_id, bool is_printing, bool supports_mqtt_homing,
|
||||
int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_go_home,
|
||||
dev_id, is_printing, supports_mqtt_homing, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_set_bed(std::string dev_id, int temp, bool supports_mqtt_bed_ctrl,
|
||||
int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_set_bed,
|
||||
dev_id, temp, supports_mqtt_bed_ctrl, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_set_nozzle(std::string dev_id, int temp, int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_set_nozzle,
|
||||
dev_id, temp, sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
int command_axis_control(std::string dev_id, std::string axis, double unit, double input_val,
|
||||
int speed, bool is_core_xy, bool supports_mqtt_axis_control,
|
||||
int sequence_id, bool lan_mode) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
[] {}, PYBIND11_OVERRIDE, int, PrinterAgentPluginCapability, command_axis_control,
|
||||
dev_id, axis, unit, input_val, speed, is_core_xy, supports_mqtt_axis_control,
|
||||
sequence_id, lan_mode);
|
||||
}
|
||||
|
||||
bool start_discovery(bool start, bool sending) override
|
||||
{
|
||||
ORCA_PY_OVERRIDE_AUDITED(
|
||||
|
||||
@@ -73,7 +73,12 @@ TEST_CASE("integration: orca.printer_agent binding surface", "[integration][Pyth
|
||||
REQUIRE(py::hasattr(pa, "PrinterAgentBase"));
|
||||
py::object base = pa.attr("PrinterAgentBase");
|
||||
for (const char* method : { "get_agent_info", "connect_printer", "disconnect_printer",
|
||||
"send_message", "start_discovery", "bind_detect",
|
||||
"send_message", "send_message_to_printer",
|
||||
"command_ams_refresh_rfid", "command_ams_calibrate",
|
||||
"command_ams_select_tray", "command_start_camera",
|
||||
"command_xyz_abs", "command_auto_leveling", "command_go_home",
|
||||
"command_set_bed", "command_set_nozzle", "command_axis_control",
|
||||
"start_discovery", "bind_detect",
|
||||
"start_print", "get_filament_sync_mode" }) {
|
||||
CAPTURE(method);
|
||||
CHECK(py::hasattr(base, method));
|
||||
@@ -95,6 +100,7 @@ TEST_CASE("integration: orca.printer_agent binding surface", "[integration][Pyth
|
||||
REQUIRE(py::hasattr(pa, "CameraStreamMode"));
|
||||
py::object camera_mode = pa.attr("CameraStreamMode");
|
||||
CHECK(py::hasattr(camera_mode, "HTTPS"));
|
||||
CHECK_FALSE(py::hasattr(camera_mode, "WebRTC"));
|
||||
|
||||
// Plugin-type enum exposed at module root (host reads it without the GIL).
|
||||
CHECK(py::hasattr(orca, "PluginType"));
|
||||
|
||||
Reference in New Issue
Block a user