mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-05 00:20:37 +08:00
WIP tools in printer state list
This commit is contained in:
parent
578a648e69
commit
0132273a11
@ -256,9 +256,16 @@ bool UserAccount::on_connect_uiid_map_success(const std::string& data, AppConfig
|
|||||||
BOOST_LOG_TRIVIAL(error) << "Could not parse prusaconnect message. " << e.what();
|
BOOST_LOG_TRIVIAL(error) << "Could not parse prusaconnect message. " << e.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
pt::ptree printers_ptree;
|
||||||
|
if (auto it = ptree.find("printers"); it != ptree.not_found()) {
|
||||||
|
printers_ptree = it->second;
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Could not parse prusaconnect message. \"printers\" subtree is missing.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& printer_tree : ptree) {
|
for (const auto& printer_tree : printers_ptree) {
|
||||||
const auto printer_uuid = printer_tree.second.get_optional<std::string>("printer_uuid");
|
const auto printer_uuid = printer_tree.second.get_optional<std::string>("uuid");
|
||||||
if (!printer_uuid) {
|
if (!printer_uuid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -266,6 +273,10 @@ bool UserAccount::on_connect_uiid_map_success(const std::string& data, AppConfig
|
|||||||
if (!printer_model) {
|
if (!printer_model) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::map<std::string, std::vector<std::string>> config_options_to_match;
|
||||||
|
UserAccountUtils::fill_config_options_from_json(ptree, config_options_to_match);
|
||||||
|
|
||||||
const auto nozzle_diameter_opt = printer_tree.second.get_optional<std::string>("nozzle_diameter");
|
const auto nozzle_diameter_opt = printer_tree.second.get_optional<std::string>("nozzle_diameter");
|
||||||
const std::string nozzle_diameter = (nozzle_diameter_opt && *nozzle_diameter_opt != "0.0") ? *nozzle_diameter_opt : std::string();
|
const std::string nozzle_diameter = (nozzle_diameter_opt && *nozzle_diameter_opt != "0.0") ? *nozzle_diameter_opt : std::string();
|
||||||
std::pair<std::string, std::string> model_nozzle_pair = { *printer_model, nozzle_diameter };
|
std::pair<std::string, std::string> model_nozzle_pair = { *printer_model, nozzle_diameter };
|
||||||
|
@ -26,7 +26,8 @@ enum class ConnectPrinterState {
|
|||||||
};
|
};
|
||||||
// <std::pair<std::string, std::string> is pair of printer_model and nozzle_diameter. std::vector<size_t> is vector of ConnectPrinterState counters
|
// <std::pair<std::string, std::string> is pair of printer_model and nozzle_diameter. std::vector<size_t> is vector of ConnectPrinterState counters
|
||||||
typedef std::map<std::pair<std::string, std::string>, std::vector<size_t>> ConnectPrinterStateMap;
|
typedef std::map<std::pair<std::string, std::string>, std::vector<size_t>> ConnectPrinterStateMap;
|
||||||
typedef std::map< std::string, std::pair<std::string, std::string>> ConnectUUIDToModelNozzleMap;
|
// inner map is map of parameters
|
||||||
|
typedef std::map< std::string, std::map<std::string, std::string>> ConnectUUIDToModelNozzleMap;
|
||||||
// Class UserAccount should handle every request for entities outside PrusaSlicer like PrusaAuth or PrusaConnect.
|
// Class UserAccount should handle every request for entities outside PrusaSlicer like PrusaAuth or PrusaConnect.
|
||||||
// Outside communication is implemented in class UserAccountCommunication that runs separate thread. Results come back in events to Plater.
|
// Outside communication is implemented in class UserAccountCommunication that runs separate thread. Results come back in events to Plater.
|
||||||
// All incoming data shoud be stored in UserAccount.
|
// All incoming data shoud be stored in UserAccount.
|
||||||
|
@ -10,7 +10,7 @@ public:
|
|||||||
const std::string& connect_url() const { return m_connect_url; }
|
const std::string& connect_url() const { return m_connect_url; }
|
||||||
|
|
||||||
std::string connect_status_url() const { return m_connect_url + "/slicer/status"; }
|
std::string connect_status_url() const { return m_connect_url + "/slicer/status"; }
|
||||||
std::string connect_printer_list_url() const { return m_connect_url + "/slicer/printer_list"; }
|
std::string connect_printer_list_url() const { return m_connect_url + "/slicer/v1/printers"; }
|
||||||
std::string connect_select_printer_url() const { return m_connect_url + "/slicer-select-printer"; }
|
std::string connect_select_printer_url() const { return m_connect_url + "/slicer-select-printer"; }
|
||||||
std::string connect_printers_url() const { return m_connect_url + "/app/printers/"; }
|
std::string connect_printers_url() const { return m_connect_url + "/app/printers/"; }
|
||||||
std::string connect_teams_url() const { return m_connect_url + "/app/teams"; }
|
std::string connect_teams_url() const { return m_connect_url + "/app/teams"; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user