Firmware updater: Make the GUI less scary

This commit is contained in:
Vojtech Kral 2018-05-18 15:38:33 +02:00
parent c5f1acfbfb
commit a54672fb54
5 changed files with 211 additions and 68 deletions

View file

@ -8,12 +8,34 @@
namespace Slic3r {
namespace AvrDude {
class AvrDude
{
public:
typedef std::function<void(const char * /* msg */, unsigned /* size */)> MessageFn;
typedef std::function<void(const char * /* task */, unsigned /* progress */)> ProgressFn;
AvrDude();
AvrDude(AvrDude &&) = delete;
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 message output callback
AvrDude& on_message(MessageFn fn);
// Set progress report callback
// Progress is reported per each task (reading / writing), progress is reported in percents.
AvrDude& on_progress(MessageFn fn);
int run(std::vector<std::string> args);
private:
std::string m_sys_config;
MessageFn m_message_fn;
ProgressFn m_progress_fn;
};
int main(std::vector<std::string> args, std::string sys_config, MessageFn message_fn);
int main(std::vector<std::string> args, std::string sys_config, std::ostream &os);
}
}