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

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