PrusaSlicer-NonPlainar/src/slic3r/Utils/PrintHost.hpp

76 lines
1.7 KiB
C++
Raw Normal View History

#ifndef slic3r_PrintHost_hpp_
#define slic3r_PrintHost_hpp_
2018-08-21 09:10:32 +00:00
#include <memory>
#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;
};
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-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-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;
};
}
#endif