@@ -365,25 +365,16 @@ bool Adafruit_MQTT::disconnect() {
365365 return disconnectServer ();
366366}
367367
368- bool Adafruit_MQTT::publish (const char *topic, const char *data, uint8_t qos) {
369- return publish (topic, (uint8_t *)(data), strlen (data), false , qos);
370- }
371-
372- bool Adafruit_MQTT::publish (const char *topic, const char *data, bool retain,
373- uint8_t qos) {
374- return publish (topic, (uint8_t *)(data), strlen (data), retain, qos);
375- }
376-
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);
368+ bool Adafruit_MQTT::publish (const char *topic, const char *data, uint8_t qos,
369+ bool retain) {
370+ return publish (topic, (uint8_t *)(data), strlen (data), qos, retain);
380371}
381372
382373bool Adafruit_MQTT::publish (const char *topic, uint8_t *data, uint16_t bLen,
383- bool retain, uint8_t qos ) {
374+ uint8_t qos, bool retain ) {
384375 // Construct and send publish packet.
385- uint16_t len = publishPacket (buffer, topic, data, bLen, retain, qos,
386- (uint16_t )sizeof (buffer));
376+ uint16_t len = publishPacket (buffer, topic, data, bLen, qos,
377+ (uint16_t )sizeof (buffer), retain );
387378
388379 if (!sendPacket (buffer, len))
389380 return false ;
@@ -763,13 +754,7 @@ uint8_t Adafruit_MQTT::connectPacket(uint8_t *packet) {
763754// http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718040
764755uint16_t Adafruit_MQTT::publishPacket (uint8_t *packet, const char *topic,
765756 uint8_t *data, uint16_t bLen, uint8_t qos,
766- uint16_t maxPacketLen) {
767- return publishPacket (packet, topic, data, bLen, false , qos, maxPacketLen);
768- }
769-
770- uint16_t Adafruit_MQTT::publishPacket (uint8_t *packet, const char *topic,
771- uint8_t *data, uint16_t bLen, bool retain,
772- uint8_t qos, uint16_t maxPacketLen) {
757+ uint16_t maxPacketLen, bool retain) {
773758 uint8_t *p = packet;
774759 uint16_t len = 0 ;
775760
@@ -925,50 +910,33 @@ Adafruit_MQTT_Publish::Adafruit_MQTT_Publish(Adafruit_MQTT *mqttserver,
925910 qos = q;
926911}
927912
928- bool Adafruit_MQTT_Publish::publish (int32_t i) { return publish (i, false ); }
929-
930913bool Adafruit_MQTT_Publish::publish (int32_t i, bool retain) {
931914 char payload[12 ];
932915 ltoa (i, payload, 10 );
933- return mqtt->publish (topic, payload, retain, qos );
916+ return mqtt->publish (topic, payload, qos, retain );
934917}
935918
936- bool Adafruit_MQTT_Publish::publish (uint32_t i) { return publish (i, false ); }
937-
938919bool Adafruit_MQTT_Publish::publish (uint32_t i, bool retain) {
939920 char payload[11 ];
940921 ultoa (i, payload, 10 );
941- return mqtt->publish (topic, payload, retain, qos);
942- }
943-
944- bool Adafruit_MQTT_Publish::publish (double f, uint8_t precision) {
945- return publish (f, false , precision);
922+ return mqtt->publish (topic, payload, qos, retain);
946923}
947924
948- bool Adafruit_MQTT_Publish::publish (double f, bool retain, uint8_t precision ) {
925+ bool Adafruit_MQTT_Publish::publish (double f, uint8_t precision, bool retain ) {
949926 char payload[41 ]; // Need to technically hold float max, 39 digits and minus
950927 // sign.
951928 dtostrf (f, 0 , precision, payload);
952- return mqtt->publish (topic, payload, retain, qos);
953- }
954-
955- bool Adafruit_MQTT_Publish::publish (const char *payload) {
956- return publish (payload, false );
929+ return mqtt->publish (topic, payload, qos, retain);
957930}
958931
959932bool Adafruit_MQTT_Publish::publish (const char *payload, bool retain) {
960- return mqtt->publish (topic, payload, retain, qos );
933+ return mqtt->publish (topic, payload, qos, retain );
961934}
962935
963936// publish buffer of arbitrary length
964- bool Adafruit_MQTT_Publish::publish (uint8_t *payload, uint16_t bLen) {
965- return publish (payload, bLen, false );
966- }
967-
968937bool Adafruit_MQTT_Publish::publish (uint8_t *payload, uint16_t bLen,
969938 bool retain) {
970-
971- return mqtt->publish (topic, payload, bLen, retain, qos);
939+ return mqtt->publish (topic, payload, bLen, qos, retain);
972940}
973941
974942// Adafruit_MQTT_Subscribe Definition //////////////////////////////////////////
@@ -1011,4 +979,4 @@ void Adafruit_MQTT_Subscribe::removeCallback(void) {
1011979 callback_double = 0 ;
1012980 callback_io = 0 ;
1013981 io_mqtt = 0 ;
1014- }
982+ }
0 commit comments