allow unauthenticated connections to mqtt brokers
This commit is contained in:
parent
9b23f6747e
commit
f793f8d2d0
@ -232,6 +232,20 @@ int8_t Adafruit_MQTT::connect() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t Adafruit_MQTT::connect(const char *user, const char *pass)
|
||||||
|
{
|
||||||
|
username = user;
|
||||||
|
password = pass;
|
||||||
|
return connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
int8_t Adafruit_MQTT::connect(const __FlashStringHelper *user, const __FlashStringHelper *pass)
|
||||||
|
{
|
||||||
|
username = (const char*)user;
|
||||||
|
password = (const char*)pass;
|
||||||
|
return connect();
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t Adafruit_MQTT::processPacketsUntil(uint8_t *buffer, uint8_t waitforpackettype, uint16_t timeout) {
|
uint16_t Adafruit_MQTT::processPacketsUntil(uint8_t *buffer, uint8_t waitforpackettype, uint16_t timeout) {
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
while (len = readFullPacket(buffer, MAXBUFFERSIZE, timeout)) {
|
while (len = readFullPacket(buffer, MAXBUFFERSIZE, timeout)) {
|
||||||
|
@ -133,8 +133,8 @@ class Adafruit_MQTT {
|
|||||||
const __FlashStringHelper *pass);
|
const __FlashStringHelper *pass);
|
||||||
Adafruit_MQTT(const char *server,
|
Adafruit_MQTT(const char *server,
|
||||||
uint16_t port,
|
uint16_t port,
|
||||||
const char *user,
|
const char *user = "",
|
||||||
const char *pass);
|
const char *pass = "");
|
||||||
Adafruit_MQTT(const __FlashStringHelper *server,
|
Adafruit_MQTT(const __FlashStringHelper *server,
|
||||||
uint16_t port,
|
uint16_t port,
|
||||||
const __FlashStringHelper *user,
|
const __FlashStringHelper *user,
|
||||||
@ -153,6 +153,8 @@ class Adafruit_MQTT {
|
|||||||
// Use connectErrorString() to get a printable string version of the
|
// Use connectErrorString() to get a printable string version of the
|
||||||
// error.
|
// error.
|
||||||
int8_t connect();
|
int8_t connect();
|
||||||
|
int8_t connect(const char *user, const char *pass);
|
||||||
|
int8_t connect(const __FlashStringHelper *user, const __FlashStringHelper *pass);
|
||||||
|
|
||||||
// Return a printable string version of the error code returned by
|
// Return a printable string version of the error code returned by
|
||||||
// connect(). This returns a __FlashStringHelper*, which points to a
|
// connect(). This returns a __FlashStringHelper*, which points to a
|
||||||
|
@ -44,7 +44,7 @@ class Adafruit_MQTT_CC3000 : public Adafruit_MQTT {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Adafruit_MQTT_CC3000(Adafruit_CC3000 *cc3k, const char *server, uint16_t port,
|
Adafruit_MQTT_CC3000(Adafruit_CC3000 *cc3k, const char *server, uint16_t port,
|
||||||
const char *user, const char *pass):
|
const char *user = "", const char *pass = ""):
|
||||||
Adafruit_MQTT(server, port, user, pass),
|
Adafruit_MQTT(server, port, user, pass),
|
||||||
cc3000(cc3k)
|
cc3000(cc3k)
|
||||||
{}
|
{}
|
||||||
|
@ -42,7 +42,7 @@ class Adafruit_MQTT_Client : public Adafruit_MQTT {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Adafruit_MQTT_Client(Client *client, const char *server, uint16_t port,
|
Adafruit_MQTT_Client(Client *client, const char *server, uint16_t port,
|
||||||
const char *user, const char *pass):
|
const char *user="", const char *pass=""):
|
||||||
Adafruit_MQTT(server, port, user, pass),
|
Adafruit_MQTT(server, port, user, pass),
|
||||||
client(client)
|
client(client)
|
||||||
{}
|
{}
|
||||||
|
@ -42,7 +42,7 @@ class Adafruit_MQTT_FONA : public Adafruit_MQTT {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Adafruit_MQTT_FONA(Adafruit_FONA *f, const char *server, uint16_t port,
|
Adafruit_MQTT_FONA(Adafruit_FONA *f, const char *server, uint16_t port,
|
||||||
const char *user, const char *pass):
|
const char *user="", const char *pass=""):
|
||||||
Adafruit_MQTT(server, port, user, pass),
|
Adafruit_MQTT(server, port, user, pass),
|
||||||
fona(f)
|
fona(f)
|
||||||
{}
|
{}
|
||||||
|
Loading…
Reference in New Issue
Block a user