Merge branch 'merge-upstream'

Signed-off-by: SoftFever <softfeverever@gmail.com>

# Conflicts:
#	src/libslic3r/Preset.cpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
This commit is contained in:
SoftFever 2023-09-30 08:44:32 +08:00
commit 59bab91da9
579 changed files with 23269 additions and 11097 deletions

View file

@ -1,5 +1,5 @@
#include "CalibUtils.hpp"
#include "../GUI/I18N.hpp"
#include "../GUI/GUI_App.hpp"
#include "../GUI/DeviceManager.hpp"
#include "../GUI/Jobs/ProgressIndicator.hpp"
@ -28,6 +28,10 @@ static std::string MachineBedTypeString[5] = {
std::string get_calib_mode_name(CalibMode cali_mode, int stage)
{
switch(cali_mode) {
case CalibMode::Calib_PA_Line:
return "pa_line_calib_mode";
case CalibMode::Calib_PA_Pattern:
return "pa_pattern_calib_mode";
case CalibMode::Calib_Flow_Rate:
if (stage == 1)
return "flow_rate_coarse_calib_mode";
@ -51,7 +55,15 @@ std::string get_calib_mode_name(CalibMode cali_mode, int stage)
CalibMode CalibUtils::get_calib_mode_by_name(const std::string name, int& cali_stage)
{
if (name == "flow_rate_coarse_calib_mode") {
if (name == "pa_line_calib_mode") {
cali_stage = 0;
return CalibMode::Calib_PA_Line;
}
else if (name == "pa_pattern_calib_mode") {
cali_stage = 1;
return CalibMode::Calib_PA_Line;
}
else if (name == "flow_rate_coarse_calib_mode") {
cali_stage = 1;
return CalibMode::Calib_Flow_Rate;
}
@ -170,7 +182,7 @@ std::array<Vec3d, 4> get_cut_plane_points(const BoundingBoxf3 &bbox, const doubl
return plane_pts;
}
void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, int mode, std::string& error_message)
void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, int mode, wxString& error_message)
{
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev)
@ -348,7 +360,7 @@ bool CalibUtils::get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult>&
return flow_ratio_calib_results.size() > 0;
}
void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString &error_message)
{
if (pass != 1 && pass != 2)
return;
@ -443,16 +455,78 @@ void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::stri
send_to_print(calib_info, error_message, pass);
}
void CalibUtils::calib_generic_PA(const CalibInfo &calib_info, std::string &error_message)
void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model)
{
DynamicPrintConfig& print_config = calib_info.print_prest->config;
DynamicPrintConfig& filament_config = calib_info.filament_prest->config;
DynamicPrintConfig& printer_config = calib_info.printer_prest->config;
DynamicPrintConfig full_config;
full_config.apply(FullPrintConfig::defaults());
full_config.apply(print_config);
full_config.apply(filament_config);
full_config.apply(printer_config);
float nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second));
}
print_config.set_key_value("outer_wall_speed",
new ConfigOptionFloat(CalibPressureAdvance::find_optimal_PA_speed(
full_config, print_config.get_abs_value("line_width"),
print_config.get_abs_value("layer_height"), 0)));
for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionFloat(nozzle_diameter * opt.second / 100));
}
for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second));
}
print_config.set_key_value(SuggestedConfigCalibPAPattern().brim_pair.first,
new ConfigOptionEnum<BrimType>(SuggestedConfigCalibPAPattern().brim_pair.second));
//DynamicPrintConfig full_config;
full_config.apply(FullPrintConfig::defaults());
full_config.apply(print_config);
full_config.apply(filament_config);
full_config.apply(printer_config);
Vec3d plate_origin(0, 0, 0);
CalibPressureAdvancePattern pa_pattern(calib_info.params, full_config, true, model, plate_origin);
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
double current_width = bedfs[2].x() - bedfs[0].x();
double current_depth = bedfs[2].y() - bedfs[0].y();
Vec3d half_pattern_size = Vec3d(pa_pattern.print_size_x() / 2, pa_pattern.print_size_y() / 2, 0);
Vec3d offset = Vec3d(current_width / 2, current_depth / 2, 0) - half_pattern_size;
pa_pattern.set_start_offset(offset);
pa_pattern.generate_custom_gcodes(full_config, true, model, plate_origin);
model.calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>(pa_pattern);
}
void CalibUtils::calib_generic_PA(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_PA_Line)
if (params.mode != CalibMode::Calib_PA_Line && params.mode != CalibMode::Calib_PA_Pattern)
return;
Model model;
std::string input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pressure_advance_test.stl";
std::string input_file;
if (params.mode == CalibMode::Calib_PA_Line)
input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pressure_advance_test.stl";
else if (params.mode == CalibMode::Calib_PA_Pattern)
input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pa_pattern.3mf";
read_model_from_file(input_file, model);
if (params.mode == CalibMode::Calib_PA_Pattern)
calib_pa_pattern(calib_info, model);
DynamicPrintConfig print_config = calib_info.print_prest->config;
DynamicPrintConfig filament_config = calib_info.filament_prest->config;
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
@ -472,7 +546,7 @@ void CalibUtils::calib_generic_PA(const CalibInfo &calib_info, std::string &erro
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_temptue(const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_temptue(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_Temp_Tower)
@ -542,7 +616,7 @@ void CalibUtils::calib_temptue(const CalibInfo& calib_info, std::string& error_m
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_max_vol_speed(const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_max_vol_speed(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_Vol_speed_Tower)
@ -621,7 +695,7 @@ void CalibUtils::calib_max_vol_speed(const CalibInfo& calib_info, std::string& e
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_VFA(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_VFA_Tower)
@ -662,7 +736,7 @@ void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_messa
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
}
else {
error_message = L("The start, end or step is not valid value.");
error_message = _L("The start, end or step is not valid value.");
return;
}
@ -679,7 +753,7 @@ void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_messa
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_retraction(const CalibInfo &calib_info, std::string &error_message)
void CalibUtils::calib_retraction(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_Retraction_tower)
@ -752,7 +826,7 @@ bool CalibUtils::get_pa_k_n_value_by_cali_idx(const MachineObject *obj, int cali
return false;
}
void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message)
void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &full_config, const Calib_Params &params, wxString &error_message)
{
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
double print_height = full_config.opt_float("printable_height");
@ -763,8 +837,13 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
plate_size[1] = bedfs[2].y() - bedfs[0].y();
plate_size[2] = print_height;
// todo: adjust the objects position
if (model->objects.size() == 1) {
if (params.mode == CalibMode::Calib_PA_Pattern) {
ModelInstance *instance = model->objects[0]->instances[0];
Vec3d offset = model->calib_pa_pattern->get_start_offset() +
Vec3d(model->calib_pa_pattern->handle_xy_size() / 2, -model->calib_pa_pattern->handle_xy_size() / 2 - model->calib_pa_pattern->handle_spacing(), 0);
instance->set_offset(offset);
}
else if (model->objects.size() == 1) {
ModelInstance *instance = model->objects[0]->instances[0];
instance->set_offset(instance->get_offset() + Vec3d(current_width / 2, current_depth / 2, 0));
} else {
@ -789,7 +868,7 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
BuildVolume build_volume(bedfs, print_height);
unsigned int count = model->update_print_volume_state(build_volume);
if (count == 0) {
error_message = L("Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small");
error_message = _L("Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small");
return;
}
@ -898,8 +977,25 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
release_PlateData_list(plate_data_list);
}
void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_message, int flow_ratio_mode)
void CalibUtils::send_to_print(const CalibInfo &calib_info, wxString &error_message, int flow_ratio_mode)
{
{ // before send
json j;
j["print"]["cali_mode"] = calib_info.params.mode;
j["print"]["start"] = calib_info.params.start;
j["print"]["end"] = calib_info.params.end;
j["print"]["step"] = calib_info.params.step;
j["print"]["print_numbers"] = calib_info.params.print_numbers;
j["print"]["flow_ratio_mode"] = flow_ratio_mode;
j["print"]["tray_id"] = calib_info.select_ams;
j["print"]["dev_id"] = calib_info.dev_id;
j["print"]["bed_type"] = calib_info.bed_type;
j["print"]["printer_prest"] = calib_info.printer_prest ? calib_info.printer_prest->name : "";
j["print"]["filament_prest"] = calib_info.filament_prest ? calib_info.filament_prest->name : "";
j["print"]["print_prest"] = calib_info.print_prest ? calib_info.print_prest->name : "";
BOOST_LOG_TRIVIAL(info) << "send_cali_job - before send: " << j.dump();
}
std::string dev_id = calib_info.dev_id;
std::string select_ams = calib_info.select_ams;
std::shared_ptr<ProgressIndicator> process_bar = calib_info.process_bar;
@ -907,35 +1003,35 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_m
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) {
error_message = L("Need select printer");
error_message = _L("Need select printer");
return;
}
MachineObject* obj_ = dev->get_selected_machine();
if (obj_ == nullptr) {
error_message = L("Need select printer");
error_message = _L("Need select printer");
return;
}
if (obj_->is_in_upgrading()) {
error_message = L("Cannot send the print job when the printer is updating firmware");
error_message = _L("Cannot send the print job when the printer is updating firmware");
return;
}
else if (obj_->is_system_printing()) {
error_message = L("The printer is executing instructions. Please restart printing after it ends");
error_message = _L("The printer is executing instructions. Please restart printing after it ends");
return;
}
else if (obj_->is_in_printing()) {
error_message = L("The printer is busy on other print job");
error_message = _L("The printer is busy on other print job");
return;
}
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD) && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) {
error_message = L("An SD card needs to be inserted before printing.");
error_message = _L("An SD card needs to be inserted before printing.");
return;
}
if (obj_->is_lan_mode_printer()) {
if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
error_message = L("An SD card needs to be inserted before printing via LAN.");
error_message = _L("An SD card needs to be inserted before printing via LAN.");
return;
}
}
@ -978,23 +1074,19 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_m
print_job->task_ams_mapping_info = "";
print_job->task_use_ams = select_ams == "[254]" ? false : true;
CalibMode cali_mode = calib_info.params.mode;
CalibMode cali_mode = calib_info.params.mode;
print_job->m_project_name = get_calib_mode_name(cali_mode, flow_ratio_mode);
print_job->set_calibration_task(true);
print_job->has_sdcard = obj_->has_sdcard();
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true);
print_job->set_print_job_finished_event(wxGetApp().plater()->get_send_calibration_finished_event(), print_job->m_project_name);
{ // record the print job
{ // after send: record the print job
json j;
j["print"]["cali_type"] = calib_info.params.mode;
j["print"]["flow_ratio_mode"] = flow_ratio_mode;
j["print"]["tray_id"] = calib_info.select_ams;
j["print"]["dev_id"] = calib_info.dev_id;
j["print"]["start"] = calib_info.params.start;
j["print"]["end"] = calib_info.params.end;
j["print"]["step"] = calib_info.params.step;
BOOST_LOG_TRIVIAL(trace) << "send_cali_job: " << j.dump();
j["print"]["project_name"] = print_job->m_project_name;
j["print"]["is_cali_task"] = print_job->m_is_calibration_task;
BOOST_LOG_TRIVIAL(info) << "send_cali_job - after send: " << j.dump();
}
print_job->start();

View file

@ -30,7 +30,7 @@ public:
static CalibMode get_calib_mode_by_name(const std::string name, int &cali_stage);
static void calib_PA(const X1CCalibInfos& calib_infos, int mode, std::string& error_message);
static void calib_PA(const X1CCalibInfos& calib_infos, int mode, wxString& error_message);
static void emit_get_PA_calib_results(float nozzle_diameter);
static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results);
@ -48,13 +48,15 @@ public:
static void calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::string& error_message);
static void emit_get_flow_ratio_calib_results(float nozzle_diameter);
static bool get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult> &flow_ratio_calib_results);
static void calib_flowrate(int pass, const CalibInfo& calib_info, std::string& error_message);
static void calib_flowrate(int pass, const CalibInfo &calib_info, wxString &error_message);
static void calib_generic_PA(const CalibInfo& calib_info, std::string &error_message);
static void calib_temptue(const CalibInfo& calib_info, std::string& error_message);
static void calib_max_vol_speed(const CalibInfo& calib_info, std::string& error_message);
static void calib_VFA(const CalibInfo& calib_info, std::string& error_message);
static void calib_retraction(const CalibInfo &calib_info, std::string &error_message);
static void calib_pa_pattern(const CalibInfo &calib_info, Model &model);
static void calib_generic_PA(const CalibInfo &calib_info, wxString &error_message);
static void calib_temptue(const CalibInfo &calib_info, wxString &error_message);
static void calib_max_vol_speed(const CalibInfo &calib_info, wxString &error_message);
static void calib_VFA(const CalibInfo &calib_info, wxString &error_message);
static void calib_retraction(const CalibInfo &calib_info, wxString &error_message);
//help function
static int get_selected_calib_idx(const std::vector<PACalibResult> &pa_calib_values, int cali_idx);
@ -64,8 +66,8 @@ public:
static bool validate_input_flow_ratio(wxString flow_ratio, float* output_value);
private:
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message);
static void send_to_print(const CalibInfo &calib_info, std::string& error_message, int flow_ratio_mode = 0); // 0: none 1: coarse 2: fine
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, wxString& error_message);
static void send_to_print(const CalibInfo &calib_info, wxString& error_message, int flow_ratio_mode = 0); // 0: none 1: coarse 2: fine
};
}

View file

@ -90,6 +90,7 @@ func_get_printer_firmware NetworkAgent::get_printer_firmware_ptr = nul
func_get_task_plate_index NetworkAgent::get_task_plate_index_ptr = nullptr;
func_get_user_info NetworkAgent::get_user_info_ptr = nullptr;
func_request_bind_ticket NetworkAgent::request_bind_ticket_ptr = nullptr;
func_get_subtask_info NetworkAgent::get_subtask_info_ptr = nullptr;
func_get_slice_info NetworkAgent::get_slice_info_ptr = nullptr;
func_query_bind_status NetworkAgent::query_bind_status_ptr = nullptr;
func_modify_printer_name NetworkAgent::modify_printer_name_ptr = nullptr;
@ -107,6 +108,10 @@ func_track_event NetworkAgent::track_event_ptr = nullptr;
func_track_header NetworkAgent::track_header_ptr = nullptr;
func_track_update_property NetworkAgent::track_update_property_ptr = nullptr;
func_track_get_property NetworkAgent::track_get_property_ptr = nullptr;
func_put_model_mall_rating_url NetworkAgent::put_model_mall_rating_url_ptr = nullptr;
func_get_oss_config NetworkAgent::get_oss_config_ptr = nullptr;
func_put_rating_picture_oss NetworkAgent::put_rating_picture_oss_ptr = nullptr;
func_get_model_mall_rating_result NetworkAgent::get_model_mall_rating_result_ptr = nullptr;
NetworkAgent::NetworkAgent()
@ -242,6 +247,7 @@ int NetworkAgent::initialize_network_module(bool using_backup)
get_task_plate_index_ptr = reinterpret_cast<func_get_task_plate_index>(get_network_function("bambu_network_get_task_plate_index"));
get_user_info_ptr = reinterpret_cast<func_get_user_info>(get_network_function("bambu_network_get_user_info"));
request_bind_ticket_ptr = reinterpret_cast<func_request_bind_ticket>(get_network_function("bambu_network_request_bind_ticket"));
get_subtask_info_ptr = reinterpret_cast<func_get_subtask_info>(get_network_function("bambu_network_get_subtask_info"));
get_slice_info_ptr = reinterpret_cast<func_get_slice_info>(get_network_function("bambu_network_get_slice_info"));
query_bind_status_ptr = reinterpret_cast<func_query_bind_status>(get_network_function("bambu_network_query_bind_status"));
modify_printer_name_ptr = reinterpret_cast<func_modify_printer_name>(get_network_function("bambu_network_modify_printer_name"));
@ -259,6 +265,10 @@ int NetworkAgent::initialize_network_module(bool using_backup)
track_header_ptr = reinterpret_cast<func_track_header>(get_network_function("bambu_network_track_header"));
track_update_property_ptr = reinterpret_cast<func_track_update_property>(get_network_function("bambu_network_track_update_property"));
track_get_property_ptr = reinterpret_cast<func_track_get_property>(get_network_function("bambu_network_track_get_property"));
put_model_mall_rating_url_ptr = reinterpret_cast<func_put_model_mall_rating_url>(get_network_function("bambu_network_put_model_mall_rating"));
get_oss_config_ptr = reinterpret_cast<func_get_oss_config>(get_network_function("bambu_network_get_oss_config"));
put_rating_picture_oss_ptr = reinterpret_cast<func_put_rating_picture_oss>(get_network_function("bambu_network_put_rating_picture_oss"));
get_model_mall_rating_result_ptr = reinterpret_cast<func_get_model_mall_rating_result>(get_network_function("bambu_network_get_model_mall_rating"));
return 0;
}
@ -347,11 +357,12 @@ int NetworkAgent::unload_network_module()
get_printer_firmware_ptr = nullptr;
get_task_plate_index_ptr = nullptr;
get_user_info_ptr = nullptr;
get_subtask_info_ptr = nullptr;
get_slice_info_ptr = nullptr;
query_bind_status_ptr = nullptr;
modify_printer_name_ptr = nullptr;
get_camera_url_ptr = nullptr;
get_design_staffpick_ptr = nullptr;
get_design_staffpick_ptr = nullptr;
start_publish_ptr = nullptr;
get_profile_3mf_ptr = nullptr;
get_model_publish_url_ptr = nullptr;
@ -364,6 +375,10 @@ int NetworkAgent::unload_network_module()
track_header_ptr = nullptr;
track_update_property_ptr = nullptr;
track_get_property_ptr = nullptr;
get_oss_config_ptr = nullptr;
put_rating_picture_oss_ptr = nullptr;
put_model_mall_rating_url_ptr = nullptr;
get_model_mall_rating_result_ptr = nullptr;
return 0;
}
@ -878,33 +893,33 @@ int NetworkAgent::set_user_selected_machine(std::string dev_id)
return ret;
}
int NetworkAgent::start_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)
int NetworkAgent::start_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn)
{
int ret = 0;
if (network_agent && start_print_ptr) {
ret = start_print_ptr(network_agent, params, update_fn, cancel_fn);
ret = start_print_ptr(network_agent, params, update_fn, cancel_fn, wait_fn);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, ret=%2%, dev_id=%3%, task_name=%4%, project_name=%5%")
%network_agent %ret %params.dev_id %params.task_name %params.project_name;
}
return ret;
}
int NetworkAgent::start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)
int NetworkAgent::start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn)
{
int ret = 0;
if (network_agent && start_local_print_with_record_ptr) {
ret = start_local_print_with_record_ptr(network_agent, params, update_fn, cancel_fn);
ret = start_local_print_with_record_ptr(network_agent, params, update_fn, cancel_fn, wait_fn);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, ret=%2%, dev_id=%3%, task_name=%4%, project_name=%5%")
%network_agent %ret %params.dev_id %params.task_name %params.project_name;
}
return ret;
}
int NetworkAgent::start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)
int NetworkAgent::start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn)
{
int ret = 0;
if (network_agent && start_send_gcode_to_sdcard_ptr) {
ret = start_send_gcode_to_sdcard_ptr(network_agent, params, update_fn, cancel_fn);
ret = start_send_gcode_to_sdcard_ptr(network_agent, params, update_fn, cancel_fn, wait_fn);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, ret=%2%, dev_id=%3%, task_name=%4%, project_name=%5%")
% network_agent % ret % params.dev_id % params.task_name % params.project_name;
}
@ -1071,6 +1086,17 @@ int NetworkAgent::request_bind_ticket(std::string* ticket)
return ret;
}
int NetworkAgent::get_subtask_info(std::string subtask_id, std::string* task_json, unsigned int* http_code, std::string* http_body)
{
int ret = 0;
if (network_agent && get_subtask_info_ptr) {
ret = get_subtask_info_ptr(network_agent, subtask_id, task_json, http_code, http_body);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format("error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json)
{
int ret;
@ -1158,11 +1184,11 @@ int NetworkAgent::get_model_publish_url(std::string* url)
return ret;
}
int NetworkAgent::get_subtask(BBLModelTask* task)
int NetworkAgent::get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn)
{
int ret = 0;
if (network_agent && get_subtask_ptr) {
ret = get_subtask_ptr(network_agent, task);
ret = get_subtask_ptr(network_agent, task, getsub_fn);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
@ -1272,4 +1298,44 @@ int NetworkAgent::track_get_property(std::string name, std::string& value, std::
return ret;
}
int NetworkAgent::put_model_mall_rating(int rating_id, int score, std::string content, std::vector<std::string> images, unsigned int &http_code, std::string &http_error)
{
int ret = 0;
if (network_agent && get_model_publish_url_ptr) {
ret = put_model_mall_rating_url_ptr(network_agent, rating_id, score, content, images, http_code, http_error);
if (ret) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_oss_config(std::string &config, std::string country_code, unsigned int &http_code, std::string &http_error)
{
int ret = 0;
if (network_agent && get_oss_config_ptr) {
ret = get_oss_config_ptr(network_agent, config, country_code, http_code, http_error);
if (ret) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::put_rating_picture_oss(std::string &config, std::string &pic_oss_path, std::string model_id, int profile_id, unsigned int &http_code, std::string &http_error)
{
int ret = 0;
if (network_agent && put_rating_picture_oss_ptr) {
ret = put_rating_picture_oss_ptr(network_agent, config, pic_oss_path, model_id, profile_id, http_code, http_error);
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_rating_result(int job_id, std::string &rating_result, unsigned int &http_code, std::string &http_error)
{
int ret = 0;
if (network_agent && get_model_mall_rating_result_ptr) {
ret = get_model_mall_rating_result_ptr(network_agent, job_id, rating_result, http_code, http_error);
if (ret) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
} //namespace

View file

@ -8,84 +8,93 @@ using namespace BBL;
namespace Slic3r {
typedef bool (*func_check_debug_consistent)(bool is_debug);
typedef std::string (*func_get_version)(void);
typedef std::string(*func_get_version)(void);
typedef void* (*func_create_agent)(void);
typedef int (*func_destroy_agent)(void *agent);
typedef int (*func_init_log)(void *agent);
typedef int (*func_set_config_dir)(void *agent, std::string config_dir);
typedef int (*func_set_cert_file)(void *agent, std::string folder, std::string filename);
typedef int (*func_set_country_code)(void *agent, std::string country_code);
typedef int (*func_start)(void *agent);
typedef int (*func_set_on_ssdp_msg_fn)(void *agent, OnMsgArrivedFn fn);
typedef int (*func_set_on_user_login_fn)(void *agent, OnUserLoginFn fn);
typedef int (*func_set_on_printer_connected_fn)(void *agent, OnPrinterConnectedFn fn);
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_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);
typedef int (*func_set_queue_on_main_fn)(void *agent, QueueOnMainFn fn);
typedef int (*func_connect_server)(void *agent);
typedef bool (*func_is_server_connected)(void *agent);
typedef int (*func_refresh_connection)(void *agent);
typedef int (*func_start_subscribe)(void *agent, std::string module);
typedef int (*func_stop_subscribe)(void *agent, std::string module);
typedef int (*func_send_message)(void *agent, std::string dev_id, std::string json_str, int qos);
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_send_message_to_printer)(void *agent, std::string dev_id, std::string json_str, int qos);
typedef bool (*func_start_discovery)(void *agent, bool start, bool sending);
typedef int (*func_change_user)(void *agent, std::string user_info);
typedef bool (*func_is_user_login)(void *agent);
typedef int (*func_user_logout)(void *agent);
typedef std::string (*func_get_user_id)(void *agent);
typedef std::string (*func_get_user_name)(void *agent);
typedef std::string (*func_get_user_avatar)(void *agent);
typedef std::string (*func_get_user_nickanme)(void *agent);
typedef std::string (*func_build_login_cmd)(void *agent);
typedef std::string (*func_build_logout_cmd)(void *agent);
typedef std::string (*func_build_login_info)(void *agent);
typedef int (*func_bind)(void *agent, std::string dev_ip, std::string dev_id, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn);
typedef int (*func_unbind)(void *agent, std::string dev_id);
typedef std::string (*func_get_bambulab_host)(void *agent);
typedef std::string (*func_get_user_selected_machine)(void *agent);
typedef int (*func_set_user_selected_machine)(void *agent, std::string dev_id);
typedef int (*func_start_print)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
typedef int (*func_start_local_print_with_record)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
typedef int (*func_start_send_gcode_to_sdcard)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
typedef int (*func_start_local_print)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
typedef int (*func_get_user_presets)(void *agent, std::map<std::string, std::map<std::string, std::string>>* user_presets);
typedef std::string (*func_request_setting_id)(void *agent, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
typedef int (*func_put_setting)(void *agent, std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
typedef int (*func_get_setting_list)(void *agent, std::string bundle_version, ProgressFn pro_fn, WasCancelledFn cancel_fn);
typedef int (*func_delete_setting)(void *agent, std::string setting_id);
typedef std::string (*func_get_studio_info_url)(void *agent);
typedef int (*func_set_extra_http_header)(void *agent, std::map<std::string, std::string> extra_headers);
typedef int (*func_get_my_message)(void *agent, int type, int after, int limit, unsigned int* http_code, std::string* http_body);
typedef int (*func_check_user_task_report)(void *agent, int* task_id, bool* printable);
typedef int (*func_get_user_print_info)(void *agent, unsigned int* http_code, std::string* http_body);
typedef int (*func_get_printer_firmware)(void *agent, std::string dev_id, unsigned* http_code, std::string* http_body);
typedef int (*func_get_task_plate_index)(void *agent, std::string task_id, int* plate_index);
typedef int (*func_get_user_info)(void *agent, int* identifier);
typedef int (*func_request_bind_ticket)(void *agent, std::string* ticket);
typedef int (*func_get_slice_info)(void *agent, std::string project_id, std::string profile_id, int plate_index, std::string* slice_json);
typedef int (*func_query_bind_status)(void *agent, std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
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_get_design_staffpick)(void *agent, int offset, int limit, 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_subtask)(void *agent, BBLModelTask* task);
typedef int (*func_get_model_mall_home_url)(void *agent, std::string* url);
typedef int (*func_get_model_mall_detail_url)(void *agent, std::string* url, std::string id);
typedef int (*func_get_my_profile)(void *agent, std::string token, unsigned int *http_code, std::string *http_body);
typedef int (*func_track_enable)(void *agent, bool enable);
typedef int (*func_track_event)(void *agent, std::string evt_key, std::string content);
typedef int (*func_track_header)(void *agent, std::string header);
typedef int (*func_track_update_property)(void *agent, std::string name, std::string value, std::string type);
typedef int (*func_track_get_property)(void *agent, std::string name, std::string& value, std::string type);
typedef int (*func_destroy_agent)(void* agent);
typedef int (*func_init_log)(void* agent);
typedef int (*func_set_config_dir)(void* agent, std::string config_dir);
typedef int (*func_set_cert_file)(void* agent, std::string folder, std::string filename);
typedef int (*func_set_country_code)(void* agent, std::string country_code);
typedef int (*func_start)(void* agent);
typedef int (*func_set_on_ssdp_msg_fn)(void* agent, OnMsgArrivedFn fn);
typedef int (*func_set_on_user_login_fn)(void* agent, OnUserLoginFn fn);
typedef int (*func_set_on_printer_connected_fn)(void* agent, OnPrinterConnectedFn fn);
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_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);
typedef int (*func_set_queue_on_main_fn)(void* agent, QueueOnMainFn fn);
typedef int (*func_connect_server)(void* agent);
typedef bool (*func_is_server_connected)(void* agent);
typedef int (*func_refresh_connection)(void* agent);
typedef int (*func_start_subscribe)(void* agent, std::string module);
typedef int (*func_stop_subscribe)(void* agent, std::string module);
typedef int (*func_send_message)(void* agent, std::string dev_id, std::string json_str, int qos);
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_send_message_to_printer)(void* agent, std::string dev_id, std::string json_str, int qos);
typedef bool (*func_start_discovery)(void* agent, bool start, bool sending);
typedef int (*func_change_user)(void* agent, std::string user_info);
typedef bool (*func_is_user_login)(void* agent);
typedef int (*func_user_logout)(void* agent);
typedef std::string(*func_get_user_id)(void* agent);
typedef std::string(*func_get_user_name)(void* agent);
typedef std::string(*func_get_user_avatar)(void* agent);
typedef std::string(*func_get_user_nickanme)(void* agent);
typedef std::string(*func_build_login_cmd)(void* agent);
typedef std::string(*func_build_logout_cmd)(void* agent);
typedef std::string(*func_build_login_info)(void* agent);
typedef int (*func_bind)(void* agent, std::string dev_ip, std::string dev_id, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn);
typedef int (*func_unbind)(void* agent, std::string dev_id);
typedef std::string(*func_get_bambulab_host)(void* agent);
typedef std::string(*func_get_user_selected_machine)(void* agent);
typedef int (*func_set_user_selected_machine)(void* agent, std::string dev_id);
typedef int (*func_start_print)(void* agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
typedef int (*func_start_local_print_with_record)(void* agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
typedef int (*func_start_send_gcode_to_sdcard)(void* agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
typedef int (*func_start_local_print)(void* agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
typedef int (*func_get_user_presets)(void* agent, std::map<std::string, std::map<std::string, std::string>>* user_presets);
typedef std::string(*func_request_setting_id)(void* agent, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
typedef int (*func_put_setting)(void* agent, std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
typedef int (*func_get_setting_list)(void* agent, std::string bundle_version, ProgressFn pro_fn, WasCancelledFn cancel_fn);
typedef int (*func_get_setting_list2)(void* agent, std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn, WasCancelledFn cancel_fn);
typedef int (*func_delete_setting)(void* agent, std::string setting_id);
typedef std::string(*func_get_studio_info_url)(void* agent);
typedef int (*func_set_extra_http_header)(void* agent, std::map<std::string, std::string> extra_headers);
typedef int (*func_get_my_message)(void* agent, int type, int after, int limit, unsigned int* http_code, std::string* http_body);
typedef int (*func_check_user_task_report)(void* agent, int* task_id, bool* printable);
typedef int (*func_check_user_report)(void* agent, int* task_id, bool* printable, std::string* report_url);
typedef int (*func_get_user_print_info)(void* agent, unsigned int* http_code, std::string* http_body);
typedef int (*func_get_printer_firmware)(void* agent, std::string dev_id, unsigned* http_code, std::string* http_body);
typedef int (*func_get_task_plate_index)(void* agent, std::string task_id, int* plate_index);
typedef int (*func_get_user_info)(void* agent, int* identifier);
typedef int (*func_request_bind_ticket)(void* agent, std::string* ticket);
typedef int (*func_get_subtask_info)(void* agent, std::string subtask_id, std::string* task_json, unsigned int* http_code, std::string* http_body);
typedef int (*func_get_slice_info)(void* agent, std::string project_id, std::string profile_id, int plate_index, std::string* slice_json);
typedef int (*func_query_bind_status)(void* agent, std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
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_get_design_staffpick)(void* agent, int offset, int limit, 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_subtask)(void* agent, BBLModelTask* task, OnGetSubTaskFn getsub_fn);
typedef int (*func_get_model_mall_home_url)(void* agent, std::string* url);
typedef int (*func_get_model_mall_detail_url)(void* agent, std::string* url, std::string id);
typedef int (*func_get_my_profile)(void* agent, std::string token, unsigned int* http_code, std::string* http_body);
typedef int (*func_track_enable)(void* agent, bool enable);
typedef int (*func_track_event)(void* agent, std::string evt_key, std::string content);
typedef int (*func_track_header)(void* agent, std::string header);
typedef int (*func_track_update_property)(void* agent, std::string name, std::string value, std::string type);
typedef int (*func_track_get_property)(void* agent, std::string name, std::string& value, std::string type);
typedef int (*func_put_model_mall_rating_url)(
void* agent, int rating_id, int score, std::string content, std::vector<std::string> images, unsigned int& http_code, std::string& http_error);
typedef int (*func_get_oss_config)(void* agent, std::string& config, std::string country_code, unsigned int& http_code, std::string& http_error);
typedef int (*func_put_rating_picture_oss)(
void* agent, std::string& config, std::string& pic_oss_path, std::string model_id, int profile_id, unsigned int& http_code, std::string& http_error);
typedef int (*func_get_model_mall_rating_result)(void* agent, int job_id, std::string& rating_result, unsigned int& http_code, std::string& http_error);
//the NetworkAgent class
@ -140,29 +149,32 @@ public:
std::string build_login_cmd();
std::string build_logout_cmd();
std::string build_login_info();
int bind(std::string dev_ip, std::string dev_id, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn);
int bind(std::string dev_ip, std::string dev_id, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn);
int unbind(std::string dev_id);
std::string get_bambulab_host();
std::string get_user_selected_machine();
int set_user_selected_machine(std::string dev_id);
int start_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
int start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
int start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
int start_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
int start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
int start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
int start_local_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
int get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets);
std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
int put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
int get_setting_list(std::string bundle_version, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr);
int get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr);
int delete_setting(std::string setting_id);
std::string get_studio_info_url();
int set_extra_http_header(std::map<std::string, std::string> extra_headers);
int get_my_message(int type, int after, int limit, unsigned int* http_code, std::string* http_body);
int check_user_task_report(int* task_id, bool* printable);
int check_user_report(int* task_id, bool* printable, std::string* report_url);
int get_user_print_info(unsigned int* http_code, std::string* http_body);
int get_printer_firmware(std::string dev_id, unsigned* http_code, std::string* http_body);
int get_task_plate_index(std::string task_id, int* plate_index);
int get_user_info(int* identifier);
int request_bind_ticket(std::string* ticket);
int get_subtask_info(std::string subtask_id, std::string* task_json, unsigned int* http_code, std::string* http_body);
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json);
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
int modify_printer_name(std::string dev_id, std::string dev_name);
@ -171,8 +183,8 @@ public:
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_subtask(BBLModelTask* task);
int get_model_mall_home_url(std::string* url);
int get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn);
int get_model_mall_home_url(std::string* url);
int get_model_mall_detail_url(std::string* url, std::string id);
int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body);
int track_enable(bool enable);
@ -180,10 +192,14 @@ public:
int track_header(std::string header);
int track_update_property(std::string name, std::string value, std::string type = "string");
int track_get_property(std::string name, std::string& value, std::string type = "string");
int put_model_mall_rating(int design_id, int score, std::string content, std::vector<std::string> images, unsigned int& http_code, std::string& http_error);
int get_oss_config(std::string& config, std::string country_code, unsigned int& http_code, std::string& http_error);
int put_rating_picture_oss(std::string& config, std::string& pic_oss_path, std::string model_id, int profile_id, unsigned int& http_code, std::string& http_error);
int get_model_mall_rating_result(int job_id, std::string& rating_result, unsigned int& http_code, std::string& http_error);
bool get_track_enable() { return enable_track; }
private:
bool enable_track = false;
void* network_agent { nullptr };
void* network_agent{ nullptr };
static func_check_debug_consistent check_debug_consistent_ptr;
static func_get_version get_version_ptr;
@ -237,16 +253,19 @@ private:
static func_request_setting_id request_setting_id_ptr;
static func_put_setting put_setting_ptr;
static func_get_setting_list get_setting_list_ptr;
static func_get_setting_list2 get_setting_list2_ptr;
static func_delete_setting delete_setting_ptr;
static func_get_studio_info_url get_studio_info_url_ptr;
static func_set_extra_http_header set_extra_http_header_ptr;
static func_get_my_message get_my_message_ptr;
static func_check_user_task_report check_user_task_report_ptr;
static func_check_user_report check_user_report_ptr;
static func_get_user_print_info get_user_print_info_ptr;
static func_get_printer_firmware get_printer_firmware_ptr;
static func_get_task_plate_index get_task_plate_index_ptr;
static func_get_user_info get_user_info_ptr;
static func_request_bind_ticket request_bind_ticket_ptr;
static func_get_subtask_info get_subtask_info_ptr;
static func_get_slice_info get_slice_info_ptr;
static func_query_bind_status query_bind_status_ptr;
static func_modify_printer_name modify_printer_name_ptr;
@ -264,6 +283,10 @@ private:
static func_track_header track_header_ptr;
static func_track_update_property track_update_property_ptr;
static func_track_get_property track_get_property_ptr;
static func_put_model_mall_rating_url put_model_mall_rating_url_ptr;
static func_get_oss_config get_oss_config_ptr;
static func_put_rating_picture_oss put_rating_picture_oss_ptr;
static func_get_model_mall_rating_result get_model_mall_rating_result_ptr;
};
}

View file

@ -1260,8 +1260,14 @@ void PresetUpdater::sync(std::string http_url, std::string language, std::string
this->p->sync_version();
if (p->cancel)
return;
if (!vendors.empty())
if (!vendors.empty()) {
this->p->sync_config(http_url, std::move(vendors));
if (p->cancel)
return;
GUI::wxGetApp().CallAfter([] {
GUI::wxGetApp().check_config_updates_from_updater();
});
}
if (p->cancel)
return;
this->p->sync_plugins(http_url, plugin_version);

View file

@ -27,6 +27,11 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_CANCELED -18
#define BAMBU_NETWORK_ERR_INVALID_RESULT -19
#define BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED -20
#define BAMBU_NETWORK_ERR_GET_RATING_ID_FAILED -21
#define BAMBU_NETWORK_ERR_OPEN_FILE_FAILED -22
#define BAMBU_NETWORK_ERR_PARSE_CONFIG_FAILED -23
#define BAMBU_NETWORK_ERR_NO_CORRESPONDING_BUCKET -24
#define BAMBU_NETWORK_ERR_GET_INSTANCE_ID_FAILED -25
//bind error
#define BAMBU_NETWORK_ERR_BIND_CREATE_SOCKET_FAILED -1010 //failed to create socket
@ -50,7 +55,7 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_PRINT_WR_PATCH_PROJECT_FAILED -2080 //failed to patch project
#define BAMBU_NETWORK_ERR_PRINT_WR_GET_MY_SETTING_FAILED -2090 //failed to get my setting
#define BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST -2100 //3mf file is not exists
#define BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_3MF_TO_OSS_FAILED -2110 //failed to upload 3mf to oss
#define BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_3MF_TO_OSS_FAILED -2110 //failed to upload 3mf to oss
#define BAMBU_NETWORK_ERR_PRINT_WR_POST_TASK_FAILED -2120 //failed to post task
#define BAMBU_NETWORK_ERR_PRINT_WR_UPLOAD_FTP_FAILED -2130 //failed to upload to ftp
#define BAMBU_NETWORK_ERR_PRINT_WR_GET_USER_UPLOAD_FAILED -2140 //failed to get_user_upload
@ -68,6 +73,7 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_PRINT_SP_UPLOAD_3MF_TO_OSS_FAILED -3100 //failed to upload 3mf to oss
#define BAMBU_NETWORK_ERR_PRINT_SP_PATCH_PROJECT_FAILED -3110 //failed to patch project
#define BAMBU_NETWORK_ERR_PRINT_SP_POST_TASK_FAILED -3120 //failed to post task
#define BAMBU_NETWORK_ERR_PRINT_SP_WAIT_PRINTER_FAILED -3130 //failed to wait the ack from printer
//start_local_print error
#define BAMBU_NETWORK_ERR_PRINT_LP_FILE_OVER_SIZE -4010 //the size of the uploaded file cannot exceed 1 GB
@ -78,13 +84,13 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED -5010 //failed to upload ftp
//connection to printer failed
#define BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED -6010 //Connection to printer failed
#define BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED -6020 //Connection to server failed
#define BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED -6010 //Connection to printer failed
#define BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED -6020 //Connection to server failed
#define BAMBU_NETWORK_LIBRARY "bambu_networking"
#define BAMBU_NETWORK_AGENT_NAME "bambu_network_agent"
#define BAMBU_NETWORK_AGENT_VERSION "01.07.04.01"
#define BAMBU_NETWORK_AGENT_VERSION "01.07.06.01"
//iot preset type strings
#define IOT_PRINTER_TYPE_STRING "printer"
@ -114,6 +120,7 @@ typedef std::function<std::string()> GetCountryCodeFn;
// print callbacks
typedef std::function<void(int status, int code, std::string msg)> OnUpdateStatusFn;
typedef std::function<bool()> WasCancelledFn;
typedef std::function<bool(int status, std::string job_info)> OnWaitFn;
// local callbacks
typedef std::function<void(std::string dev_info_json_str)> OnMsgArrivedFn;
// queue call to main thread
@ -123,22 +130,24 @@ typedef std::function<void(int progress)> ProgressFn;
typedef std::function<void(int retcode, std::string info)> LoginFn;
typedef std::function<void(int result, std::string info)> ResultFn;
typedef std::function<bool()> CancelFn;
typedef std::function<bool(std::map<std::string, std::string> info)> CheckFn;
enum SendingPrintJobStage {
PrintingStageCreate = 0,
PrintingStageUpload = 1,
PrintingStageWaiting = 2,
PrintingStageSending = 3,
PrintingStageRecord = 4,
PrintingStageFinished = 5,
PrintingStageERROR = 6,
PrintingStageRecord = 4,
PrintingStageWaitPrinter = 5,
PrintingStageFinished = 6,
PrintingStageERROR = 7,
};
enum PublishingStage {
PublishingCreate = 0,
PublishingUpload = 1,
PublishingWaiting = 2,
PublishingJumpUrl = 3,
PublishingCreate = 0,
PublishingUpload = 1,
PublishingWaiting = 2,
PublishingJumpUrl = 3,
};
enum BindJobStage {