You've already forked Adafruit_MQTT_Library
mirror of
https://github.com/adafruit/Adafruit_MQTT_Library.git
synced 2025-07-23 05:40:59 +03:00
fix return type for esp bsp 2.0.8
This commit is contained in:
@ -327,6 +327,47 @@ uint16_t Adafruit_MQTT::readFullPacket(uint8_t *buffer, uint16_t maxsize,
|
|||||||
return ((pbuff - buffer) + rlen);
|
return ((pbuff - buffer) + rlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
const char *Adafruit_MQTT::connectErrorString(int8_t code) {
|
||||||
|
const char *statusMsg;
|
||||||
|
switch (code) {
|
||||||
|
case 1:
|
||||||
|
statusMsg =
|
||||||
|
"The Server does not support the level of the MQTT protocol requested";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
statusMsg =
|
||||||
|
"The Client identifier is correct UTF-8 but not allowed by the Server";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
statusMsg = "The MQTT service is unavailable";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
statusMsg = "The data in the user name or password is malformed";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
statusMsg = "Not authorized to connect";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
statusMsg = "Exceeded reconnect rate limit. Please try again later.";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
statusMsg = "You have been banned from connecting. Please contact the MQTT "
|
||||||
|
"server administrator for more details.";
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
statusMsg = "Connection failed";
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
statusMsg = "Failed to subscribe";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
statusMsg = "Unknown error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return statusMsg;
|
||||||
|
}
|
||||||
|
#else
|
||||||
const __FlashStringHelper *Adafruit_MQTT::connectErrorString(int8_t code) {
|
const __FlashStringHelper *Adafruit_MQTT::connectErrorString(int8_t code) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -354,6 +395,7 @@ const __FlashStringHelper *Adafruit_MQTT::connectErrorString(int8_t code) {
|
|||||||
return F("Unknown error");
|
return F("Unknown error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool Adafruit_MQTT::disconnect() {
|
bool Adafruit_MQTT::disconnect() {
|
||||||
|
|
||||||
|
@ -166,11 +166,19 @@ public:
|
|||||||
int8_t connect();
|
int8_t connect();
|
||||||
int8_t connect(const char *user, const char *pass);
|
int8_t connect(const char *user, const char *pass);
|
||||||
|
|
||||||
// Return a printable string version of the error code returned by
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
// Returns a printable string version of the error code returned by
|
||||||
|
// connect(). Preprocessor due to breaking change within
|
||||||
|
// Arduino ESP32 BSP v2.0.8
|
||||||
|
// see: https://github.com/espressif/arduino-esp32/pull/7941
|
||||||
|
const char *connectErrorString(int8_t code);
|
||||||
|
#else
|
||||||
|
// Returns 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
|
||||||
// string stored in flash, but can be directly passed to e.g.
|
// string stored in flash, but can be directly passed to e.g.
|
||||||
// Serial.println without any further processing.
|
// Serial.println without any further processing.
|
||||||
const __FlashStringHelper *connectErrorString(int8_t code);
|
const __FlashStringHelper *connectErrorString(int8_t code);
|
||||||
|
#endif;
|
||||||
|
|
||||||
// Sends MQTT disconnect packet and calls disconnectServer()
|
// Sends MQTT disconnect packet and calls disconnectServer()
|
||||||
bool disconnect();
|
bool disconnect();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=Adafruit MQTT Library
|
name=Adafruit MQTT Library
|
||||||
version=2.5.2
|
version=2.5.3
|
||||||
author=Adafruit
|
author=Adafruit
|
||||||
maintainer=Adafruit <info@adafruit.com>
|
maintainer=Adafruit <info@adafruit.com>
|
||||||
sentence=MQTT library that supports the FONA, ESP8266, ESP32, Yun, and generic Arduino Client hardware.
|
sentence=MQTT library that supports the FONA, ESP8266, ESP32, Yun, and generic Arduino Client hardware.
|
||||||
|
Reference in New Issue
Block a user