NEW:added missing method for github branch

Change-Id: I6dba035deb036a5610d3659a6abebbe9ae768bdc
This commit is contained in:
tao wang 2023-07-04 13:31:53 +08:00 committed by Lane.Wei
parent 316636d36c
commit b461d8f9d5
5 changed files with 83 additions and 21 deletions

View file

@ -2362,6 +2362,11 @@ void MachineObject::set_print_state(std::string status)
print_status = status;
}
std::vector<std::string> MachineObject::get_compatible_machine()
{
return DeviceManager::get_compatible_machine(printer_type);
}
int MachineObject::connect(bool is_anonymous, bool use_openssl)
{
if (dev_ip.empty()) return -1;
@ -5039,4 +5044,20 @@ std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_fi
return "";
}
std::vector<std::string> DeviceManager::get_compatible_machine(std::string type_str)
{
std::vector<std::string> compatible_machine;
if (DeviceManager::function_table.contains("printers")) {
for (auto printer : DeviceManager::function_table["printers"]) {
if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) {
if (printer.contains("compatible_machine")) {
for (auto res : printer["compatible_machine"])
compatible_machine.emplace_back(res.get<std::string>());
}
}
}
}
return compatible_machine;
}
} // namespace Slic3r