renames disconnect to disconnectServer and adds disconnectPacket

This commit is contained in:
Todd Treece 2015-10-05 14:07:49 -04:00
parent f9ae6f3146
commit 16da46aece
2 changed files with 7 additions and 4 deletions

View File

@ -279,7 +279,7 @@ Adafruit_MQTT_Subscribe *Adafruit_MQTT::readSubscription(int16_t timeout) {
// to make comparison case insensitive.
if (strncasecmp_P((char*)buffer+4, subscriptions[i]->topic, topiclen) == 0) {
DEBUG_PRINT(F("Found sub #")); DEBUG_PRINTLN(i);
break;
break;
}
}
}

View File

@ -124,9 +124,8 @@ class Adafruit_MQTT {
// Serial.println without any further processing.
const __FlashStringHelper* connectErrorString(int8_t code);
// Disconnect from the MQTT server. Returns true if disconnected, false
// otherwise.
virtual bool disconnect() = 0; // Subclasses need to fill this in!
// Sends MQTT disconnect packet and calls disconnectServer()
bool disconnect();
// Return true if connected to the MQTT server, otherwise false.
virtual bool connected() = 0; // Subclasses need to fill this in!
@ -172,6 +171,9 @@ class Adafruit_MQTT {
// Connect to the server and return true if successful, false otherwise.
virtual bool connectServer() = 0;
// Disconnect from the MQTT server. Returns true if disconnected, false otherwise.
virtual bool disconnectServer() = 0; // Subclasses need to fill this in!
// Send data to the server specified by the buffer and length of data.
virtual bool sendPacket(uint8_t *buffer, uint8_t len) = 0;
@ -200,6 +202,7 @@ class Adafruit_MQTT {
// Functions to generate MQTT packets.
uint8_t connectPacket(uint8_t *packet);
uint8_t disconnectPacket(uint8_t *packet);
uint8_t publishPacket(uint8_t *packet, const char *topic, const char *payload, uint8_t qos);
uint8_t subscribePacket(uint8_t *packet, const char *topic, uint8_t qos);
uint8_t unsubscribePacket(uint8_t *packet, const char *topic);