AWS IoT Device SDK C: MQTT
MQTT 3.1.1 client library
Return to main page ↑
IotMqtt_DeserializeResponse

Deserialize incoming ack packets.

Parameters
[in,out]pMqttPacketThe caller of this API sets type, remainingLength and pRemainingData. On success, packetIdentifier will be set.
Returns
One of the following:
Note
This call is part of serializer API used for implementing light-weight MQTT client.

Example

// Example below shows how IotMqtt_DeserializeResponse() is used to process unsubscribe ack.
// xMQTTSocket here is posix socket created and connected to MQTT broker outside of this function.
void processUnsubscribeAck( int xMQTTSocket )
{
IotMqttError_t xResult;
IotMqttPacketInfo_t xIncomingPacket;
xResult = IotMqtt_GetIncomingMQTTPacketTypeAndLength( &xIncomingPacket, getNextByte, ( void * ) xMQTTSocket );
IotMqtt_Assert( xIncomingPacket.remainingLength <= sizeof( ucSharedBuffer ) );
// Receive the remaining bytes.
if( recv( xMQTTSocket, ( void * ) ucSharedBuffer, xIncomingPacket.remainingLength, 0 ) == xIncomingPacket.remainingLength )
{
xIncomingPacket.pRemainingData = ucSharedBuffer;
if( IotMqtt_DeserializeResponse( &xIncomingPacket ) != IOT_MQTT_SUCCESS )
{
}
}
else
{
}
}