OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
anonymous_namespace{MoonrakerPrinterAgent.cpp} Namespace Reference

Classes

struct  WsEndpoint

Typedefs

using tcp = net::ip::tcp

Functions

bool parse_ws_endpoint (const std::string &base_url, WsEndpoint &endpoint)
std::string map_moonraker_state (std::string state)
Slic3r::Http::ProgressFn cancel_when (std::function< bool()> cancelled)
uint64_t steady_now_ms ()

Class Documentation

◆ anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint

struct anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint
Collaboration diagram for anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint:
Class Members
string host
string port
bool secure = false
string target

Typedef Documentation

◆ tcp

using anonymous_namespace{MoonrakerPrinterAgent.cpp}::tcp = net::ip::tcp

Function Documentation

◆ cancel_when()

Slic3r::Http::ProgressFn anonymous_namespace{MoonrakerPrinterAgent.cpp}::cancel_when ( std::function< bool()> cancelled)
131{
132 if (!cancelled) {
133 return {};
134 }
135 return [cancelled = std::move(cancelled)](Slic3r::Http::Progress, bool& cancel) { cancel = cancelled(); };
136}

Referenced by Slic3r::MoonrakerPrinterAgent::fetch_device_info(), Slic3r::MoonrakerPrinterAgent::fetch_object_list(), and Slic3r::MoonrakerPrinterAgent::query_printer_status().

Here is the caller graph for this function:

◆ map_moonraker_state()

std::string anonymous_namespace{MoonrakerPrinterAgent.cpp}::map_moonraker_state ( std::string state)
113{
114 boost::algorithm::to_lower(state);
115 if (state == "printing") {
116 return "RUNNING";
117 }
118 if (state == "paused") {
119 return "PAUSE";
120 }
121 if (state == "complete") {
122 return "FINISH";
123 }
124 if (state == "error" || state == "cancelled") {
125 return "FAILED";
126 }
127 return "IDLE";
128}

Referenced by Slic3r::MoonrakerPrinterAgent::build_print_payload_locked().

Here is the caller graph for this function:

◆ parse_ws_endpoint()

bool anonymous_namespace{MoonrakerPrinterAgent.cpp}::parse_ws_endpoint ( const std::string & base_url,
WsEndpoint & endpoint )
80{
81 if (base_url.empty()) {
82 return false;
83 }
84
85 std::string url = base_url;
86 if (boost::istarts_with(url, "https://")) {
87 endpoint.secure = true;
88 url = url.substr(8);
89 } else if (boost::istarts_with(url, "http://")) {
90 url = url.substr(7);
91 }
92
93 auto slash = url.find('/');
94 if (slash != std::string::npos) {
95 url = url.substr(0, slash);
96 }
97 if (url.empty()) {
98 return false;
99 }
100
101 endpoint.host = url;
102 endpoint.port = endpoint.secure ? "443" : "80";
103 if (auto colon = url.rfind(':'); colon != std::string::npos && url.find(']') == std::string::npos) {
104 endpoint.host = url.substr(0, colon);
105 endpoint.port = url.substr(colon + 1);
106 }
107
108 endpoint.target = "/websocket";
109 return !endpoint.host.empty() && !endpoint.port.empty();
110}
std::string target
Definition MoonrakerPrinterAgent.cpp:75
std::string host
Definition MoonrakerPrinterAgent.cpp:73
bool secure
Definition MoonrakerPrinterAgent.cpp:76
std::string port
Definition MoonrakerPrinterAgent.cpp:74

References anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint::host, anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint::port, anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint::secure, and anonymous_namespace{MoonrakerPrinterAgent.cpp}::WsEndpoint::target.

Referenced by Slic3r::MoonrakerPrinterAgent::run_status_stream().

Here is the caller graph for this function:

◆ steady_now_ms()

uint64_t anonymous_namespace{MoonrakerPrinterAgent.cpp}::steady_now_ms ( )
139{
140 return static_cast<uint64_t>(
141 std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count());
142}

Referenced by Slic3r::MoonrakerPrinterAgent::handle_ws_message(), and Slic3r::MoonrakerPrinterAgent::send_heartbeat_if_due().

Here is the caller graph for this function: