Skip to content

Commit

Permalink
Add .config() for Particle
Browse files Browse the repository at this point in the history
  • Loading branch information
vshymanskyy committed Dec 26, 2016
1 parent 0d7c5f5 commit 2879206
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/BlynkParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,37 @@ class BlynkParticle
: Base(transp)
{}

// TODO: config
void config(const char* auth,
const char* domain = BLYNK_DEFAULT_DOMAIN,
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
this->conn.begin(domain, port);
}

void config(const char* auth,
IPAddress addr,
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
this->conn.begin(addr, port);
}

void begin( const char* auth,
const char* domain = BLYNK_DEFAULT_DOMAIN,
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
::delay(1000); // Give the board time to settle
this->conn.begin(domain, port);
config(auth, domain, port);
while(this->connect() != true) {}
}

void begin( const char* auth,
IPAddress addr,
uint16_t port)
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
::delay(1000); // Give the board time to settle
this->conn.begin(addr, port);
config(auth, addr, port);
while(this->connect() != true) {}
}
private:
Expand Down

0 comments on commit 2879206

Please sign in to comment.