1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-07-29 02:02:00 +03:00

Added generic buffer

Crashes when publishing to more than one stream
This commit is contained in:
Stuart Feichtinger
2016-01-17 19:27:20 -06:00
parent e77be5b9ac
commit 2876ac43dd
2 changed files with 92 additions and 13 deletions

View File

@ -160,6 +160,7 @@ class Adafruit_MQTT {
// The topic must be stored in PROGMEM. It can either be a
// char*, or a __FlashStringHelper* (the result of the F() macro).
bool publish(const char *topic, const char *payload, uint8_t qos = 0);
bool publish(const char *topic, uint8_t *payload, uint8_t bLen, uint8_t qos = 0);
bool publish(const __FlashStringHelper *topic, const char *payload, uint8_t qos = 0) {
return publish((const char *)topic, payload, qos);
}
@ -223,6 +224,7 @@ class Adafruit_MQTT {
uint8_t connectPacket(uint8_t *packet);
uint8_t disconnectPacket(uint8_t *packet);
uint8_t publishPacket(uint8_t *packet, const char *topic, const char *payload, uint8_t qos);
uint8_t publishPacket(uint8_t *packet, const char *topic, uint8_t *payload, uint8_t bLen, uint8_t qos);
uint8_t subscribePacket(uint8_t *packet, const char *topic, uint8_t qos);
uint8_t unsubscribePacket(uint8_t *packet, const char *topic);
uint8_t pingPacket(uint8_t *packet);
@ -239,6 +241,8 @@ class Adafruit_MQTT_Publish {
// This might be ignored and a higher precision value sent.
bool publish(int32_t i);
bool publish(uint32_t i);
bool publish(uint8_t *b, uint8_t bLen);
private:
Adafruit_MQTT *mqtt;