Commit Graph

306 Commits

Author SHA1 Message Date
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
Todd Treece
f61abbdae0 skip due travis builds 2015-07-27 14:08:41 -04:00
Todd Treece
ee6094cccd simplify travis config with new helper functions 2015-07-27 14:04:58 -04:00
Todd Treece
6636f4579b Merge pull request #1 from adafruit/travis
Add Travis CI
2015-07-15 17:03:44 -04:00
Todd Treece
f5fd58caed drop due builds because of watchdog dependency 2015-07-15 16:40:36 -04:00
Todd Treece
86fcd2907b remove fona lib version from travis 2015-07-15 16:37:35 -04:00
Todd Treece
82050f1fed adds specific fona lib version to travis config 2015-07-15 16:09:25 -04:00
Todd Treece
03e989533b adds cc3k lib to travis install 2015-07-15 14:11:18 -04:00
Todd Treece
68772a9f00 source the travis dependency install script 2015-07-15 14:08:16 -04:00
Todd Treece
c9e64fc321 test new travis dependency install script 2015-07-15 13:17:02 -04:00
Todd Treece
65569159a9 adds travis icon to readme 2015-07-15 12:09:51 -04:00
Todd Treece
76185fb099 adds fona lib to travis dependencies 2015-07-15 12:08:44 -04:00
Todd Treece
e27e563d10 adds travis config 2015-07-15 11:20:10 -04:00
Tony DiCola
23f919adc3 Merge connected branch, bump to version 0.9.3 2015-07-14 15:54:04 -07:00
Tony DiCola
9b92bb379c Add date and time to client ID generation for more unique value. 2015-07-06 13:43:52 -07:00
Tony DiCola
643c906aa6 Add connected() function to MQTT class. Update examples with robust reconnect logic. 2015-07-05 14:29:13 -07:00
Tony DiCola
207bcd44dd Update library.properties 2015-06-20 14:37:38 -07:00
Tony DiCola
ea7549445b Switch back to calling dtostrf for float to string (snprintf doesn't work by design on ESP8266). 2015-06-19 01:23:29 -07:00
Tony DiCola
ad33b0b738 Merge branch 'master' of https://github.com/adafruit/Adafruit_MQTT_Library 2015-06-12 12:59:37 -07:00
Tony DiCola
08f05456ec Update default keepalive to 5 minutes, add reset on ping fail to CC3k sketch. 2015-06-12 12:59:14 -07:00
Tony DiCola
fe6302bfb8 Make static IP optional and off by default in CC3k example. 2015-06-11 13:58:36 -07:00
Tony DiCola
a33dac3249 Merge branch 'master' of https://github.com/adafruit/Adafruit_MQTT_Library 2015-06-10 15:39:03 -07:00
Tony DiCola
6a740d4004 Cleanup and prepare for publishing. 2015-06-10 15:38:34 -07:00
ladyada
a2c5fca4d8 read max packet 2015-06-10 00:30:52 -04:00
Tony DiCola
d063469e03 Add Ladyada's FONA implementation. 2015-06-09 21:22:36 -07:00
Tony DiCola
6a1b0bc442 Merge branch 'client' 2015-06-09 18:50:45 -07:00
Tony DiCola
d7a6433b81 Add Adafruit_MQTT_Client class that implements MQTT code for generic Arduino client. Add ESP8266 example using new MQTT client class. Fix bugs with using library on ESP8266 (move CC3000 to header-only class). 2015-06-08 01:48:25 -07:00
Tony DiCola
2fa9804b48 Merge cleanup changes and update README todo. 2015-06-05 13:10:22 -07:00
Tony DiCola
bd5f874e07 Merge branch 'refactor' 2015-06-05 13:03:04 -07:00
ladyada
7ef04a85a2 headercleanup & todos 2015-06-05 12:09:58 -04:00
Tony DiCola
f3ca82a548 Update CC3k example. 2015-06-04 21:25:00 -07:00
Tony DiCola
ac74ef4fd6 Refactor Adafruit_MQTT to have a simple interface for packet sending & receiving that subclasses implement. 2015-06-04 21:16:08 -07:00
Todd Treece
ae0b4778a1 updates aio mqtt auth info in cc3k example 2015-06-03 17:13:41 -04:00
ladyada
c1302a413c fix for new sleepydog include 2015-06-02 19:21:49 -04:00
ladyada
c79e6e82ea delish 2015-06-02 18:37:15 -04:00
ladyada
0152ac91cb woooo 2015-06-02 18:33:03 -04:00
ladyada
7c5113e32e more flash memory, pingreq debugging, etc. 2015-06-02 15:23:42 -04:00
ladyada
6a3b6132d9 fixed user/client/password mixup 2015-06-01 22:51:59 -04:00
ladyada
fa63c335a5 string friend, made client optional 2015-05-31 23:56:27 -04:00
ladyada
495f2cddd5 Merge branch 'master' of github.com:adafruit/Adafruit_MQTT_Library
Conflicts:
	Adafruit_MQTT.h
2015-05-31 23:21:00 -04:00