Deserialize an MQTT PUBLISH packet.
uint16_t * pPacketId,
MQTTStatus_t MQTT_DeserializePublish(const MQTTPacketInfo_t *pIncomingPacket, uint16_t *pPacketId, MQTTPublishInfo_t *pPublishInfo)
Deserialize an MQTT PUBLISH packet.
Definition: core_mqtt_serializer.c:2451
MQTTStatus_t
Return codes from MQTT functions.
Definition: core_mqtt_serializer.h:99
MQTT incoming packet parameters.
Definition: core_mqtt_serializer.h:256
MQTT PUBLISH packet parameters.
Definition: core_mqtt_serializer.h:214
- Parameters
-
[in] | pIncomingPacket | MQTTPacketInfo_t containing the buffer. |
[out] | pPacketId | The packet ID obtained from the buffer. |
[out] | pPublishInfo | Struct containing information about the publish. |
- Returns
- MQTTBadParameter, MQTTBadResponse, or MQTTSuccess.
Example
int32_t socket_recv(
void * pBuffer,
size_t bytesToRecv
);
uint16_t packetId;
int32_t bytesRecvd;
uint8_t buffer[ BUFFER_SIZE ];
socket_recv,
&networkContext,
&incomingPacket
);
bytesRecvd = socket_recv(
&networkContext,
( void * ) buffer,
);
{
{
}
}
MQTTStatus_t MQTT_GetIncomingPacketTypeAndLength(TransportRecv_t readFunc, NetworkContext_t *pNetworkContext, MQTTPacketInfo_t *pIncomingPacket)
Extract the MQTT packet type and length from incoming packet.
Definition: core_mqtt_serializer.c:2565
#define MQTT_PACKET_TYPE_PUBLISH
PUBLISH (bidirectional).
Definition: core_mqtt_serializer.h:67
@ MQTTSuccess
Definition: core_mqtt_serializer.h:100
struct NetworkContext NetworkContext_t
The NetworkContext is an incomplete type. An implementation of this interface must define struct Netw...
Definition: transport_interface.h:191
size_t remainingLength
Length of remaining serialized data.
Definition: core_mqtt_serializer.h:270
uint8_t type
Type of incoming MQTT packet.
Definition: core_mqtt_serializer.h:260
uint8_t * pRemainingData
Remaining serialized data in the MQTT packet.
Definition: core_mqtt_serializer.h:265