mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-11-01 15:42:19 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user