1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-07-27 15:01:49 +03:00

Library Fixes (#127)

* Removing warnings

* handle reading zero-length packets

* updating travis to exclude archived libraries, addin Arduino WiFi101 lib instead

* adding esp lib to travis

* restrict builds to current hardware platforms

* travis, esp8266: skip esp target for non-esp-based examples

* adding test skips for zero, fixing fingerprint error

bump library version
This commit is contained in:
brentrubell
2018-08-17 18:01:52 -04:00
committed by brentru
parent a4e1ee0133
commit 61f75246f4
18 changed files with 38 additions and 15 deletions

View File

@ -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
}
@ -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"));
}
}
@ -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();
@ -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;