2018-07-08 12:32:48 +00:00
|
|
|
#ifndef slic3r_PrintHost_hpp_
|
|
|
|
#define slic3r_PrintHost_hpp_
|
|
|
|
|
2018-08-21 09:10:32 +00:00
|
|
|
#include <memory>
|
2018-07-08 12:32:48 +00:00
|
|
|
#include <string>
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
class DynamicPrintConfig;
|
|
|
|
|
2018-12-11 09:33:11 +00:00
|
|
|
|
|
|
|
struct PrintHostUpload
|
|
|
|
{
|
|
|
|
boost::filesystem::path source_path;
|
|
|
|
boost::filesystem::path upload_path;
|
|
|
|
bool start_print = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-07-08 12:32:48 +00:00
|
|
|
class PrintHost
|
|
|
|
{
|
|
|
|
public:
|
2018-12-11 09:33:11 +00:00
|
|
|
virtual ~PrintHost();
|
|
|
|
|
|
|
|
virtual bool test(wxString &curl_msg) const = 0;
|
|
|
|
virtual wxString get_test_ok_msg () const = 0;
|
|
|
|
virtual wxString get_test_failed_msg (wxString &msg) const = 0;
|
|
|
|
// Send gcode file to print host, filename is expected to be in UTF-8
|
|
|
|
virtual bool send_gcode(const std::string &filename) const = 0; // XXX: remove in favor of upload()
|
|
|
|
virtual bool upload(PrintHostUpload upload_data) const = 0;
|
|
|
|
virtual bool has_auto_discovery() const = 0;
|
|
|
|
virtual bool can_test() const = 0;
|
|
|
|
|
|
|
|
static PrintHost* get_print_host(DynamicPrintConfig *config);
|
|
|
|
};
|
2018-07-08 12:32:48 +00:00
|
|
|
|
2018-08-21 09:10:32 +00:00
|
|
|
|
2018-12-11 09:33:11 +00:00
|
|
|
struct PrintHostJob
|
|
|
|
{
|
|
|
|
PrintHostUpload upload_data;
|
|
|
|
std::unique_ptr<PrintHost> printhost;
|
|
|
|
|
|
|
|
PrintHostJob() {}
|
|
|
|
PrintHostJob(DynamicPrintConfig *config)
|
|
|
|
: printhost(PrintHost::get_print_host(config))
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool empty() const { return !printhost; }
|
|
|
|
operator bool() const { return !!printhost; }
|
2018-07-08 12:32:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-12-11 09:33:11 +00:00
|
|
|
class PrintHostJobQueue
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PrintHostJobQueue();
|
|
|
|
PrintHostJobQueue(const PrintHostJobQueue &) = delete;
|
|
|
|
PrintHostJobQueue(PrintHostJobQueue &&other) = delete;
|
|
|
|
~PrintHostJobQueue();
|
|
|
|
|
|
|
|
PrintHostJobQueue& operator=(const PrintHostJobQueue &) = delete;
|
|
|
|
PrintHostJobQueue& operator=(PrintHostJobQueue &&other) = delete;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct priv;
|
|
|
|
std::shared_ptr<priv> p;
|
|
|
|
};
|
|
|
|
|
2018-07-08 12:32:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|