Commit Graph

245 Commits

Author SHA1 Message Date
ladyada
286245ab62 compile fix & #ifdef the MQTT version 2015-10-21 00:05:46 -04:00
ladyada
15713af468 switch to MQTT 3.1.1 by default 2015-10-20 23:51:03 -04:00
Todd Treece
9fa0c54fce Merge pull request #14 from tapiralec/master
add ethernet example
2015-10-06 08:02:35 -04:00
Alec Moore
63229fbd12 skip tests on due and esp8266 2015-10-06 00:56:32 -05:00
Alec Moore
9e6b151997 triggering travis ci 2015-10-05 20:13:18 -05:00
Alec Moore
4ccf81e923 fixed up and functional
removed unnecessary "}", and removed getFreeRam() which was dependent on "utility/debug.h"
2015-10-05 19:47:54 -05:00
Alec Moore
478e2324d5 removed username/aio key 2015-10-05 19:17:32 -05:00
Todd Treece
9a11d83cf5 removes client id from all example sketches 2015-10-05 15:26:02 -04:00
Todd Treece
f1499b484a rearrange child classes to match new constructor 2015-10-05 14:57:44 -04:00
Todd Treece
b48265faed support anon auth & generated client id in constructor 2015-10-05 14:54:37 -04:00
Todd Treece
aa6db4d5f5 rename all subclass diconnect() to disconnectServer() 2015-10-05 14:18:49 -04:00
Todd Treece
4ab72be73e adds disconnect & disconnectPacket functions 2015-10-05 14:18:31 -04:00
Todd Treece
16da46aece renames disconnect to disconnectServer and adds disconnectPacket 2015-10-05 14:07:49 -04:00
Todd Treece
f9ae6f3146 comment out suback for now 2015-10-05 13:46:38 -04:00
Todd Treece
921c132f92 adds missing will payload to connect packet 2015-10-05 13:41:14 -04:00
Todd Treece
e70e2367b6 only check for suback if using MQTT 3.1.1 or higher 2015-10-05 11:32:10 -04:00
Todd Treece
b9c9a28883 adds packet ids for publish QoS > 0
also adds packet id counter so packet ids aren't
static values. this is a step in the direction
of QoS 1 support
2015-10-05 11:21:05 -04:00
Todd Treece
765a2feaff remove broken while loop from ping() 2015-10-05 10:38:09 -04:00
Todd Treece
0fbd734646 adds unsubscribe & unsubscribePacket functions 2015-10-05 10:33:33 -04:00
Todd Treece
476d1115e6 adds will() function 2015-10-05 09:50:57 -04:00
Todd Treece
e9e154ab52 adds will support to the connect packet 2015-10-05 09:45:27 -04:00
Todd Treece
e60be3e972 adds unsubscribePacket method def 2015-10-05 09:27:31 -04:00
Todd Treece
b2a198af5a adds unsubscribe() method def 2015-10-05 09:26:06 -04:00
Todd Treece
b9a04c8be5 adds will() method def 2015-10-05 09:25:07 -04:00
Todd Treece
78d733aee3 define the missing MQTT control packets 2015-10-05 09:14:17 -04:00
Alec Moore
57885554f9 adding ethernet example
It took more than a couple minutes to get some sample code going with ethernet, so I figured it would benefit everyone if there was at least one example out there.
2015-10-03 00:59:51 -05:00
Todd Treece
dfbe6a1e11 remove client id from esp example 2015-10-02 17:22:31 -04:00
Todd Treece
4f3466bdbf comment out MQTT_DEBUG 2015-10-02 17:13:35 -04:00
Todd Treece
913cce41af adds zero byte client id option for 3.1.1 2015-10-02 17:10:16 -04:00
Todd Treece
a3925bdb6b adds MQTT 3.1.1 connect packet changes 2015-10-02 10:45:00 -04:00
Todd Treece
ea779b1daa allow user to define MQTT KEEPALIVE in sketch 2015-10-02 10:43:11 -04:00
Todd Treece
a0520d3265 default to MQTT_PROTOCOL_LEVEL 4 2015-10-01 12:00:56 -04:00
Todd Treece
798e37b4de bump lib to v0.11.1 2015-09-08 12:16:02 -04:00
Todd Treece
5ac8cda53d update mqtt client id to be __TIME__ + AIO_USERNAME in examples 2015-09-08 12:15:21 -04:00
Tony DiCola
e41e843d67 Add Travis ignore for Due using Yun test. 2015-08-31 15:11:28 -07:00
Tony DiCola
e42f3094e5 Add Arduino Yun example. 2015-08-31 14:36:06 -07:00
Todd Treece
2572130d97 bump lib version to 0.10.0 2015-08-03 14:45:21 -04:00
Todd Treece
63493a0bfb Merge pull request #3 from matthijskooijman/fixes
Various fixes and improvements
2015-08-03 14:40:35 -04:00
Matthijs Kooijman
3a1bef8318 Default to qos = 0 in Adafruit_MQTT::publish()
This was already the case for the Adafruit_MQTT_Publish constructor, so
this makes things a bit more consistent when using the publish() method
directly.
2015-08-02 11:51:51 +02:00
Matthijs Kooijman
5d101b8a7b Allow passing __FlashStringHelper* in addition to char* everywhere
Arduino supplies the F() macro that allows easily putting strings in
PROGMEM and marking them with a custom type. Essentially,
a __FlashStringHelper* is just the same char*, but cast to a different
type, which allows for example Serial.print() to automatically handle
both PROGMEM and normal strings.

By letting this library accept __FlashStringHelper* as well, you can
use easily use the F() macro and reduce the chance of mixing up normal
and PROGMEM pointers.
2015-08-02 11:51:43 +02:00
Matthijs Kooijman
22b77ecb68 Add Adafruit_MQTT_Subscribe::datalen
This stores the number of valid bytes in lastread. Having access to this
information allows transmitting binary data as well, containing embedded
nul bytes.
2015-08-02 11:51:43 +02:00
Matthijs Kooijman
22c3533745 Fix type of Adafruit_MQTT_Subscribe::lastread
The lastread array stores the data bytes of the most recently read
received packet. It was previously declared as an array of pointers to
uint8_t, instead of an array of uint8_t, which obviously was not the
intention. Because the examples explicitely cast to (char*) for printing
(because Print::println(uint8_t[]) is not defined) and a pointer is at
least as big as uint8_t and memcpy uses void*, this problem did not show
up before.
2015-08-02 11:49:34 +02:00
Matthijs Kooijman
565d9afd36 Add parenthesis to fix compiler warning
Gcc warns when using = where == seems logical, and adding parenthesis
tells gcc you really mean =.
2015-07-27 20:32:38 +02:00
Matthijs Kooijman
05b145146a Comment out stringprint(), it is not used
This fixes a compiler warning.
2015-07-27 20:32:38 +02:00
Matthijs Kooijman
06767dc4b2 Clarify that subscribe() must be called before connect() 2015-07-27 20:32:38 +02:00
Matthijs Kooijman
b996b096b3 Fix Adafruit_MQTT:subscribe()
This method contained a loop that checked for an existing subscription,
but it only printed a debug message if so. Now, it immediately returns
true if the subscription is already registered.

When this method succesfully adds a subscription, it was documented to
return true, but the actual code did not return anything in this case,
resulting in a compiler warning. In practice, on AVR, the value of the
first argument would be returned, which likely evaluates as true, so
it is likely it actually seemed to work fine.
2015-07-27 20:32:38 +02:00
Matthijs Kooijman
564e87ff36 Fix indentation in Adafruit_MQTT::subscribe 2015-07-27 20:32:38 +02:00
Matthijs Kooijman
6879df86f6 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.
2015-07-27 20:32:36 +02:00
Matthijs Kooijman
73f5be4e5c Use const pointers for payload
The payload data is never modified by the library, so using const is
possible without any further changes. Using const allows using a string
literal, or String::c_str() as the payload.
2015-07-27 20:23:55 +02:00
Todd Treece
d4e27c9b3f Merge pull request #2 from adafruit/travis_helper
Use Adafruit Travis CI Helper Functions
2015-07-27 14:12:18 -04:00