Skip to content

Commit 4a3309f

Browse files
author
brentru
committed
update AdafruitIO, Definitions
1 parent 32c497b commit 4a3309f

4 files changed

Lines changed: 55 additions & 48 deletions

File tree

src/AdafruitIO.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
A pointer to a constant AIO user name.
2323
@param key
2424
A pointer to a constant key for the user name.
25-
@return none
2625
*/
2726
/**************************************************************************/
2827
AdafruitIO::AdafruitIO(const char *user, const char *key) {
@@ -43,7 +42,6 @@ AdafruitIO::AdafruitIO(const char *user, const char *key) {
4342
/**************************************************************************/
4443
/*!
4544
@brief Initialize the AIO object.
46-
@return none
4745
*/
4846
/**************************************************************************/
4947
void AdafruitIO::_init() {
@@ -87,7 +85,6 @@ void AdafruitIO::_init() {
8785
/**************************************************************************/
8886
/*!
8987
@brief Destructor to end the AIO object.
90-
@return none
9188
*/
9289
/**************************************************************************/
9390
AdafruitIO::~AdafruitIO() {
@@ -111,7 +108,6 @@ AdafruitIO::~AdafruitIO() {
111108
An error string to print.
112109
@param len
113110
The length of the error string.
114-
@return none
115111
*/
116112
/**************************************************************************/
117113
void errorCallback(char *err, uint16_t len) {
@@ -125,7 +121,6 @@ void errorCallback(char *err, uint16_t len) {
125121
/*!
126122
@brief Connects to AIO, setting up using parameters set when the
127123
class is instantiated.
128-
@return none
129124
*/
130125
/**************************************************************************/
131126
void AdafruitIO::connect() {
@@ -156,7 +151,6 @@ void AdafruitIO::connect() {
156151
/**************************************************************************/
157152
/*!
158153
@brief Disconnects from WiFi.
159-
@return none
160154
*/
161155
/**************************************************************************/
162156
void AdafruitIO::wifi_disconnect() {
@@ -171,16 +165,24 @@ void AdafruitIO::wifi_disconnect() {
171165
@brief Create a new AIO feed.
172166
@param name
173167
The AIO name of the feed.
174-
@param owner
175-
The AIO name of the user that owns the feed, if not the current
176-
user.
177168
@return A pointer to the feed.
178169
*/
179170
/**************************************************************************/
180171
AdafruitIO_Feed *AdafruitIO::feed(const char *name) {
181172
return new AdafruitIO_Feed(this, name);
182173
}
183174

175+
/**************************************************************************/
176+
/*!
177+
@brief Create a new AIO feed.
178+
@param name
179+
The AIO name of the feed.
180+
@param owner
181+
The AIO name of the user that owns the feed, if not the current
182+
user.
183+
@return A pointer to the feed.
184+
*/
185+
/**************************************************************************/
184186
AdafruitIO_Feed *AdafruitIO::feed(const char *name, const char *owner) {
185187
return new AdafruitIO_Feed(this, name, owner);
186188
}

src/AdafruitIO.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,43 +67,43 @@ class AdafruitIO {
6767
const __FlashStringHelper *statusText();
6868

6969
aio_status_t status();
70-
virtual aio_status_t networkStatus() = 0;
70+
virtual aio_status_t networkStatus() = 0; /*!< Network module status */
7171
aio_status_t mqttStatus(bool fail_fast = false);
7272

7373
char *boardID();
7474
const char *boardType();
7575
char *version();
7676
char *userAgent();
77-
virtual const char *connectionType() = 0;
77+
virtual const char *connectionType() = 0; /*!< Network module type */
7878

7979
protected:
80-
virtual void _connect() = 0;
81-
virtual void _disconnect() = 0;
82-
aio_status_t _status = AIO_IDLE;
83-
uint32_t _last_ping = 0;
84-
uint32_t _last_mqtt_connect = 0;
80+
virtual void _connect() = 0; /*!< Connect to Adafruit IO MQTT Broker */
81+
virtual void _disconnect() = 0; /*!< Disconnect from Adafruit IO MQTT Broker */
82+
aio_status_t _status = AIO_IDLE; /*!< Adafruit IO Connection Status */
83+
uint32_t _last_ping = 0; /*!< Previous time when client pinged Adafruit IO, in milliseconds */
84+
uint32_t _last_mqtt_connect = 0; /*!< Previous time when client connected to Adafruit IO, in milliseconds */
8585

86-
Adafruit_MQTT *_mqtt;
87-
HttpClient *_http;
86+
Adafruit_MQTT *_mqtt; /*!< Reference to Adafruit_MQTT, _mqtt. */
87+
HttpClient *_http; /*!< Reference to HTTPClient, _http */
8888

89-
char _version[10];
89+
char _version[10]; /*!< Adafruit IO Arduino library version */
9090

91-
const char *_host = "io.adafruit.com";
92-
uint16_t _mqtt_port = 8883;
93-
uint16_t _mqtt_eth_port = 1883;
94-
uint16_t _http_port = 443;
91+
const char *_host = "io.adafruit.com"; /*!< Adafruit IO URL */
92+
uint16_t _mqtt_port = 8883; /*!< Adafruit IO MQTT SSL port */
93+
uint16_t _mqtt_eth_port = 1883; /*!< Adafruit IO MQTT insecure port, used by ethernet clients. */
94+
uint16_t _http_port = 443; /*!< Adafruit IO HTTP SSL port */
9595

96-
uint16_t _packetread_timeout;
96+
uint16_t _packetread_timeout; /*!< Maximum amount of time to wait before processing packets. */
9797

98-
const char *_username;
99-
const char *_key;
98+
const char *_username; /*!< Adafruit IO Username. */
99+
const char *_key; /*!< Adafruit IO Key. */
100100

101-
char *_err_topic;
102-
char *_throttle_topic;
103-
char *_user_agent;
101+
char *_err_topic; /*!< Adafruit IO MQTT error message topic. */
102+
char *_throttle_topic; /*!< Adafruit IO MQTT throttle message topic. */
103+
char *_user_agent; /*!< Identifies the Adafruit IO client. */
104104

105-
Adafruit_MQTT_Subscribe *_err_sub;
106-
Adafruit_MQTT_Subscribe *_throttle_sub;
105+
Adafruit_MQTT_Subscribe *_err_sub; /*!< Subscription to Adafruit IO Error topic. */
106+
Adafruit_MQTT_Subscribe *_throttle_sub; /*!< Subscription to Adafruit IO Throttle topic. */
107107

108108
private:
109109
void _init();

src/AdafruitIO_Dashboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class AdafruitIO_Dashboard {
4444
AdafruitIO_Dashboard(AdafruitIO *io, const char *name);
4545
~AdafruitIO_Dashboard();
4646

47-
const char *name;
48-
const char *user();
47+
const char *name; /*!< Dashboard name. */
48+
const char *user(); /*!< Dashboard owner's Adafruit IO username. */
4949

5050
AdafruitIO *io();
5151

@@ -64,7 +64,7 @@ class AdafruitIO_Dashboard {
6464
ImageBlock *addImageBlock(AdafruitIO_Feed *feed);
6565

6666
private:
67-
AdafruitIO *_io;
67+
AdafruitIO *_io; /*!< Reference to Adafruit IO client */
6868
};
6969

7070
#endif // ADAFRUITIO_DASHBOARD_H

src/AdafruitIO_Definitions.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@
1616
#ifndef ADAFRUITIO_DEFINITIONS_H_
1717
#define ADAFRUITIO_DEFINITIONS_H_
1818

19-
#define ADAFRUITIO_VERSION_MAJOR 3 /// < Adafruit IO Arduino Major Semvar
20-
#define ADAFRUITIO_VERSION_MINOR 2 /// < Adafruit IO Arduino Minor Semvar
21-
#define ADAFRUITIO_VERSION_PATCH 0 /// < Adafruit IO Arduino Patch Semvar
19+
#define ADAFRUITIO_VERSION_MAJOR 3 ///< Adafruit IO Arduino Major Semvar
20+
#define ADAFRUITIO_VERSION_MINOR 2 ///< Adafruit IO Arduino Minor Semvar
21+
#define ADAFRUITIO_VERSION_PATCH 0 ///< Adafruit IO Arduino Patch Semvar
2222

2323
// forward declaration
2424
class AdafruitIO_Data;
2525

26-
typedef void (*AdafruitIODataCallbackType)(AdafruitIO_Data *data);
26+
typedef void (*AdafruitIODataCallbackType)(AdafruitIO_Data *data); /*!< Data callback type */
2727

28+
29+
/**************************************************************************/
30+
/*!
31+
@brief Class that contains methods for Adafruit IO MQTT callbacks.
32+
*/
33+
/**************************************************************************/
2834
class AdafruitIOGroupCallback {
2935
public:
3036
AdafruitIOGroupCallback(const char *f, AdafruitIODataCallbackType cb) {
@@ -51,32 +57,32 @@ class AdafruitIOGroupCallback {
5157

5258
// note: if you're using something like Zero or Due, change the below to
5359
// SerialUSB
54-
#define AIO_PRINTER Serial /// < Where debug messages will be printed
60+
#define AIO_PRINTER Serial ///< Where debug messages will be printed
5561

5662
// Define actual debug output functions when necessary.
5763
#ifdef AIO_DEBUG
5864
#define AIO_DEBUG_PRINT(...) \
59-
{ AIO_PRINTER.print(__VA_ARGS__); } /// < Debug output for Printer
65+
{ AIO_PRINTER.print(__VA_ARGS__); } ///< Prints debug output.
6066
#define AIO_DEBUG_PRINTLN(...) \
61-
{ AIO_PRINTER.println(__VA_ARGS__); } /// < Println-like debug output for Printer
67+
{ AIO_PRINTER.println(__VA_ARGS__); } ///< Prints line from debug output.
6268
#else
6369
#define AIO_DEBUG_PRINT(...) \
64-
{} /// < Prints if AIO_DEBUG is True
70+
{} ///< Prints debug output
6571
#define AIO_DEBUG_PRINTLN(...) \
66-
{} /// < Prints line if AIO_DEBUG is True
72+
{} ///< Prints line from debug output.
6773
#endif
6874

6975
// Define actual error output functions when necessary.
7076
#ifdef AIO_ERROR
7177
#define AIO_ERROR_PRINT(...) \
72-
{ AIO_PRINTER.print(__VA_ARGS__); }
78+
{ AIO_PRINTER.print(__VA_ARGS__); } ///< Prints error output
7379
#define AIO_ERROR_PRINTLN(...) \
74-
{ AIO_PRINTER.println(__VA_ARGS__); }
80+
{ AIO_PRINTER.println(__VA_ARGS__); } ///< Prints line from error output
7581
#else
7682
#define AIO_ERROR_PRINT(...) \
77-
{}
83+
{} ///< Prints error output.
7884
#define AIO_ERROR_PRINTLN(...) \
79-
{}
85+
{} ///< Prints line from error output.
8086
#endif
8187

8288
#define AIO_PING_INTERVAL 60000 ///< Adafruit IO Ping Interval, in milliseconds
@@ -112,7 +118,6 @@ typedef enum {
112118
AIO_AUTH_FAILED = 13, // Invalid Adafruit IO login credentials provided.
113119
AIO_SSID_INVALID = 14, // SSID is "" or otherwise invalid, connection not attempted
114120

115-
// SUCCESS
116121
AIO_NET_CONNECTED = 20, // Connected to Adafruit IO
117122
AIO_CONNECTED = 21, // Connected to network
118123
AIO_CONNECTED_INSECURE = 22, // Insecurely (non-SSL) connected to network

0 commit comments

Comments
 (0)