Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
aws_iot_mqtt_client_publish.c File Reference
MQTT client publish API definitions. More...
Go to the source code of this file.
Functions | |
| static IoT_Error_t | _aws_iot_mqtt_read_string_with_len (char **stringVar, uint16_t *stringLen, unsigned char **pptr, unsigned char *enddata) |
| static IoT_Error_t | _aws_iot_mqtt_internal_serialize_publish (unsigned char *pTxBuf, size_t txBufLen, uint8_t dup, QoS qos, uint8_t retained, uint16_t packetId, const char *pTopicName, uint16_t topicNameLen, const unsigned char *pPayload, size_t payloadLen, uint32_t *pSerializedLen) |
| Serializes the supplied publish data into the supplied buffer, ready for sending. | |
| IoT_Error_t | aws_iot_mqtt_internal_serialize_ack (unsigned char *pTxBuf, size_t txBufLen, MessageTypes msgType, uint8_t dup, uint16_t packetId, uint32_t *pSerializedLen) |
| Serializes the ack packet into the supplied buffer. | |
| static IoT_Error_t | _aws_iot_mqtt_internal_publish (AWS_IoT_Client *pClient, const char *pTopicName, uint16_t topicNameLen, IoT_Publish_Message_Params *pParams) |
| Publish an MQTT message on a topic. | |
| IoT_Error_t | aws_iot_mqtt_publish (AWS_IoT_Client *pClient, const char *pTopicName, uint16_t topicNameLen, IoT_Publish_Message_Params *pParams) |
| Publish an MQTT message on a topic. | |
| IoT_Error_t | aws_iot_mqtt_internal_deserialize_publish (uint8_t *dup, QoS *qos, uint8_t *retained, uint16_t *pPacketId, char **pTopicName, uint16_t *topicNameLen, unsigned char **payload, size_t *payloadLen, unsigned char *pRxBuf, size_t rxBufLen) |
| Deserializes the supplied (wire) buffer into publish data. | |
| IoT_Error_t | aws_iot_mqtt_internal_deserialize_ack (unsigned char *pPacketType, unsigned char *dup, uint16_t *pPacketId, unsigned char *pRxBuf, size_t rxBuflen) |
| Deserializes the supplied (wire) buffer into an ack. | |
Detailed Description
MQTT client publish API definitions.
Definition in file aws_iot_mqtt_client_publish.c.
Function Documentation
| static IoT_Error_t _aws_iot_mqtt_internal_publish | ( | AWS_IoT_Client * | pClient, |
| const char * | pTopicName, | ||
| uint16_t | topicNameLen, | ||
| IoT_Publish_Message_Params * | pParams | ||
| ) | [static] |
Publish an MQTT message on a topic.
Called to publish an MQTT message on a topic.
- Note:
- Call is blocking. In the case of a QoS 0 message the function returns after the message was successfully passed to the TLS layer. In the case of QoS 1 the function returns after the receipt of the PUBACK control packet. This is the internal function which is called by the publish API to perform the operation. Not meant to be called directly as it doesn't do validations or client state changes
- Parameters:
-
pClient Reference to the IoT Client pTopicName Topic Name to publish to topicNameLen Length of the topic name pParams Pointer to Publish Message parameters
- Returns:
- An IoT Error Type defining successful/failed publish
Definition at line 197 of file aws_iot_mqtt_client_publish.c.
| static IoT_Error_t _aws_iot_mqtt_internal_serialize_publish | ( | unsigned char * | pTxBuf, |
| size_t | txBufLen, | ||
| uint8_t | dup, | ||
| QoS | qos, | ||
| uint8_t | retained, | ||
| uint16_t | packetId, | ||
| const char * | pTopicName, | ||
| uint16_t | topicNameLen, | ||
| const unsigned char * | pPayload, | ||
| size_t | payloadLen, | ||
| uint32_t * | pSerializedLen | ||
| ) | [static] |
Serializes the supplied publish data into the supplied buffer, ready for sending.
- Parameters:
-
pTxBuf the buffer into which the packet will be serialized txBufLen the length in bytes of the supplied buffer dup uint8_t - the MQTT dup flag qos QoS - the MQTT QoS value retained uint8_t - the MQTT retained flag packetId uint16_t - the MQTT packet identifier pTopicName char * - the MQTT topic in the publish topicNameLen uint16_t - the length of the Topic Name pPayload byte buffer - the MQTT publish payload payloadLen size_t - the length of the MQTT payload pSerializedLen uint32_t - pointer to the variable that stores serialized len
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 87 of file aws_iot_mqtt_client_publish.c.
| static IoT_Error_t _aws_iot_mqtt_read_string_with_len | ( | char ** | stringVar, |
| uint16_t * | stringLen, | ||
| unsigned char ** | pptr, | ||
| unsigned char * | enddata | ||
| ) | [static] |
- Parameters:
-
stringVar pointer to the String into which the data is to be read stringLen pointer to variable which has the length of the string pptr pointer to the output buffer - incremented by the number of bytes used & returned enddata pointer to the end of the data: do not read beyond
- Returns:
- AWS_SUCCESS if successful, FAILURE if not
Definition at line 52 of file aws_iot_mqtt_client_publish.c.
| IoT_Error_t aws_iot_mqtt_internal_deserialize_ack | ( | unsigned char * | pPacketType, |
| unsigned char * | dup, | ||
| uint16_t * | pPacketId, | ||
| unsigned char * | pRxBuf, | ||
| size_t | rxBuflen | ||
| ) |
Deserializes the supplied (wire) buffer into an ack.
- Parameters:
-
pPacketType returned integer - the MQTT packet type dup returned integer - the MQTT dup flag pPacketId returned integer - the MQTT packet identifier pRxBuf the raw buffer data, of the correct length determined by the remaining length field rxBuflen the length in bytes of the data in the supplied buffer
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 383 of file aws_iot_mqtt_client_publish.c.
| IoT_Error_t aws_iot_mqtt_internal_deserialize_publish | ( | uint8_t * | dup, |
| QoS * | qos, | ||
| uint8_t * | retained, | ||
| uint16_t * | pPacketId, | ||
| char ** | pTopicName, | ||
| uint16_t * | topicNameLen, | ||
| unsigned char ** | payload, | ||
| size_t * | payloadLen, | ||
| unsigned char * | pRxBuf, | ||
| size_t | rxBufLen | ||
| ) |
Deserializes the supplied (wire) buffer into publish data.
- Parameters:
-
dup returned uint8_t - the MQTT dup flag qos returned QoS type - the MQTT QoS value retained returned uint8_t - the MQTT retained flag pPacketId returned uint16_t - the MQTT packet identifier pTopicName returned String - the MQTT topic in the publish topicNameLen returned uint16_t - the length of the MQTT topic in the publish payload returned byte buffer - the MQTT publish payload payloadlen returned size_t - the length of the MQTT payload pRxBuf the raw buffer data, of the correct length determined by the remaining length field rxBufLen the length in bytes of the data in the supplied buffer
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 312 of file aws_iot_mqtt_client_publish.c.
| IoT_Error_t aws_iot_mqtt_internal_serialize_ack | ( | unsigned char * | pTxBuf, |
| size_t | txBufLen, | ||
| MessageTypes | msgType, | ||
| uint8_t | dup, | ||
| uint16_t | packetId, | ||
| uint32_t * | pSerializedLen | ||
| ) |
Serializes the ack packet into the supplied buffer.
- Parameters:
-
pTxBuf the buffer into which the packet will be serialized txBufLen the length in bytes of the supplied buffer msgType the MQTT packet type dup the MQTT dup flag packetId the MQTT packet identifier pSerializedLen uint32_t - pointer to the variable that stores serialized len
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 146 of file aws_iot_mqtt_client_publish.c.
| IoT_Error_t aws_iot_mqtt_publish | ( | AWS_IoT_Client * | pClient, |
| const char * | pTopicName, | ||
| uint16_t | topicNameLen, | ||
| IoT_Publish_Message_Params * | pParams | ||
| ) |
Publish an MQTT message on a topic.
Called to publish an MQTT message on a topic.
- Note:
- Call is blocking. In the case of a QoS 0 message the function returns after the message was successfully passed to the TLS layer. In the case of QoS 1 the function returns after the receipt of the PUBACK control packet. This is the outer function which does the validations and calls the internal publish above to perform the actual operation. It is also responsible for client state changes
- Parameters:
-
pClient Reference to the IoT Client pTopicName Topic Name to publish to topicNameLen Length of the topic name pParams Pointer to Publish Message parameters
- Returns:
- An IoT Error Type defining successful/failed publish
Definition at line 262 of file aws_iot_mqtt_client_publish.c.
Generated on Tue Jul 12 2022 19:02:38 by
1.7.2