picofuse

Data Fields
net_mqtt_received_t Struct Reference

Payload for a net_mqtt_event_received event. More...

#include <mqtt.h>

Data Fields

const char * topic
 Topic the message was published to - may be more specific than the net_mqtt_subscribe() filter that matched it, if that filter used a wildcard. More...
 
const void * payload
 Message payload - NULL if payload_len is 0. More...
 
size_t payload_len
 Total payload length in bytes.
 
bool retain
 True if this is a retained message delivered because of the subscription itself rather than a live publish - see net_mqtt_publish()'s own doc on retained messages. More...
 
uint32_t topic_id
 The confirmed subscription topic matched - see net_mqtt_subscribe()'s own doc on this id. More...
 

Detailed Description

Payload for a net_mqtt_event_received event.

Definition at line 209 of file mqtt.h.

Field Documentation

◆ payload

const void* net_mqtt_received_t::payload

Message payload - NULL if payload_len is 0.

Not caller-owned and only valid for the duration of this callback - copy anything that's still needed once it returns, same as net_mqtt_publish()'s own payload parameter. Read off the wire and buffered in full before this callback runs (a small internal buffer for short messages, a temporary allocation freed right after this callback returns for larger ones) - not streamed, so there's no need to read it "incrementally" to avoid holding the whole message in memory.

Definition at line 215 of file mqtt.h.

◆ retain

bool net_mqtt_received_t::retain

True if this is a retained message delivered because of the subscription itself rather than a live publish - see net_mqtt_publish()'s own doc on retained messages.

Definition at line 228 of file mqtt.h.

◆ topic

const char* net_mqtt_received_t::topic

Topic the message was published to - may be more specific than the net_mqtt_subscribe() filter that matched it, if that filter used a wildcard.

Not caller-owned, valid only for the duration of this callback.

Definition at line 210 of file mqtt.h.

◆ topic_id

uint32_t net_mqtt_received_t::topic_id

The confirmed subscription topic matched - see net_mqtt_subscribe()'s own doc on this id.

0 if none did, which shouldn't normally happen (a broker only delivers what something here subscribed to) but isn't asserted, since a subscription unsubscribed moments earlier could still have a message in flight. If more than one confirmed filter matches (legal with overlapping wildcards), only the first one found is reported here.

Definition at line 232 of file mqtt.h.


The documentation for this struct was generated from the following file: