add payload to MQTT_EVENT_SUBSCRIBE

+ documentation
+ cleanup logging

Closes https://github.com/espressif/esp-mqtt/issues/200
Merges https://github.com/espressif/esp-mqtt/pull/203
This commit is contained in:
Bert Melis
2021-09-20 14:51:21 +02:00
committed by David Cermak
parent e1d5a9402f
commit de47f1c341
4 changed files with 49 additions and 6 deletions

View File

@@ -272,6 +272,18 @@ char *mqtt_get_publish_data(uint8_t *buffer, size_t *length)
return (char *)(buffer + i);
}
char *mqtt_get_suback_data(uint8_t *buffer, size_t *length)
{
// SUBACK payload length = total length - (fixed header (2 bytes) + variable header (2 bytes))
// This requires the remaining length to be encoded in 1 byte.
if (*length > 4) {
*length -= 4;
return (char *)(buffer + 4);
}
*length = 0;
return NULL;
}
uint16_t mqtt_get_id(uint8_t *buffer, size_t length)
{
if (length < 1) {