mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
ENH: delete useless function, delay start_device_subscribe after mqtt_connect called
jira: [STUDIO-13135] Change-Id: Ibce80b043d08f6c1c7baa6611c3cfa2f0c85f2f5 (cherry picked from commit c2ff073525937fb571ea8d3bfae55231adaa691d)
This commit is contained in:
@@ -6003,6 +6003,7 @@ std::string MachineObject::get_string_from_fantype(int type)
|
|||||||
|
|
||||||
void MachineObject::nt_condition_local_tunnel()
|
void MachineObject::nt_condition_local_tunnel()
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
int full_msg_count_limit = 2;
|
int full_msg_count_limit = 2;
|
||||||
if (!nt_try_local_tunnel && nt_cloud_full_msg_count == full_msg_count_limit) {
|
if (!nt_try_local_tunnel && nt_cloud_full_msg_count == full_msg_count_limit) {
|
||||||
connect(Slic3r::GUI::wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
|
connect(Slic3r::GUI::wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
|
||||||
@@ -7495,8 +7496,6 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
|
|||||||
if (last_selected->second->connection_type() == "lan") {
|
if (last_selected->second->connection_type() == "lan") {
|
||||||
if (last_selected->second->is_connecting() && !need_disconnect)
|
if (last_selected->second->is_connecting() && !need_disconnect)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!need_disconnect) {m_agent->disconnect_printer(); }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7514,7 +7513,6 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
|
|||||||
} else {
|
} else {
|
||||||
// lan mode printer reconnect printer
|
// lan mode printer reconnect printer
|
||||||
if (m_agent) {
|
if (m_agent) {
|
||||||
if (!need_disconnect) {m_agent->disconnect_printer();}
|
|
||||||
it->second->reset();
|
it->second->reset();
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
#if !BBL_RELEASE_TO_PUBLIC
|
||||||
it->second->connect(Slic3r::GUI::wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
|
it->second->connect(Slic3r::GUI::wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
|
||||||
@@ -7574,28 +7572,6 @@ MachineObject* DeviceManager::get_selected_machine()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::add_user_subscribe()
|
|
||||||
{
|
|
||||||
/* user machine */
|
|
||||||
std::vector<std::string> dev_list;
|
|
||||||
for (auto it = userMachineList.begin(); it != userMachineList.end(); it++) {
|
|
||||||
dev_list.push_back(it->first);
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "add_user_subscribe: " << it->first;
|
|
||||||
}
|
|
||||||
m_agent->add_subscribe(dev_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceManager::del_user_subscribe()
|
|
||||||
{
|
|
||||||
/* user machine */
|
|
||||||
std::vector<std::string> dev_list;
|
|
||||||
for (auto it = userMachineList.begin(); it != userMachineList.end(); it++) {
|
|
||||||
dev_list.push_back(it->first);
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "del_user_subscribe: " << it->first;
|
|
||||||
}
|
|
||||||
m_agent->del_subscribe(dev_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceManager::subscribe_device_list(std::vector<std::string> dev_list)
|
void DeviceManager::subscribe_device_list(std::vector<std::string> dev_list)
|
||||||
{
|
{
|
||||||
std::vector<std::string> unsub_list;
|
std::vector<std::string> unsub_list;
|
||||||
|
|||||||
@@ -1498,8 +1498,6 @@ public:
|
|||||||
|
|
||||||
bool set_selected_machine(std::string dev_id, bool need_disconnect = false);
|
bool set_selected_machine(std::string dev_id, bool need_disconnect = false);
|
||||||
MachineObject* get_selected_machine();
|
MachineObject* get_selected_machine();
|
||||||
void add_user_subscribe();
|
|
||||||
void del_user_subscribe();
|
|
||||||
|
|
||||||
void subscribe_device_list(std::vector<std::string> dev_list);
|
void subscribe_device_list(std::vector<std::string> dev_list);
|
||||||
|
|
||||||
|
|||||||
@@ -1689,7 +1689,6 @@ void GUI_App::init_networking_callbacks()
|
|||||||
m_agent->set_user_selected_machine(m_agent->get_user_selected_machine());
|
m_agent->set_user_selected_machine(m_agent->get_user_selected_machine());
|
||||||
//subscribe device
|
//subscribe device
|
||||||
if (m_agent->is_user_login()) {
|
if (m_agent->is_user_login()) {
|
||||||
m_agent->start_device_subscribe();
|
|
||||||
|
|
||||||
/*disconnect lan*/
|
/*disconnect lan*/
|
||||||
DeviceManager* dev = this->getDeviceManager();
|
DeviceManager* dev = this->getDeviceManager();
|
||||||
@@ -4343,7 +4342,6 @@ void GUI_App::on_user_login_handle(wxCommandEvent &evt)
|
|||||||
|
|
||||||
int online_login = evt.GetInt();
|
int online_login = evt.GetInt();
|
||||||
m_agent->connect_server();
|
m_agent->connect_server();
|
||||||
|
|
||||||
// get machine list
|
// get machine list
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev) return;
|
if (!dev) return;
|
||||||
|
|||||||
@@ -2339,27 +2339,6 @@ void SelectMachineDialog::Enable_Auto_Refill(bool enable)
|
|||||||
m_ams_backup_tip->Refresh();
|
m_ams_backup_tip->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectMachineDialog::connect_printer_mqtt()
|
|
||||||
{
|
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
|
||||||
if (!dev) return;
|
|
||||||
MachineObject* obj_ = dev->get_selected_machine();
|
|
||||||
|
|
||||||
if (obj_->connection_type() == "cloud") {
|
|
||||||
show_status(PrintDialogStatus::PrintStatusSending);
|
|
||||||
m_status_bar->disable_cancel_button();
|
|
||||||
m_status_bar->set_status_text(_L("Connecting to the printer. Unable to cancel during the connection process."));
|
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
|
||||||
obj_->connect(wxGetApp().app_config->get("enable_ssl_for_mqtt") == "true" ? true : false);
|
|
||||||
#else
|
|
||||||
obj_->connect(obj_->local_use_ssl_for_mqtt);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
on_send_print();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool _HasExt(const std::vector<FilamentInfo> &ams_mapping_result) {
|
static bool _HasExt(const std::vector<FilamentInfo> &ams_mapping_result) {
|
||||||
if (ams_mapping_result.empty()) {
|
if (ams_mapping_result.empty()) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -448,7 +448,6 @@ public:
|
|||||||
void show_errors(wxString& info);
|
void show_errors(wxString& info);
|
||||||
void on_ok_btn(wxCommandEvent& event);
|
void on_ok_btn(wxCommandEvent& event);
|
||||||
void Enable_Auto_Refill(bool enable);
|
void Enable_Auto_Refill(bool enable);
|
||||||
void connect_printer_mqtt();
|
|
||||||
void on_send_print();
|
void on_send_print();
|
||||||
void clear_ip_address_config(wxCommandEvent& e);
|
void clear_ip_address_config(wxCommandEvent& e);
|
||||||
void on_refresh(wxCommandEvent& event);
|
void on_refresh(wxCommandEvent& event);
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ func_stop_subscribe NetworkAgent::stop_subscribe_ptr = nullptr;
|
|||||||
func_add_subscribe NetworkAgent::add_subscribe_ptr = nullptr;
|
func_add_subscribe NetworkAgent::add_subscribe_ptr = nullptr;
|
||||||
func_del_subscribe NetworkAgent::del_subscribe_ptr = nullptr;
|
func_del_subscribe NetworkAgent::del_subscribe_ptr = nullptr;
|
||||||
func_enable_multi_machine NetworkAgent::enable_multi_machine_ptr = nullptr;
|
func_enable_multi_machine NetworkAgent::enable_multi_machine_ptr = nullptr;
|
||||||
func_start_device_subscribe NetworkAgent::start_device_subscribe_ptr = nullptr;
|
|
||||||
func_stop_device_subscribe NetworkAgent::stop_device_subscribe_ptr = nullptr;
|
|
||||||
func_send_message NetworkAgent::send_message_ptr = nullptr;
|
func_send_message NetworkAgent::send_message_ptr = nullptr;
|
||||||
func_connect_printer NetworkAgent::connect_printer_ptr = nullptr;
|
func_connect_printer NetworkAgent::connect_printer_ptr = nullptr;
|
||||||
func_disconnect_printer NetworkAgent::disconnect_printer_ptr = nullptr;
|
func_disconnect_printer NetworkAgent::disconnect_printer_ptr = nullptr;
|
||||||
@@ -318,8 +316,6 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
|||||||
add_subscribe_ptr = reinterpret_cast<func_add_subscribe>(get_network_function("bambu_network_add_subscribe"));
|
add_subscribe_ptr = reinterpret_cast<func_add_subscribe>(get_network_function("bambu_network_add_subscribe"));
|
||||||
del_subscribe_ptr = reinterpret_cast<func_del_subscribe>(get_network_function("bambu_network_del_subscribe"));
|
del_subscribe_ptr = reinterpret_cast<func_del_subscribe>(get_network_function("bambu_network_del_subscribe"));
|
||||||
enable_multi_machine_ptr = reinterpret_cast<func_enable_multi_machine>(get_network_function("bambu_network_enable_multi_machine"));
|
enable_multi_machine_ptr = reinterpret_cast<func_enable_multi_machine>(get_network_function("bambu_network_enable_multi_machine"));
|
||||||
start_device_subscribe_ptr = reinterpret_cast<func_start_device_subscribe>(get_network_function("bambu_network_start_device_subscribe"));
|
|
||||||
stop_device_subscribe_ptr = reinterpret_cast<func_stop_device_subscribe>(get_network_function("bambu_network_stop_device_subscribe"));
|
|
||||||
send_message_ptr = reinterpret_cast<func_send_message>(get_network_function("bambu_network_send_message"));
|
send_message_ptr = reinterpret_cast<func_send_message>(get_network_function("bambu_network_send_message"));
|
||||||
connect_printer_ptr = reinterpret_cast<func_connect_printer>(get_network_function("bambu_network_connect_printer"));
|
connect_printer_ptr = reinterpret_cast<func_connect_printer>(get_network_function("bambu_network_connect_printer"));
|
||||||
disconnect_printer_ptr = reinterpret_cast<func_disconnect_printer>(get_network_function("bambu_network_disconnect_printer"));
|
disconnect_printer_ptr = reinterpret_cast<func_disconnect_printer>(get_network_function("bambu_network_disconnect_printer"));
|
||||||
@@ -880,28 +876,6 @@ void NetworkAgent::enable_multi_machine(bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int NetworkAgent::start_device_subscribe()
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
if (network_agent && start_device_subscribe_ptr) {
|
|
||||||
ret = start_device_subscribe_ptr(network_agent);
|
|
||||||
if (ret)
|
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkAgent::stop_device_subscribe()
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
if (network_agent && stop_device_subscribe_ptr) {
|
|
||||||
ret = stop_device_subscribe_ptr(network_agent);
|
|
||||||
if (ret)
|
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
|
int NetworkAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ typedef int (*func_stop_subscribe)(void *agent, std::string module);
|
|||||||
typedef int (*func_add_subscribe)(void *agent, std::vector<std::string> dev_list);
|
typedef int (*func_add_subscribe)(void *agent, std::vector<std::string> dev_list);
|
||||||
typedef int (*func_del_subscribe)(void *agent, std::vector<std::string> dev_list);
|
typedef int (*func_del_subscribe)(void *agent, std::vector<std::string> dev_list);
|
||||||
typedef void (*func_enable_multi_machine)(void *agent, bool enable);
|
typedef void (*func_enable_multi_machine)(void *agent, bool enable);
|
||||||
typedef int (*func_start_device_subscribe)(void* agent);
|
|
||||||
typedef int (*func_stop_device_subscribe)(void* agent);
|
|
||||||
typedef int (*func_send_message)(void *agent, std::string dev_id, std::string json_str, int qos, int flag);
|
typedef int (*func_send_message)(void *agent, std::string dev_id, std::string json_str, int qos, int flag);
|
||||||
typedef int (*func_connect_printer)(void *agent, std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
typedef int (*func_connect_printer)(void *agent, std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
||||||
typedef int (*func_disconnect_printer)(void *agent);
|
typedef int (*func_disconnect_printer)(void *agent);
|
||||||
@@ -157,8 +155,6 @@ public:
|
|||||||
int add_subscribe(std::vector<std::string> dev_list);
|
int add_subscribe(std::vector<std::string> dev_list);
|
||||||
int del_subscribe(std::vector<std::string> dev_list);
|
int del_subscribe(std::vector<std::string> dev_list);
|
||||||
void enable_multi_machine(bool enable);
|
void enable_multi_machine(bool enable);
|
||||||
int start_device_subscribe();
|
|
||||||
int stop_device_subscribe();
|
|
||||||
int send_message(std::string dev_id, std::string json_str, int qos, int flag);
|
int send_message(std::string dev_id, std::string json_str, int qos, int flag);
|
||||||
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
||||||
int disconnect_printer();
|
int disconnect_printer();
|
||||||
@@ -266,8 +262,6 @@ private:
|
|||||||
static func_add_subscribe add_subscribe_ptr;
|
static func_add_subscribe add_subscribe_ptr;
|
||||||
static func_del_subscribe del_subscribe_ptr;
|
static func_del_subscribe del_subscribe_ptr;
|
||||||
static func_enable_multi_machine enable_multi_machine_ptr;
|
static func_enable_multi_machine enable_multi_machine_ptr;
|
||||||
static func_start_device_subscribe start_device_subscribe_ptr;
|
|
||||||
static func_stop_device_subscribe stop_device_subscribe_ptr;
|
|
||||||
static func_send_message send_message_ptr;
|
static func_send_message send_message_ptr;
|
||||||
static func_connect_printer connect_printer_ptr;
|
static func_connect_printer connect_printer_ptr;
|
||||||
static func_disconnect_printer disconnect_printer_ptr;
|
static func_disconnect_printer disconnect_printer_ptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user