Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ sudo: false
before_install:
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
install:
- arduino --install-library "Adafruit SleepyDog Library,Adafruit FONA Library,Adafruit CC3000 Library,Adafruit_WINC1500"
- arduino --install-library "Adafruit SleepyDog Library","Adafruit FONA Library"
script:
- build_main_platforms
- build_platform esp8266
- arduino --install-library "WiFi101"
- build_platform zero
notifications:
email:
on_success: change
Expand Down
21 changes: 12 additions & 9 deletions Adafruit_MQTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ int8_t Adafruit_MQTT::connect() {
success = true;
break;
}
//Serial.println("\t**failed, retrying!");
}
if (! success) return -2; // failed to sub for some reason
}
Expand All @@ -206,15 +205,20 @@ int8_t Adafruit_MQTT::connect(const char *user, const char *pass)

uint16_t Adafruit_MQTT::processPacketsUntil(uint8_t *buffer, uint8_t waitforpackettype, uint16_t timeout) {
uint16_t len;
while (len = readFullPacket(buffer, MAXBUFFERSIZE, timeout)) {

//DEBUG_PRINT("Packet read size: "); DEBUG_PRINTLN(len);
// TODO: add subscription reading & call back processing here
while(true) {
len = readFullPacket(buffer, MAXBUFFERSIZE, timeout);

if ((buffer[0] >> 4) == waitforpackettype) {
//DEBUG_PRINTLN(F("Found right packet"));
if(len == 0){
break;
}

if ((buffer[0] >> 4) == waitforpackettype)
{
return len;
} else {
}
else
{
ERROR_PRINTLN(F("Dropped a packet"));
}
}
Expand Down Expand Up @@ -407,7 +411,6 @@ bool Adafruit_MQTT::unsubscribe(Adafruit_MQTT_Subscribe *sub) {
}

void Adafruit_MQTT::processPackets(int16_t timeout) {
uint16_t len;

uint32_t elapsed = 0, endtime, starttime = millis();

Expand Down Expand Up @@ -482,7 +485,7 @@ Adafruit_MQTT_Subscribe *Adafruit_MQTT::readSubscription(int16_t timeout) {
if (i==MAXSUBSCRIPTIONS) return NULL; // matching sub not found ???

uint8_t packet_id_len = 0;
uint16_t packetid;
uint16_t packetid = 0;
// Check if it is QoS 1, TODO: we dont support QoS 2
if ((buffer[0] & 0x6) == 0x2) {
packet_id_len = 2;
Expand Down
6 changes: 6 additions & 0 deletions Adafruit_MQTT_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ uint16_t Adafruit_MQTT_Client::readPacket(uint8_t *buffer, uint16_t maxlen,
uint16_t len = 0;
int16_t t = timeout;


while (client->connected() && (timeout >= 0)) {
//DEBUG_PRINT('.');
while (client->available()) {
Expand All @@ -62,6 +63,11 @@ uint16_t Adafruit_MQTT_Client::readPacket(uint8_t *buffer, uint16_t maxlen,
buffer[len] = c;
//DEBUG_PRINTLN((uint8_t)c, HEX);
len++;

if (maxlen == 0) { // handle zero-length packets
return 0;
}

if (len == maxlen) { // we read all we want, bail
DEBUG_PRINT(F("Read data:\t"));
DEBUG_PRINTBUFFER(buffer, len);
Expand Down
1 change: 1 addition & 0 deletions examples/adafruitio_anon_time_esp8266/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/adafruitio_errors_esp8266/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/adafruitio_secure_esp8266/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ WiFiClientSecure client;
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);

// io.adafruit.com SHA1 fingerprint. Current fingerprint can be verified via:
// echo | openssl s_client -connect io.adafruit.com:443 |& openssl x509 -fingerprint -noout
#define AIO_SSL_FINGERPRINT "77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18"
// io.adafruit.com SHA1 fingerprint
const char* fingerprint = "AD 4B 64 B3 67 40 B5 FC 0E 51 9B BD 25 E9 7F 88 B6 2A A3 5B";

/****************************** Feeds ***************************************/

Expand Down
1 change: 1 addition & 0 deletions examples/adafruitio_time_esp8266/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_2subs_esp8266/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_esp8266/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_esp8266_callback/.esp8266.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_esp8266_callback/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_ethernet/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_fona/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_winc1500/.esp8266.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_yun/.esp8266.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/mqtt_yun/.zero.test.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@