You've already forked Adafruit_MQTT_Library
mirror of
https://github.com/adafruit/Adafruit_MQTT_Library.git
synced 2025-07-21 18:22:06 +03:00
Tidy code
This commit is contained in:
@ -369,20 +369,21 @@ bool Adafruit_MQTT::publish(const char *topic, const char *data, uint8_t qos) {
|
|||||||
return publish(topic, (uint8_t*)(data), strlen(data), false, qos);
|
return publish(topic, (uint8_t*)(data), strlen(data), false, qos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
|
|
||||||
uint8_t qos) {
|
|
||||||
return publish(topic, data, bLen, false, qos);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Adafruit_MQTT::publish(const char *topic, const char *data,
|
bool Adafruit_MQTT::publish(const char *topic, const char *data,
|
||||||
bool retain, uint8_t qos) {
|
bool retain, uint8_t qos) {
|
||||||
return publish(topic, (uint8_t*)(data), strlen(data), retain, qos);
|
return publish(topic, (uint8_t*)(data), strlen(data), retain, qos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
|
||||||
|
uint8_t qos) {
|
||||||
|
return publish(topic, data, bLen, false, qos);
|
||||||
|
}
|
||||||
|
|
||||||
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
|
bool Adafruit_MQTT::publish(const char *topic, uint8_t *data, uint16_t bLen,
|
||||||
bool retain, uint8_t qos) {
|
bool retain, uint8_t qos) {
|
||||||
// Construct and send publish packet.
|
// Construct and send publish packet.
|
||||||
uint16_t len = publishPacket(buffer, topic, data, bLen, retain, qos, (uint16_t)sizeof(buffer));
|
uint16_t len = publishPacket(buffer, topic, data, bLen, retain, qos,
|
||||||
|
(uint16_t)sizeof(buffer));
|
||||||
|
|
||||||
if (!sendPacket(buffer, len))
|
if (!sendPacket(buffer, len))
|
||||||
return false;
|
return false;
|
||||||
|
@ -190,10 +190,11 @@ public:
|
|||||||
// Publish a message to a topic using the specified QoS level. Returns true
|
// Publish a message to a topic using the specified QoS level. Returns true
|
||||||
// if the message was published, false otherwise.
|
// if the message was published, false otherwise.
|
||||||
bool publish(const char *topic, const char *payload, uint8_t qos = 0);
|
bool publish(const char *topic, const char *payload, uint8_t qos = 0);
|
||||||
|
bool publish(const char *topic, const char *payload, bool retain, uint8_t qos = 0);
|
||||||
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
|
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
|
||||||
uint8_t qos = 0);
|
uint8_t qos = 0);
|
||||||
bool publish(const char *topic, const char *payload, bool retain, uint8_t qos = 0);
|
bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
|
||||||
bool publish(const char *topic, uint8_t *payload, uint16_t bLen, bool retain, uint8_t qos = 0);
|
bool retain, uint8_t qos = 0);
|
||||||
|
|
||||||
// Add a subscription to receive messages for a topic. Returns true if the
|
// Add a subscription to receive messages for a topic. Returns true if the
|
||||||
// subscription could be added or was already present, false otherwise.
|
// subscription could be added or was already present, false otherwise.
|
||||||
|
Reference in New Issue
Block a user