12
12
#ifndef ADAFRUITIO_DEFINITIONS_H_
13
13
#define ADAFRUITIO_DEFINITIONS_H_
14
14
15
- #define ADAFRUITIO_VERSION_MAJOR 2
16
- #define ADAFRUITIO_VERSION_MINOR 6
15
+ #define ADAFRUITIO_VERSION_MAJOR 3
16
+ #define ADAFRUITIO_VERSION_MINOR 0
17
17
#define ADAFRUITIO_VERSION_PATCH 0
18
18
19
19
// forward declaration
@@ -43,12 +43,12 @@ class AdafruitIOGroupCallback {
43
43
44
44
// Uncomment/comment to turn on/off debug output messages.
45
45
#define AIO_DEBUG
46
- // uncomment /comment to turn on/off error output
46
+ // Uncomment /comment to turn on/off error output
47
47
#define AIO_ERROR
48
48
49
- // where debug messages will be printed
49
+ // Where debug messages will be printed
50
+ // note: if you're using something like Zero or Due, change the below to SerialUSB
50
51
#define AIO_PRINTER Serial
51
- // If using something like Zero or Due, change the above to SerialUSB
52
52
53
53
// Define actual debug output functions when necessary.
54
54
#ifdef AIO_DEBUG
@@ -59,6 +59,7 @@ class AdafruitIOGroupCallback {
59
59
#define AIO_DEBUG_PRINTLN (...) {}
60
60
#endif
61
61
62
+ // Define actual error output functions when necessary.
62
63
#ifdef AIO_ERROR
63
64
#define AIO_ERROR_PRINT (...) { AIO_PRINTER.print (__VA_ARGS__); }
64
65
#define AIO_ERROR_PRINTLN (...) { AIO_PRINTER.println (__VA_ARGS__); }
@@ -67,7 +68,9 @@ class AdafruitIOGroupCallback {
67
68
#define AIO_ERROR_PRINTLN (...) {}
68
69
#endif
69
70
71
+ // Adafruit IO Ping Interval, in milliseconds
70
72
#define AIO_PING_INTERVAL 60000
73
+ // Time to wait between re-connecting to Adafruit IO after throttled
71
74
#define AIO_THROTTLE_RECONNECT_INTERVAL 60000
72
75
73
76
#define AIO_ERROR_TOPIC " /errors"
@@ -77,38 +80,43 @@ class AdafruitIOGroupCallback {
77
80
// echo | openssl s_client -connect io.adafruit.com:443 | openssl x509 -fingerprint -noout
78
81
#define AIO_SSL_FINGERPRINT " 77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18"
79
82
83
+ // Maximum length of an Adafruit IO Feed name
80
84
#define AIO_FEED_NAME_LENGTH 20
85
+ // Maximum length of data sent/recieved from Adafruit IO
81
86
#define AIO_DATA_LENGTH 45
87
+ // Maximum comma-separated-value length from Adafruit IO
82
88
#define AIO_CSV_LENGTH 150
83
89
90
+ /* * aio_status_t offers 13 status states */
84
91
typedef enum {
85
92
86
93
// CONNECTING
87
94
AIO_IDLE = 0 ,
88
- AIO_NET_DISCONNECTED = 1 ,
89
- AIO_DISCONNECTED = 2 ,
90
- AIO_FINGERPRINT_UNKOWN = 3 ,
95
+ AIO_NET_DISCONNECTED = 1 , // Network disconnected
96
+ AIO_DISCONNECTED = 2 , // Disconnected from Adafruit IO
97
+ AIO_FINGERPRINT_UNKOWN = 3 , // Unknown AIO_SSL_FINGERPRINT
91
98
92
99
// FAILURE
93
- AIO_NET_CONNECT_FAILED = 10 ,
94
- AIO_CONNECT_FAILED = 11 ,
95
- AIO_FINGERPRINT_INVALID = 12 ,
96
- AIO_AUTH_FAILED = 13 ,
100
+ AIO_NET_CONNECT_FAILED = 10 , // Failed to connect to network
101
+ AIO_CONNECT_FAILED = 11 , // Failed to connect to Adafruit IO
102
+ AIO_FINGERPRINT_INVALID = 12 , // Unknown AIO_SSL_FINGERPRINT
103
+ AIO_AUTH_FAILED = 13 , // Invalid Adafruit IO login credentials provided.
97
104
98
105
// SUCCESS
99
- AIO_NET_CONNECTED = 20 ,
100
- AIO_CONNECTED = 21 ,
101
- AIO_CONNECTED_INSECURE = 22 ,
102
- AIO_FINGERPRINT_UNSUPPORTED = 23 ,
103
- AIO_FINGERPRINT_VALID = 24
106
+ AIO_NET_CONNECTED = 20 , // Connected to Adafruit IO
107
+ AIO_CONNECTED = 21 , // Connected to network
108
+ AIO_CONNECTED_INSECURE = 22 , // Insecurely (non-SSL) connected to network
109
+ AIO_FINGERPRINT_UNSUPPORTED = 23 , // Unsupported AIO_SSL_FINGERPRINT
110
+ AIO_FINGERPRINT_VALID = 24 // Valid AIO_SSL_FINGERPRINT
104
111
105
112
} aio_status_t ;
106
113
114
+ /* * Three different types of MQTT time feeds from IO */
107
115
typedef enum {
108
116
109
- AIO_TIME_SECONDS = 0 ,
110
- AIO_TIME_MILLIS = 1 ,
111
- AIO_TIME_ISO = 2
117
+ AIO_TIME_SECONDS = 0 , // Seconds MQTT feed
118
+ AIO_TIME_MILLIS = 1 , // Milisecond MQTT feed
119
+ AIO_TIME_ISO = 2 // ISO8601 MQTT Feed
112
120
113
121
} aio_time_format_t ;
114
122
0 commit comments