1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-06-11 22:48:09 +03:00

remove defaults from mqtt constructors

This commit is contained in:
Todd Treece
2015-10-22 10:09:16 -04:00
parent 371b16bfab
commit 2aed9ae737
5 changed files with 93 additions and 36 deletions

View File

@ -70,9 +70,11 @@ static uint8_t *stringprint_P(uint8_t *p, const char *s, uint16_t maxlen=0) {
// Adafruit_MQTT Definition ////////////////////////////////////////////////////
Adafruit_MQTT::Adafruit_MQTT(const char *server, uint16_t port,
const char *user, const char *pass,
const char *cid) {
Adafruit_MQTT::Adafruit_MQTT(const char *server,
uint16_t port,
const char *cid,
const char *user,
const char *pass) {
servername = server;
portnum = port;
clientid = cid;
@ -85,13 +87,14 @@ Adafruit_MQTT::Adafruit_MQTT(const char *server, uint16_t port,
}
packet_id_counter = 0;
}
Adafruit_MQTT::Adafruit_MQTT(const __FlashStringHelper *server,
uint16_t port,
const __FlashStringHelper *cid,
const __FlashStringHelper *user,
const __FlashStringHelper *pass,
const __FlashStringHelper *cid) {
const __FlashStringHelper *pass) {
servername = (const char *)server;
portnum = port;
@ -105,6 +108,46 @@ Adafruit_MQTT::Adafruit_MQTT(const __FlashStringHelper *server,
}
packet_id_counter = 0;
}
Adafruit_MQTT::Adafruit_MQTT(const char *server,
uint16_t port,
const char *user,
const char *pass) {
servername = server;
portnum = port;
clientid = "";
username = user;
password = pass;
// reset subscriptions
for (uint8_t i=0; i<MAXSUBSCRIPTIONS; i++) {
subscriptions[i] = 0;
}
packet_id_counter = 0;
}
Adafruit_MQTT::Adafruit_MQTT(const __FlashStringHelper *server,
uint16_t port,
const __FlashStringHelper *user,
const __FlashStringHelper *pass) {
servername = (const char *)server;
portnum = port;
clientid = "";
username = (const char *)user;
password = (const char *)pass;
// reset subscriptions
for (uint8_t i=0; i<MAXSUBSCRIPTIONS; i++) {
subscriptions[i] = 0;
}
packet_id_counter = 0;
}
int8_t Adafruit_MQTT::connect() {