1
0
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:
Matthijs Kooijman
2015-07-02 13:01:05 +02:00
parent 73f5be4e5c
commit 6879df86f6
5 changed files with 25 additions and 34 deletions

View File

@ -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!