Removed redundant code

This commit is contained in:
Stuart Feichtinger 2016-01-19 16:10:03 -06:00
parent cda4a5d7d4
commit 67092945e6
1 changed files with 9 additions and 3 deletions

View File

@ -532,6 +532,9 @@ uint8_t Adafruit_MQTT::connectPacket(uint8_t *packet) {
// as per http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718040
uint8_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
const char *data, uint8_t qos) {
return publishPacket(packet, topic, (uint8_t*)(data), strlen(data), qos);
/*
uint8_t *p = packet;
uint16_t len;
@ -559,11 +562,13 @@ uint8_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
DEBUG_PRINTLN(F("MQTT publish packet:"));
DEBUG_PRINTBUFFER(buffer, len);
return len;
*/
}
// as per http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718040
uint8_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
uint8_t *sData, uint8_t bLen, uint8_t qos) {
uint8_t *data, uint8_t bLen, uint8_t qos) {
uint8_t *p = packet;
uint16_t len;
@ -584,13 +589,14 @@ uint8_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
packet_id_counter++;
}
memmove(p, sData, bLen);
memmove(p, data, bLen);
p+= bLen;
len = p - packet;
packet[1] = len-2; // don't include the 2 bytes of fixed header data
DEBUG_PRINTLN(F("MQTT publish packet:"));
DEBUG_PRINTBUFFER(buffer, len);
return len;
}
uint8_t Adafruit_MQTT::subscribePacket(uint8_t *packet, const char *topic,
@ -706,7 +712,7 @@ bool Adafruit_MQTT_Publish::publish(const char *payload) {
}
bool Adafruit_MQTT_Publish::publish(uint8_t *payload, uint8_t bLen) {
return mqtt->publish(topic, payload, bLen, qos);
}