Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::AvrDude::priv Struct Reference
+ Collaboration diagram for Slic3r::AvrDude::priv:

Classes

struct  HandlerGuard
 

Public Member Functions

void set_handlers ()
 
void unset_handlers ()
 
int run_one (const std::vector< std::string > &args)
 
int run ()
 

Public Attributes

std::deque< std::vector< std::string > > args
 
bool cancelled = false
 
int exit_code = 0
 
size_t current_args_set = 0
 
RunFn run_fn
 
MessageFn message_fn
 
ProgressFn progress_fn
 
CompleteFn complete_fn
 
std::thread avrdude_thread
 

Detailed Description

Member Function Documentation

◆ run()

int Slic3r::AvrDude::priv::run ( )
115 {
116 for (; args.size() > 0; current_args_set++) {
117 int res = run_one(args.front());
118 args.pop_front();
119 if (res != 0) {
120 return res;
121 }
122 }
123
124 return 0;
125}
size_t current_args_set
Definition avrdude-slic3r.cpp:48
int run_one(const std::vector< std::string > &args)
Definition avrdude-slic3r.cpp:95
std::deque< std::vector< std::string > > args
Definition avrdude-slic3r.cpp:45

◆ run_one()

int Slic3r::AvrDude::priv::run_one ( const std::vector< std::string > &  args)
95 {
96 std::vector<const char*> c_args { PACKAGE };
97 std::string command_line { PACKAGE };
98
99 for (const auto &arg : args) {
100 c_args.push_back(arg.c_str());
101 command_line.push_back(' ');
102 command_line.append(arg);
103 }
104 command_line.push_back('\n');
105
106 HandlerGuard guard(*this);
107
108 message_fn(command_line.c_str(), (unsigned)command_line.size());
109
110 const auto res = ::avrdude_main(static_cast<int>(c_args.size()), const_cast<char**>(c_args.data()));
111
112 return res;
113}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Definition ArrayCwiseUnaryOps.h:57
#define PACKAGE
Definition ac_cfg.h:172
int avrdude_main(int argc, char *argv[])
Definition main.c:429
MessageFn message_fn
Definition avrdude-slic3r.cpp:50

References arg(), avrdude_main(), and PACKAGE.

+ Here is the call graph for this function:

◆ set_handlers()

void Slic3r::AvrDude::priv::set_handlers ( )
71{
72 if (message_fn) {
74 } else {
75 ::avrdude_message_handler_set(nullptr, nullptr);
76 }
77
78 if (progress_fn) {
80 } else {
81 ::avrdude_progress_handler_set(nullptr, nullptr);
82 }
83
85}
void avrdude_progress_handler_set(avrdude_progress_handler_t newhandler, void *user_p)
Definition main.c:131
void avrdude_oom_handler_set(avrdude_oom_handler_t newhandler, void *user_p)
Definition main.c:158
void avrdude_message_handler_set(avrdude_message_handler_t newhandler, void *user_p)
Definition main.c:82
static avrdude_oom_handler_t avrdude_oom_handler
Definition main.c:156
static void avrdude_progress_handler_closure(const char *task, unsigned progress, void *user_p)
Definition avrdude-slic3r.cpp:29
static void avrdude_message_handler_closure(const char *msg, unsigned size, void *user_p)
Definition avrdude-slic3r.cpp:22
ProgressFn progress_fn
Definition avrdude-slic3r.cpp:51

References Slic3r::avrdude_message_handler_closure(), avrdude_message_handler_set(), avrdude_oom_handler, avrdude_oom_handler_set(), Slic3r::avrdude_progress_handler_closure(), avrdude_progress_handler_set(), message_fn, and progress_fn.

Referenced by Slic3r::AvrDude::priv::HandlerGuard::HandlerGuard().

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

◆ unset_handlers()

void Slic3r::AvrDude::priv::unset_handlers ( )
88{
89 ::avrdude_message_handler_set(nullptr, nullptr);
90 ::avrdude_progress_handler_set(nullptr, nullptr);
91 ::avrdude_oom_handler_set(nullptr, nullptr);
92}

References avrdude_message_handler_set(), avrdude_oom_handler_set(), and avrdude_progress_handler_set().

Referenced by Slic3r::AvrDude::priv::HandlerGuard::~HandlerGuard().

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

Member Data Documentation

◆ args

std::deque<std::vector<std::string> > Slic3r::AvrDude::priv::args

◆ avrdude_thread

std::thread Slic3r::AvrDude::priv::avrdude_thread

◆ cancelled

bool Slic3r::AvrDude::priv::cancelled = false

◆ complete_fn

CompleteFn Slic3r::AvrDude::priv::complete_fn

◆ current_args_set

size_t Slic3r::AvrDude::priv::current_args_set = 0

◆ exit_code

int Slic3r::AvrDude::priv::exit_code = 0

◆ message_fn

MessageFn Slic3r::AvrDude::priv::message_fn

Referenced by set_handlers().

◆ progress_fn

ProgressFn Slic3r::AvrDude::priv::progress_fn

Referenced by set_handlers().

◆ run_fn

RunFn Slic3r::AvrDude::priv::run_fn

The documentation for this struct was generated from the following file: