FIX: use actual printer_type when connecting with ip&access_code

jira: [STUDIO-13841]
Change-Id: Iff594cd1f6dcd5c6485ab0aa67c98f422a75fd6c
(cherry picked from commit f8d0f62a1b3f3379de40a3b845c06fe61d907d82)
This commit is contained in:
haolin.tian 2025-08-05 20:05:16 +08:00 committed by Noisyfox
parent cae1fe4dd4
commit e68daa36c9
3 changed files with 13 additions and 4 deletions

View file

@ -314,7 +314,9 @@ namespace Slic3r
}
}
MachineObject* DeviceManager::insert_local_device(const BBLocalMachine& machine, std::string connection_type, std::string bind_state, std::string version, std::string access_code)
MachineObject* DeviceManager::insert_local_device(const BBLocalMachine& machine,
std::string connection_type, std::string bind_state,
std::string version, std::string access_code)
{
MachineObject* obj;
auto it = localMachineList.find(machine.dev_id);
@ -324,7 +326,10 @@ namespace Slic3r
obj = new MachineObject(this, m_agent, machine.dev_name, machine.dev_id, machine.dev_ip);
localMachineList.insert(std::make_pair(machine.dev_id, obj));
}
obj->printer_type = _parse_printer_type(machine.printer_type);
if (machine.printer_type.empty())
obj->printer_type = _parse_printer_type("C11");
else
obj->printer_type = _parse_printer_type(machine.printer_type);
obj->dev_connection_type = connection_type == "farm" ? "lan":connection_type;
obj->bind_state = connection_type == "farm" ? "free":bind_state;
obj->bind_sec_link = "secure";

View file

@ -100,7 +100,9 @@ private:
/*TODO*/
public:
// to remove
MachineObject* insert_local_device(const BBLocalMachine& machine, std::string connection_type, std::string bind_state, std::string version, std::string access_code);
MachineObject* insert_local_device(const BBLocalMachine& machine,
std::string connection_type, std::string bind_state, std::string version,
std::string access_code);
static void update_local_machine(const MachineObject& m);
};

View file

@ -2105,7 +2105,9 @@ void InputIpAddressDialog::workerThreadFunc(std::string str_ip, std::string str_
machine.dev_ip = str_ip;
machine.dev_id = detectData.dev_id;
machine.printer_type = detectData.model_id;
m_obj = dev->insert_local_device(machine, detectData.connect_type, detectData.bind_state, detectData.version, str_access_code);
m_obj = dev->insert_local_device(machine,
detectData.connect_type, detectData.bind_state, detectData.version,
str_access_code);
if (w.expired()) return;