HTTPS动态注册功能的例程运行后,功能的例程运行后,您可以在设备端查看日志信息。
前提条件
已配置C Link SDK的HTTPS动态注册功能的例程,已配置C Link SDK的HTTPS动态注册使用示例。
设备端日志
您可以在设备端查看运行结果。仅动态注册设备时,物联网平台的日志服务页面不会产生日志。
注册请求日志:
设备端向物联网平台发起动态注册请求的日志如下。
core_sysdep_network_establish host iot-auth.cn-shanghai.aliyuncs.com port 443, type 0 establish tcp connection with server(host='iot-auth.cn-shanghai.aliyuncs.com', port=[443]) success to establish tcp, fd=3 local port: 37994 [1622515780.966][LK-1000] establish mbedtls connection with server(host='iot-auth.cn-shanghai.aliyuncs.com', port=[443]) [1622515780.977][LK-1000] success to establish mbedtls connection, (cost 45371 bytes in total, max used 48075 bytes) [1622515780.977][LK-040B] > POST /auth/register/device HTTP/1.1 [1622515780.977][LK-040B] > Host: iot-auth.cn-shanghai.aliyuncs.com [1622515780.977][LK-040B] > Accept: text/xml,text/javascript,text/html,application/json [1622515780.977][LK-040B] > Content-Type: application/x-www-form-urlencoded [1622515780.977][LK-040B] > Content-Length: 159 [1622515780.977][LK-040B] > [LK-040C] > 70 72 6F 64 75 63 74 4B 65 79 3D 67 37 68 30 6E | productKey=a18** [LK-040C] > 77 43 65 65 77 75 26 64 65 76 69 63 65 4E 61 6D | ******&deviceNam [LK-040C] > 65 3D 4C 69 67 68 74 53 77 69 74 63 68 48 74 74 | e=LightSwitch&ra [LK-040C] > 70 73 26 72 61 6E 64 6F 6D 3D 36 39 32 31 34 37 | ndom=692147492&s [LK-040C] > 34 39 32 26 73 69 67 6E 3D 35 44 37 38 31 37 39 | ign=5D78179***** [LK-040C] > 36 32 44 46 38 33 44 30 36 45 45 33 44 32 42 32 | 62DF83D06EE3D2B2 [LK-040C] > 33 38 33 35 41 38 41 35 31 39 41 45 42 42 42 43 | 3835A8A519AEBBBC [LK-040C] > 45 33 36 31 32 39 42 43 33 41 39 36 36 36 42 31 | E36129BC3A9666B1 [LK-040C] > 34 39 34 38 36 39 34 42 41 26 73 69 67 6E 4D 65 | ****&signMethod= [LK-040C] > 74 68 6F 64 3D 68 6D 61 63 73 68 61 32 35 36 | hmacsha256
应答日志:
物联网平台收到动态注册请求后,向设备端返回的应答日志如下。
[1622515781.088][LK-040D] < HTTP/1.1 200 OK [1622515781.088][LK-040D] < Server: nginx/1.14.2 [1622515781.088][LK-040D] < Date: Tue, 01 Jun 2021 02:49:41 GMT [1622515781.088][LK-040D] < Content-Type: text/xml [1622515781.088][LK-040D] < Content-Length: 150 [1622515781.088][LK-040D] < Connection: keep-alive [1622515781.088][LK-040D] < X-Application-Context: iotx-base:vpc-sh:7001 [1622515781.088][LK-040D] < [LK-040E] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-040E] < 61 22 3A 7B 22 64 65 76 69 63 65 4E 61 6D 65 22 | a":{"deviceName" [LK-040E] < 3A 22 4C 69 67 68 74 53 77 69 74 63 68 48 74 74 | :"LightSwitch"," [LK-040E] < 70 73 22 2C 22 64 65 76 69 63 65 53 65 63 72 65 | deviceSecret":"3 [LK-040E] < 74 22 3A 22 33 62 31 38 62 35 32 38 63 62 38 64 | b18b528cb8d***** [LK-040E] < 62 37 35 39 33 39 30 61 36 32 62 31 33 63 64 39 | b759390a62b13cd" [LK-040E] < 35 37 36 37 22 2C 22 70 72 6F 64 75 63 74 4B 65 | ,"productKey":"a [LK-040E] < 79 22 3A 22 67 37 68 30 6E 77 43 65 65 77 75 22 | 18********"},"me [LK-040E] < 7D 2C 22 6D 65 73 73 61 67 65 22 3A 22 73 75 63 | ssage":"success" [LK-040E] < 63 65 73 73 22 7D | } status code: 200 device secret: 3b18b528cb8db759390a62b1******** [1622515781.088][LK-1000] adapter_network_deinit
后续步骤
运行日志中出现的错误信息,请参见aiot_dynreg_api.h中的状态码描述,根据提示解决问题。
文档内容是否对您有帮助?