blob: 8d881b0947ae04335080f1f79e5ee7e911770203 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef slic3r_avrdude_slic3r_hpp_
#define slic3r_avrdude_slic3r_hpp_
#include <memory>
#include <vector>
#include <string>
#include <functional>
namespace Slic3r {
class AvrDude
{
public:
typedef std::shared_ptr<AvrDude> Ptr;
typedef std::function<void(const char * /* msg */, unsigned /* size */)> MessageFn;
typedef std::function<void(const char * /* task */, unsigned /* progress */)> ProgressFn;
typedef std::function<void(int /* exit status */)> CompleteFn;
AvrDude();
AvrDude(AvrDude &&);
AvrDude(const AvrDude &) = delete;
AvrDude &operator=(AvrDude &&) = delete;
AvrDude &operator=(const AvrDude &) = delete;
~AvrDude();
// Set location of avrdude's main configuration file
AvrDude& sys_config(std::string sys_config);
// Set avrdude cli arguments
AvrDude& args(std::vector<std::string> args);
// Set message output callback
AvrDude& on_message(MessageFn fn);
// Set progress report callback
// Progress is reported per each task (reading / writing) in percents.
AvrDude& on_progress(ProgressFn fn);
// Called when avrdude's main function finishes
AvrDude& on_complete(CompleteFn fn);
int run_sync();
Ptr run();
void cancel();
void join();
private:
struct priv;
std::unique_ptr<priv> p;
};
}
#endif
|