Jim Flynn / Mbed OS aws-iot-device-sdk-mbed-c
Embed: (wiki syntax)

« Back to documentation index

aws_iot_mqtt_client_subscribe.c File Reference

aws_iot_mqtt_client_subscribe.c File Reference

MQTT client subscribe API definitions. More...

Go to the source code of this file.

Functions

static IoT_Error_t _aws_iot_mqtt_serialize_subscribe (unsigned char *pTxBuf, size_t txBufLen, unsigned char dup, uint16_t packetId, uint32_t topicCount, const char **pTopicNameList, uint16_t *pTopicNameLenList, QoS *pRequestedQoSs, uint32_t *pSerializedLen)
 Serializes the supplied subscribe data into the supplied buffer, ready for sending.
static IoT_Error_t _aws_iot_mqtt_deserialize_suback (uint16_t *pPacketId, uint32_t maxExpectedQoSCount, uint32_t *pGrantedQoSCount, QoS *pGrantedQoSs, unsigned char *pRxBuf, size_t rxBufLen)
 Deserializes the supplied (wire) buffer into suback data.
static IoT_Error_t _aws_iot_mqtt_internal_subscribe (AWS_IoT_Client *pClient, const char *pTopicName, uint16_t topicNameLen, QoS qos, pApplicationHandler_t pApplicationHandler, void *pApplicationHandlerData)
 Subscribe to an MQTT topic.
IoT_Error_t aws_iot_mqtt_subscribe (AWS_IoT_Client *pClient, const char *pTopicName, uint16_t topicNameLen, QoS qos, pApplicationHandler_t pApplicationHandler, void *pApplicationHandlerData)
 Subscribe to an MQTT topic.
static IoT_Error_t _aws_iot_mqtt_internal_resubscribe (AWS_IoT_Client *pClient)
 Subscribe to an MQTT topic.
IoT_Error_t aws_iot_mqtt_resubscribe (AWS_IoT_Client *pClient)
 Subscribe to an MQTT topic.

Detailed Description

MQTT client subscribe API definitions.

Definition in file aws_iot_mqtt_client_subscribe.c.


Function Documentation

static IoT_Error_t _aws_iot_mqtt_deserialize_suback ( uint16_t *  pPacketId,
uint32_t  maxExpectedQoSCount,
uint32_t *  pGrantedQoSCount,
QoS pGrantedQoSs,
unsigned char *  pRxBuf,
size_t  rxBufLen 
) [static]

Deserializes the supplied (wire) buffer into suback data.

Parameters:
pPacketIdreturned integer - the MQTT packet identifier
maxExpectedQoSCount- the maximum number of members allowed in the grantedQoSs array
pGrantedQoSCountreturned uint32_t - number of members in the grantedQoSs array
pGrantedQoSsreturned array of QoS type - the granted qualities of service
pRxBufthe raw buffer data, of the correct length determined by the remaining length field
rxBufLenthe length in bytes of the data in the supplied buffer
Returns:
An IoT Error Type defining successful/failed operation

Definition at line 116 of file aws_iot_mqtt_client_subscribe.c.

static IoT_Error_t _aws_iot_mqtt_internal_resubscribe ( AWS_IoT_Client pClient ) [static]

Subscribe to an MQTT topic.

Called to send a subscribe message to the broker requesting a subscription to an MQTT topic. This is the internal function which is called by the resubscribe API to perform the operation. Not meant to be called directly as it doesn't do validations or client state changes

Note:
Call is blocking. The call returns after the receipt of the SUBACK control packet.
Parameters:
pClientReference to the IoT Client
Returns:
An IoT Error Type defining successful/failed subscription

Definition at line 345 of file aws_iot_mqtt_client_subscribe.c.

static IoT_Error_t _aws_iot_mqtt_internal_subscribe ( AWS_IoT_Client pClient,
const char *  pTopicName,
uint16_t  topicNameLen,
QoS  qos,
pApplicationHandler_t  pApplicationHandler,
void *  pApplicationHandlerData 
) [static]

Subscribe to an MQTT topic.

Called to send a subscribe message to the broker requesting a subscription to an MQTT topic. This is the internal function which is called by the subscribe API to perform the operation. Not meant to be called directly as it doesn't do validations or client state changes

Note:
Call is blocking. The call returns after the receipt of the SUBACK control packet.
Warning:
pTopicName and pApplicationHandlerData need to be static in memory.
Parameters:
pClientReference to the IoT Client
pTopicNameTopic Name to publish to. pTopicName needs to be static in memory since no malloc are performed by the SDK
topicNameLenLength of the topic name
pApplicationHandler_tReference to the handler function for this subscription
pApplicationHandlerDataPoint to data passed to the callback. pApplicationHandlerData also needs to be static in memory since no malloc are performed by the SDK
Returns:
An IoT Error Type defining successful/failed subscription

Definition at line 207 of file aws_iot_mqtt_client_subscribe.c.

static IoT_Error_t _aws_iot_mqtt_serialize_subscribe ( unsigned char *  pTxBuf,
size_t  txBufLen,
unsigned char  dup,
uint16_t  packetId,
uint32_t  topicCount,
const char **  pTopicNameList,
uint16_t *  pTopicNameLenList,
QoS pRequestedQoSs,
uint32_t *  pSerializedLen 
) [static]

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

Parameters:
pTxBufthe buffer into which the packet will be serialized
txBufLenthe length in bytes of the supplied buffer
dupunsigned char - the MQTT dup flag
packetIduint16_t - the MQTT packet identifier
topicCount- number of members in the topicFilters and reqQos arrays
pTopicNameList- array of topic filter names
pTopicNameLenList- array of length of topic filter names
pRequestedQoSs- array of requested QoS
pSerializedLen- the length of the serialized data
Returns:
An IoT Error Type defining successful/failed operation

Definition at line 58 of file aws_iot_mqtt_client_subscribe.c.

IoT_Error_t aws_iot_mqtt_resubscribe ( AWS_IoT_Client pClient )

Subscribe to an MQTT topic.

Called to send a subscribe message to the broker requesting a subscription to an MQTT topic. This is the outer function which does the validations and calls the internal resubscribe above to perform the actual operation. It is also responsible for client state changes

Note:
Call is blocking. The call returns after the receipt of the SUBACK control packet.
Parameters:
pClientReference to the IoT Client
Returns:
An IoT Error Type defining successful/failed subscription

Definition at line 412 of file aws_iot_mqtt_client_subscribe.c.

IoT_Error_t aws_iot_mqtt_subscribe ( AWS_IoT_Client pClient,
const char *  pTopicName,
uint16_t  topicNameLen,
QoS  qos,
pApplicationHandler_t  pApplicationHandler,
void *  pApplicationHandlerData 
)

Subscribe to an MQTT topic.

Called to send a subscribe message to the broker requesting a subscription to an MQTT topic. This is the outer function which does the validations and calls the internal subscribe above to perform the actual operation. It is also responsible for client state changes

Note:
Call is blocking. The call returns after the receipt of the SUBACK control packet.
Warning:
pTopicName and pApplicationHandlerData need to be static in memory.
Parameters:
pClientReference to the IoT Client
pTopicNameTopic Name to publish to. pTopicName needs to be static in memory since no malloc are performed by the SDK
topicNameLenLength of the topic name
pApplicationHandler_tReference to the handler function for this subscription
pApplicationHandlerDataPoint to data passed to the callback. pApplicationHandlerData also needs to be static in memory since no malloc are performed by the SDK
Returns:
An IoT Error Type defining successful/failed subscription

Definition at line 296 of file aws_iot_mqtt_client_subscribe.c.