OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Bonjour Class Reference

Bonjour lookup performer. More...

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Bonjour.hpp>

Inheritance diagram for Slic3r::Bonjour:
Collaboration diagram for Slic3r::Bonjour:

Classes

struct  priv

Public Types

typedef std::shared_ptr< Bonjour > Ptr
typedef std::function< void(BonjourReply &&)> ReplyFn
typedef std::function< void()> CompleteFn
typedef std::function< void(const std::vector< BonjourReply > &)> ResolveFn
typedef std::set< std::string > TxtKeys

Public Member Functions

 Bonjour (std::string service)
 Bonjour (Bonjour &&other)
 ~Bonjour ()
Bonjour & set_protocol (std::string protocol)
Bonjour & set_txt_keys (TxtKeys txt_keys)
Bonjour & set_timeout (unsigned timeout)
Bonjour & set_retries (unsigned retries)
Bonjour & set_hostname (const std::string &hostname)
Bonjour & on_reply (ReplyFn fn)
Bonjour & on_complete (CompleteFn fn)
Bonjour & on_resolve (ResolveFn fn)
Ptr lookup ()
Ptr resolve ()
void resolve_sync ()

Private Attributes

std::unique_ptr< priv > p

Detailed Description

Bonjour lookup performer.

Member Typedef Documentation

◆ CompleteFn

typedef std::function<void()> Slic3r::Bonjour::CompleteFn

◆ Ptr

typedef std::shared_ptr<Bonjour> Slic3r::Bonjour::Ptr

◆ ReplyFn

typedef std::function<void(BonjourReply &&)> Slic3r::Bonjour::ReplyFn

◆ ResolveFn

typedef std::function<void(const std::vector<BonjourReply>&)> Slic3r::Bonjour::ResolveFn

◆ TxtKeys

typedef std::set<std::string> Slic3r::Bonjour::TxtKeys

Constructor & Destructor Documentation

◆ Bonjour() [1/2]

Slic3r::Bonjour::Bonjour ( std::string service)
1131 : p(new priv(std::move(service)))
1132{}
std::unique_ptr< priv > p
Definition Bonjour.hpp:103
Definition Bonjour.cpp:855

References p.

Referenced by Bonjour(), on_complete(), on_reply(), on_resolve(), set_hostname(), set_protocol(), set_retries(), set_timeout(), and set_txt_keys().

Here is the caller graph for this function:

◆ Bonjour() [2/2]

Slic3r::Bonjour::Bonjour ( Bonjour && other)
1134: p(std::move(other.p)) {}

References Bonjour(), and p.

Here is the call graph for this function:

◆ ~Bonjour()

Slic3r::Bonjour::~Bonjour ( )
1137{
1138 if (p && p->io_thread.joinable()) {
1139 p->io_thread.detach();
1140 }
1141}

References p.

Member Function Documentation

◆ lookup()

Bonjour::Ptr Slic3r::Bonjour::lookup ( )
1192{
1193 auto self = std::make_shared<Bonjour>(std::move(*this));
1194
1195 if (self->p) {
1196 auto io_thread = std::thread([self]() {
1197 self->p->lookup_perform();
1198 });
1199 self->p->io_thread = std::move(io_thread);
1200 }
1201
1202 return self;
1203}

◆ on_complete()

Bonjour & Slic3r::Bonjour::on_complete ( CompleteFn fn)
1180{
1181 if (p) { p->completefn = std::move(fn); }
1182 return *this;
1183}

References Bonjour(), and p.

Here is the call graph for this function:

◆ on_reply()

Bonjour & Slic3r::Bonjour::on_reply ( ReplyFn fn)
1174{
1175 if (p) { p->replyfn = std::move(fn); }
1176 return *this;
1177}

References Bonjour(), and p.

Referenced by Slic3r::BonjourDialog::show_and_lookup().

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

◆ on_resolve()

Bonjour & Slic3r::Bonjour::on_resolve ( ResolveFn fn)
1186{
1187 if (p) { p->resolvefn = std::move(fn); }
1188 return *this;
1189}

References Bonjour(), and p.

Referenced by Slic3r::ElegooLink::upload(), and Slic3r::OctoPrint::upload().

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

◆ resolve()

Bonjour::Ptr Slic3r::Bonjour::resolve ( )
1207{
1208 auto self = std::make_shared<Bonjour>(std::move(*this));
1209
1210 if (self->p) {
1211 auto io_thread = std::thread([self]() {
1212 self->p->resolve_perform();
1213 });
1214 self->p->io_thread = std::move(io_thread);
1215 }
1216
1217 return self;
1218}

◆ resolve_sync()

void Slic3r::Bonjour::resolve_sync ( )
1221{
1222 if (p)
1223 p->resolve_perform();
1224}

References p.

◆ set_hostname()

Bonjour & Slic3r::Bonjour::set_hostname ( const std::string & hostname)
1162{
1163 if (p) { p->hostname = hostname; }
1164 return *this;
1165}

References Bonjour(), and p.

Referenced by Slic3r::ElegooLink::upload(), and Slic3r::OctoPrint::upload().

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

◆ set_protocol()

Bonjour & Slic3r::Bonjour::set_protocol ( std::string protocol)
1144{
1145 if (p) { p->protocol = std::move(protocol); }
1146 return *this;
1147}

References Bonjour(), and p.

Here is the call graph for this function:

◆ set_retries()

Bonjour & Slic3r::Bonjour::set_retries ( unsigned retries)
1168{
1169 if (p && retries > 0) { p->retries = retries; }
1170 return *this;
1171}

References Bonjour(), and p.

Referenced by Slic3r::BonjourDialog::show_and_lookup(), Slic3r::ElegooLink::upload(), and Slic3r::OctoPrint::upload().

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

◆ set_timeout()

Bonjour & Slic3r::Bonjour::set_timeout ( unsigned timeout)
1156{
1157 if (p) { p->timeout = timeout; }
1158 return *this;
1159}

References Bonjour(), and p.

Referenced by Slic3r::BonjourDialog::show_and_lookup(), Slic3r::ElegooLink::upload(), and Slic3r::OctoPrint::upload().

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

◆ set_txt_keys()

Bonjour & Slic3r::Bonjour::set_txt_keys ( TxtKeys txt_keys)
1150{
1151 if (p) { p->txt_keys = std::move(txt_keys); }
1152 return *this;
1153}

References Bonjour(), and p.

Referenced by Slic3r::BonjourDialog::show_and_lookup().

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

Member Data Documentation

◆ p


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Bonjour.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Bonjour.cpp