NEW:add model mall system

Change-Id: Iccfe460cd7bfd11d91cdd7eddf142a8590e3c5b0
This commit is contained in:
tao wang 2022-10-17 14:08:38 +08:00 committed by Lane.Wei
parent 35edf03eca
commit 407d1faf0d
16 changed files with 630 additions and 21 deletions

View file

@ -91,6 +91,9 @@ func_query_bind_status NetworkAgent::query_bind_status_ptr = nullpt
func_modify_printer_name NetworkAgent::modify_printer_name_ptr = nullptr;
func_get_camera_url NetworkAgent::get_camera_url_ptr = nullptr;
func_start_pubilsh NetworkAgent::start_publish_ptr = nullptr;
func_get_profile_3mf NetworkAgent::get_profile_3mf_ptr = nullptr;
func_get_model_publish_url NetworkAgent::get_model_publish_url_ptr = nullptr;
func_get_model_mall_home_url NetworkAgent::get_model_mall_home_url_ptr = nullptr;
NetworkAgent::NetworkAgent()
@ -228,6 +231,9 @@ int NetworkAgent::initialize_network_module(bool using_backup)
modify_printer_name_ptr = reinterpret_cast<func_modify_printer_name>(get_network_function("bambu_network_modify_printer_name"));
get_camera_url_ptr = reinterpret_cast<func_get_camera_url>(get_network_function("bambu_network_get_camera_url"));
start_publish_ptr = reinterpret_cast<func_start_pubilsh>(get_network_function("bambu_network_start_publish"));
get_profile_3mf_ptr = reinterpret_cast<func_get_profile_3mf>(get_network_function("bambu_network_get_profile_3mf"));
get_model_publish_url_ptr = reinterpret_cast<func_get_model_publish_url>(get_network_function("bambu_network_get_model_publish_url"));
get_model_mall_home_url_ptr = reinterpret_cast<func_get_model_mall_home_url>(get_network_function("bambu_network_get_model_mall_home_url"));
return 0;
}
@ -319,6 +325,9 @@ int NetworkAgent::unload_network_module()
modify_printer_name_ptr = nullptr;
get_camera_url_ptr = nullptr;
start_publish_ptr = nullptr;
get_profile_3mf_ptr = nullptr;
get_model_publish_url_ptr = nullptr;
get_model_mall_home_url_ptr = nullptr;
return 0;
}
@ -1048,5 +1057,36 @@ int NetworkAgent::start_publish(PublishParams params, OnUpdateStatusFn update_fn
return ret;
}
int NetworkAgent::get_profile_3mf(BBLProfile* profile)
{
int ret = -1;
if (network_agent && get_profile_3mf_ptr) {
ret = get_profile_3mf_ptr(network_agent, profile);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_model_publish_url(std::string* url)
{
int ret = 0;
if (network_agent && get_model_publish_url_ptr) {
ret = get_model_publish_url_ptr(network_agent, url);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_model_mall_home_url(std::string* url)
{
int ret = 0;
if (network_agent && get_model_publish_url_ptr) {
ret = get_model_mall_home_url_ptr(network_agent, url);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
} //namespace

View file

@ -2,6 +2,7 @@
#define __NETWORK_Agent_HPP__
#include "bambu_networking.hpp"
#include "libslic3r/ProjectTask.hpp"
using namespace BBL;
@ -70,7 +71,9 @@ typedef int (*func_query_bind_status)(void *agent, std::vector<std::string> quer
typedef int (*func_modify_printer_name)(void *agent, std::string dev_id, std::string dev_name);
typedef int (*func_get_camera_url)(void *agent, std::string dev_id, std::function<void(std::string)> callback);
typedef int (*func_start_pubilsh)(void *agent, PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
typedef int (*func_get_profile_3mf)(void *agent, BBLProfile* profile);
typedef int (*func_get_model_publish_url)(void *agent, std::string* url);
typedef int (*func_get_model_mall_home_url)(void *agent, std::string* url);
//the NetworkAgent class
@ -150,6 +153,9 @@ public:
int modify_printer_name(std::string dev_id, std::string dev_name);
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback);
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
int get_profile_3mf(BBLProfile* profile);
int get_model_publish_url(std::string* url);
int get_model_mall_home_url(std::string* url);
private:
@ -219,6 +225,9 @@ private:
static func_modify_printer_name modify_printer_name_ptr;
static func_get_camera_url get_camera_url_ptr;
static func_start_pubilsh start_publish_ptr;
static func_get_profile_3mf get_profile_3mf_ptr;
static func_get_model_publish_url get_model_publish_url_ptr;
static func_get_model_mall_home_url get_model_mall_home_url_ptr;
};
}