update slic3r

This commit is contained in:
QIDI TECH
2025-02-26 20:14:36 +08:00
parent d32f03deb8
commit ffb5d3da8a
60 changed files with 1724 additions and 475 deletions

View File

@@ -177,12 +177,11 @@ Http::priv::priv(const std::string &url)
::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // curl makes a copy internally
::curl_easy_setopt(curl, CURLOPT_USERAGENT, SLIC3R_APP_NAME "/" SLIC3R_VERSION);
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer.front());
::curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
#ifdef __WINDOWS__
::curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_MAX_TLSv1_2);
#endif
::curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
}
Http::priv::~priv()

View File

@@ -29,6 +29,7 @@ enum HttpErrorCode
HttpErrorTimeout = 13,
HttpErrorResourcesExhaust = 14,
HttpErrorVersionLimited = 15,
HttpErrorCertRevoked = 101,
};
/// Represetns a Http request

View File

@@ -152,6 +152,8 @@ void openFolderForFile(wxString const & file)
{
NSURL* url = [NSURL URLFromPasteboard:[info draggingPasteboard]];
NSString * path = [url path];
if (path == nil)
return TRUE;
url = [NSURL fileURLWithPath: path];
[self loadFileURL:url allowingReadAccessToURL:url];
return TRUE;

View File

@@ -62,6 +62,8 @@ func_send_message NetworkAgent::send_message_ptr = nullptr;
func_connect_printer NetworkAgent::connect_printer_ptr = nullptr;
func_disconnect_printer NetworkAgent::disconnect_printer_ptr = nullptr;
func_send_message_to_printer NetworkAgent::send_message_to_printer_ptr = nullptr;
func_check_cert NetworkAgent::check_cert_ptr = nullptr;
func_install_device_cert NetworkAgent::install_device_cert_ptr = nullptr;
func_start_discovery NetworkAgent::start_discovery_ptr = nullptr;
func_change_user NetworkAgent::change_user_ptr = nullptr;
func_is_user_login NetworkAgent::is_user_login_ptr = nullptr;
@@ -274,6 +276,8 @@ int NetworkAgent::initialize_network_module(bool using_backup)
connect_printer_ptr = reinterpret_cast<func_connect_printer>(get_network_function("qidi_network_connect_printer"));
disconnect_printer_ptr = reinterpret_cast<func_disconnect_printer>(get_network_function("qidi_network_disconnect_printer"));
send_message_to_printer_ptr = reinterpret_cast<func_send_message_to_printer>(get_network_function("qidi_network_send_message_to_printer"));
check_cert_ptr = reinterpret_cast<func_check_cert>(get_network_function("bambu_network_update_cert"));
install_device_cert_ptr = reinterpret_cast<func_install_device_cert>(get_network_function("bambu_network_install_device_cert"));
start_discovery_ptr = reinterpret_cast<func_start_discovery>(get_network_function("qidi_network_start_discovery"));
change_user_ptr = reinterpret_cast<func_change_user>(get_network_function("qidi_network_change_user"));
is_user_login_ptr = reinterpret_cast<func_is_user_login>(get_network_function("qidi_network_is_user_login"));
@@ -398,6 +402,7 @@ int NetworkAgent::unload_network_module()
connect_printer_ptr = nullptr;
disconnect_printer_ptr = nullptr;
send_message_to_printer_ptr = nullptr;
check_cert_ptr = nullptr;
start_discovery_ptr = nullptr;
change_user_ptr = nullptr;
is_user_login_ptr = nullptr;
@@ -853,11 +858,11 @@ int NetworkAgent::stop_device_subscribe()
return ret;
}
int NetworkAgent::send_message(std::string dev_id, std::string json_str, int qos)
int NetworkAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
{
int ret = 0;
if (network_agent && send_message_ptr) {
ret = send_message_ptr(network_agent, dev_id, json_str, qos);
ret = send_message_ptr(network_agent, dev_id, json_str, qos, flag);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%, dev_id=%3%, json_str=%4%, qos=%5%")%network_agent %ret %dev_id %json_str %qos;
}
@@ -887,11 +892,11 @@ int NetworkAgent::disconnect_printer()
return ret;
}
int NetworkAgent::send_message_to_printer(std::string dev_id, std::string json_str, int qos)
int NetworkAgent::send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag)
{
int ret = 0;
if (network_agent && send_message_to_printer_ptr) {
ret = send_message_to_printer_ptr(network_agent, dev_id, json_str, qos);
ret = send_message_to_printer_ptr(network_agent, dev_id, json_str, qos, flag);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%, dev_id=%3%, json_str=%4%, qos=%5%")
%network_agent %ret %dev_id %json_str %qos;
@@ -899,6 +904,24 @@ int NetworkAgent::send_message_to_printer(std::string dev_id, std::string json_s
return ret;
}
int NetworkAgent::check_cert()
{
int ret = 0;
if (network_agent && check_cert_ptr) {
ret = check_cert_ptr(network_agent);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
void NetworkAgent::install_device_cert(std::string dev_id, bool lan_only)
{
if (network_agent && install_device_cert_ptr) {
install_device_cert_ptr(network_agent, dev_id, lan_only);
}
}
bool NetworkAgent::start_discovery(bool start, bool sending)
{
bool ret = false;

View File

@@ -38,10 +38,12 @@ typedef int (*func_del_subscribe)(void *agent, std::vector<std::string> dev_list
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);
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_disconnect_printer)(void *agent);
typedef int (*func_send_message_to_printer)(void *agent, std::string dev_id, std::string json_str, int qos);
typedef int (*func_send_message_to_printer)(void *agent, std::string dev_id, std::string json_str, int qos, int flag);
typedef int (*func_check_cert)(void* agent);
typedef void (*func_install_device_cert)(void* agent, std::string dev_id, bool lan_only);
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);
@@ -157,10 +159,12 @@ public:
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 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 disconnect_printer();
int send_message_to_printer(std::string dev_id, std::string json_str, int qos);
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag);
int check_cert();
void install_device_cert(std::string dev_id, bool lan_only);
bool start_discovery(bool start, bool sending);
int change_user(std::string user_info);
bool is_user_login();
@@ -270,6 +274,8 @@ private:
static func_connect_printer connect_printer_ptr;
static func_disconnect_printer disconnect_printer_ptr;
static func_send_message_to_printer send_message_to_printer_ptr;
static func_check_cert check_cert_ptr;
static func_install_device_cert install_device_cert_ptr;
static func_start_discovery start_discovery_ptr;
static func_change_user change_user_ptr;
static func_is_user_login is_user_login_ptr;

View File

@@ -620,31 +620,34 @@ GUI::Box_info OctoPrint::get_box_info(wxString& msg)
std::string vendor_key = "vendor_slot" + std::to_string(i);
std::string slot_key = "slot" + std::to_string(i);
if (line.find(color_key) != std::string::npos) {
// Create regex patterns for exact variable name matches
std::regex color_pattern("^\\s*" + color_key + "\\s*=");
std::regex filament_pattern("^\\s*" + filament_key + "\\s*=");
std::regex vendor_pattern("^\\s*" + vendor_key + "\\s*=");
std::regex slot_pattern("^\\s*" + slot_key + "\\s*=");
if (std::regex_search(line, color_pattern)) {
size_t value_start = line.find("=") + 1;
std::string value_str = line.substr(value_start);
value_str.erase(0, value_str.find_first_not_of(" "));
value_str.erase(value_str.find_last_not_of(" ") + 1);
filament_info.filament_color_index[i] = std::stoi(value_str);
}
if (line.find(filament_key) != std::string::npos) {
else if (std::regex_search(line, filament_pattern)) {
size_t value_start = line.find("=") + 1;
std::string value_str = line.substr(value_start);
value_str.erase(0, value_str.find_first_not_of(" "));
value_str.erase(value_str.find_last_not_of(" ") + 1);
filament_info.filament_index[i] = std::stoi(value_str);
}
if (line.find(vendor_key) != std::string::npos) {
else if (std::regex_search(line, vendor_pattern)) {
size_t value_start = line.find("=") + 1;
std::string value_str = line.substr(value_start);
value_str.erase(0, value_str.find_first_not_of(" "));
value_str.erase(value_str.find_last_not_of(" ") + 1);
filament_info.filament_vendor[i] = std::stoi(value_str);
}
if (line.find(slot_key) != std::string::npos) {
else if (std::regex_search(line, slot_pattern)) {
size_t value_start = line.find("=") + 1;
std::string value_str = line.substr(value_start);
value_str.erase(0, value_str.find_first_not_of(" "));

View File

@@ -36,6 +36,7 @@ namespace QDT {
#define QIDI_NETWORK_ERR_PARSE_CONFIG_FAILED -23
#define QIDI_NETWORK_ERR_NO_CORRESPONDING_BUCKET -24
#define QIDI_NETWORK_ERR_GET_INSTANCE_ID_FAILED -25
#define QIDI_NETWORK_SIGNED_ERROR -26
//bind error
#define QIDI_NETWORK_ERR_BIND_CREATE_SOCKET_FAILED -1010 //failed to create socket
@@ -78,6 +79,7 @@ namespace QDT {
#define QIDI_NETWORK_ERR_PRINT_SP_PATCH_PROJECT_FAILED -3110 //failed to patch project
#define QIDI_NETWORK_ERR_PRINT_SP_POST_TASK_FAILED -3120 //failed to post task
#define QIDI_NETWORK_ERR_PRINT_SP_WAIT_PRINTER_FAILED -3130 //failed to wait the ack from printer
#define QIDI_NETOWRK_ERR_PRINT_SP_ENC_FLAG_NOT_READY -3140 //enc parse not ready
//start_local_print error
#define QIDI_NETWORK_ERR_PRINT_LP_FILE_OVER_SIZE -4010 //the size of the uploaded file cannot exceed 1 GB
@@ -95,7 +97,7 @@ namespace QDT {
#define QIDI_NETWORK_LIBRARY "qidi_networking"
#define QIDI_NETWORK_AGENT_NAME "qidi_network_agent"
#define QIDI_NETWORK_AGENT_VERSION "01.10.01.01"
#define QIDI_NETWORK_AGENT_VERSION "01.10.02.28"
//iot preset type strings
#define IOT_PRINTER_TYPE_STRING "printer"
@@ -253,6 +255,13 @@ struct CertificateInformation {
std::string serial_number;
};
enum class MessageFlag : int
{
MSG_FLAG_NONE = 0,
MSG_SIGN = 1 << 0,
MSG_ENCRYPT = 1 << 1,
};
}
#endif