设备标签功能的例程运行后,您可以在设备端查看标签的上报日志;在物联网平台,查看设备标签信息及上报标签的相关日志。

前提条件

已配置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.299][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/deviceinfo/update
      
      [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  2C 22 61 74 74 72 56 61 | testKey","attrVa
      [LK-030A] > 6C 75 65 22 3A 22 74 65  73 74 56 61 6C 75 65 22 | lue":"testValue"
      [LK-030A] > 7D 5D 7D                                         | }]}
      
      aiot_devinfo_send update msg id: 1
    • 应答日志:
      [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中的状态码描述根据提示解决问题。若未能解决问题,您可以提交工单