Microchip® Advanced Software Framework

MQTTUnsubscribeClient.c File Reference
#include "MQTTPacket.h"
#include "StackTrace.h"
#include <string.h>

Functions

int MQTTDeserialize_unsuback (unsigned short *packetid, unsigned char *buf, int buflen)
 Deserializes the supplied (wire) buffer into unsuback data. More...
 
int MQTTSerialize_unsubscribe (unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid, int count, MQTTString topicFilters[])
 Serializes the supplied unsubscribe data into the supplied buffer, ready for sending. More...
 
int MQTTSerialize_unsubscribeLength (int count, MQTTString topicFilters[])
 Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters. More...
 

int MQTTDeserialize_unsuback ( unsigned short *  packetid,
unsigned char *  buf,
int  buflen 
)

Deserializes the supplied (wire) buffer into unsuback data.

Parameters
packetidreturned integer - the MQTT packet identifier
bufthe raw buffer data, of the correct length determined by the remaining length field
buflenthe length in bytes of the data in the supplied buffer
Returns
error code. 1 is success, 0 is failure

References FUNC_ENTRY, FUNC_EXIT_RC, MQTTDeserialize_ack(), and UNSUBACK.

Referenced by MQTTFormat_toClientString(), and MQTTUnsubscribe().

int MQTTSerialize_unsubscribe ( unsigned char *  buf,
int  buflen,
unsigned char  dup,
unsigned short  packetid,
int  count,
MQTTString  topicFilters[] 
)

Serializes the supplied unsubscribe data into the supplied buffer, ready for sending.

Parameters
bufthe raw buffer data, of the correct length determined by the remaining length field
buflenthe length in bytes of the data in the supplied buffer
dupinteger - the MQTT dup flag
packetidinteger - the MQTT packet identifier
count- number of members in the topicFilters array
topicFilters- array of topic filter names
Returns
the length of the serialized data. <= 0 indicates error

References MQTTHeader::bits, MQTTHeader::byte, count, MQTTHeader::dup, FUNC_ENTRY, FUNC_EXIT_RC, header, i, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), MQTTPacket_len(), MQTTSerialize_unsubscribeLength(), ptr, MQTTHeader::qos, MQTTHeader::type, UNSUBSCRIBE, writeChar(), writeInt(), and writeMQTTString().

Referenced by MQTTUnsubscribe().

int MQTTSerialize_unsubscribeLength ( int  count,
MQTTString  topicFilters[] 
)

Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters.

Parameters
countthe number of topic filter strings in topicFilters
topicFiltersthe array of topic filter strings to be used in the publish
Returns
the length of buffer needed to contain the serialized version of the packet

References count, i, and MQTTstrlen().

Referenced by MQTTSerialize_unsubscribe().