Skip to content

Commit e6ab3a9

Browse files
committed
Tidy code
1 parent d3fdbb2 commit e6ab3a9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Adafruit_MQTT.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,20 +369,21 @@ bool Adafruit_MQTT::publish(const char *topic, const char *data, uint8_t qos) {
369369
return publish(topic, (uint8_t*)(data), strlen(data), false, qos);
370370
}
371371

372-
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
373-
uint8_t qos) {
374-
return publish(topic, data, bLen, false, qos);
375-
}
376-
377372
bool Adafruit_MQTT::publish(const char *topic, const char *data,
378373
bool retain, uint8_t qos) {
379374
return publish(topic, (uint8_t*)(data), strlen(data), retain, qos);
380375
}
381376

377+
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
378+
uint8_t qos) {
379+
return publish(topic, data, bLen, false, qos);
380+
}
381+
382382
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
383383
bool retain, uint8_t qos) {
384384
// Construct and send publish packet.
385-
uint16_t len = publishPacket(buffer, topic, data, bLen, retain, qos, (uint16_t)sizeof(buffer));
385+
uint16_t len = publishPacket(buffer, topic, data, bLen, retain, qos,
386+
(uint16_t)sizeof(buffer));
386387

387388
if (!sendPacket(buffer, len))
388389
return false;

Adafruit_MQTT.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@ class Adafruit_MQTT {
190190
// Publish a message to a topic using the specified QoS level. Returns true
191191
// if the message was published, false otherwise.
192192
bool publish(const char *topic, const char *payload, uint8_t qos = 0);
193+
bool publish(const char *topic, const char *payload, bool retain, uint8_t qos = 0);
193194
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
194195
uint8_t qos = 0);
195-
bool publish(const char *topic, const char *payload, bool retain, uint8_t qos = 0);
196-
bool publish(const char *topic, uint8_t *payload, uint16_t bLen, bool retain, uint8_t qos = 0);
196+
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
197+
bool retain, uint8_t qos = 0);
197198

198199
// Add a subscription to receive messages for a topic. Returns true if the
199200
// subscription could be added or was already present, false otherwise.

0 commit comments

Comments
 (0)