Parses the payload of an MQTT SUBACK packet that contains status codes corresponding to topic filter subscription requests from the original subscribe packet.
uint8_t ** pPayloadStart,
size_t * pPayloadSize );
MQTTStatus_t MQTT_GetSubAckStatusCodes(const MQTTPacketInfo_t *pSubackPacket, uint8_t **pPayloadStart, size_t *pPayloadSize)
Parses the payload of an MQTT SUBACK packet that contains status codes corresponding to topic filter ...
Definition: core_mqtt.c:2366
MQTTStatus_t
Return codes from MQTT functions.
Definition: core_mqtt_serializer.h:97
MQTT incoming packet parameters.
Definition: core_mqtt_serializer.h:251
Each return code in the SUBACK packet corresponds to a topic filter in the SUBSCRIBE Packet being acknowledged. The status codes can be one of the following:
- 0x00 - Success - Maximum QoS 0
- 0x01 - Success - Maximum QoS 1
- 0x02 - Success - Maximum QoS 2
- 0x80 - Failure Refer to MQTTSubAckStatus_t for the status codes.
- Parameters
-
[in] | pSubackPacket | The SUBACK packet whose payload is to be parsed. |
[out] | pPayloadStart | This is populated with the starting address of the payload (or return codes for topic filters) in the SUBACK packet. |
[out] | pPayloadSize | This is populated with the size of the payload in the SUBACK packet. It represents the number of topic filters whose SUBACK status is present in the packet. |
- Returns
- Returns one of the following:
Example
void eventCallback(
)
{
uint8_t * pCodes;
size_t numCodes;
{
assert( numCodes == NUMBER_OF_SUBSCRIPTIONS );
for( int i = 0; i < numCodes; i++ )
{
{
}
else
{
if( pSubscribes[ i ].qos != pCodes[ i ] )
{
"Requested QoS %u, but granted QoS %u for %s",
pSubscribes[ i ].qos, pCodes[ i ], pSubscribes[ i ].pTopicFilter
) );
}
}
}
}
}
#define LogWarn(message)
Macro that is called in the MQTT library for logging "Warning" level messages.
Definition: core_mqtt_config_defaults.h:213
#define MQTT_PACKET_TYPE_SUBACK
SUBACK (server-to-client).
Definition: core_mqtt_serializer.h:71
@ MQTTSubAckFailure
Failure.
Definition: core_mqtt.h:150
@ MQTTSuccess
Definition: core_mqtt_serializer.h:98
A struct representing an MQTT connection.
Definition: core_mqtt.h:169
Struct to hold deserialized packet information for an MQTTEventCallback_t callback.
Definition: core_mqtt.h:233
uint8_t type
Type of incoming MQTT packet.
Definition: core_mqtt_serializer.h:255
MQTT SUBSCRIBE packet parameters.
Definition: core_mqtt_serializer.h:187