Microchip® Advanced Software Framework

MQTTSubscribe.h File Reference

Macros

#define DLLExport
 
#define DLLImport
 

Functions

DLLExport int MQTTDeserialize_suback (unsigned short *packetid, int maxcount, int *count, int grantedQoSs[], unsigned char *buf, int len)
 Deserializes the supplied (wire) buffer into suback data. More...
 
DLLExport int MQTTDeserialize_subscribe (unsigned char *dup, unsigned short *packetid, int maxcount, int *count, MQTTString topicFilters[], int requestedQoSs[], unsigned char *buf, int len)
 Deserializes the supplied (wire) buffer into subscribe data. More...
 
DLLExport int MQTTSerialize_suback (unsigned char *buf, int buflen, unsigned short packetid, int count, int *grantedQoSs)
 Serializes the supplied suback data into the supplied buffer, ready for sending. More...
 
DLLExport int MQTTSerialize_subscribe (unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid, int count, MQTTString topicFilters[], int requestedQoSs[])
 Serializes the supplied subscribe data into the supplied buffer, ready for sending. More...
 

#define DLLExport
#define DLLImport

DLLExport int MQTTDeserialize_suback ( unsigned short *  packetid,
int  maxcount,
int *  count,
int  grantedQoSs[],
unsigned char *  buf,
int  buflen 
)

Deserializes the supplied (wire) buffer into suback data.

Parameters
packetidreturned integer - the MQTT packet identifier
maxcount- the maximum number of members allowed in the grantedQoSs array
countreturned integer - number of members in the grantedQoSs array
grantedQoSsreturned array of integers - the granted qualities of service
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 MQTTHeader::bits, MQTTHeader::byte, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_decodeBuf(), NULL, readChar(), readInt(), SUBACK, and MQTTHeader::type.

Referenced by MQTTFormat_toClientString(), and MQTTSubscribe().

DLLExport int MQTTDeserialize_subscribe ( unsigned char *  dup,
unsigned short *  packetid,
int  maxcount,
int *  count,
MQTTString  topicFilters[],
int  requestedQoSs[],
unsigned char *  buf,
int  buflen 
)

Deserializes the supplied (wire) buffer into subscribe data.

Parameters
dupinteger returned - the MQTT dup flag
packetidinteger returned - the MQTT packet identifier
maxcount- the maximum number of members allowed in the topicFilters and requestedQoSs arrays
count- number of members in the topicFilters and requestedQoSs arrays
topicFilters- array of topic filter names
requestedQoSs- array of requested QoS
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
the length of the serialized data. <= 0 indicates error

References MQTTHeader::bits, MQTTHeader::byte, count, MQTTHeader::dup, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_decodeBuf(), NULL, readChar(), readInt(), readMQTTLenString(), SUBSCRIBE, and MQTTHeader::type.

Referenced by MQTTFormat_toServerString().

DLLExport int MQTTSerialize_suback ( unsigned char *  buf,
int  buflen,
unsigned short  packetid,
int  count,
int *  grantedQoSs 
)

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

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer
packetidinteger - the MQTT packet identifier
count- number of members in the grantedQoSs array
grantedQoSs- array of granted QoS
Returns
the length of the serialized data. <= 0 indicates error

References MQTTHeader::bits, MQTTHeader::byte, count, FUNC_ENTRY, FUNC_EXIT_RC, header, i, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), ptr, SUBACK, MQTTHeader::type, writeChar(), and writeInt().

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

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

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied bufferr
dupinteger - the MQTT dup flag
packetidinteger - the MQTT packet identifier
count- number of members in the topicFilters and reqQos arrays
topicFilters- array of topic filter names
requestedQoSs- array of requested QoS
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_subscribeLength(), ptr, MQTTHeader::qos, SUBSCRIBE, MQTTHeader::type, writeChar(), writeInt(), and writeMQTTString().

Referenced by MQTTSubscribe().