MQTT动态注册功能的例程运行后,您可以在设备端查看日志信息

前提条件

已配置C Link SDK的MQTT动态注册功能的例程

设备端日志

您可以在设备端查看运行结果。仅动态注册设备时,物联网平台的日志服务页面不会产生日志。

  • 注册请求日志:

    设备端向物联网平台发起动态注册请求的日志如下。
    [1622428788.933][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    core_sysdep_network_establish host a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com 443, type 0
    establish tcp connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443])
    success to establish tcp, fd=3
    local port: 53828
    [1622428788.933][LK-1000] establish mbedtls connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443])
    [1622428788.999][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes)
    [1622428789.166][LK-0313] MQTT connect success in 231 ms
  • 应答日志:
    • 如果使用预注册的方式进行动态注册,物联网平台返回的应答日志如下:
      [LK-030A] < 7B 22 64 65 76 69 63 65  53 65 63 72 65 74 22 3A | {"deviceSecret":
      [LK-030A] < 22 30 66 34 38 31 32 31  65 38 63 62 35 35 63 36 | "0f48121e8cb55c6
      [LK-030A] < 35 65 66 62 61 37 65 30  33 66 37 39 38 37 62 65 | 5efba7e03f******
      [LK-030A] < 65 22 2C 22 70 72 6F 64  75 63 74 4B 65 79 22 3A | *","productKey":
      [LK-030A] < 22 67 37 68 30 66 6A 79  33 52 31 4F 22 2C 22 64 | "a18wP******","d
      [LK-030A] < 65 76 69 63 65 4E 61 6D  65 22 3A 22 4C 69 67 68 | eviceName":"Ligh
      [LK-030A] < 74 53 77 69 74 63 68 50  72 65 41 75 74 68 22 7D | tSwitch"}
      
      device secret: 0f48121e8cb55c65efba7e03f7******
      [1622429683.799][LK-1000] adapter_network_deinit
    • 如果使用免预注册的方式进行动态注册,物联网平台返回的应答日志如下:
      [LK-030A] < 7B 22 63 6C 69 65 6E 74  49 64 22 3A 22 34 66 34 | {"clientId":"4f4
      [LK-030A] < 61 71 59 78 44 43 4C 6B  6F 41 50 32 46 4B 4C 70 | aqYxDCLkoAP2FKLp
      [LK-030A] < 79 30 30 30 31 30 30 22  2C 22 70 72 6F 64 75 63 | y******","produc
      [LK-030A] < 74 4B 65 79 22 3A 22 67  37 68 30 66 6A 79 33 52 | tKey":"a18wP****
      [LK-030A] < 31 4F 22 2C 22 64 65 76  69 63 65 4E 61 6D 65 22 | **","deviceName"
      [LK-030A] < 3A 22 4C 69 67 68 74 53  77 69 74 63 68 22 2C 22 | :"LightSwitch","
      [LK-030A] < 64 65 76 69 63 65 54 6F  6B 65 6E 22 3A 22 5E 31 | deviceToken":"^1
      [LK-030A] < 5E 31 36 32 32 34 32 38  37 38 39 31 35 35 5E 32 | ^1622428789155^2
      [LK-030A] < 63 33 66 34 38 33 35 63  30 34 36 39 32 65 22 7D | c3f4835c******"}
      
      clientid: 4f4aqYxDCLkoAP2FKLpy******|authType=connwl,securemode=-2,_ss=1,ext=3,_v=sdk-c-4.1.0|
      username: LightSwitch&a18wP******
      password: ^1^1622428789155^2c3f4835c******
      [1622428789.166][LK-1000] adapter_network_deinit

后续步骤

如果运行例程出现错误,请参见aiot_dynregmq_api.h中的状态码描述根据提示解决问题。若未能解决问题,您可以提交工单