2 Replies Latest reply on Sep 23, 2020 12:23 AM by YaWu_4722351

    multi ota targets from example: AnyCloud_OTA_Using_MQTT



      I am using PrototypingKit (CY8CPROTO-062-4343W) with ModusToolbox. Taking the "AnyCloud_OTA_Using_MQTT" example directly, I build the project. Then two questions come to my way, hope somebody could help to explain what happens here. Thanks very much.

      1. Where exactly the "anycloud/test/ota/image" ota happens?  I found inside: libs\anycloud-ota\source\cy_ota_agent.c, line 649, callback function is called here. But from: source\ota_task.c, line 239, void ota_callback(), couldn't find how the image is upgraded.
      2. How to add a second ota target? From: source\ota_app_config.h, line 77, I found the ota topics. If I want to add a second or third topic, what should I do? From: source\ota_task.c, line 239, void ota_callback(),
        • cb_arg can just be converted to cy_ota_context_ptr, it's a void pointer. I need to dig into: libs\anycloud-ota\source\cy_ota_internal.h, line 184, to find out  cy_ota_context_t. Don't understand why 'cy_ota_context_t' is put inside "internal" header.Why don't put it inside "cy_ota_api.h" ?
        • cb_arg can't interpret out any information about different ota topics, how can I differentiate topics?


      In another way to ask:


      Header 1

      /* MQTT topics */

      const char * my_topics[ MQTT_TOPIC_FILTER_NUM ] =


              "anycloud/test/ota/image",                       // original topic to upgrade fw of prototypingKit

              "anycloud/test/ota/my_another_module" // another topic to upgrade fw of external module by OTA




      How can distinguish topics based on cb_arg ?

      Header 1
      void ota_callback(cy_ota_cb_reason_t reason, uint32_t value, void *cb_arg )