HTTPS協議下載含多個檔案的升級包的OTA升級功能常式運行後,您可以在裝置端和物聯網平台查看日誌資訊。
前提條件
已配置OTA升級常式./demos/fota_multi_file_demo.c
,詳細資料,請參見範例程式碼說明。
裝置端日誌
您可以在裝置端查看運行結果。串連日誌:
出現如下日誌,表示裝置與物聯網平台串連成功。[1579511737.377][LK-0313] MQTT user calls aiot_mqtt_connect api, connect [1579511737.377][LK-0317] LightSwitch&a18wP****** [1579511737.377][LK-0318] 779ACA0181ED1C0BD4B1BA7A347C9B172E27EAAB4AA18FC1F9FAD4CED1******* [1579511737.377][LK-0319] a18wP******.LightSwitch|timestamp=2524608000000,_ss=1,_v=sdk-c-4.0.0,securemode=2,signmethod=hmacsha256,ext=1,| establish mbedtls connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443]) success to establish mbedtls connection, fd = 3(cost 44763 bytes in total, max used 47675 bytes) [1579511737.522][LK-0313] MQTT connect success in 152 ms AIOT_MQTTEVT_CONNECT
上報版本號碼日誌:
以下日誌顯示裝置上報了初始的裝置版本號碼1.0.0
。[1579511737.522][LK-0309] pub: /ota/device/inform/a18wP******/LightSwitch [LK-030A] > 7B 22 69 64 22 3A 30 2C 20 22 70 61 72 61 6D 73 | {"id":0, "params [LK-030A] > 22 3A 7B 22 76 65 72 73 69 6F 6E 22 3A 22 31 2E | ":{"version":"1. [LK-030A] > 30 2E 30 22 7D 7D | 0.0"}}
接收OTA升級指令的日誌:
在物聯網平台建立OTA升級任務,並添加含多個檔案的升級包後,裝置接收以下OTA指令訊息。[1630656666.999][LK-0309] pub: /ota/device/upgrade/a18wP******/61p3RZuOhUkDyE****** [LK-030A] < 7B 22 63 6F 64 65 22 3A 22 31 30 30 30 22 2C 22 | {"code":"1000"," [LK-030A] < 64 61 74 61 22 3A 7B 22 65 78 74 44 61 74 61 22 | data":{"extData" [LK-030A] < 3A 7B 22 6B 65 79 31 22 3A 22 76 61 6C 75 65 31 | :{"key1":"value1 [LK-030A] < 22 2C 22 5F 70 61 63 6B 61 67 65 5F 75 64 69 22 | ","_package_udi" [LK-030A] < 3A 22 75 73 65 72 20 64 65 66 69 6E 65 20 69 6E | :"user define in [LK-030A] < 66 6F 2C 6B 65 79 3A 76 61 6C 75 65 22 7D 2C 22 | fo,key:value"}," [LK-030A] < 66 69 6C 65 73 22 3A 5B 7B 22 66 69 6C 65 53 69 | files":[{"fileSi [LK-030A] < 67 6E 22 3A 22 36 31 34 64 62 39 34 65 64 65 64 | gn":"614db94eded [LK-030A] < 62 33 31 34 32 39 38 32 65 38 35 62 30 63 30 33 | b3142982e85b0c0* [LK-030A] < 64 62 38 66 34 22 2C 22 66 69 6C 65 4E 61 6D 65 | *****","fileName [LK-030A] < 22 3A 22 66 69 6C 65 31 22 2C 22 66 69 6C 65 53 | ":"file1","fileS [LK-030A] < 69 7A 65 22 3A 33 32 34 34 30 34 35 2C 22 66 69 | ize":3244045,"fi [LK-030A] < 6C 65 55 72 6C 22 3A 22 68 74 74 70 73 3A 2F 2F | leUrl":"https:// [LK-030A] < 69 6F 74 78 2D 6F 74 61 2D 64 61 69 6C 79 2E 6F | iotx-ota-daily.o [LK-030A] < 73 73 2D 63 6E 2D 73 68 61 6E 67 68 61 69 2E 61 | ss-cn-shanghai.a [LK-030A] < 6C 69 79 75 6E 63 73 2E 63 6F 6D 2F 6F 74 61 2F | liyuncs.com/ota/ [LK-030A] < 61 32 34 32 37 32 61 39 32 61 62 63 39 36 31 36 | a24272a92abc9616 [LK-030A] < 34 66 34 38 32 35 37 32 37 34 34 37 32 36 30 33 | 4f48257274****** [LK-030A] < 2F 63 6B 72 6C 73 77 61 70 73 30 30 30 32 33 68 | /ckrlswaps00023h [LK-030A] < 38 61 79 62 36 35 6B 34 6A 34 2E 74 61 72 3F 45 | 8ayb******.tar?E [LK-030A] < 78 70 69 72 65 73 3D 31 36 33 30 37 34 33 30 36 | xpires=163074306 [LK-030A] < 36 26 4F 53 53 41 63 63 65 73 73 4B 65 79 49 64 | 6&OSSAccessKeyId [LK-030A] < 3D 4C 54 41 49 34 47 35 5A 76 50 64 54 31 77 66 | =LTAI4G5ZvPdT1wf [LK-030A] < 44 64 54 51 46 48 63 45 59 26 53 69 67 6E 61 74 | DdT******&Signat [LK-030A] < 75 72 65 3D 66 63 45 4A 61 50 74 76 6A 4A 30 62 | ure=fcEJaPtvjJ0b [LK-030A] < 46 4A 5A 37 66 33 50 74 50 4F 39 66 47 75 6F 25 | FJZ7f3PtPO9f**** [LK-030A] < 33 44 22 2C 22 66 69 6C 65 4D 64 35 22 3A 22 36 | **","fileMd5":"6 [LK-030A] < 31 34 64 62 39 34 65 64 65 64 62 33 31 34 32 39 | 14db94ededb31429 [LK-030A] < 38 32 65 38 35 62 30 63 30 33 64 62 38 66 34 22 | 82e85b0c0******" [LK-030A] < 7D 2C 7B 22 66 69 6C 65 53 69 67 6E 22 3A 22 36 | },{"fileSign":"6 [LK-030A] < 31 34 64 62 39 34 65 64 65 64 62 33 31 34 32 39 | 14db94ededb31429 [LK-030A] < 38 32 65 38 35 62 30 63 30 33 64 62 38 66 34 22 | 82e85b0c0******" [LK-030A] < 2C 22 66 69 6C 65 4E 61 6D 65 22 3A 22 66 69 6C | ,"fileName":"fil [LK-030A] < 65 32 22 2C 22 66 69 6C 65 53 69 7A 65 22 3A 33 | e2","fileSize":3 [LK-030A] < 32 34 34 30 34 35 2C 22 66 69 6C 65 55 72 6C 22 | 244045,"fileUrl" [LK-030A] < 3A 22 68 74 74 70 73 3A 2F 2F 69 6F 74 78 2D 6F | :"https://iotx-o [LK-030A] < 74 61 2D 64 61 69 6C 79 2E 6F 73 73 2D 63 6E 2D | ta-daily.oss-cn- [LK-030A] < 73 68 61 6E 67 68 61 69 2E 61 6C 69 79 75 6E 63 | shanghai.aliyunc [LK-030A] < 73 2E 63 6F 6D 2F 6F 74 61 2F 61 32 34 32 37 32 | s.com/ota/a24272 [LK-030A] < 61 39 32 61 62 63 39 36 31 36 34 66 34 38 32 35 | a92abc96164f4825 [LK-030A] < 37 32 37 34 34 37 32 36 30 33 2F 63 6B 72 6C 73 | 7274472603/ckrls [LK-030A] < 77 61 70 73 30 30 30 32 33 68 38 61 79 62 36 35 | waps00023h8ayb** [LK-030A] < 6B 34 6A 34 2E 74 61 72 3F 45 78 70 69 72 65 73 | ****.tar?Expires [LK-030A] < 3D 31 36 33 30 37 34 33 30 36 36 26 4F 53 53 41 | =1630743066&OSSA [LK-030A] < 63 63 65 73 73 4B 65 79 49 64 3D 4C 54 41 49 34 | ccessKeyId=LTAI4 [LK-030A] < 47 35 5A 76 50 64 54 31 77 66 44 64 54 51 46 48 | G5ZvPdT1wfDdT*** [LK-030A] < 63 45 59 26 53 69 67 6E 61 74 75 72 65 3D 66 63 | ***&Signature=fc [LK-030A] < 45 4A 61 50 74 76 6A 4A 30 62 46 4A 5A 37 66 33 | EJaPtvjJ0bFJZ7f3 [LK-030A] < 50 74 50 4F 39 66 47 75 6F 25 33 44 22 2C 22 66 | PtPO9f******","f [LK-030A] < 69 6C 65 4D 64 35 22 3A 22 36 31 34 64 62 39 34 | ileMd5":"614db94 [LK-030A] < 65 64 65 64 62 33 31 34 32 39 38 32 65 38 35 62 | ededb3142982e85b [LK-030A] < 30 63 30 33 64 62 38 66 34 22 7D 5D 2C 22 76 65 | 0c0******"}],"ve [LK-030A] < 72 73 69 6F 6E 22 3A 22 31 32 33 2E 34 35 36 2E | rsion":"123.456. [LK-030A] < 37 2E 38 22 2C 22 73 69 67 6E 4D 65 74 68 6F 64 | 7.8","signMethod [LK-030A] < 22 3A 22 4D 64 35 22 7D 2C 22 69 64 22 3A 31 36 | ":"Md5"},"id":16 [LK-030A] < 33 30 36 35 36 36 36 36 39 33 32 2C 22 6D 65 73 | 30656******,"mes [LK-030A] < 73 61 67 65 22 3A 22 73 75 63 63 65 73 73 22 7D | sage":"success"} Total file number is 2, current file id is 0, with file_name file1 OTA target firmware version: a1,b1, size: 3244045 Bytes extra data: {"key1":"value1","_package_udi":"user define info,key:value"}
升級包下載過程日誌:
以下日誌顯示裝置開始下載升級包,並擷取下載進度,直至下載完成。
[1630656666.999][LK-0309] pub[1]: /ota/device/progress/a1wP******/61p3RZuOhUkDyE****** [LK-030A] > 7B 22 69 64 22 3A 32 2C 20 22 70 61 72 61 6D 73 | {"id":2, "params [LK-030A] > 22 3A 7B 22 73 74 65 70 22 3A 22 30 22 2C 22 64 | ":{"step":"0","d [LK-030A] > 65 73 63 22 3A 22 22 7D 7D | esc":""}} Total file number is 2, current file id is 1, with file_name file2 OTA target firmware version: 123.456.7.8, size: 3244045 Bytes extra data: {"key1":"value1","_package_udi":"user define info,key:value"} starting download thread in 2 seconds ...... starting download thread in 2 seconds ...... success to establish tcp, fd=5 local port: 54038 [1630656669.022][LK-1000] establish mbedtls connection with server(host='iotx-ota-daily.oss-cn-shanghai.aliyuncs.com', port=[443]) success to establish tcp, fd=4 local port: 54036 [1630656669.022][LK-1000] establish mbedtls connection with server(host='iotx-ota-daily.oss-cn-shanghai.aliyuncs.com', port=[443]) [1630656669.100][LK-1000] success to establish mbedtls connection, (cost 94636 bytes in total, max used 97324 bytes) [1630656669.100][LK-040B] > GET /ota/a24272a92abc96164f48257274******/ckrlswaps00023h8ayb******.tar?Expires=1630743066&OSSAccessKeyId=LTAI4G5ZvPdT1wfDdT******&Signature=fcEJaPtvjJ0bFJZ7f3PtPO9fG****** HTTP/1.1 [1630656669.100][LK-040B] > Host: iotx-ota-daily.oss-cn-shanghai.aliyuncs.com [1630656669.100][LK-040B] > Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8 [1630656669.100][LK-040B] > Range: bytes=0- [1630656669.100][LK-040B] > Content-Length: 0 [1630656669.100][LK-040B] > [1630656669.100][LK-0309] pub[1]: /ota/device/progress/a1wP******/61p3RZuOhUkDyE****** [LK-030A] > 7B 22 69 64 22 3A 33 2C 20 22 70 61 72 61 6D 73 | {"id":3, "params [LK-030A] > 22 3A 7B 22 73 74 65 70 22 3A 22 30 22 2C 22 64 | ":{"step":"0","d [LK-030A] > 65 73 63 22 3A 22 22 7D 7D | esc":""}} [1630656669.100][LK-1000] success to establish mbedtls connection, (cost 94348 bytes in total, max used 97324 bytes) [1630656669.100][LK-040B] > GET /ota/a24272a92abc96164f48257274******/ckrlswaps00023h8ayb******.tar?Expires=1630743066&OSSAccessKeyId=LTAI4G5ZvPdT1wfDdT******&Signature=fcEJaPtvjJ0bFJZ7f3PtPO9f****** HTTP/1.1 [1630656669.100][LK-040B] > Host: iotx-ota-daily.oss-cn-shanghai.aliyuncs.com [1630656669.100][LK-040B] > Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8 [1630656669.100][LK-040B] > Range: bytes=0- [1630656669.100][LK-040B] > Content-Length: 0 [1630656669.100][LK-040B] > [1630656669.100][LK-0309] pub[1]: /ota/device/progress/a1wP******/61p3RZuOhUkDyE****** [LK-030A] > 7B 22 69 64 22 3A 34 2C 20 22 70 61 72 61 6D 73 | {"id":4, "params [LK-030A] > 22 3A 7B 22 73 74 65 70 22 3A 22 30 22 2C 22 64 | ":{"step":"0","d [LK-030A] > 65 73 63 22 3A 22 22 7D 7D | esc":""}} [1630656669.277][LK-040D] < HTTP/1.1 206 Partial Content [1630656669.277][LK-040D] < Server: AliyunOSS [1630656669.277][LK-040D] < Date: Fri, 03 Sep 2021 08:11:09 GMT [1630656669.277][LK-040D] < Content-Type: application/octet-stream [1630656669.277][LK-040D] < Content-Length: 3244045 [1630656669.277][LK-040D] < Connection: keep-alive [1630656669.277][LK-040D] < x-oss-request-id: 6131D89D1672CD3131****** [1630656669.277][LK-040D] < Content-Range: bytes 0-3244044/3244045 [1630656669.277][LK-040D] < Accept-Ranges: bytes [1630656669.277][LK-040D] < ETag: "614DB94EDEDB3142982E85B0C03DB8F4" [1630656669.277][LK-040D] < Last-Modified: Tue, 27 Jul 2021 08:32:11 GMT [1630656669.277][LK-040D] < x-oss-object-type: Normal [1630656669.277][LK-040D] < x-oss-hash-crc64ecma: 13960427643434****** [1630656669.277][LK-040D] < x-oss-storage-class: Standard [1630656669.277][LK-040D] < Content-MD5: YU25Tt7bMUKYLoWwwD****** [1630656669.277][LK-040D] < x-oss-server-time: 161 [1630656669.277][LK-040D] < [1630656669.277][LK-040D] < HTTP/1.1 206 Partial Content [1630656669.277][LK-040D] < Server: AliyunOSS [1630656669.277][LK-040D] < Date: Fri, 03 Sep 2021 08:11:09 GMT [1630656669.277][LK-040D] < Content-Type: application/octet-stream [1630656669.277][LK-040D] < Content-Length: 3244045 [1630656669.277][LK-040D] < Connection: keep-alive [1630656669.277][LK-040D] < x-oss-request-id: 6131D89DC562923431****** [1630656669.277][LK-040D] < Content-Range: bytes 0-3244044/3244045 [1630656669.277][LK-040D] < Accept-Ranges: bytes [1630656669.277][LK-040D] < ETag: "614DB94EDEDB3142982E85B0C03DB8F4" [1630656669.277][LK-040D] < Last-Modified: Tue, 27 Jul 2021 08:32:11 GMT [1630656669.277][LK-040D] < x-oss-object-type: Normal [1630656669.277][LK-040D] < x-oss-hash-crc64ecma: 13960427643434****** [1630656669.277][LK-040D] < x-oss-storage-class: Standard [1630656669.277][LK-040D] < Content-MD5: YU25Tt7bMUKYLoWwwD****** [1630656669.277][LK-040D] < x-oss-server-time: 166 [1630656669.277][LK-040D] < file_id 1, download 010% done, +8192 bytes file_id 0, download 010% done, +8192 bytes file_id 1, download 020% done, +8192 bytes file_id 0, download 020% done, +8192 bytes file_id 0, download 030% done, +8192 bytes file_id 1, download 030% done, +8192 bytes file_id 0, download 040% done, +8192 bytes file_id 1, download 040% done, +8192 bytes file_id 0, download 050% done, +8192 bytes file_id 0, download 060% done, +8192 bytes file_id 1, download 050% done, +8192 bytes file_id 0, download 070% done, +8192 bytes file_id 1, download 060% done, +8192 bytes file_id 0, download 080% done, +8192 bytes file_id 1, download 070% done, +8192 bytes file_id 0, download 090% done, +8192 bytes file_id 1, download 080% done, +8192 bytes [1630656669.755][LK-0901] digest matched file_id 0, download 100% done, +13 bytes download completed [1630656669.755][LK-1000] adapter_network_deinit download thread exit file_id 1, download 090% done, +8192 bytes file_id 1, download 095% done, +8192 bytes [1630656669.855][LK-0901] digest matched file_id 1, download 100% done, +13 bytes [1630656669.855][LK-0309] pub[1]: /ota/device/progress/a1wP******/61p3RZuOhUkDyE****** [LK-030A] > 7B 22 69 64 22 3A 35 2C 20 22 70 61 72 61 6D 73 | {"id":5, "params [LK-030A] > 22 3A 7B 22 73 74 65 70 22 3A 22 31 30 30 22 2C | ":{"step":"100", [LK-030A] > 22 64 65 73 63 22 3A 22 22 7D 7D | "desc":""}} download completed
物聯網平台日誌
您可以在物聯網平台控制台,查看常式運行後的日誌資訊。
OTA升級包情況:
在左側導覽列,選擇 ,在升級包列表查看升級包,瞭解升級情況。更多資訊,請參見查看升級情況。線上狀態:
在左側導覽列,選擇
,找到裝置,查看裝置狀態。裝置狀態顯示為線上,則表示裝置與物聯網平台成功串連。升級日誌:
在左側導覽列,選擇查看裝置的上線、裝置上報裝置版本、物聯網平台推送OTA升級包等日誌。 ,選擇產品後,
後續步驟
作業記錄中出現的錯誤資訊,請參見aiot_ota_api.h中的狀態代碼描述,根據提示解決問題。