Skip to content

Commit a770ba9

Browse files
committed
add preproc for return types
1 parent a21c9a3 commit a770ba9

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit IO Arduino
2-
version=4.2.3
2+
version=4.2.4
33
author=Adafruit
44
maintainer=Adafruit <[email protected]>
55
sentence=Arduino library to access Adafruit IO.

src/AdafruitIO.cpp

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,71 @@ AdafruitIO_Dashboard *AdafruitIO::dashboard(const char *name) {
243243
return new AdafruitIO_Dashboard(this, name);
244244
}
245245

246+
// due to breaking change within Arduino ESP32 BSP v2.0.8
247+
// see: https://github.com/espressif/arduino-esp32/pull/7941
248+
#ifdef ARDUINO_ARCH_ESP32
249+
/**************************************************************************/
250+
/*!
251+
@brief Provide status explanation strings.
252+
@return A pointer to the status string literal, _status. _status is
253+
the AIO status value
254+
*/
255+
/**************************************************************************/
256+
const char *AdafruitIO::statusText() {
257+
const char *statusMsg;
258+
switch (_status) {
259+
260+
// CONNECTING
261+
case AIO_IDLE:
262+
statusMsg = "Idle. Waiting for connect to be called...";
263+
break;
264+
case AIO_NET_DISCONNECTED:
265+
statusMsg = "Network disconnected.";
266+
break;
267+
case AIO_DISCONNECTED:
268+
statusMsg = "Disconnected from Adafruit IO.";
269+
break;
270+
271+
// FAILURE
272+
case AIO_NET_CONNECT_FAILED:
273+
statusMsg = "Network connection failed.";
274+
break;
275+
case AIO_CONNECT_FAILED:
276+
statusMsg = "Adafruit IO connection failed.";
277+
break;
278+
case AIO_FINGERPRINT_INVALID:
279+
statusMsg = "Adafruit IO SSL fingerprint verification failed.";
280+
break;
281+
case AIO_AUTH_FAILED:
282+
statusMsg = "Adafruit IO authentication failed.";
283+
break;
284+
285+
// SUCCESS
286+
case AIO_NET_CONNECTED:
287+
statusMsg = "Network connected.";
288+
break;
289+
case AIO_CONNECTED:
290+
statusMsg = "Adafruit IO connected.";
291+
break;
292+
case AIO_CONNECTED_INSECURE:
293+
statusMsg =
294+
"Adafruit IO connected. **THIS CONNECTION IS INSECURE** SSL/TLS "
295+
"not supported for this platform.";
296+
break;
297+
case AIO_FINGERPRINT_UNSUPPORTED:
298+
statusMsg = "Adafruit IO connected over SSL/TLS. Fingerprint verification "
299+
"unsupported.";
300+
break;
301+
case AIO_FINGERPRINT_VALID:
302+
statusMsg = "Adafruit IO connected over SSL/TLS. Fingerprint valid.";
303+
break;
304+
default:
305+
statusMsg = "Unknown status code";
306+
break;
307+
}
308+
return statusMsg;
309+
}
310+
#else
246311
/**************************************************************************/
247312
/*!
248313
@brief Provide status explanation strings.
@@ -289,6 +354,7 @@ const __FlashStringHelper *AdafruitIO::statusText() {
289354
return F("Unknown status code");
290355
}
291356
}
357+
#endif
292358

293359
/**************************************************************************/
294360
/*!

src/AdafruitIO.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ class AdafruitIO {
8787
AdafruitIO_Dashboard *dashboard(const char *name);
8888
AdafruitIO_Time *time(aio_time_format_t format);
8989

90+
// due to breaking change within Arduino ESP32 BSP v2.0.8
91+
// see: https://github.com/espressif/arduino-esp32/pull/7941
92+
#ifdef ARDUINO_ARCH_ESP32
93+
const char *statusText();
94+
#else
9095
const __FlashStringHelper *statusText();
96+
#endif;
9197

9298
aio_status_t status();
9399
/********************************************************************/

0 commit comments

Comments
 (0)