FIX: Sync AMS settings after device certificate installation

jira: STUDIO-14191
Change-Id: If4a02ed6f2c5ef111f0c7086b138e3dabc8ed1dd
(cherry picked from commit 172824c4b93f6b3eb197481efc38a262774ef313)
This commit is contained in:
haolin.tian 2025-08-25 10:10:51 +08:00 committed by Noisyfox
parent f36f73e518
commit 90830ab2ea
4 changed files with 26 additions and 1 deletions

View file

@ -2299,6 +2299,7 @@ void MachineObject::reset()
job_id_ = "";
jobState_ = 0;
m_plate_index = -1;
device_cert_installed = false;
// reset print_json
json empty_j;
@ -2395,6 +2396,11 @@ bool MachineObject::is_info_ready(bool check_version) const
}
bool MachineObject::is_security_control_ready() const
{
return device_cert_installed;
}
std::vector<std::string> MachineObject::get_resolution_supported()
{
return camera_resolution_supported;
@ -4230,6 +4236,11 @@ int MachineObject::publish_gcode(std::string gcode_str)
return publish_json(j);
}
void MachineObject::update_device_cert_state(bool ready)
{
device_cert_installed = ready;
}
BBLSubTask* MachineObject::get_subtask()
{
if (!subtask_)

View file

@ -239,6 +239,8 @@ public:
std::chrono::system_clock::time_point last_request_push; /* last received print push from machine */
std::chrono::system_clock::time_point last_request_start; /* last received print push from machine */
bool device_cert_installed = false;
int m_active_state = 0; // 0 - not active, 1 - active, 2 - update-to-date
bool is_tunnel_mqtt = false;
@ -801,6 +803,7 @@ public:
void set_online_state(bool on_off);
bool is_online() { return m_is_online; }
bool is_info_ready(bool check_version = true) const;
bool is_security_control_ready() const;
bool is_camera_busy_off();
std::vector<std::string> get_resolution_supported();
@ -814,6 +817,7 @@ public:
int local_publish_json(std::string json_str, int qos = 0, int flag = 0);
int parse_json(std::string tunnel, std::string payload, bool key_filed_only = false);
int publish_gcode(std::string gcode_str);
void update_device_cert_state(bool ready);
static std::string setting_id_to_type(std::string setting_id, std::string tray_type);
BBLSubTask* get_subtask();

View file

@ -4904,6 +4904,15 @@ void GUI_App::process_network_msg(std::string dev_id, std::string msg)
if (dev_id.empty()) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << msg;
}
else if (msg == "device_cert_installed") {
BOOST_LOG_TRIVIAL(info) << "process_network_msg, device_cert_installed";
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return;
MachineObject* obj = dev->get_my_machine(dev_id);
if (obj) {
obj->update_device_cert_state(true);
}
}
}
//BBS pop up a dialog and download files

View file

@ -3120,7 +3120,8 @@ void StatusPanel::update_ams(MachineObject *obj)
if (obj) {
if (obj->get_printer_ams_type() == "f1") { ams_mode = AMSModel::AMS_LITE; }
obj->check_ams_filament_valid();
if (obj->is_security_control_ready())
obj->check_ams_filament_valid();
}
if (obj->is_enable_np && obj->GetFilaSystem()->GetAmsList().size() > 0) {
ams_mode = AMSModel(obj->GetFilaSystem()->GetAmsList().begin()->second->GetAmsType());