mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 10:16:50 +00:00
ENH:try again after subscription failure
jira:[Try again after subscription failure] Change-Id: Ibfb1e8e26eb166d786a372632a86ef98030db034
This commit is contained in:
@@ -42,6 +42,7 @@ func_set_on_printer_connected_fn NetworkAgent::set_on_printer_connected_fn_pt
|
||||
func_set_on_server_connected_fn NetworkAgent::set_on_server_connected_fn_ptr = nullptr;
|
||||
func_set_on_http_error_fn NetworkAgent::set_on_http_error_fn_ptr = nullptr;
|
||||
func_set_get_country_code_fn NetworkAgent::set_get_country_code_fn_ptr = nullptr;
|
||||
func_set_on_subscribe_failure_fn NetworkAgent::set_on_subscribe_failure_fn_ptr = nullptr;
|
||||
func_set_on_message_fn NetworkAgent::set_on_message_fn_ptr = nullptr;
|
||||
func_set_on_local_connect_fn NetworkAgent::set_on_local_connect_fn_ptr = nullptr;
|
||||
func_set_on_local_message_fn NetworkAgent::set_on_local_message_fn_ptr = nullptr;
|
||||
@@ -200,6 +201,7 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||
set_on_server_connected_fn_ptr = reinterpret_cast<func_set_on_server_connected_fn>(get_network_function("bambu_network_set_on_server_connected_fn"));
|
||||
set_on_http_error_fn_ptr = reinterpret_cast<func_set_on_http_error_fn>(get_network_function("bambu_network_set_on_http_error_fn"));
|
||||
set_get_country_code_fn_ptr = reinterpret_cast<func_set_get_country_code_fn>(get_network_function("bambu_network_set_get_country_code_fn"));
|
||||
set_on_subscribe_failure_fn_ptr = reinterpret_cast<func_set_on_subscribe_failure_fn>(get_network_function("bambu_network_set_on_subscribe_failure_fn"));
|
||||
set_on_message_fn_ptr = reinterpret_cast<func_set_on_message_fn>(get_network_function("bambu_network_set_on_message_fn"));
|
||||
set_on_local_connect_fn_ptr = reinterpret_cast<func_set_on_local_connect_fn>(get_network_function("bambu_network_set_on_local_connect_fn"));
|
||||
set_on_local_message_fn_ptr = reinterpret_cast<func_set_on_local_message_fn>(get_network_function("bambu_network_set_on_local_message_fn"));
|
||||
@@ -312,6 +314,7 @@ int NetworkAgent::unload_network_module()
|
||||
set_on_server_connected_fn_ptr = nullptr;
|
||||
set_on_http_error_fn_ptr = nullptr;
|
||||
set_get_country_code_fn_ptr = nullptr;
|
||||
set_on_subscribe_failure_fn_ptr = nullptr;
|
||||
set_on_message_fn_ptr = nullptr;
|
||||
set_on_local_connect_fn_ptr = nullptr;
|
||||
set_on_local_message_fn_ptr = nullptr;
|
||||
@@ -595,6 +598,17 @@ int NetworkAgent::set_get_country_code_fn(GetCountryCodeFn fn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetworkAgent::set_on_subscribe_failure_fn(GetSubscribeFailureFn fn)
|
||||
{
|
||||
int ret = 0;
|
||||
if (network_agent && set_on_subscribe_failure_fn_ptr) {
|
||||
ret = set_on_subscribe_failure_fn_ptr(network_agent, fn);
|
||||
if (ret)
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetworkAgent::set_on_message_fn(OnMessageFn fn)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -22,6 +22,7 @@ typedef int (*func_set_on_printer_connected_fn)(void *agent, OnPrinterConnectedF
|
||||
typedef int (*func_set_on_server_connected_fn)(void *agent, OnServerConnectedFn fn);
|
||||
typedef int (*func_set_on_http_error_fn)(void *agent, OnHttpErrorFn fn);
|
||||
typedef int (*func_set_get_country_code_fn)(void *agent, GetCountryCodeFn fn);
|
||||
typedef int (*func_set_on_subscribe_failure_fn)(void *agent, GetSubscribeFailureFn fn);
|
||||
typedef int (*func_set_on_message_fn)(void *agent, OnMessageFn fn);
|
||||
typedef int (*func_set_on_local_connect_fn)(void *agent, OnLocalConnectedFn fn);
|
||||
typedef int (*func_set_on_local_message_fn)(void *agent, OnMessageFn fn);
|
||||
@@ -124,6 +125,7 @@ public:
|
||||
int set_on_server_connected_fn(OnServerConnectedFn fn);
|
||||
int set_on_http_error_fn(OnHttpErrorFn fn);
|
||||
int set_get_country_code_fn(GetCountryCodeFn fn);
|
||||
int set_on_subscribe_failure_fn(GetSubscribeFailureFn fn);
|
||||
int set_on_message_fn(OnMessageFn fn);
|
||||
int set_on_local_connect_fn(OnLocalConnectedFn fn);
|
||||
int set_on_local_message_fn(OnMessageFn fn);
|
||||
@@ -214,6 +216,7 @@ private:
|
||||
static func_set_on_server_connected_fn set_on_server_connected_fn_ptr;
|
||||
static func_set_on_http_error_fn set_on_http_error_fn_ptr;
|
||||
static func_set_get_country_code_fn set_get_country_code_fn_ptr;
|
||||
static func_set_on_subscribe_failure_fn set_on_subscribe_failure_fn_ptr;
|
||||
static func_set_on_message_fn set_on_message_fn_ptr;
|
||||
static func_set_on_local_connect_fn set_on_local_connect_fn_ptr;
|
||||
static func_set_on_local_message_fn set_on_local_message_fn_ptr;
|
||||
|
||||
@@ -135,6 +135,7 @@ typedef std::function<void(std::string dev_id, std::string msg)> OnMessageFn;
|
||||
// http callbacks
|
||||
typedef std::function<void(unsigned http_code, std::string http_body)> OnHttpErrorFn;
|
||||
typedef std::function<std::string()> GetCountryCodeFn;
|
||||
typedef std::function<void(std::string topic)> GetSubscribeFailureFn;
|
||||
// print callbacks
|
||||
typedef std::function<void(int status, int code, std::string msg)> OnUpdateStatusFn;
|
||||
typedef std::function<bool()> WasCancelledFn;
|
||||
|
||||
Reference in New Issue
Block a user