Removed redundant code
This commit is contained in:
parent
cda4a5d7d4
commit
67092945e6
@ -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
|
// 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 Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
|
||||||
const char *data, uint8_t qos) {
|
const char *data, uint8_t qos) {
|
||||||
|
|
||||||
|
return publishPacket(packet, topic, (uint8_t*)(data), strlen(data), qos);
|
||||||
|
/*
|
||||||
uint8_t *p = packet;
|
uint8_t *p = packet;
|
||||||
uint16_t len;
|
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_PRINTLN(F("MQTT publish packet:"));
|
||||||
DEBUG_PRINTBUFFER(buffer, len);
|
DEBUG_PRINTBUFFER(buffer, len);
|
||||||
return len;
|
return len;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// as per http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718040
|
// 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 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;
|
uint8_t *p = packet;
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
|
|
||||||
@ -584,13 +589,14 @@ uint8_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
|
|||||||
packet_id_counter++;
|
packet_id_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(p, sData, bLen);
|
memmove(p, data, bLen);
|
||||||
p+= bLen;
|
p+= bLen;
|
||||||
len = p - packet;
|
len = p - packet;
|
||||||
packet[1] = len-2; // don't include the 2 bytes of fixed header data
|
packet[1] = len-2; // don't include the 2 bytes of fixed header data
|
||||||
DEBUG_PRINTLN(F("MQTT publish packet:"));
|
DEBUG_PRINTLN(F("MQTT publish packet:"));
|
||||||
DEBUG_PRINTBUFFER(buffer, len);
|
DEBUG_PRINTBUFFER(buffer, len);
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Adafruit_MQTT::subscribePacket(uint8_t *packet, const char *topic,
|
uint8_t Adafruit_MQTT::subscribePacket(uint8_t *packet, const char *topic,
|
||||||
|
Loading…
Reference in New Issue
Block a user