OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::UltiMaker Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/UltiMaker.hpp>

Inheritance diagram for Slic3r::UltiMaker:
Collaboration diagram for Slic3r::UltiMaker:

Public Types

typedef Http::ProgressFn ProgressFn
typedef std::function< void(wxString)> ErrorFn
typedef std::function< void(wxString, wxString)> InfoFn

Public Member Functions

 UltiMaker (DynamicPrintConfig *config)
 ~UltiMaker () override=default
const char * get_name () const override
bool test (wxString &curl_msg) const override
wxString get_test_ok_msg () const override
wxString get_test_failed_msg (wxString &msg) const override
bool has_auth_creds () const
bool is_authorized () const
std::string auth_status () const
bool generate_auth_creds (wxString &msg) const
std::string test_auth () const
bool upload (PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const override
bool has_auto_discovery () const override
bool can_test () const override
PrintHostPostUploadActions get_post_upload_actions () const override
std::string get_host () const override
const std::string & get_api_user () const
const std::string & get_api_username () const
const std::string & get_api_password () const
int getPrintTime (std::string filepath) const
virtual bool supports_multiple_printers () const
virtual std::string get_sn () const
virtual bool get_groups (wxArrayString &) const
virtual bool get_printers (wxArrayString &) const
virtual bool get_storage (wxArrayString &, wxArrayString &) const
virtual bool is_cloud () const
virtual bool is_logged_in () const
virtual void log_out () const
virtual bool get_login_url (wxString &auth_url) const

Static Public Member Functions

static PrintHost * get_print_host (DynamicPrintConfig *config)
static std::string get_print_host_webui (DynamicPrintConfig *config)
static int get_err_code_from_body (const std::string &body)

Protected Member Functions

bool makeGriffinCompatible (std::string filepath) const
virtual wxString format_error (const std::string &body, const std::string &error, unsigned status) const

Static Protected Member Functions

static wxString timed_out_message ()

Protected Attributes

std::string m_host
std::string m_api_username
std::string m_api_password
bool m_ssl_revoke_best_effort

Private Types

enum class  ConnectionType { rrf , dsf , error }

Private Member Functions

std::string get_upload_url (const std::string &filename, ConnectionType connectionType) const
std::string get_status_url () const
std::string get_connect_url () const
std::string get_base_url () const
std::string timestamp_str () const
ConnectionType connect (wxString &msg) const
void set_auth (Http &http) const
void disconnect (ConnectionType connectionType) const
bool start_print (wxString &msg, const std::string &filename, ConnectionType connectionType) const

Private Attributes

std::string host

Detailed Description

Member Typedef Documentation

◆ ErrorFn

typedef std::function<void(wxString )> Slic3r::PrintHost::ErrorFn
inherited

◆ InfoFn

typedef std::function<void(wxString , wxString )> Slic3r::PrintHost::InfoFn
inherited

◆ ProgressFn

Member Enumeration Documentation

◆ ConnectionType

enum class Slic3r::UltiMaker::ConnectionType
strongprivate
Enumerator
rrf 
dsf 
error 
55{ rrf, dsf, error };

Constructor & Destructor Documentation

◆ UltiMaker()

Slic3r::UltiMaker::UltiMaker ( DynamicPrintConfig * config)
explicit
40 :
41
42 m_host(config->opt_string("print_host")),
43 host(config->opt_string("print_host")),
44
45 m_api_username(config->opt_string("printhost_user")),
46 m_api_password(config->opt_string("printhost_password")),
47 m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke"))
48{}
std::string m_api_password
Definition UltiMaker.hpp:48
std::string host
Definition UltiMaker.hpp:56
bool m_ssl_revoke_best_effort
Definition UltiMaker.hpp:50
std::string m_api_username
Definition UltiMaker.hpp:47
std::string m_host
Definition UltiMaker.hpp:44

References host, m_api_password, m_api_username, m_host, and m_ssl_revoke_best_effort.

◆ ~UltiMaker()

Slic3r::UltiMaker::~UltiMaker ( )
overridedefault

Member Function Documentation

◆ auth_status()

std::string Slic3r::UltiMaker::auth_status ( ) const
183 {
184 // returns 'authorized', 'unauthorized', or 'waiting', or 'ERROR: unknown value' on a different output
185
186 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: auth_status() verifying credentials.");
187
188 const char* name = get_name();
189
190 std::string rtn = "ERROR: unknown value";
191 auto url = (boost::format("http://%1%/api/v1/auth/check/%2%") % host % m_api_username).str();
192
193 auto http = Http::get(std::move(url));
194 set_auth(http);
195 http.on_error([&](std::string body, std::string error, unsigned status) {
196 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error verifying credentials: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
197
198 })
199 .on_complete([&](std::string body, unsigned) {
200 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: url completed without error: %1%") % url;
201 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got credential verification: %2%") % name % body;
202
203 try {
204 if (body == "{\"message\": \"unknown\"}") { rtn = "waiting";}
205 if (body == "{\"message\": \"authorized\"}" ) {rtn = "authorized";}
206 if (body == "{\"message\": \"unauthorized\"}") {rtn = "unauthorized";}
207
208 }
209 catch (const std::exception &) {
210 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: auth_status Caught error") % name;
211 }
212 })
213#ifdef WIN32
214 .ssl_revoke_best_effort(m_ssl_revoke_best_effort)
215 .on_ip_resolve([&](std::string address) {
216 // Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
217 // Remember resolved address to be reused at successive REST API call.
218 // msg = GUI::from_u8(address);
219 })
220#endif // WIN32
221 .perform_sync();
222
223 if (boost::starts_with(rtn, "ERROR")) { BOOST_LOG_TRIVIAL(warning) << boost::format("%1%: [auth][auth_status] Unknown value encountered in api/v1/auth/check") % name;}
224 return rtn;
225}
static Http get(std::string url)
Definition Http.cpp:886
const char * get_name() const override
Definition UltiMaker.cpp:50
void set_auth(Http &http) const
Definition UltiMaker.cpp:120
@ error
Definition UltiMaker.hpp:55
@ http
Definition IPrinterAgent.hpp:64

References error, Slic3r::Http::get(), get_name(), host, Slic3r::http, m_api_username, m_ssl_revoke_best_effort, and set_auth().

Referenced by test_auth().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ can_test()

bool Slic3r::UltiMaker::can_test ( ) const
inlineoverridevirtual

Implements Slic3r::PrintHost.

34{ return true; }

◆ connect()

UltiMaker::ConnectionType Slic3r::UltiMaker::connect ( wxString & msg) const
private
517{
518 BOOST_LOG_TRIVIAL(info) << boost::format("UltiMaker: Attempting to connect");
519
520 auto res = ConnectionType::error;
521 auto url = get_connect_url();
522
523 auto http = Http::get(std::move(url));
524 set_auth(http);
525
526 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: Connecting to url %1%") % url;
527
528 http.on_error([&](std::string body, std::string error, unsigned status) {
529 auto dsfUrl = get_connect_url();
530 auto dsfHttp = Http::get(std::move(dsfUrl));
531 dsfHttp.on_error([&](std::string body, std::string error, unsigned status) {
532 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: Error connecting: %1%, HTTP %2%, body: `%3%`") % error % status % body;
533 msg = format_error(body, error, status);
534 })
535 .on_complete([&](std::string body, unsigned) {
537 })
538 .perform_sync();
539 })
540 .on_complete([&](std::string body, unsigned) {
541 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: Got: %1%") % body;
542
543 int err_code = get_err_code_from_body(body);
544 switch (err_code) {
545 case 0:
547 break;
548 case 1:
549 msg = format_error(body, _u8L("Wrong password"), 0);
550 break;
551 case 2:
552 msg = format_error(body, _u8L("Could not get resources to create a new connection"), 0);
553 break;
554 default:
555 msg = format_error(body, _u8L("Unknown error occurred"), 0);
556 break;
557 }
558
559 })
560 .perform_sync();
561
562 return res;
563}
virtual wxString format_error(const std::string &body, const std::string &error, unsigned status) const
Definition PrintHost.cpp:202
static int get_err_code_from_body(const std::string &body)
Definition PrintHost.cpp:188
std::string get_connect_url() const
Definition UltiMaker.cpp:602
@ rrf
Definition UltiMaker.hpp:55
@ dsf
Definition UltiMaker.hpp:55
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, dsf, error, Slic3r::PrintHost::format_error(), Slic3r::Http::get(), get_connect_url(), Slic3r::PrintHost::get_err_code_from_body(), Slic3r::http, rrf, and set_auth().

Referenced by upload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disconnect()

void Slic3r::UltiMaker::disconnect ( ConnectionType connectionType) const
private
566{
567 // we don't need to disconnect from DSF or if it failed anyway
568 if (connectionType != ConnectionType::rrf) {
569 return;
570 }
571 auto url = (boost::format("%1%rr_disconnect")
572 % get_base_url()).str();
573
574 auto http = Http::get(std::move(url));
575 http.on_error([&](std::string body, std::string error, unsigned status) {
576 // we don't care about it, if disconnect is not working UltiMaker will disconnect automatically after some time
577 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: Error disconnecting: %1%, HTTP %2%, body: `%3%`") % error % status % body;
578 })
579 .perform_sync();
580}
std::string get_base_url() const
Definition UltiMaker.cpp:607

References error, Slic3r::Http::get(), get_base_url(), Slic3r::http, and rrf.

Referenced by upload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format_error()

wxString Slic3r::PrintHost::format_error ( const std::string & body,
const std::string & error,
unsigned status ) const
protectedvirtualinherited
203{
204 if (status != 0) {
205 const std::string reason = moonraker_error_reason(body);
206 auto wxbody = wxString::FromUTF8(reason.empty() ? body : reason);
207 return wxString::Format("HTTP %u: %s", status, wxbody);
208 } else {
209 if (error.find("curl:Timeout was reached") != std::string::npos) {
210 return timed_out_message();
211 }else if(error.find("curl:Couldn't resolve host name")!= std::string::npos){
212 return _L("The Hostname/IP/URL could not be parsed, please check it and try again.");
213 } else if (error.find("Connection was reset") != std::string::npos){
214 return _L("File/data transfer interrupted. Please check the printer and network, then try it again.");
215 }
216 else {
217 return wxString::FromUTF8(error.data());
218 }
219 }
220}
#define _L(s)
Definition OBJ.cpp:34
static wxString timed_out_message()
Definition PrintHost.cpp:222
std::string moonraker_error_reason(const std::string &body)
Definition PrintHost.cpp:137

References _L, and timed_out_message().

Referenced by Slic3r::Duet::connect(), Slic3r::UltiMaker::connect(), Slic3r::SimplyPrint::do_chunk_upload(), Slic3r::SimplyPrint::do_temp_upload(), Slic3r::ElegooLink::elegoo_cc2_test(), Slic3r::ElegooLink::elegoo_test(), Slic3r::PrusaLink::post_inner(), Slic3r::PrusaLink::put_inner(), Slic3r::Flashforge::request_local_api_json(), Slic3r::Duet::start_print(), Slic3r::Moonraker::start_print(), Slic3r::UltiMaker::start_print(), Slic3r::AstroBox::test(), Slic3r::CrealityPrint::test(), Slic3r::ESP3D::test(), Slic3r::FlashAir::test(), Slic3r::Moonraker::test(), Slic3r::Obico::test(), Slic3r::OctoPrint::test(), Slic3r::PrusaLink::test(), Slic3r::Repetier::test(), Slic3r::UltiMaker::test(), Slic3r::PrusaLink::test_with_method_check(), Slic3r::AstroBox::upload(), Slic3r::C3DPrinterOS::upload(), Slic3r::CrealityPrint::upload(), Slic3r::Duet::upload(), Slic3r::ESP3D::upload(), Slic3r::FlashAir::upload(), Slic3r::MKS::upload(), Slic3r::Moonraker::upload(), Slic3r::Obico::upload(), Slic3r::Repetier::upload(), Slic3r::UltiMaker::upload(), Slic3r::OctoPrint::upload_inner_with_host(), Slic3r::Flashforge::upload_local_api(), Slic3r::ElegooLink::uploadPart(), and Slic3r::ElegooLink::uploadPartCC2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_auth_creds()

bool Slic3r::UltiMaker::generate_auth_creds ( wxString & msg) const
229 {
230 // Returns true if no error, false otherwise.
231
232 BOOST_LOG_TRIVIAL(debug) << "UltiMaker: generate_auth_creds called!";
233 bool ret = true;
234 /*
235 The auth POST request returns json of the form
236 {
237 "id": "string",
238 "key": "string"
239 }
240 where id is the m_api_username and key is the m_api_password
241 */
242 const std::string name = get_name();
243 std::string application = "OrcaSlicer";
244 std::string application_key = "application";
245 std::string user = "OrcaSlicer";
246 std::string user_key = "user";
247 std::string exclusionKey = "OrcaSlicer";
248 std::string exclusionKey_key = "OrcaSlicer";
249 auto url = (boost::format("http://%1%/api/v1/auth/request") % host).str();
250 auto http = Http::post(std::move(url));
251
252 // Note: the body/form cannot be blank or OrcaSlicer's Http library crashes on perform_sync()
253 http.form_clear();
254 http.mime_form_add_text(application_key,application);
255 http.mime_form_add_text(user_key,user);
256 http.mime_form_add_text(exclusionKey_key,exclusionKey);
257
258 http.on_error([name, &msg, &ret](std::string body, std::string error, unsigned status) {
259 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error generating credentials: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
260 msg = _L("Error generating credentials! See the log for details.");
261 ret = false;
262 })
263 .on_complete([name, &msg, &ret](std::string body, unsigned) {
264 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: body: %2%") % name % body;
265 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: POST request completed without error") % name;
266 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got credential verification: %2%") % name % body;
267
268 std::stringstream sin(body);
269 boost::property_tree::ptree pt;
270
271 try {
272 // Parse JSON into property tree
273 boost::property_tree::read_json(sin, pt);
274 // Extract the keys from the json
275 std::string id = pt.get<std::string>("id", "");
276 std::string key = pt.get<std::string>("key", "");
277 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: Got id and key. ID=%1%") % id;
278 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: KEY=%1%") % key;
279
280 if (id.empty() || key.empty()) {
281 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Either ID or KEY is empty.") % name;
282 // TRN %1% and %2% are the ID and KEY returned by the printer.
283 msg = GUI::format_wxstr(_L("ERROR: Either ID or KEY is empty. ID=%1% KEY=%2%"), id, key);
284 ret = false;
285 } else {
286 BOOST_LOG_TRIVIAL(info) << boost::format("%1%: ID and KEY are both present. Setting message appropriately.") % name;
287 // TRN Generated API credentials. %1% is the username, %2% the password.
288 msg = GUI::format_wxstr(_L("Username: %1% Password: %2%"), id, key);
289 }
290 }
291 catch (const std::exception & e) {
292 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: generate_auth_creds Caught error") % name;
293 BOOST_LOG_TRIVIAL(error) << "Json parse err: " << e.what();
294 ret = false;
295 }
296 })
297#ifdef WIN32
298 .ssl_revoke_best_effort(m_ssl_revoke_best_effort)
299 .on_ip_resolve([&](std::string address) {
300 // Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
301 // Remember resolved address to be reused at successive REST API call.
302 // msg = GUI::from_u8(address);
303 })
304#endif // WIN32
305 .perform_sync();
306
307
308 // Wait for user to authorize on the physical machine
309 BOOST_LOG_TRIVIAL(debug) << "UltiMaker: generate_auth_creds done! ret=" << ret;
310 return ret;
311}
static Http post(std::string url)
Definition Http.cpp:891
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:22
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:273

References _L, Slic3r::empty(), error, Slic3r::GUI::format_wxstr(), get_name(), host, Slic3r::http, m_ssl_revoke_best_effort, and Slic3r::Http::post().

Referenced by test().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_api_password()

const std::string & Slic3r::UltiMaker::get_api_password ( ) const
inline
39{ return m_api_password; }

References m_api_password.

Referenced by set_auth().

Here is the caller graph for this function:

◆ get_api_user()

const std::string & Slic3r::UltiMaker::get_api_user ( ) const
inline
37{ return m_api_username; }

References m_api_username.

◆ get_api_username()

const std::string & Slic3r::UltiMaker::get_api_username ( ) const
inline
38{ return m_api_username; }

References m_api_username.

Referenced by set_auth().

Here is the caller graph for this function:

◆ get_base_url()

std::string Slic3r::UltiMaker::get_base_url ( ) const
private
608{
609 if (host.find("http://") == 0 || host.find("https://") == 0) {
610 if (host.back() == '/') {
611 return host;
612 } else {
613 return (boost::format("%1%/api/v1") % host).str();
614 }
615 } else {
616 return (boost::format("http://%1%/api/v1") % host).str();
617 }
618}

References host.

Referenced by disconnect(), get_connect_url(), get_status_url(), get_upload_url(), and start_print().

Here is the caller graph for this function:

◆ get_connect_url()

std::string Slic3r::UltiMaker::get_connect_url ( ) const
private
603{
604 return (boost::format("%1%/printer/status") % get_base_url()).str();
605}

References get_base_url().

Referenced by connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_err_code_from_body()

int Slic3r::PrintHost::get_err_code_from_body ( const std::string & body)
staticinherited
189{
190 boost::property_tree::ptree root;
191 std::istringstream iss(body);
192 try {
193 boost::property_tree::read_json(iss, root);
194 } catch (const std::exception &ex) {
195 BOOST_LOG_TRIVIAL(error) << "PrintHost: response is not valid JSON: " << ex.what();
196 return -1;
197 }
198
199 return root.get<int>("err", 0);
200}

Referenced by Slic3r::Duet::connect(), Slic3r::UltiMaker::connect(), Slic3r::Duet::upload(), Slic3r::MKS::upload(), and Slic3r::UltiMaker::upload().

Here is the caller graph for this function:

◆ get_groups()

virtual bool Slic3r::PrintHost::get_groups ( wxArrayString & ) const
inlinevirtualinherited

Reimplemented in Slic3r::Repetier.

84{ return false; }

◆ get_host()

std::string Slic3r::UltiMaker::get_host ( ) const
inlineoverridevirtual

Implements Slic3r::PrintHost.

36{ return host; }

References host.

◆ get_login_url()

virtual bool Slic3r::PrintHost::get_login_url ( wxString & auth_url) const
inlinevirtualinherited

Reimplemented in Slic3r::Obico.

99{ return false; }

Referenced by Slic3r::GUI::PrinterCloudAuthDialog::PrinterCloudAuthDialog().

Here is the caller graph for this function:

◆ get_name()

const char * Slic3r::UltiMaker::get_name ( ) const
overridevirtual

Implements Slic3r::PrintHost.

50{ return "UltiMaker"; }

Referenced by auth_status(), generate_auth_creds(), is_authorized(), test(), and test_auth().

Here is the caller graph for this function:

◆ get_post_upload_actions()

PrintHostPostUploadActions Slic3r::UltiMaker::get_post_upload_actions ( ) const
inlineoverridevirtual

Implements Slic3r::PrintHost.

@ StartPrint
Definition PrintHost.hpp:25

References Slic3r::StartPrint.

◆ get_print_host()

PrintHost * Slic3r::PrintHost::get_print_host ( DynamicPrintConfig * config)
staticinherited
59{
61
62 {
63 const auto opt = config->option<ConfigOptionEnum<PrinterTechnology>>("printer_technology");
64 if (opt != nullptr) {
65 tech = opt->value;
66 }
67 }
68
69 if (tech == ptFFF) {
70 const auto opt = config->option<ConfigOptionEnum<PrintHostType>>("host_type");
71 const auto host_type = opt != nullptr ? opt->value : htOctoPrint;
72
73 switch (host_type) {
74 case htOctoPrint: return new OctoPrint(config);
75 case htDuet: return new Duet(config);
76 case htUltiMaker: return new UltiMaker(config);
77 case htFlashAir: return new FlashAir(config);
78 case htAstroBox: return new AstroBox(config);
79 case htRepetier: return new Repetier(config);
80 case htPrusaLink: return new PrusaLink(config);
81 case htPrusaConnect: return new PrusaConnect(config);
82 case htMKS: return new MKS(config);
83 case htESP3D: return new ESP3D(config);
84 case htCrealityPrint: return new CrealityPrint(config);
85 case htObico: return new Obico(config);
86 case htFlashforge: return new Flashforge(config);
87 case htSimplyPrint: return new SimplyPrint(config);
88 case htElegooLink: return new ElegooLink(config);
89 case ht3DPrinterOS: return new C3DPrinterOS(config);
90 case htMoonraker: return new Moonraker(config);
91 default: return nullptr;
92 }
93 } else {
94 return new SL1Host(config);
95 }
96}
PrinterTechnology
Definition Config.hpp:229
@ ptFFF
Definition Config.hpp:231
@ htSimplyPrint
Definition PrintConfig.hpp:119
@ htMoonraker
Definition PrintConfig.hpp:119
@ htElegooLink
Definition PrintConfig.hpp:119
@ htCrealityPrint
Definition PrintConfig.hpp:119
@ ht3DPrinterOS
Definition PrintConfig.hpp:119
@ htPrusaLink
Definition PrintConfig.hpp:119
@ htRepetier
Definition PrintConfig.hpp:119
@ htMKS
Definition PrintConfig.hpp:119
@ htPrusaConnect
Definition PrintConfig.hpp:119
@ htDuet
Definition PrintConfig.hpp:119
@ htUltiMaker
Definition PrintConfig.hpp:119
@ htObico
Definition PrintConfig.hpp:119
@ htOctoPrint
Definition PrintConfig.hpp:119
@ htFlashforge
Definition PrintConfig.hpp:119
@ htFlashAir
Definition PrintConfig.hpp:119
@ htAstroBox
Definition PrintConfig.hpp:119
@ htESP3D
Definition PrintConfig.hpp:119
ConfigOptionEnum< PrinterTechnology >
Definition PrintConfig.hpp:2358

References Slic3r::ht3DPrinterOS, Slic3r::htAstroBox, Slic3r::htCrealityPrint, Slic3r::htDuet, Slic3r::htElegooLink, Slic3r::htESP3D, Slic3r::htFlashAir, Slic3r::htFlashforge, Slic3r::htMKS, Slic3r::htMoonraker, Slic3r::htObico, Slic3r::htOctoPrint, Slic3r::htPrusaConnect, Slic3r::htPrusaLink, Slic3r::htRepetier, Slic3r::htSimplyPrint, Slic3r::htUltiMaker, Slic3r::ConfigBase::option(), and Slic3r::ptFFF.

Referenced by Slic3r::GUI::PhysicalPrinterDialog::build_printhost_settings(), Slic3r::GUI::anonymous_namespace{PrinterWebViewHandler.cpp}::ElegooPrinterWebViewHandler::handle_get_sn_request(), Slic3r::GUI::anonymous_namespace{PrinterWebViewHandler.cpp}::ElegooPrinterWebViewHandler::handle_upload_request(), Slic3r::GUI::PhysicalPrinterDialog::update_printers(), and Slic3r::GUI::PhysicalPrinterDialog::update_printhost_buttons().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_print_host_webui()

std::string Slic3r::PrintHost::get_print_host_webui ( DynamicPrintConfig * config)
staticinherited
99{
100 if (config == nullptr)
101 return {};
102
103 std::string webui_url;
104 const auto* host_type_opt = config->option<ConfigOptionEnum<PrintHostType>>("host_type");
105 const auto host_type = host_type_opt != nullptr ? host_type_opt->value : htOctoPrint;
106
107 switch (host_type) {
108 case htElegooLink: {
109 webui_url = ElegooLink::get_print_host_webui(config);
110 break;
111 }
112 default: break;
113 }
114
115 if (webui_url.empty()) {
116 webui_url = config->opt_string("print_host_webui");
117 if (webui_url.empty())
118 webui_url = config->opt_string("print_host");
119 if (webui_url.empty())
120 return webui_url;
121 }
122
123 const bool has_http_scheme = boost::algorithm::istarts_with(webui_url, "http");
124 const bool has_file_scheme = boost::algorithm::istarts_with(webui_url, "file:");
125
126 if (!has_http_scheme && !has_file_scheme)
127 webui_url = "http://" + webui_url;
128
129 return webui_url;
130}

References Slic3r::ElegooLink::get_print_host_webui(), Slic3r::htElegooLink, Slic3r::htOctoPrint, Slic3r::DynamicConfig::opt_string(), Slic3r::ConfigBase::option(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::GUI::MainFrame::load_printer_url(), Slic3r::GUI::Plater::priv::on_tab_selection_changing(), and Slic3r::GUI::Sidebar::update_all_preset_comboboxes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_printers()

virtual bool Slic3r::PrintHost::get_printers ( wxArrayString & ) const
inlinevirtualinherited

Reimplemented in Slic3r::Obico, and Slic3r::Repetier.

85{ return false; }

◆ get_sn()

virtual std::string Slic3r::PrintHost::get_sn ( ) const
inlinevirtualinherited

Get the serial number for connecting to the printer. For Elegoo CC2, the device details connection to the printer requires the serial number. Other print hosts do not need to implement this interface, and it returns an empty string by default.

Reimplemented in Slic3r::ElegooLink.

80{ return ""; }

◆ get_status_url()

std::string Slic3r::UltiMaker::get_status_url ( ) const
private
598{
599 return (boost::format("%1%/printer/status") % get_base_url()).str();
600}

References get_base_url().

Here is the call graph for this function:

◆ get_storage()

virtual bool Slic3r::PrintHost::get_storage ( wxArrayString & ,
wxArrayString &  ) const
inlinevirtualinherited

Reimplemented in Slic3r::Moonraker, Slic3r::PrusaConnect, and Slic3r::PrusaLink.

88{ return false; }

◆ get_test_failed_msg()

wxString Slic3r::UltiMaker::get_test_failed_msg ( wxString & msg) const
overridevirtual

Implements Slic3r::PrintHost.

111{
112 return GUI::from_u8((boost::format("%s: %s")
113 % _u8L("Could not connect to UltiMaker")
114 % std::string(msg.ToUTF8())).str());
115}
wxString from_u8(const std::string &str)
Definition GUI.cpp:544

References _u8L, and Slic3r::GUI::from_u8().

Here is the call graph for this function:

◆ get_test_ok_msg()

wxString Slic3r::UltiMaker::get_test_ok_msg ( ) const
overridevirtual

Implements Slic3r::PrintHost.

106{
107 return _L("Connection to UltiMaker works correctly.");
108}

References _L.

◆ get_upload_url()

std::string Slic3r::UltiMaker::get_upload_url ( const std::string & filename,
ConnectionType connectionType ) const
private
585{
586 assert(connectionType != ConnectionType::error);
587
588 if (connectionType == ConnectionType::dsf) {
589 return (boost::format("%1%/machine/file/gcodes/%2%")
590 % get_base_url()
591 % Http::url_encode(filename)).str();
592 } else {
593 return get_base_url()+"/print_job";
594 }
595}
static std::string url_encode(const std::string &str)
Definition Http.cpp:969

References dsf, error, get_base_url(), and Slic3r::Http::url_encode().

Referenced by upload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPrintTime()

int Slic3r::UltiMaker::getPrintTime ( std::string filepath) const
354 {
355 // Get the total print time in seconds from the provided gcode filepath
356 std::ifstream file_in(filepath);
357 std::string line;
358 int ret = 0;
359 bool found = false;
360 int h = 0;
361 int m = 0;
362 int s = 0;
363
364 if (file_in.is_open()){
365 while (getline(file_in, line) && !found) {
366 if (boost::starts_with(line, "; estimated printing time (normal mode) =")) {
367 if (sscanf(line.c_str(), "; estimated printing time (normal mode) = %dh %dm %ds", &h, &m, &s) == 3) {
368 ret = 3600*h + 60*m + s;
369 BOOST_LOG_TRIVIAL(warning) << boost::format("UltiMaker: Hours=%1% Minutes=%2% Seconds=%3% Total Seconds=%4%") % h % m % s % ret;
370 found = true;
371 } else if (sscanf(line.c_str(), "; estimated printing time (normal mode) = %dm %ds", &m, &s) == 2) {
372 ret = 60*m + s;
373 BOOST_LOG_TRIVIAL(warning) << boost::format("UltiMaker: No Hours, Minutes=%1% Seconds=%2% Total Seconds=%3%") % m % s % ret;
374 found = true;
375 } else {
376 BOOST_LOG_TRIVIAL(warning) << boost::format("UltiMaker: ERROR: sscanf error while getting total print time, no vars assigned.");
377 }
378 }
379 }
380 } else {
381 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker postprocessing ERROR: file %1% or file %2% was unable to open!") % filepath % (filepath+".temp");
382 return 0;
383 }
384
385 if (!found) {
386 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: Print time estimate not found!!");
387 }
388
389 file_in.close();
390
391 return ret;
392}

References error.

Referenced by makeGriffinCompatible().

Here is the caller graph for this function:

◆ has_auth_creds()

bool Slic3r::UltiMaker::has_auth_creds ( ) const
127 {
128 // True if has authentication credentials, false otherwise
129 return (!m_api_username.empty()) && (!m_api_password.empty());
130}

References m_api_password, and m_api_username.

Referenced by test_auth().

Here is the caller graph for this function:

◆ has_auto_discovery()

bool Slic3r::UltiMaker::has_auto_discovery ( ) const
inlineoverridevirtual

Implements Slic3r::PrintHost.

33{ return false; }

◆ is_authorized()

bool Slic3r::UltiMaker::is_authorized ( ) const
133 {
134
135 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: is_authorized() checking if creds are valid.");
136
137 const char* name = get_name();
138
139 bool rtn = false;
140 auto url = (boost::format("http://%1%/api/v1/auth/verify") % host).str();
141
142 auto http = Http::get(std::move(url));
143 set_auth(http);
144 http.on_error([&](std::string body, std::string error, unsigned status) {
145 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error verifying credentials: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
146
147 if (status == 403 || body == "{\"message\": \"Authorization required.\"}") {
148 rtn = false;
149 }
150
151 })
152 .on_complete([&](std::string body, unsigned) {
153 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: url completed without error: %1%") % url;
154 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got credential verification: %2%") % name % body;
155 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: [auth] rtn=%2%") % name % rtn; // DEBUG
156
157 try {
158 // Validate that response is correct
159 rtn = (boost::starts_with(body, "\"ok\"") || body == "{\"message\": \"ok\"}");
160 }
161 catch (const std::exception &) {
162 rtn = false;
163 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: is_authorized Caught error") % name;
164 }
165 })
166#ifdef WIN32
167 .ssl_revoke_best_effort(m_ssl_revoke_best_effort)
168 .on_ip_resolve([&](std::string address) {
169 // Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
170 // Remember resolved address to be reused at successive REST API call.
171 // msg = GUI::from_u8(address);
172 })
173#endif // WIN32
174 .perform_sync();
175
176 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: [auth] rtn=%2%") % name % rtn;
177 return rtn;
178}

References error, Slic3r::Http::get(), get_name(), host, Slic3r::http, m_ssl_revoke_best_effort, and set_auth().

Referenced by test_auth().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_cloud()

virtual bool Slic3r::PrintHost::is_cloud ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::C3DPrinterOS, Slic3r::Obico, and Slic3r::SimplyPrint.

96{ return false; }

◆ is_logged_in()

virtual bool Slic3r::PrintHost::is_logged_in ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::C3DPrinterOS, and Slic3r::SimplyPrint.

97{ return false; }

◆ log_out()

virtual void Slic3r::PrintHost::log_out ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::C3DPrinterOS, and Slic3r::SimplyPrint.

98{}

◆ makeGriffinCompatible()

bool Slic3r::UltiMaker::makeGriffinCompatible ( std::string filepath) const
protected
395 {
396 // Modifies the header of the given file path to remove the double colon
397 // at the timestamp because >1 colons in a line makes UltiMakers crash.
398
399 // Opening and modifying files code was modified from https://www.w3resource.com/cpp-exercises/file-handling/cpp-file-handling-exercise-6.php
400 std::string file_temp = filepath+".temp";
401 std::ifstream file_in(filepath);
402 std::ofstream file_out(file_temp);
403 std::string line;
404 bool write_on = false;
405
406 if (file_in.is_open() && file_out.is_open()){
407 while (getline(file_in, line)) {
408
409 if (write_on) {
410 if (boost::starts_with(line, "; generated by OrcaSlicer")) {
411 boost::replace_all(line, ":", "-"); // Replace the colons in the date with dashes to prevent printer crash.
412 }
413
414 // UM machines need total print time in seconds.
415 if (boost::starts_with(line, ";PRINT.TIME:")) {
416 file_out << ";PRINT.TIME:"<< getPrintTime(filepath) << "\n";
417
418 } else {
419 file_out << line << "\n"; // Write the modified line to the output file
420 }
421
422 } else if (boost::starts_with(line, ";START_OF_HEADER")) {
423 write_on = true;
424 file_out << line << "\n";
425 }
426 }
427 } else {
428 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: file %1% or file %2% was unable to open!") % filepath % (filepath+".temp");
429 return false;
430 }
431
432 if (!write_on) {
433 BOOST_LOG_TRIVIAL(warning) << boost::format("UltiMaker: while postprocessing to make compatible with Griffin, headers not found!");
434 }
435
436 file_in.close();
437 file_out.close();
438
439 // Now replace the upload file with the temp one
440 std::remove(filepath.c_str());
441 std::rename(file_temp.c_str(), filepath.c_str());
442 // boost::filesystem::copy_file(file_temp, filepath); // replacement of the above line to keep in /tmp/
443 return true;
444}
int getPrintTime(std::string filepath) const
Definition UltiMaker.cpp:354

References error, and getPrintTime().

Referenced by upload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_auth()

void Slic3r::UltiMaker::set_auth ( Http & http) const
private
121{
122 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: set_auth, m_api_username of %1% and m_api_password of %2%") % get_api_username() % get_api_password();
123 http.auth_digest(m_api_username, m_api_password);
124}
const std::string & get_api_password() const
Definition UltiMaker.hpp:39
const std::string & get_api_username() const
Definition UltiMaker.hpp:38

References get_api_password(), get_api_username(), Slic3r::http, m_api_password, and m_api_username.

Referenced by auth_status(), connect(), is_authorized(), start_print(), test(), and upload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_print()

bool Slic3r::UltiMaker::start_print ( wxString & msg,
const std::string & filename,
ConnectionType connectionType ) const
private
636{
637 assert(connectionType != ConnectionType::error);
638
639 bool res = false;
640 bool dsf = (connectionType == ConnectionType::dsf);
641
642 auto url = dsf
643 ? (boost::format("%1%machine/code") % get_base_url()).str()
644 : (boost::format("%1%rr_gcode?gcode=M32%%20\"0:/gcodes/%2%\"") % get_base_url() % Http::url_encode(filename)).str();
645
646 auto http = (dsf ? Http::post(std::move(url)) : Http::get(std::move(url)));
647 set_auth(http);
648 if (dsf) {
649 http.set_post_body(
650 (boost::format("M32 \"0:/gcodes/%1%\"") % filename).str()
651 );
652 }
653 http.on_error([&](std::string body, std::string error, unsigned status) {
654 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: Error starting print: %1%, HTTP %2%, body: `%3%`") % error % status % body;
655 msg = format_error(body, error, status);
656 })
657 .on_complete([&](std::string body, unsigned) {
658 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: Got: %1%") % body;
659 res = true;
660 })
661 .perform_sync();
662
663 return res;
664}
static std::string url_encode(const std::vector< std::pair< std::string, std::string > > query)
Definition SimplyPrint.cpp:99
@ Http
Definition PluginAuditManager.hpp:49
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:45
id get(id object, const void *key)
Definition MacIME.mm:22

References dsf, error, Slic3r::PrintHost::format_error(), Slic3r::Http::get(), get_base_url(), Slic3r::http, Slic3r::Http::post(), set_auth(), and Slic3r::Http::url_encode().

Referenced by upload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ supports_multiple_printers()

virtual bool Slic3r::PrintHost::supports_multiple_printers ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::Repetier.

73{ return false; }

◆ test()

bool Slic3r::UltiMaker::test ( wxString & curl_msg) const
overridevirtual

Implements Slic3r::PrintHost.

54{
55 // Returns true on success, false on error.
56 // If called with specific arg, just generate the auth creds.
57 if (msg == "generate_auth_creds") {
58 BOOST_LOG_TRIVIAL(debug) << "UltiMaker: test called with generate_auth_creds! Generating the auth credentials.";
59 return this->generate_auth_creds(msg);
60 }
61
62 // Since the request is performed synchronously here,
63 // it is ok to refer to `msg` from within the closure
64 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: Attempting to test machine");
65
66 const char* name = get_name();
67
68 bool res = true;
69 auto url = (boost::format("http://%1%/api/v1/system/variant") % host).str();
70
71 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Get system variant at: %2%") % name % url;
72
73 auto http = Http::get(std::move(url));
75 http.on_error([&](std::string body, std::string error, unsigned status) {
76 BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting system variant: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
77 res = false;
78 msg = format_error(body, error, status);
79 })
80 .on_complete([name, &res](std::string body, unsigned) {
81 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got system variant: %2%") % name % body;
82
83 // Validate that response is correct ("UltiMaker 3", "UltiMaker 3 extended" or "UltiMaker S5")
84 res = (boost::starts_with(body, "\"Ultimaker 3") || body == "\"Ultimaker S5\"");
85 })
86#ifdef WIN32
87 .ssl_revoke_best_effort(m_ssl_revoke_best_effort)
88 .on_ip_resolve([&](std::string address) {
89 // Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
90 // Remember resolved address to be reused at successive REST API call.
91 msg = GUI::from_u8(address);
92 })
93#endif // WIN32
94 .perform_sync();
95
96
97 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Testing auth.") % name;
98 std::string auth_result = test_auth();
99 if ( !boost::starts_with(auth_result,"OK") ) { msg = GUI::from_u8(auth_result); res = false; };
100 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Auth test result: %2%") % name % auth_result;
101 return res;
102}
std::string test_auth() const
Definition UltiMaker.cpp:315
bool generate_auth_creds(wxString &msg) const
Definition UltiMaker.cpp:229

References error, Slic3r::PrintHost::format_error(), Slic3r::GUI::from_u8(), generate_auth_creds(), Slic3r::Http::get(), get_name(), host, Slic3r::http, m_ssl_revoke_best_effort, set_auth(), and test_auth().

Here is the call graph for this function:

◆ test_auth()

std::string Slic3r::UltiMaker::test_auth ( ) const
315 {
316 /*
317 Used in UltiMaker::test(), creates creds if they don't already
318 exist, and returns various error strings if errors.
319 Returns "OK" if no errors and creds are valid.
320 */
321 const char* name = get_name();
322 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Testing for presence of auth creds...") % name;
323
324 // Auth credentials are alreay existing (user-entered)
325 if (has_auth_creds()) {
326 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Has auth credentials. Testing validity...") % name;
327
328 std::string auth_stat = auth_status();
329 BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: auth_status returned %2%") % name % auth_stat;
330
331 if (auth_stat == "waiting") {
332 BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Auth credentials are waiting for user approval at the physical machine.") % name;
333 return _u8L("Authentication credentials are waiting for approval. Please approve access via the dialog box on the printer's screen.");
334
335 } else if (auth_stat == "authorized" && is_authorized()) {
336 BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Auth credentials are valid. Returning OK") % name;
337 return "OK";
338
339 } else {
340 BOOST_LOG_TRIVIAL(warning) << boost::format("%1%: Auth credentials are INVALID. auth_status returned %2%") % name % auth_stat;
341 return _u8L("Invalid authentication credentials");
342 }
343
344 } else { // Auth credentials do not exist
345 BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Auth credentials do NOT already exist. Returning error string.") % name;
346 return _u8L("Error: No authentication credentials found!");
347 }
348
349}
bool has_auth_creds() const
Definition UltiMaker.cpp:127
std::string auth_status() const
Definition UltiMaker.cpp:183
bool is_authorized() const
Definition UltiMaker.cpp:133

References _u8L, auth_status(), get_name(), has_auth_creds(), and is_authorized().

Referenced by test().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timed_out_message()

wxString Slic3r::PrintHost::timed_out_message ( )
staticprotectedinherited
223{
224 return _L("Connection timed out. Please check if the printer and computer network are functioning properly, and confirm that they are on the same network.");
225}

References _L.

Referenced by format_error(), and Slic3r::CrealityPrint::start_print().

Here is the caller graph for this function:

◆ timestamp_str()

std::string Slic3r::UltiMaker::timestamp_str ( ) const
private
621{
622 enum { BUFFER_SIZE = 32 };
623
624 auto t = std::time(nullptr);
625 auto tm = *std::localtime(&t);
626
627 char buffer[BUFFER_SIZE];
628 std::strftime(buffer, BUFFER_SIZE, "time=%Y-%m-%dT%H:%M:%S", &tm);
629
630 return std::string(buffer);
631}

◆ upload()

bool Slic3r::UltiMaker::upload ( PrintHostUpload upload_data,
ProgressFn prorgess_fn,
ErrorFn error_fn,
InfoFn info_fn ) const
overridevirtual

Implements Slic3r::PrintHost.

448{
449 // Preprocess the file so the machine doesn't crash
450 if (makeGriffinCompatible(upload_data.source_path.string())) {
451 BOOST_LOG_TRIVIAL(info) << "UltiMaker: [upload] Griffin compatibility appeared successful.";
452 } else {
453 BOOST_LOG_TRIVIAL(warning) << "UltiMaker: [upload] Griffin compatibility FAILED.";
454 return false;
455 }
456
457 wxString connect_msg;
458 auto connectionType = connect(connect_msg);
459 if (connectionType == ConnectionType::error) {
460 BOOST_LOG_TRIVIAL(warning) << boost::format("UltiMaker: [upload] connectionType is of type error!");
461 error_fn(std::move(connect_msg));
462 return false;
463 }
464
465 bool res = true;
466 bool dsf = (connectionType == ConnectionType::dsf);
467
468 auto upload_cmd = get_upload_url(upload_data.upload_path.string(), connectionType);
469 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: Uploading file %1%, filepath: %2%, post_action: %3%, command: %4%")
470 % upload_data.source_path
471 % upload_data.upload_path
472 % int(upload_data.post_action)
473 % upload_cmd;
474
475 auto http = (dsf ? Http::put(std::move(upload_cmd)) : Http::post(std::move(upload_cmd)));
476 http.form_add("jobname",upload_data.upload_path.string());
477 http.form_add_file("file", upload_data.source_path, upload_data.upload_path.string());
478
479 set_auth(http);
480 http.on_complete([&](std::string body, unsigned status) {
481 BOOST_LOG_TRIVIAL(debug) << boost::format("UltiMaker: File uploaded: HTTP %1%: %2%") % status % body;
482
483 int err_code = dsf ? (status == 201 ? 0 : 1) : get_err_code_from_body(body);
484 if (err_code != 0) {
485 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: Request completed but error code was received: %1%") % err_code;
486 error_fn(format_error(body, _u8L("Unknown error occurred"), 0));
487 res = false;
488 } else if (upload_data.post_action == PrintHostPostUploadAction::StartPrint) {
489 wxString errormsg;
490 res = start_print(errormsg, upload_data.upload_path.string(), connectionType);
491 if (! res) {
492 error_fn(std::move(errormsg));
493 }
494 }
495 })
496 .on_error([&](std::string body, std::string error, unsigned status) {
497 BOOST_LOG_TRIVIAL(error) << boost::format("UltiMaker: Error uploading file: %1%, HTTP %2%, body: `%3%`") % error % status % body;
498 error_fn(format_error(body, error, status));
499 res = false;
500 })
501 .on_progress([&](Http::Progress progress, bool &cancel) {
502 prorgess_fn(std::move(progress), cancel);
503 if (cancel) {
504 // Upload was canceled
505 BOOST_LOG_TRIVIAL(info) << "UltiMaker: Upload canceled";
506 res = false;
507 }
508 })
509 .perform_sync();
510
511 disconnect(connectionType);
512
513 return res;
514}
static Http put(std::string url)
Definition Http.cpp:899
std::string get_upload_url(const std::string &filename, ConnectionType connectionType) const
Definition UltiMaker.cpp:584
ConnectionType connect(wxString &msg) const
Definition UltiMaker.cpp:516
bool makeGriffinCompatible(std::string filepath) const
Definition UltiMaker.cpp:395
void disconnect(ConnectionType connectionType) const
Definition UltiMaker.cpp:565

References _u8L, connect(), disconnect(), dsf, error, Slic3r::PrintHost::format_error(), Slic3r::PrintHost::get_err_code_from_body(), get_upload_url(), Slic3r::http, makeGriffinCompatible(), Slic3r::Http::post(), Slic3r::PrintHostUpload::post_action, Slic3r::Http::put(), set_auth(), Slic3r::PrintHostUpload::source_path, start_print(), Slic3r::StartPrint, and Slic3r::PrintHostUpload::upload_path.

Here is the call graph for this function:

Member Data Documentation

◆ host

std::string Slic3r::UltiMaker::host
private

◆ m_api_password

std::string Slic3r::UltiMaker::m_api_password
protected

◆ m_api_username

std::string Slic3r::UltiMaker::m_api_username
protected

◆ m_host

std::string Slic3r::UltiMaker::m_host
protected

Referenced by UltiMaker().

◆ m_ssl_revoke_best_effort

bool Slic3r::UltiMaker::m_ssl_revoke_best_effort
protected

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/UltiMaker.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/UltiMaker.cpp