Adafruit IO Arduino Library
|
Class for interacting with Adafruit IO. More...
#include <AdafruitIO.h>
Public Member Functions | |
AdafruitIO (const char *user, const char *key) | |
Instantiate the AIO object. More... | |
virtual | ~AdafruitIO () |
Destructor to end the AIO object. | |
void | connect () |
Connects to AIO, setting up using parameters set when the class is instantiated. | |
void | wifi_disconnect () |
Disconnects from WiFi. | |
aio_status_t | run (uint16_t busywait_ms=0, bool fail_fast=false) |
Must be called frequently to keep AIO connections alive. When called with no arguments run() will try to repair MQTT and WiFi connections before returning. To avoid potentially long timeout delays, sketches can use the busywait_ms and fail_fast arguments to return an imperfect status quickly. The calling sketch will then need to respond appropriately to that status. More... | |
AdafruitIO_Feed * | feed (const char *name) |
Create a new AIO feed. More... | |
AdafruitIO_Feed * | feed (const char *name, const char *owner) |
Create a new AIO feed. More... | |
AdafruitIO_Group * | group (const char *name) |
Create a new AIO group. More... | |
AdafruitIO_Dashboard * | dashboard (const char *name) |
Create a new AIO dashboard. More... | |
AdafruitIO_Time * | time (aio_time_format_t format) |
Create a new AIO time. More... | |
const __FlashStringHelper * | statusText () |
Provide status explanation strings. More... | |
aio_status_t | status () |
Status check. More... | |
virtual aio_status_t | networkStatus ()=0 |
Returns network module status. More... | |
aio_status_t | mqttStatus (bool fail_fast=false) |
Returns MQTT connection status. More... | |
char * | boardID () |
Identify the board. More... | |
const char * | boardType () |
Identify the board type. More... | |
char * | version () |
Identify the software version. More... | |
char * | userAgent () |
Identify the user agent. More... | |
virtual const char * | connectionType ()=0 |
Returns the Adafruit IO network module connection type. More... | |
Protected Member Functions | |
virtual void | _connect ()=0 |
Establishes a connection with the Adafruit IO MQTT broker. More... | |
virtual void | _disconnect ()=0 |
Disconnects from the Adafruit IO MQTT broker. More... | |
Protected Attributes | |
aio_status_t | _status = AIO_IDLE |
uint32_t | _last_ping |
uint32_t | _last_mqtt_connect = 0 |
Adafruit_MQTT * | _mqtt |
HttpClient * | _http |
char | _version [10] |
const char * | _host = "io.adafruit.com" |
uint16_t | _mqtt_port = 8883 |
uint16_t | _mqtt_eth_port |
uint16_t | _http_port = 443 |
uint16_t | _packetread_timeout |
const char * | _username |
const char * | _key |
char * | _err_topic |
char * | _throttle_topic |
char * | _user_agent |
Adafruit_MQTT_Subscribe * | _err_sub |
Adafruit_MQTT_Subscribe * | _throttle_sub |
Friends | |
class | AdafruitIO_Block |
AdafruitIO_Block addition. | |
Class for interacting with Adafruit IO.
AdafruitIO::AdafruitIO | ( | const char * | user, |
const char * | key | ||
) |
Instantiate the AIO object.
user | A pointer to a constant AIO user name. |
key | A pointer to a constant key for the user name. |
aio_status_t AdafruitIO::run | ( | uint16_t | busywait_ms = 0 , |
bool | fail_fast = false |
||
) |
Must be called frequently to keep AIO connections alive. When called with no arguments run() will try to repair MQTT and WiFi connections before returning. To avoid potentially long timeout delays, sketches can use the busywait_ms and fail_fast arguments to return an imperfect status quickly. The calling sketch will then need to respond appropriately to that status.
busywait_ms | The packet read timeout, optional. |
fail_fast | Set true to skip retries and return with status immediately, optional. |
AdafruitIO_Feed * AdafruitIO::feed | ( | const char * | name | ) |
Create a new AIO feed.
name | The AIO name of the feed. |
AdafruitIO_Feed * AdafruitIO::feed | ( | const char * | name, |
const char * | owner | ||
) |
Create a new AIO feed.
name | The AIO name of the feed. |
owner | The AIO name of the user that owns the feed, if not the current user. |
AdafruitIO_Group * AdafruitIO::group | ( | const char * | name | ) |
Create a new AIO group.
name | The AIO name of the group. |
AdafruitIO_Dashboard * AdafruitIO::dashboard | ( | const char * | name | ) |
Create a new AIO dashboard.
name | The AIO name of the dashboard. |
AdafruitIO_Time * AdafruitIO::time | ( | aio_time_format_t | format | ) |
Create a new AIO time.
format | A format specifier. |
const __FlashStringHelper * AdafruitIO::statusText | ( | ) |
Provide status explanation strings.
aio_status_t AdafruitIO::status | ( | ) |
Status check.
|
pure virtual |
aio_status_t AdafruitIO::mqttStatus | ( | bool | fail_fast = false | ) |
Returns MQTT connection status.
Checks connection status with Adafruit IO's MQTT broker.
fail_fast | Set true to skip retries and return with status immediately. |
char * AdafruitIO::boardID | ( | ) |
Identify the board.
const char * AdafruitIO::boardType | ( | ) |
Identify the board type.
char * AdafruitIO::version | ( | ) |
Identify the software version.
char * AdafruitIO::userAgent | ( | ) |
Identify the user agent.
|
pure virtual |
Returns the Adafruit IO network module connection type.
Implemented in AdafruitIO_FONA, and AdafruitIO_Ethernet.
|
protectedpure virtual |
Establishes a connection with the Adafruit IO MQTT broker.
Implemented in AdafruitIO_FONA, and AdafruitIO_Ethernet.
|
protectedpure virtual |
Disconnects from the Adafruit IO MQTT broker.
Implemented in AdafruitIO_FONA, and AdafruitIO_Ethernet.
|
protected |
Adafruit IO Connection Status
|
protected |
Previous time when client pinged Adafruit IO, in milliseconds
|
protected |
Previous time when client connected to Adafruit IO, in milliseconds
|
protected |
Reference to Adafruit_MQTT, _mqtt.
|
protected |
Reference to HTTPClient, _http
|
protected |
Adafruit IO Arduino library version
|
protected |
Adafruit IO URL
|
protected |
Adafruit IO MQTT SSL port
|
protected |
Adafruit IO MQTT insecure port, used by ethernet clients.
|
protected |
Adafruit IO HTTP SSL port
|
protected |
Maximum amount of time to wait before processing packets.
|
protected |
Adafruit IO Username.
|
protected |
Adafruit IO Key.
|
protected |
Adafruit IO MQTT error message topic.
|
protected |
Adafruit IO MQTT throttle message topic.
|
protected |
Identifies the Adafruit IO client.
|
protected |
Subscription to Adafruit IO Error topic.
|
protected |
Subscription to Adafruit IO Throttle topic.