ENH: add dev_ota_version in ssdp
JIRA: STUDIO-5740 Change-Id: Ic80e6d4b9bf82813fdc4a76604a3d36213d12b03 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
8b82f68f57
commit
557d587bfa
|
@ -573,7 +573,8 @@ wxString get_fail_reason(int code)
|
|||
agent->track_update_property("dev_ota_version", m_machine_info->get_ota_version());
|
||||
|
||||
m_simplebook->SetSelection(0);
|
||||
m_bind_job = std::make_shared<BindJob>(m_status_bar, wxGetApp().plater(), m_machine_info->dev_id, m_machine_info->dev_ip, m_machine_info->bind_sec_link);
|
||||
m_bind_job = std::make_shared<BindJob>(m_status_bar, wxGetApp().plater(),
|
||||
m_machine_info->dev_id, m_machine_info->dev_ip, m_machine_info->bind_sec_link, m_machine_info->bind_ssdp_version);
|
||||
|
||||
if (m_machine_info && (m_machine_info->get_printer_series() == PrinterSeries::SERIES_X1)) {
|
||||
m_bind_job->set_improved(false);
|
||||
|
|
|
@ -2757,7 +2757,10 @@ int MachineObject::parse_json(std::string payload)
|
|||
module_vers.emplace(ver_info.name, ver_info);
|
||||
if (ver_info.name == "ota") {
|
||||
NetworkAgent* agent = GUI::wxGetApp().getAgent();
|
||||
if (agent) agent->track_update_property("dev_ota_ver", ver_info.sw_ver);
|
||||
if (agent) {
|
||||
std::string dev_ota_str = "dev_ota_ver:" + this->dev_id;
|
||||
agent->track_update_property(dev_ota_str, ver_info.sw_ver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4975,9 +4978,13 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
std::string connect_type = j["connect_type"].get<std::string>();
|
||||
std::string bind_state = j["bind_state"].get<std::string>();
|
||||
std::string sec_link = "";
|
||||
std::string ssdp_version = "";
|
||||
if (j.contains("sec_link")) {
|
||||
sec_link = j["sec_link"].get<std::string>();
|
||||
}
|
||||
if (j.contains("ssdp_version")) {
|
||||
ssdp_version = j["ssdp_version"].get<std::string>();
|
||||
}
|
||||
std::string connection_name = "";
|
||||
if (j.contains("connection_name")) {
|
||||
connection_name = j["connection_name"].get<std::string>();
|
||||
|
@ -4992,6 +4999,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
it->second->bind_state = bind_state;
|
||||
it->second->bind_sec_link = sec_link;
|
||||
it->second->dev_connection_type = connect_type;
|
||||
it->second->bind_ssdp_version = ssdp_version;
|
||||
}
|
||||
|
||||
/* update localMachineList */
|
||||
|
@ -5022,6 +5030,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
obj->dev_connection_type= connect_type;
|
||||
obj->bind_state = bind_state;
|
||||
obj->bind_sec_link = sec_link;
|
||||
obj->bind_ssdp_version = ssdp_version;
|
||||
obj->printer_type = MachineObject::parse_printer_type(printer_type_str);
|
||||
|
||||
// U0 firmware
|
||||
|
@ -5046,6 +5055,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
obj->bind_state = bind_state;
|
||||
obj->bind_sec_link = sec_link;
|
||||
obj->dev_connection_name = connection_name;
|
||||
obj->bind_ssdp_version = ssdp_version;
|
||||
obj->m_is_online = true;
|
||||
|
||||
//load access code
|
||||
|
|
|
@ -452,6 +452,7 @@ public:
|
|||
std::string bind_user_id;
|
||||
std::string bind_state; /* free | occupied */
|
||||
std::string bind_sec_link;
|
||||
std::string bind_ssdp_version;
|
||||
bool is_avaliable() { return bind_state == "free"; }
|
||||
time_t last_alive;
|
||||
bool m_is_online;
|
||||
|
|
|
@ -16,11 +16,13 @@ static wxString waiting_auth_str = _L("Logging in");
|
|||
static wxString login_failed_str = _L("Login failed");
|
||||
|
||||
|
||||
BindJob::BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link)
|
||||
BindJob::BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link,
|
||||
std::string ssdp_version)
|
||||
: PlaterJob{std::move(pri), plater},
|
||||
m_dev_id(dev_id),
|
||||
m_dev_ip(dev_ip),
|
||||
m_sec_link(sec_link)
|
||||
m_sec_link(sec_link),
|
||||
m_ssdp_version(ssdp_version)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
@ -65,7 +67,8 @@ void BindJob::process()
|
|||
wxDateTime::TimeZone tz(wxDateTime::Local);
|
||||
long offset = tz.GetOffset();
|
||||
std::string timezone = get_timezone_utc_hm(offset);
|
||||
|
||||
|
||||
m_agent->track_update_property("ssdp_version", m_ssdp_version, "string");
|
||||
int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone, m_improved,
|
||||
[this, &curr_percent, &msg, &result_code, &result_info](int stage, int code, std::string info) {
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ class BindJob : public PlaterJob
|
|||
std::string m_dev_id;
|
||||
std::string m_dev_ip;
|
||||
std::string m_sec_link;
|
||||
std::string m_ssdp_version;
|
||||
bool m_job_finished{ false };
|
||||
int m_print_job_completed_id = 0;
|
||||
bool m_improved{false};
|
||||
|
@ -24,7 +25,8 @@ class BindJob : public PlaterJob
|
|||
protected:
|
||||
void on_exception(const std::exception_ptr &) override;
|
||||
public:
|
||||
BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link);
|
||||
BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip,
|
||||
std::string sec_link, std::string ssdp_version);
|
||||
|
||||
int status_range() const override
|
||||
{
|
||||
|
|
|
@ -10646,7 +10646,7 @@ void Plater::export_gcode(bool prefer_removable)
|
|||
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
if (preset_bundle) {
|
||||
j["Gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
j["gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
}
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
if (agent) agent->track_event("printer_export_gcode", j.dump());
|
||||
|
|
|
@ -2827,8 +2827,10 @@ void SelectMachineDialog::on_send_print()
|
|||
|
||||
// update ota version
|
||||
NetworkAgent* agent = wxGetApp().getAgent();
|
||||
if (agent)
|
||||
agent->track_update_property("dev_ota_version", obj_->get_ota_version());
|
||||
if (agent) {
|
||||
std::string dev_ota_str = "dev_ota_ver:" + obj_->dev_id;
|
||||
agent->track_update_property(dev_ota_str, obj_->get_ota_version());
|
||||
}
|
||||
|
||||
m_print_job->start();
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: start print job";
|
||||
|
|
Loading…
Reference in New Issue