mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-10 14:02:47 +00:00
CrealityPrint: add CFS material box query
Add query_boxes_info() to discover loaded materials in the CFS (Creality Filament System) via websocket. Returns the boxsInfo JSON with slot details (type, color, vendor, temperature range). Signed-off-by: Igor Mammedov <niallain@gmail.com>
This commit is contained in:
@@ -261,6 +261,23 @@ bool CrealityPrint::supports_multi_color_print() const
|
||||
|| m_model == "F021"; // K2
|
||||
}
|
||||
|
||||
std::string CrealityPrint::query_boxes_info() const
|
||||
{
|
||||
try {
|
||||
net::io_context ioc;
|
||||
websocket::stream<beast::tcp_stream> ws{ioc};
|
||||
ws_connect(ioc, ws, m_host, "9999");
|
||||
|
||||
json boxs_query = {{"method", "get"}, {"params", {{"boxsInfo", 1}}}};
|
||||
std::string result = ws_send_and_read(ws, boxs_query, "boxsInfo");
|
||||
ws.close(websocket::close_code::normal);
|
||||
return result;
|
||||
} catch (std::exception const& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "CrealityPrint: Failed to query boxsInfo: " << e.what();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
bool CrealityPrint::start_print(wxString &msg, const std::string &filename) const
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
PrintHostPostUploadActions get_post_upload_actions() const;
|
||||
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const override;
|
||||
bool supports_multi_color_print() const;
|
||||
std::string query_boxes_info() const;
|
||||
|
||||
protected:
|
||||
virtual void set_auth(Http& http) const;
|
||||
|
||||
Reference in New Issue
Block a user