IoT Platform provides the over-the-air (OTA) update and management feature. This article describes how to configure Link SDK for C to perform an OTA update.
Prerequisites
- The device authentication information is obtained.
-
When you customize an SDK on the SDK customization page, set Advanced Capabilities to OTA.
- A development environment is prepared.
Background information
- For more information about the OTA update feature, see Overview.
- For more information about OTA update-specific Alink data formats, see OTA updates.
Process
To perform an OTA update, you must use the MQTT protocol to connect the application program with IoT Platform. You can use the HTTPS or MQTT protocol to download an OTA update package.
- HTTPS
- You can use this protocol to download an OTA update package that contains one or more files.
- For more information about the related API operations, see aiot_ota_api.h.
- The following figure shows the process. In this example, the ./demos/fota_posix_demo.c or ./demos/fota_multi_file_demo.c application program is used.
- MQTT
- You can use this protocol to download an OTA update package that contains a single file.
- For more information about the related API operations, see aiot_mqtt_download_api.h.
- The following figure shows the process. In this example, the ./demos/mota_basic_demo.c application program is used.
Examples
- For more information about examples, see the following sample code files:
Sample code file Protocol to connect devices with IoT Platform Protocol to download update packages Number of files in an update package Reference ./demos/fota_posix_demo.c MQTT HTTPS One Example 1: Sample code ./demos/fota_multi_file_demo.c Multiple Example 2: Sample code ./demos/mota_basic_demo.c MQTT One Example 3: Sample code - For more information about error codes, see aiot_ota_api.h or aiot_mqtt_download_api.h.