Commit Graph

7 Commits

Author SHA1 Message Date
Igor Mammedov
c746c48649 CrealityPrint: add ws_send_and_read() helper
Add a reusable websocket helper that sends a JSON command and loops
reads until finding a response containing the expected key. This
handles the printer's unsolicited status messages that arrive on
connect before the actual response. Returns empty string on timeout
instead of throwing.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2026-05-18 09:41:32 +02:00
Igor Mammedov
8e1ef9bc5f CrealityPrint: add ws_connect() helper
Consolidate websocket connection setup into a reusable helper.
Migrate from tcp::socket to beast::tcp_stream for timeout support.
Set SO_RCVTIMEO read timeout (3s) and connect timeout (5s).
Refactor query_boxes_info() and start_print() to use ws_connect().

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2026-05-18 09:41:32 +02:00
Igor Mammedov
aa9d472d9e CrealityPrint: add model detection from /info endpoint
Parse the model field from the /info JSON response to enable
model-specific features. Add supports_multi_color_print() which
returns true for K2-platform printers (K2 Plus, K2 Pro, K2).

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2026-05-18 09:41:32 +02:00
Igor Mammedov
e995541c25 CrealityPrint: propagate start_print() errors to caller
Change start_print() from void to bool with a wxString& msg
out-parameter, matching the error handling pattern used by Duet,
MKS, ESP3D and Flashforge. On failure, the error message is now
reported to the user via error_fn instead of being silently
swallowed. Use BOOST_LOG_TRIVIAL for logging instead of std::cerr.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2026-05-18 09:41:31 +02:00
Igor Mammedov
376841e28e Http: consolidate get_host_from_url() into Http class
Move duplicate get_host_from_url() implementations from ElegooLink and
OctoPrint into Http as a static method using the curl_url API. This
eliminates code duplication and provides a single reliable URL host
extraction utility for all print host implementations.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2026-05-18 09:41:31 +02:00
Rob Duplock
6dea7b444e Fixed bug with spaces in filename 2024-09-27 22:06:48 +10:00
Rob Duplock
735d179f1a Add support for creality print 2024-09-27 17:11:40 +10:00