You've already forked Adafruit_MQTT_Library
mirror of
https://github.com/adafruit/Adafruit_MQTT_Library.git
synced 2025-08-01 00:24:22 +03:00
Add Adfruit_MQTT::connectErrorString() method
This easily allows printing error messages without having to hard-code return values in the sketch and makes the example sketches a bit more concise.
This commit is contained in:
@ -105,8 +105,16 @@ class Adafruit_MQTT {
|
||||
// 4 = Bad username or password
|
||||
// 5 = Not authenticated
|
||||
// 6 = Failed to subscribe
|
||||
// Use connectErrorString() to get a printable string version of the
|
||||
// error.
|
||||
int8_t connect();
|
||||
|
||||
// Return a printable string version of the error code returned by
|
||||
// connect(). This returns a __FlashStringHelper*, which points to a
|
||||
// string stored in flash, but can be directly passed to e.g.
|
||||
// Serial.println without any further processing.
|
||||
const __FlashStringHelper* connectErrorString(int8_t code);
|
||||
|
||||
// Disconnect from the MQTT server. Returns true if disconnected, false
|
||||
// otherwise.
|
||||
virtual bool disconnect() = 0; // Subclasses need to fill this in!
|
||||
|
Reference in New Issue
Block a user