全部產品
Search
文件中心

:作業記錄

更新時間:Jun 30, 2024

HTTPS協議下載單個檔案升級包的OTA升級功能常式運行後,您可以在裝置端和物聯網平台查看日誌資訊

前提條件

已配置OTA升級常式./demos/fota_posix_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指令訊息。
    [1579511826.577][LK-0309] pub: /ota/device/upgrade/a18wP******/LightSwitch
    
    [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  73 69 7A 65 22 3A 31 32 | data":{"size":12
    [LK-030A] < 34 38 33 30 36 2C 22 73  69 67 6E 22 3A 22 34 62 | 48306,"sign":"4b
    [LK-030A] < 66 61 63 65 66 35 63 62  61 30 61 35 36 64 63 32 | facef5cba0a56dc2
    [LK-030A] < 62 65 62 38 65 65 30 33  65 32 62 65 30 61 37 61 | beb8ee03e2be0a7a
    [LK-030A] < 65 64 65 65 65 31 38 38  35 61 63 65 30 66 62 35 | edeee1885ace0fb5
    [LK-030A] < 35 65 61 38 62 62 66 64  39 38 64 61 64 63 22 2C | 5ea8bbfd******",
    [LK-030A] < 22 76 65 72 73 69 6F 6E  22 3A 22 31 2E 31 2E 30 | "version":"1.1.0
    [LK-030A] < 22 2C 22 75 72 6C 22 3A  22 68 74 74 70 73 3A 2F | ","url":"https:/
    [LK-030A] < 2F 6F 74 61 2E 69 6F 74  2D 74 68 69 6E 67 2E 63 | /ota.iot-thing.c
    [LK-030A] < 6E 2D 73 68 61 6E 67 68  61 69 2E 61 6C 69 79 75 | n-shanghai.aliyu
    [LK-030A] < 6E 63 73 2E 63 6F 6D 2F  6F 74 61 2F 36 35 64 66 | ncs.com/ota/65df
    [LK-030A] < 63 64 61 30 34 37 33 62  65 32 39 38 33 36 64 66 | cda0473be29836df
    [LK-030A] < 64 65 35 38 35 34 37 32  37 65 31 32 2F 63 6B 35 | de5854******/ck5
    [LK-030A] < 32 6E 79 6F 31 7A 30 30  30 30 33 39 37 69 69 79 | 2nyo1z0000397iiy
    [LK-030A] < 76 68 6E 72 32 69 2E 62  69 6E 3F 45 78 70 69 72 | ******.bin?Expir
    [LK-030A] < 65 73 3D 31 35 37 39 35  39 38 32 32 36 26 4F 53 | es=1579598226&OS
    [LK-030A] < 53 41 63 63 65 73 73 4B  65 79 49 64 3D 63 53 38 | SAccessKeyId=cS8
    [LK-030A] < 75 52 52 79 35 34 52 73  7A 59 57 6E 61 26 53 69 | uRRy54R******&Si
    [LK-030A] < 67 6E 61 74 75 72 65 3D  42 4F 55 46 51 65 34 68 | gnature=BOUFQe4h
    [LK-030A] < 39 6E 36 41 64 5A 57 46  42 45 49 7A 33 5A 6A 70 | 9n6AdZWFBEIz3Zjp
    [LK-030A] < 42 70 59 25 33 44 22 2C  22 73 69 67 6E 4D 65 74 | ******","signMet
    [LK-030A] < 68 6F 64 22 3A 22 53 48  41 32 35 36 22 7D 2C 22 | hod":"SHA256"},"
    [LK-030A] < 69 64 22 3A 31 35 37 39  35 31 31 38 32 36 35 32 | id":157951182652
    [LK-030A] < 30 2C 22 6D 65 73 73 61  67 65 22 3A 22 73 75 63 | 0,"message":"suc
    [LK-030A] < 63 65 73 73 22 7D                                | cess"}
                                
  • 升級包下載過程日誌:

    以下日誌顯示裝置開始下載升級包,並擷取下載進度,直至下載完成。

    OTA target firmware version: 1.1.0, size: 1248306 Bytes
    starting download thread in 2 seconds ......
    establish mbedtls connection with server(host='ota.iot-thing.cn-shanghai.aliyuncs.com', port=[443])
    success to establish mbedtls connection, fd = 4(cost 44868 bytes in total, max used 47604 bytes)
    [1579511828.699][LK-040B] > GET /ota/65dfcda0473be29836dfde5854******/ck52nyo1z0000397iiy******.bin?Expires=1579598226&OSSAccessKeyId=cS8uRRy54R******&Signature
    [1579511828.699][LK-040B] > Host: ota.iot-thing.cn-shanghai.aliyuncs.com
    [1579511828.699][LK-040B] > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [1579511828.699][LK-040B] > Range: bytes=0-
    [1579511828.699][LK-040B] > Content-Length: 0
    [1579511828.699][LK-040B] >
    [1579511828.699][LK-0309] pub: /ota/device/progress/a18wP******/LightSwitch
    
    [LK-030A] > 7B 22 69 64 22 3A 31 2C  20 22 70 61 72 61 6D 73 | {"id":1, "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":""}}
    
    [1579511828.755][LK-040D] < HTTP/1.1 206 Partial Content
    [1579511828.755][LK-040D] < Date: Mon, 20 Jan 2020 09:17:08 GMT
    [1579511828.755][LK-040D] < Content-Type: application/octet-stream
    [1579511828.755][LK-040D] < Content-Length: 1248306
    [1579511828.755][LK-040D] < Connection: keep-alive
    [1579511828.755][LK-040D] < x-oss-request-id: 5E2570140838A33233******
    [1579511828.755][LK-040D] < Content-Range: bytes 0-1248305/1248306
    [1579511828.755][LK-040D] < Accept-Ranges: bytes
    [1579511828.755][LK-040D] < ETag: "4818CE191A4E2A93EE2DF17938******"
    [1579511828.755][LK-040D] < Last-Modified: Mon, 06 Jan 2020 16:32:55 GMT
    [1579511828.755][LK-040D] < x-oss-object-type: Normal
    [1579511828.755][LK-040D] < x-oss-hash-crc64ecma: 14290028752135******
    [1579511828.755][LK-040D] < x-oss-storage-class: Standard
    [1579511828.755][LK-040D] < Content-MD5: SBjOGRpOKpPuLfF5OC******
    [1579511828.755][LK-040D] < x-oss-server-time: 47
    [1579511828.755][LK-040D] <
    download 005% done, +8192 bytes
    [1579511828.777][LK-0309] pub: /ota/device/progress/a18wP******/LightSwitch
    
    [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 35 22 2C 22 64 | ":{"step":"5","d
    [LK-030A] > 65 73 63 22 3A 22 22 7D  7D                      | esc":""}}
    
    download 010% done, +8192 bytes
    [1579511828.788][LK-0309] pub: /ota/device/progress/a18wP******/LightSwitch
    
    [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 31 30 22 2C 22 | ":{"step":"10","
    [LK-030A] > 64 65 73 63 22 3A 22 22  7D 7D                   | desc":""}}
    
     ……
     ……
    
    [LK-030A] > 7B 22 69 64 22 3A 32 30  2C 20 22 70 61 72 61 6D | {"id":20, "param
    [LK-030A] > 73 22 3A 7B 22 73 74 65  70 22 3A 22 39 35 22 2C | s":{"step":"95",
    [LK-030A] > 22 64 65 73 63 22 3A 22  22 7D 7D                | "desc":""}}
    
    [1579511828.833][LK-0901] digest matched
    download 100% done, +3122 bytes
    [1579511828.833][LK-0309] pub: /ota/device/progress/a18wP******/LightSwitch
    
    [LK-030A] > 7B 22 69 64 22 3A 32 31  2C 20 22 70 61 72 61 6D | {"id":21, "param
    [LK-030A] > 73 22 3A 7B 22 73 74 65  70 22 3A 22 31 30 30 22 | s":{"step":"100"
    [LK-030A] > 2C 22 64 65 73 63 22 3A  22 22 7D 7D             | ,"desc":""}}
    
    download completed
    download thread exit

物聯網平台日誌

您可以在物聯網平台控制台查看常式運行後的日誌資訊。

  • OTA升級包情況:

    在左側導覽列,選擇監控營運 > OTA升級,在升級包列表查看升級包,瞭解升級情況。更多資訊,請參見查看升級情況
  • 線上狀態:

    在左側導覽列,選擇裝置管理 > 裝置,找到裝置,查看裝置狀態。裝置狀態顯示為線上,則表示裝置與物聯網平台成功串連。查看裝置狀態

  • 升級日誌:

    在左側導覽列,選擇監控營運 > Log Service,選擇產品後,查看裝置的上線、裝置上報裝置版本、物聯網平台推送OTA升級包等日誌。日誌

後續步驟

作業記錄中出現的錯誤資訊,請參見aiot_ota_api.h中的狀態代碼描述根據提示解決問題。