@@ -522,7 +522,7 @@ static int createMQTTConnectionWithBroker( NetworkContext_t * pNetworkContext,
522522 Clock_SleepMs ( MQTT_RESPONSE_WAIT_TIME_MS );
523523 /* Since TCP socket has timeout, retry until the data is available */
524524 result = MQTT_GetIncomingPacketTypeAndLength ( Plaintext_Recv , pNetworkContext , & incomingPacket );
525- LogInfo ( ( "MQTT_GetIncomingPacketTypeAndLength returned: %d\n" , result ) );
525+ // LogInfo( ( "MQTT_GetIncomingPacketTypeAndLength returned: %d\n", result ) );
526526 } while ( ( result == MQTTNoDataAvailable ) );
527527
528528 assert ( result == MQTTSuccess );
@@ -541,7 +541,7 @@ static int createMQTTConnectionWithBroker( NetworkContext_t * pNetworkContext,
541541 connackProperties .maxPacketSize = MQTT_MAX_PACKET_SIZE ;
542542
543543 MQTTPropBuilder_t propBuffer = {0 } ;
544- result = MQTT_DeserializeConnack ( & connackProperties , & incomingPacket , & sessionPresent , & propBuffer );
544+ result = MQTT_DeserializeAck ( & incomingPacket , NULL , & sessionPresent , NULL , 0 , MQTT_MAX_PACKET_SIZE , NULL , & connackProperties );
545545
546546 if ( result != MQTTSuccess )
547547 {
@@ -878,7 +878,7 @@ static void mqttProcessIncomingPacket( NetworkContext_t * pNetworkContext,
878878 Clock_SleepMs ( MQTT_RESPONSE_WAIT_TIME_MS );
879879 /* Retry till data is available */
880880 result = MQTT_GetIncomingPacketTypeAndLength ( Plaintext_Recv , pNetworkContext , & incomingPacket );
881- LogInfo ( ( "MQTT_GetIncomingPacketTypeAndLength returned: %d\n" , result ) );
881+ // LogInfo( ( "MQTT_GetIncomingPacketTypeAndLength returned: %d\n", result ) );
882882 } while ( ( result == MQTTNoDataAvailable ) );
883883
884884 assert ( result == MQTTSuccess );
@@ -900,37 +900,18 @@ static void mqttProcessIncomingPacket( NetworkContext_t * pNetworkContext,
900900
901901 if ( ( incomingPacket .type & 0xf0 ) == MQTT_PACKET_TYPE_PUBLISH )
902902 {
903- result = MQTT_DeserializePublish ( & incomingPacket , & packetId , & publishInfo , NULL , MQTT_MAX_PACKET_SIZE );
903+ result = MQTT_DeserializePublish ( & incomingPacket , & packetId , & publishInfo , NULL , MQTT_MAX_PACKET_SIZE , 0 );
904904 assert ( result == MQTTSuccess );
905905
906906 /* Process incoming Publish message. */
907907 mqttProcessIncomingPublish ( & publishInfo , packetId );
908908 }
909- else if ( ( incomingPacket . type == MQTT_PACKET_TYPE_SUBACK ) || ( incomingPacket . type == MQTT_PACKET_TYPE_UNSUBACK ) )
909+ else
910910 {
911911 MQTTReasonCodeInfo_t reasonCodes ;
912- result = MQTT_DeserializeSuback ( & reasonCodes , & incomingPacket , & packetId , NULL , MQTT_MAX_PACKET_SIZE );
912+ result = MQTT_DeserializeAck ( & incomingPacket , & packetId , NULL , & reasonCodes , 0 , MQTT_MAX_PACKET_SIZE , NULL , NULL );
913913 globalSubAckStatus = ( result == MQTTSuccess );
914914 assert ( result == MQTTSuccess || result == MQTTServerRefused );
915-
916- /* Process the response. */
917- mqttProcessResponse ( & incomingPacket , packetId );
918- }
919- else if ( (incomingPacket .type == MQTT_PACKET_TYPE_PUBACK ) ||
920- (incomingPacket .type == MQTT_PACKET_TYPE_PUBREC ) ||
921- (incomingPacket .type == MQTT_PACKET_TYPE_PUBREL ) ||
922- (incomingPacket .type == MQTT_PACKET_TYPE_PUBCOMP ) )
923- {
924- MQTTReasonCodeInfo_t reasonCode ;
925- result = MQTT_DeserializePublishAck ( & incomingPacket , & packetId , & reasonCode , 0 , MQTT_MAX_PACKET_SIZE , NULL );
926- assert ( result == MQTTSuccess );
927- /* Process the response. */
928- mqttProcessResponse ( & incomingPacket , packetId );
929- }
930- else
931- {
932- result = MQTT_DeserializePing (& incomingPacket );
933- assert ( result == MQTTSuccess );
934915 /* Process the response. */
935916 mqttProcessResponse ( & incomingPacket , packetId );
936917 }
0 commit comments