How to enable MQTT demo and OTA simultensouly?

Hi,
I am able to achieve AWS freertos MQTT demo running on my platform.
Also, I m able to sepratly run OTA demo in AWS freertos code. It is currently only running OTA agent.

If I updated the MQTT demo using AWS freertos OTA job, it will run MQTT “hello world” demo and disable OTA agent and will not be able to perform the next OTA cycle.

Now my query is how to merge them both in a single application that should not disable either or functionality?

Regards.

Hi,
Can one help me here ?

Regards.

Hi Arjun,

You can call Iot_CreateDetachedThread multiple times in iot_demo_runner.c:

static demoContext_t mqttDemoContext =
{
.networkTypes = democonfigNETWORK_TYPES,
.demoFunction = RunMqttDemo,
.networkConnectedCallback = DEMO_networkConnectedCallback,
.networkDisconnectedCallback = DEMO_networkDisconnectedCallback
};

Iot_CreateDetachedThread( runDemoTask,
&mqttDemoContext,
1U,
democonfigDEMO_STACKSIZE );

static demoContext_t otaDemoContext =
{
.networkTypes = democonfigNETWORK_TYPES,
.demoFunction = vStartOTAUpdateDemoTask,
.networkConnectedCallback = DEMO_networkConnectedCallback,
.networkDisconnectedCallback = DEMO_networkDisconnectedCallback
};

Iot_CreateDetachedThread( runDemoTask,
&otaDemoContext,
0U,
democonfigDEMO_STACKSIZE );

You may need to use a semaphore or some other mechanism depending on how you would like those demos to synchronize.

Hi,

Thank for update i will try and update.
meanwhile I want to understand, what is the use of OTA_UPDATE_DEMO in AWS freeRTOS, updating the OTA_UPDATE_DEMO demo itself, not updating the custom code?

What is the correct way to update my application using OTA_UPDATE_DEMO ?

Do you mean to ask the purpose of OTA demo? If so, it is meant to show how to use the OTA library to remotely update your firmware. Depending on your needs, you can use it as it is or modify it as per your requirements.

Thanks.

So, Lets. If I want to upgrade the AWS any of the demo (i.e. MQTT, SHADOW, ,TCP_ECHO_CLIENT, DEFENDER, GREENGRASS_DISCOVERY) using OTA_UPDATE_DEMO from AWS. How can I upgrade it?

Thanks

I see - so what you are asking is how can you combine 2 demos. Like you want to run both MQTT and OTA. If that is correct, you will need to make some changes:

Hope that helps.

Thanks.