Skip to content

Commit a897aad

Browse files
authored
Merge pull request #31 from ActoryOu/removeOtaWarningMsgs
Remove warning messages in OTA demo.
2 parents 89aee01 + 9659d91 commit a897aad

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@
113113
*/
114114
#define OTA_JOB_NOTIFY_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_JOB_NOTIFY_TOPIC_FILTER ) - 1 ) )
115115

116+
/**
117+
* @brief Job update response topics filter for OTA.
118+
* This is used to route all the packets for OTA reserved topics which OTA agent has not subscribed for.
119+
*/
120+
#define OTA_JOB_UPDATE_RESPONSE_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/+/update/+"
121+
122+
/**
123+
* @brief Length of Job update response topics filter.
124+
*/
125+
#define OTA_JOB_UPDATE_RESPONSE_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_JOB_UPDATE_RESPONSE_TOPIC_FILTER ) - 1 ) )
126+
116127
/**
117128
* @brief Wildcard topic filter for matching job response messages.
118129
* This topic filter is used to match the responses from OTA service for OTA agent job requests. THe
@@ -584,6 +595,11 @@ static void prvOtaAppCallback( OtaJobEvent_t event,
584595
xCoreMqttAgentManagerPost( CORE_MQTT_AGENT_OTA_STARTED_EVENT );
585596
break;
586597

598+
case OtaJobEventNoActiveJob:
599+
ESP_LOGI( TAG, "Received OtaJobEventNoActiveJob callback from OTA Agent." );
600+
/* No more jobs available in IoTCore, no further actions on this event. */
601+
break;
602+
587603
default:
588604
ESP_LOGW( TAG, "Received an unhandled callback event from OTA Agent, "
589605
"event = %d", event );
@@ -1181,5 +1197,21 @@ bool vOTAProcessMessage( void * pvIncomingPublishCallbackContext,
11811197
}
11821198
}
11831199

1200+
if( isMatch == false )
1201+
{
1202+
( void ) MQTT_MatchTopic( pxPublishInfo->pTopicName,
1203+
pxPublishInfo->topicNameLength,
1204+
OTA_JOB_UPDATE_RESPONSE_TOPIC_FILTER,
1205+
OTA_JOB_UPDATE_RESPONSE_TOPIC_FILTER_LENGTH,
1206+
&isMatch );
1207+
1208+
/* Return true if receiving update/accepted or update/rejected to get rid of warning
1209+
* message "WARN: Received an unsolicited publish from topic $aws/things/+/jobs/+/update/+". */
1210+
if( isMatch == true )
1211+
{
1212+
ESP_LOGI( TAG, "Received update response: %s.", pxPublishInfo->pTopicName );
1213+
}
1214+
}
1215+
11841216
return isMatch;
11851217
}

0 commit comments

Comments
 (0)