Skip to content

Commit 2d44c9a

Browse files
committed
Subscribe to topic notify-next
1 parent d628228 commit 2d44c9a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,10 @@ static void prvOTADemoTask( void * pvParam )
13581358
/* OTA Agent state returned from calling OTA_GetAgentState.*/
13591359
OtaState_t state = OtaAgentStateStopped;
13601360

1361+
/* Buffer to hold the notify-next topic. */
1362+
char jobNotifyTopic[ JOBS_API_MAX_LENGTH( strlen( otademoconfigCLIENT_IDENTIFIER ) ) ];
1363+
size_t jobNotifyTopicLen = 0;
1364+
13611365
ESP_LOGI( TAG, "OTA over MQTT demo, Application version %u.%u.%u",
13621366
appFirmwareVersion.u.x.major,
13631367
appFirmwareVersion.u.x.minor,
@@ -1392,6 +1396,16 @@ static void prvOTADemoTask( void * pvParam )
13921396
vTaskDelay( pdMS_TO_TICKS( 100 ) );
13931397
}
13941398

1399+
/* Subscribe to notify-next */
1400+
JobsStatus_t status = Jobs_GetTopic( jobNotifyTopic,
1401+
sizeof( jobNotifyTopic ),
1402+
otademoconfigCLIENT_IDENTIFIER,
1403+
strlen( otademoconfigCLIENT_IDENTIFIER ),
1404+
JobsNextJobChanged,
1405+
&jobNotifyTopicLen );
1406+
1407+
prvMQTTSubscribe( jobNotifyTopic, ( uint16_t ) jobNotifyTopicLen, 1 );
1408+
13951409
while( otaAgentState != OtaAgentStateStopped )
13961410
{
13971411
processOTAEvents();

0 commit comments

Comments
 (0)