NEW: add config file to store functional compatibility

Change-Id: I9831cef9d57642fe7709eef87e74a64e21857e18
This commit is contained in:
lane.wei 2022-09-02 13:12:50 +08:00 committed by Lane.Wei
parent b510e94e06
commit 3b9801f147
10 changed files with 232 additions and 116 deletions

View file

@ -7,6 +7,7 @@
#include <memory>
#include <chrono>
#include <boost/thread.hpp>
#include "nlohmann/json.hpp"
#include "libslic3r/ProjectTask.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
@ -32,17 +33,10 @@ inline int correct_filament_temperature(int filament_temp)
wxString get_stage_string(int stage);
using namespace nlohmann;
namespace Slic3r {
enum PRINTER_TYPE {
PRINTER_3DPrinter_UKNOWN,
PRINTER_3DPrinter_NONE,
PRINTER_3DPrinter_X1_Carbon, // BL-P001
PRINTER_3DPrinter_X1, // BL-P002
PRINTER_3DPrinter_P1, // BL-P003
};
enum PRINTING_STAGE {
PRINTING_STAGE_PRINTING = 0,
PRINTING_STAGE_BED_LEVELING,
@ -62,6 +56,18 @@ enum PRINTING_STAGE {
PRINTING_STAGE_COUNT
};
enum PrinterFunction {
FUNC_MONITORING = 0,
FUNC_TIMELAPSE,
FUNC_RECORDING,
FUNC_FIRSTLAYER_INSPECT,
FUNC_SPAGHETTI,
FUNC_FLOW_CALIBRATION,
FUNC_AUTO_LEVELING,
FUNC_CHAMBER_TEMP,
FUNC_MAX
};
enum PrintingSpeedLevel {
SPEED_LEVEL_INVALID = 0,
@ -301,10 +307,8 @@ public:
/* static members and functions */
static inline int m_sequence_id = 20000;
static PRINTER_TYPE parse_printer_type(std::string type_str);
static PRINTER_TYPE parse_iot_printer_type(std::string type_str);
static PRINTER_TYPE parse_preset_printer_type(std::string type_str);
static std::string get_preset_printer_model_name(PRINTER_TYPE printer_type);
static std::string parse_printer_type(std::string type_str);
static std::string get_preset_printer_model_name(std::string printer_type);
static bool is_bbl_filament(std::string tag_uid);
typedef std::function<void()> UploadedFn;
@ -322,8 +326,8 @@ public:
bool has_access_right() { return !access_code.empty(); }
void set_access_code(std::string code);
bool is_lan_mode_printer();
PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
std::string get_printer_type_string();
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
std::string printer_type; /* model_id */
wxString get_printer_type_display_str();
std::string product_name; // set by iot service, get /user/print
@ -574,6 +578,7 @@ public:
void set_online_state(bool on_off);
bool is_online() { return m_is_online; }
bool is_info_ready();
bool is_function_supported(PrinterFunction func);
/* Msg for display MsgFn */
@ -636,6 +641,13 @@ public:
// get alive machine
std::map<std::string, MachineObject*> get_local_machine_list();
void load_last_machine();
static json function_table;
static std::string parse_printer_type(std::string type_str);
static std::string get_printer_display_name(std::string type_str);
static bool is_function_supported(std::string type_str, std::string function_name);
static bool load_functional_config(std::string config_file);
};
} // namespace Slic3r