Skip to content

Commit 832a797

Browse files
authored
Hygiene fix in MQTT demos to log warning for unexpected PINGRESP packet event (FreeRTOS#366)
Update MQTT demos to log warning on receiving PINGRESP packet in event callback
1 parent 559772a commit 832a797

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/DemoTasks/shadow_demo_helpers.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,9 @@ void vHandleOtherIncomingPacket( MQTTPacketInfo_t * pxPacketInfo,
469469
case MQTT_PACKET_TYPE_PINGRESP:
470470

471471
/* Nothing to be done from application as library handles
472-
* PINGRESP. */
472+
* PINGRESP with the use of MQTT_ProcessLoop API function. */
473473
LogWarn( ( "PINGRESP should not be handled by the application "
474-
"callback when using MQTT_ProcessLoop.\n\n" ) );
474+
"callback when using MQTT_ProcessLoop.\n" ) );
475475
break;
476476

477477
case MQTT_PACKET_TYPE_PUBACK:

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/DemoTasks/BasicTLSMQTTExample.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,11 @@ static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket,
778778
break;
779779

780780
case MQTT_PACKET_TYPE_PINGRESP:
781-
LogInfo( ( "Ping Response successfully received.\r\n" ) );
781+
782+
/* Nothing to be done from application as library handles
783+
* PINGRESP with the use of MQTT_ProcessLoop API function. */
784+
LogWarn( ( "PINGRESP should not be handled by the application "
785+
"callback when using MQTT_ProcessLoop.\n" ) );
782786
break;
783787

784788
case MQTT_PACKET_TYPE_PUBREC:

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/DemoTasks/MultitaskMQTTExample.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ static void prvEventCallback( MQTTContext_t * pMqttContext,
17161716
case MQTT_PACKET_TYPE_PINGRESP:
17171717

17181718
/* Nothing to be done from application as library handles
1719-
* PINGRESP. */
1719+
* PINGRESP with the use of MQTT_ProcessLoop API function. */
17201720
LogWarn( ( "PINGRESP should not be handled by the application "
17211721
"callback when using MQTT_ProcessLoop.\n" ) );
17221722
break;

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/DemoTasks/MutualAuthMQTTExample.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,11 @@ static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket,
902902
break;
903903

904904
case MQTT_PACKET_TYPE_PINGRESP:
905-
LogInfo( ( "Ping Response successfully received.\r\n" ) );
905+
906+
/* Nothing to be done from application as library handles
907+
* PINGRESP with the use of MQTT_ProcessLoop API function. */
908+
LogWarn( ( "PINGRESP should not be handled by the application "
909+
"callback when using MQTT_ProcessLoop.\n" ) );
906910
break;
907911

908912
/* Any other packet type is invalid. */

FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/DemoTasks/PlaintextMQTTExample.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@
153153
*/
154154
#define mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 200U )
155155

156-
#define MILLISECONDS_PER_SECOND ( 1000U ) /**< @brief Milliseconds per second. */
157-
#define MILLISECONDS_PER_TICK ( MILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) /**< Milliseconds per FreeRTOS tick. */
156+
#define MILLISECONDS_PER_SECOND ( 1000U ) /**< @brief Milliseconds per second. */
157+
#define MILLISECONDS_PER_TICK ( MILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) /**< Milliseconds per FreeRTOS tick. */
158158

159159
/*-----------------------------------------------------------*/
160160

@@ -723,7 +723,11 @@ static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket,
723723
break;
724724

725725
case MQTT_PACKET_TYPE_PINGRESP:
726-
LogInfo( ( "Ping Response successfully received." ) );
726+
727+
/* Nothing to be done from application as library handles
728+
* PINGRESP with the use of MQTT_ProcessLoop API function. */
729+
LogWarn( ( "PINGRESP should not be handled by the application "
730+
"callback when using MQTT_ProcessLoop.\n" ) );
727731
break;
728732

729733
/* Any other packet type is invalid. */

FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/DemoTasks/MutualAuthMQTTExample.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,11 @@ static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket,
621621
break;
622622

623623
case MQTT_PACKET_TYPE_PINGRESP:
624-
LogInfo( ( "Ping Response successfully received.\r\n" ) );
624+
625+
/* Nothing to be done from application as library handles
626+
* PINGRESP with the use of MQTT_ProcessLoop API function. */
627+
LogWarn( ( "PINGRESP should not be handled by the application "
628+
"callback when using MQTT_ProcessLoop.\n" ) );
625629
break;
626630

627631
/* Any other packet type is invalid. */

0 commit comments

Comments
 (0)