裝置標籤功能的常式運行後,您可以在裝置端查看標籤的上報日誌;在物聯網平台,查看裝置標籤資訊及上報標籤的相關日誌。
前提條件
已配置C Link SDK的裝置標籤功能常式,詳細資料,請參見使用樣本。
裝置端日誌
您可以在裝置端查看運行結果。串連日誌:
出現如下日誌,表示裝置與物聯網平台串連成功。[1626674158.155][LK-0313] MQTT user calls aiot_mqtt_connect api, connect [1626674158.155][LK-0317] LightSwitch&a1wP****** [1626674158.155][LK-0318] 613F70F16BC4C08B7FDC5BA2F9698B37B428B1C3BF5E1F0E4DAFE9B3EA****** core_sysdep_network_establish host iot-06******.mqtt.iothub.aliyuncs.com port 443, type 0 establish tcp connection with server(host='iot-06******.mqtt.iothub.aliyuncs.com', port=[443]) success to establish tcp, fd=3 local port: 32774 [1626674158.177][LK-1000] establish mbedtls connection with server(host='iot-06******.mqtt.iothub.aliyuncs.com', port=[443]) [1626674158.244][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes) [1626674158.244][LK-0319] a1wP******.LightSwitch|timestamp=2524608000000,_ss=1,_v=sdk-c-4.1.0,securemode=2,signmethod=hmacsha256,ext=3,_conn=tls_5b| [1626674158.299][LK-0313] MQTT connect success in 145 ms AIOT_MQTTEVT_CONNECT
更新裝置標籤:
- 應答日誌:
[1626674158.355][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/deviceinfo/update_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-030A] < 61 22 3A 7B 7D 2C 22 69 64 22 3A 22 31 22 2C 22 | a":{},"id":"1"," [LK-030A] < 6D 65 73 73 61 67 65 22 3A 22 73 75 63 63 65 73 | message":"succes [LK-030A] < 73 22 2C 22 6D 65 74 68 6F 64 22 3A 22 74 68 69 | s","method":"thi [LK-030A] < 6E 67 2E 64 65 76 69 63 65 69 6E 66 6F 2E 75 70 | ng.deviceinfo.up [LK-030A] < 64 61 74 65 22 2C 22 76 65 72 73 69 6F 6E 22 3A | date","version": [LK-030A] < 22 31 2E 30 22 7D | "1.0"} pk: a1wP******, dn: LightSwitch, code: 200, msg id: 1, data: {}, message: success
- 應答日誌:
刪除裝置標籤:
請求日誌:
[1626687770.800][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/deviceinfo/delete [LK-030A] > 7B 22 69 64 22 3A 22 31 22 2C 22 76 65 72 73 69 | {"id":"1","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 5B 7B 22 61 74 74 72 4B 65 79 22 3A 22 | s":[{"attrKey":" [LK-030A] > 74 65 73 74 4B 65 79 22 7D 5D 7D | testKey"}]} aiot_devinfo_send delete msg id: 1
- 應答日誌:
[1626687770.844][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/deviceinfo/delete_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-030A] < 61 22 3A 7B 7D 2C 22 69 64 22 3A 22 31 22 2C 22 | a":{},"id":"1"," [LK-030A] < 6D 65 73 73 61 67 65 22 3A 22 73 75 63 63 65 73 | message":"succes [LK-030A] < 73 22 2C 22 6D 65 74 68 6F 64 22 3A 22 74 68 69 | s","method":"thi [LK-030A] < 6E 67 2E 64 65 76 69 63 65 69 6E 66 6F 2E 64 65 | ng.deviceinfo.de [LK-030A] < 6C 65 74 65 22 2C 22 76 65 72 73 69 6F 6E 22 3A | lete","version": [LK-030A] < 22 31 2E 30 22 7D | "1.0"} pk: a1wP******, dn: LightSwitch, code: 200, msg id: 1, data: {}, message: success
物聯網平台日誌
您可以在物聯網平台控制台,查看裝置上報的標籤資訊和相關日誌。
線上狀態:
在左側導覽列,選擇
,找到裝置,查看裝置狀態。裝置狀態顯示為線上,則表示裝置與物聯網平台成功串連。標籤資訊:
在裝置列表,單擊裝置的查看,進入裝置詳情頁,查看標籤資訊。- 更新標籤:
- 刪除標籤:
作業記錄:
在左側導覽列,選擇查看裝置上線後,向物聯網平台,上報或刪除裝置標籤的日誌資訊。 ,選擇產品後,
後續步驟
作業記錄中出現的錯誤資訊,請參見aiot_devinfo_api.h中的狀態代碼描述,根據提示解決問題。