不具备IP地址的设备无法直接连接阿里云物联网平台,需要通过网关接入到阿里云物联网平台,网关需要集成“子设备管理”用于接入不具备IP地址的设备。

限制说明

  • 网关必须通过MQTT方式连接物联网平台

概述

网关与子设备的关系请参见文档《网关与子设备

由于子设备不能与物联网平台直接通信,所以网关需要代理子设备进行子设备的身份认证、子设备上线、下线、以及数据收发等工作。当网关离线时,物联网平台会自动将通过该网关接入的子设备全部设置为离线状态,因此每次网关连接到平台时,需要将当前在线的子设备的状态更新到物联网平台。

子设备设备密钥获取

网关在设计时,大概有两种方案获取子设备的设备密钥
  1. 用户输入子设备密钥

    如果用户知道需要通过网关接入哪些子设备,那么可以通过在网关上提供串口、Web页面等方式将子设备的设备密钥(ProductKey、DeviceName、DeviceSecret)输入给网关,当网关发现子设备连接到网关时,直接使用子设备的设备密钥将子设备连接到物联网平台

  2. 动态获取子设备密钥

    如果用户无法通过某种方式将子设备的设备密钥输入到网关,那么当子设备连接到网关时,网关需要根据子设备的信息知道子设备对应的ProductKey、ProductSecret、DeviceName,然后动态从物联网平台获取子设备的DeviceSecret,继而将子设备连到物联网平台。这种方式往往需要网关的固件在设计时固化子设备的型号与阿里云ProductKey、ProductSecret之间的映射关系。SDK提供API用于获取子设备的DeviceSecret。

子设备与网关建立拓扑关系

建立拓扑关系是指网关告知物联网平台:某个或者某几个子设备通过自己连接到物联网平台。当物联网平台收到该通知后,将会更新网关连接的子设备信息,当有消息需要发送给子设备时,物联网平台将会把子设备的消息发送给对应的网关,然后由网关将子设备的数据转发给子设备。

子设备与网关解除拓扑关系

解除拓扑关系是指网关告知物联网平台:自己不再代理某个或某几个子设备连接到物联网平台。当网关与子设备解除拓扑关系之后,平台不会将发送给子设备的消息发送给网关。

子设备上线

网关需要告知平台自己代理的子设备的状态,如果子设备已离线,那么当平台发送QoS=0的消息给子设备时将会立即丢弃该消息;如果子设备在线,平台才会尝试将消息发送给子设备。

子设备离线

当设备与网关之间的连接断开时,网关需要告知物联网平台子设备已离线,避免网关收到发送给子设备的消息。

子设备发送消息到物联网平台

子设备可以直接基于MQTT Topic进行消息的收发,复用MQTT的API aiot_mqtt_pub()即可,注意topic中的需要使用子设备的ProductKey和DeviceName。

若子设备通过物模型方式与物联网平台通信,可以调用物模型的API  aiot_dm_send()进行属性上报或者事件上报。

子设备接收来自物联网平台的消息

子设备若直接基于MQTT Topic进行消息通信,可以通过调用MQTT的API aiot_mqtt_sub()订阅消息来接收来自物联网平台的消息。

子设备若通过物模型与物联网平台通信,那么接收到属性设置和服务调用的机制在物模型编程中进行描述,客户编程时需要解析对应设备的ProductKey、DeviceName来区分属性设置或者服务调用是针对网关还是哪个子设备。

API列表

以下是完整的Subdev部分API列表及简要说明(详见components/subdev/aiot_subdev_api.h)。

接口名 说明
aiot_subdev_init 初始化subdev实例并设置默认参数。
aiot_subdev_setopt 配置subdev实例, 详见Subdev选项配置说明
aiot_subdev_deinit 释放subdev实例句柄的资源。
aiot_subdev_send_topo_add 向云端发送添加子设备与网关的拓扑关系的请求。
aiot_subdev_send_topo_delete 向云端发送删除子设备与网关的拓扑关系的请求。
aiot_subdev_send_topo_get 向云端发送获取子设备与网关的拓扑关系的请求。
aiot_subdev_send_batch_login 向云端发送子设备批量登录的请求。
aiot_subdev_send_batch_logout 向云端发送子设备批量登出的请求。
aiot_subdev_send_sub_register 向云端发送子设备动态注册的请求。
aiot_subdev_send_product_register 向云端发送子设备动态注册的请求(可从其他网关抢绑)。

例程讲解

现对照components/subdev/demos/subdev_basic_demo.c例程,分步骤讲解如何使用API。

  • 设置网关的设备密钥

    例程使用的三元组是测试使用,客户在体验相关代码时请在demo_mqtt_start中,替换如下的TODO部分, 传入用户自己网关的真实设备密钥。

        /* TODO: 替换为自己设备的producKey和deviceName */
        char *product_key       = "a1tmcXXXXXX";
        char *device_name       = "subdev_basic_demo";
    					

    将变量g_subdev中的子设备更换为用户自己真实的三元组和product key。

  • 进入程序入口, 给SDK配置全局的底层依赖和日志回调

    底层依赖描述了硬件平台的资源使用方式, 比如怎样获取时钟, 分配内存等, 日志回调是用户的函数, SDK有log输出的时候会进入这个函数。

    int main(int argc, char *argv[])
    {
        ...
        ...
        /* 配置SDK的底层依赖 */
        aiot_sysdep_set_portfile(&g_aiot_sysdep_portfile);
        /* 配置SDK的日志输出 */
        aiot_state_set_logcb(demo_state_logcb);
    					
  • 给连接配置参数

    这些参数包括MQTT句柄和输出SDK从云端接收消息的回调函数

        res = demo_mqtt_start(&mqtt_handle);
        if (res < 0) {
            printf("demo_mqtt_start failed\n");
            return -1;
        }
    
        subdev_handle = aiot_subdev_init();
        if (subdev_handle == NULL) {
            printf("aiot_subdev_init failed\n");
            demo_mqtt_stop(&mqtt_handle);
            return -1;
        }
    
        aiot_subdev_setopt(subdev_handle, AIOT_SUBDEVOPT_MQTT_HANDLE, mqtt_handle);
        aiot_subdev_setopt(subdev_handle, AIOT_SUBDEVOPT_RECV_HANDLER, demo_subdev_recv_handler);
    					
  • 运行例程

    直接运行例程,SDK将演示添加topo关系和批量loging两个子设备管理的功能,其他功能的使用方法类似,具体可参考demo中注释掉的部分

        res = aiot_subdev_send_topo_add(subdev_handle, g_subdev, sizeof(g_subdev)/sizeof(aiot_subdev_dev_t));
        if (res < STATE_SUCCESS) {
            printf("aiot_subdev_send_topo_add failed, res: -0x%04X\n", -res);
            aiot_subdev_deinit(&subdev_handle);
            demo_mqtt_stop(&mqtt_handle);
            return -1;
        }
    
        sleep(2);
    
        // aiot_subdev_send_topo_delete(subdev_handle, g_subdev, sizeof(g_subdev)/sizeof(aiot_subdev_dev_t));
        // if (res < STATE_SUCCESS) {
        //     printf("aiot_subdev_send_topo_delete failed, res: -0x%04X\n", -res);
        //     aiot_subdev_deinit(&subdev_handle);
        //     demo_mqtt_stop(&mqtt_handle);
        //     return -1;
        // }
    
        // sleep(2);
    
        // aiot_subdev_send_topo_get(subdev_handle);
        // if (res < STATE_SUCCESS) {
        //     printf("aiot_subdev_send_topo_get failed, res: -0x%04X\n", -res);
        //     aiot_subdev_deinit(&subdev_handle);
        //     demo_mqtt_stop(&mqtt_handle);
        //     return -1;
        // }
    
        // sleep(2);
    
        // aiot_subdev_send_sub_register(subdev_handle, g_subdev, sizeof(g_subdev)/sizeof(aiot_subdev_dev_t));
        // if (res < STATE_SUCCESS) {
        //     printf("aiot_subdev_send_sub_register failed, res: -0x%04X\n", -res);
        //     aiot_subdev_deinit(&subdev_handle);
        //     demo_mqtt_stop(&mqtt_handle);
        //     return -1;
        // }
    
        // sleep(2);
    
        // aiot_subdev_send_product_register(subdev_handle, g_subdev, sizeof(g_subdev)/sizeof(aiot_subdev_dev_t));
        // if (res < STATE_SUCCESS) {
        //     printf("aiot_subdev_send_product_register failed, res: -0x%04X\n", -res);
        //     aiot_subdev_deinit(&subdev_handle);
        //     demo_mqtt_stop(&mqtt_handle);
        //     return -1;
        // }
    
        // sleep(2);
    
        aiot_subdev_send_batch_login(subdev_handle, g_subdev, sizeof(g_subdev)/sizeof(aiot_subdev_dev_t));
        if (res < STATE_SUCCESS) {
            printf("aiot_subdev_send_batch_login failed, res: -0x%04X\n", -res);
            aiot_subdev_deinit(&subdev_handle);
            demo_mqtt_stop(&mqtt_handle);
            return -1;
        }
    
        sleep(2);
    
        // aiot_subdev_send_batch_logout(subdev_handle, g_subdev, sizeof(g_subdev)/sizeof(aiot_subdev_dev_t));
        // if (res < STATE_SUCCESS) {
        //     printf("aiot_subdev_send_batch_logout failed, res: -0x%04X\n", -res);
        //     aiot_subdev_deinit(&subdev_handle);
        //     demo_mqtt_stop(&mqtt_handle);
        //     return -1;
        // }
    					

    运行例程

    [1592187045.763][LK-0309] pub: /sys/a1tmc66UyDK/subdev_basic_demo/thing/topo/add
    
    [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 70 72  6F 64 75 63 74 4B 65 79 | s":[{"productKey
    [LK-030A] > 22 3A 22 61 31 33 46 4E  35 54 70 6C 4B 71 22 2C | ":"a13FNXXXXXX",
    [LK-030A] > 22 64 65 76 69 63 65 4E  61 6D 65 22 3A 22 73 75 | "deviceName":"su
    [LK-030A] > 62 64 65 76 5F 62 61 73  69 63 5F 64 65 6D 6F 5F | bdev_basic_demo_
    [LK-030A] > 30 31 22 2C 22 63 6C 69  65 6E 74 49 64 22 3A 22 | 01","clientId":"
    [LK-030A] > 61 31 33 46 4E 35 54 70  6C 4B 71 2E 73 75 62 64 | a13FNXXXXXX.subd
    [LK-030A] > 65 76 5F 62 61 73 69 63  5F 64 65 6D 6F 5F 30 31 | ev_basic_demo_01
    [LK-030A] > 22 2C 22 74 69 6D 65 73  74 61 6D 70 22 3A 22 31 | ","timestamp":"1
    [LK-030A] > 35 39 32 31 38 37 30 34  35 37 36 33 22 2C 22 73 | 592187045763","s
    [LK-030A] > 69 67 6E 6D 65 74 68 6F  64 22 3A 22 68 6D 61 63 | ignmethod":"hmac
    [LK-030A] > 53 68 61 32 35 36 22 2C  22 73 69 67 6E 22 3A 22 | Sha256","sign":"
    [LK-030A] > 39 31 42 33 35 44 43 33  45 35 30 31 39 43 39 44 | 91B35DC3E5019C9D
    [LK-030A] > 46 43 39 46 35 36 34 38  33 36 33 39 39 37 36 41 | FC9F56483639976A
    [LK-030A] > 44 38 31 35 37 36 37 43  42 32 44 32 44 30 37 45 | D815767CB2D2D07E
    [LK-030A] > 32 39 34 42 37 32 46 32  30 45 34 35 43 35 46 44 | 294B72F20E45C5FD
    [LK-030A] > 22 7D 2C 7B 22 70 72 6F  64 75 63 74 4B 65 79 22 | "},{"productKey"
    [LK-030A] > 3A 22 61 31 33 46 4E 35  54 70 6C 4B 71 22 2C 22 | :"a13FNXXXXXX","
    [LK-030A] > 64 65 76 69 63 65 4E 61  6D 65 22 3A 22 73 75 62 | deviceName":"sub
    [LK-030A] > 64 65 76 5F 62 61 73 69  63 5F 64 65 6D 6F 5F 30 | dev_basic_demo_0
    [LK-030A] > 32 22 2C 22 63 6C 69 65  6E 74 49 64 22 3A 22 61 | 2","clientId":"a
    [LK-030A] > 31 33 46 4E 35 54 70 6C  4B 71 2E 73 75 62 64 65 | 13FN5TplKq.subde
    [LK-030A] > 76 5F 62 61 73 69 63 5F  64 65 6D 6F 5F 30 32 22 | v_basic_demo_02"
    [LK-030A] > 2C 22 74 69 6D 65 73 74  61 6D 70 22 3A 22 31 35 | ,"timestamp":"15
    [LK-030A] > 39 32 31 38 37 30 34 35  37 36 33 22 2C 22 73 69 | 92187045763","si
    [LK-030A] > 67 6E 6D 65 74 68 6F 64  22 3A 22 68 6D 61 63 53 | gnmethod":"hmacS
    [LK-030A] > 68 61 32 35 36 22 2C 22  73 69 67 6E 22 3A 22 44 | ha256","sign":"D
    [LK-030A] > 36 37 34 32 34 41 34 35  31 33 45 30 32 44 42 33 | 67424A4513E02DB3
    [LK-030A] > 46 34 39 44 31 33 43 35  33 46 41 37 45 43 34 37 | F49D13C53FA7EC47
    [LK-030A] > 42 46 37 41 36 37 46 32  30 31 35 38 32 45 39 44 | BF7A67F201582E9D
    [LK-030A] > 37 34 35 36 32 35 31 36  45 44 30 36 33 41 44 22 | 74562516ED063AD"
    [LK-030A] > 7D 2C 7B 22 70 72 6F 64  75 63 74 4B 65 79 22 3A | },{"productKey":
    [LK-030A] > 22 61 31 33 46 4E 35 54  70 6C 4B 71 22 2C 22 64 | "a13FNXXXXXX","d
    [LK-030A] > 65 76 69 63 65 4E 61 6D  65 22 3A 22 73 75 62 64 | eviceName":"subd
    [LK-030A] > 65 76 5F 62 61 73 69 63  5F 64 65 6D 6F 5F 30 33 | ev_basic_demo_03
    [LK-030A] > 22 2C 22 63 6C 69 65 6E  74 49 64 22 3A 22 61 31 | ","clientId":"a1
    [LK-030A] > 33 46 4E 35 54 70 6C 4B  71 2E 73 75 62 64 65 76 | 3FN5TplKq.subdev
    [LK-030A] > 5F 62 61 73 69 63 5F 64  65 6D 6F 5F 30 33 22 2C | _basic_demo_03",
    [LK-030A] > 22 74 69 6D 65 73 74 61  6D 70 22 3A 22 31 35 39 | "timestamp":"159
    [LK-030A] > 32 31 38 37 30 34 35 37  36 33 22 2C 22 73 69 67 | 2187045763","sig
    [LK-030A] > 6E 6D 65 74 68 6F 64 22  3A 22 68 6D 61 63 53 68 | nmethod":"hmacSh
    [LK-030A] > 61 32 35 36 22 2C 22 73  69 67 6E 22 3A 22 34 37 | a256","sign":"47
    [LK-030A] > 31 33 38 43 38 31 38 36  34 42 41 38 38 46 31 46 | 138C81864BA88F1F
    [LK-030A] > 44 34 33 37 46 33 38 42  37 45 31 35 36 31 34 37 | D437F38B7E156147
    [LK-030A] > 37 32 45 34 34 44 42 44  32 37 35 34 43 38 44 36 | 72E44DBD2754C8D6
    [LK-030A] > 39 30 35 33 41 39 31 39  46 45 31 32 37 37 22 7D | 9053A919FE1277"}
    [LK-030A] > 2C 7B 22 70 72 6F 64 75  63 74 4B 65 79 22 3A 22 | ,{"productKey":"
    [LK-030A] > 61 31 33 46 4E 35 54 70  6C 4B 71 22 2C 22 64 65 | a13FNXXXXXX","de
    [LK-030A] > 76 69 63 65 4E 61 6D 65  22 3A 22 73 75 62 64 65 | viceName":"subde
    [LK-030A] > 76 5F 62 61 73 69 63 5F  64 65 6D 6F 5F 30 34 22 | v_basic_demo_04"
    [LK-030A] > 2C 22 63 6C 69 65 6E 74  49 64 22 3A 22 61 31 33 | ,"clientId":"a13
    [LK-030A] > 46 4E 35 54 70 6C 4B 71  2E 73 75 62 64 65 76 5F | FN5TplKq.subdev_
    [LK-030A] > 62 61 73 69 63 5F 64 65  6D 6F 5F 30 34 22 2C 22 | basic_demo_04","
    [LK-030A] > 74 69 6D 65 73 74 61 6D  70 22 3A 22 31 35 39 32 | timestamp":"1592
    [LK-030A] > 31 38 37 30 34 35 37 36  33 22 2C 22 73 69 67 6E | 187045763","sign
    [LK-030A] > 6D 65 74 68 6F 64 22 3A  22 68 6D 61 63 53 68 61 | method":"hmacSha
    [LK-030A] > 32 35 36 22 2C 22 73 69  67 6E 22 3A 22 37 30 34 | 256","sign":"704
    [LK-030A] > 46 43 42 30 31 30 33 32  33 39 33 41 43 39 42 41 | FCB01032393AC9BA
    [LK-030A] > 39 46 38 37 45 32 44 44  36 41 42 30 31 36 39 35 | 9F87E2DD6AB01695
    [LK-030A] > 35 34 36 31 45 33 41 45  32 43 35 36 31 35 39 46 | 5461E3AE2C56159F
    [LK-030A] > 36 32 34 39 35 43 38 34  37 45 34 44 39 22 7D 5D | 62495C847E4D9"}]
    [LK-030A] > 7D                                               | }               
    
    heartbeat response
    [1592187045.840][LK-0309] pub: /sys/a1tmc66UyDK/subdev_basic_demo/thing/topo/add_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 5B 7B 22 70 72  6F 64 75 63 74 4B 65 79 | a":[{"productKey
    [LK-030A] < 22 3A 22 61 31 33 46 4E  35 54 70 6C 4B 71 22 2C | ":"a13FNXXXXXX",
    [LK-030A] < 22 64 65 76 69 63 65 4E  61 6D 65 22 3A 22 73 75 | "deviceName":"su
    [LK-030A] < 62 64 65 76 5F 62 61 73  69 63 5F 64 65 6D 6F 5F | bdev_basic_demo_
    [LK-030A] < 30 32 22 7D 2C 7B 22 70  72 6F 64 75 63 74 4B 65 | 02"},{"productKe
    [LK-030A] < 79 22 3A 22 61 31 33 46  4E 35 54 70 6C 4B 71 22 | y":"a13FNXXXXXX"
    [LK-030A] < 2C 22 64 65 76 69 63 65  4E 61 6D 65 22 3A 22 73 | ,"deviceName":"s
    [LK-030A] < 75 62 64 65 76 5F 62 61  73 69 63 5F 64 65 6D 6F | ubdev_basic_demo
    [LK-030A] < 5F 30 31 22 7D 2C 7B 22  70 72 6F 64 75 63 74 4B | _01"},{"productK
    [LK-030A] < 65 79 22 3A 22 61 31 33  46 4E 35 54 70 6C 4B 71 | ey":"a13FNXXXXXX
    [LK-030A] < 22 2C 22 64 65 76 69 63  65 4E 61 6D 65 22 3A 22 | ","deviceName":"
    [LK-030A] < 73 75 62 64 65 76 5F 62  61 73 69 63 5F 64 65 6D | subdev_basic_dem
    [LK-030A] < 6F 5F 30 34 22 7D 2C 7B  22 70 72 6F 64 75 63 74 | o_04"},{"product
    [LK-030A] < 4B 65 79 22 3A 22 61 31  33 46 4E 35 54 70 6C 4B | Key":"a13FN5TplK
    [LK-030A] < 71 22 2C 22 64 65 76 69  63 65 4E 61 6D 65 22 3A | q","deviceName":
    [LK-030A] < 22 73 75 62 64 65 76 5F  62 61 73 69 63 5F 64 65 | "subdev_basic_de
    [LK-030A] < 6D 6F 5F 30 33 22 7D 5D  2C 22 69 64 22 3A 22 31 | mo_03"}],"id":"1
    [LK-030A] < 22 2C 22 6D 65 73 73 61  67 65 22 3A 22 73 75 63 | ","message":"suc
    [LK-030A] < 63 65 73 73 22 2C 22 6D  65 74 68 6F 64 22 3A 22 | cess","method":"
    [LK-030A] < 74 68 69 6E 67 2E 74 6F  70 6F 2E 61 64 64 22 2C | thing.topo.add",
    [LK-030A] < 22 76 65 72 73 69 6F 6E  22 3A 22 31 2E 30 22 7D | "version":"1.0"}
    
    msgid        : 1
    code         : 200
    product key  : a1tmc66UyDK
    device name  : subdev_basic_demo
    message      : success
    data         : [{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_02"},{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_01"},{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_04"},{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_03"}]
    [1592187045.874][LK-0309] pub: /sys/a1tmc66UyDK/subdev_basic_demo/thing/topo/change
    
    [LK-030A] < 7B 22 6D 65 74 68 6F 64  22 3A 22 74 68 69 6E 67 | {"method":"thing
    [LK-030A] < 2E 74 6F 70 6F 2E 63 68  61 6E 67 65 22 2C 22 69 | .topo.change","i
    [LK-030A] < 64 22 3A 22 31 31 38 30  37 38 31 38 36 36 22 2C | d":"1180781866",
    [LK-030A] < 22 70 61 72 61 6D 73 22  3A 7B 22 73 75 62 4C 69 | "params":{"subLi
    [LK-030A] < 73 74 22 3A 5B 7B 22 64  65 76 69 63 65 4E 61 6D | st":[{"deviceNam
    [LK-030A] < 65 22 3A 22 73 75 62 64  65 76 5F 62 61 73 69 63 | e":"subdev_basic
    [LK-030A] < 5F 64 65 6D 6F 5F 30 31  22 2C 22 70 72 6F 64 75 | _demo_01","produ
    [LK-030A] < 63 74 4B 65 79 22 3A 22  61 31 33 46 4E 35 54 70 | ctKey":"a13FN5Tp
    [LK-030A] < 6C 4B 71 22 7D 2C 7B 22  64 65 76 69 63 65 4E 61 | lKq"},{"deviceNa
    [LK-030A] < 6D 65 22 3A 22 73 75 62  64 65 76 5F 62 61 73 69 | me":"subdev_basi
    [LK-030A] < 63 5F 64 65 6D 6F 5F 30  32 22 2C 22 70 72 6F 64 | c_demo_02","prod
    [LK-030A] < 75 63 74 4B 65 79 22 3A  22 61 31 33 46 4E 35 54 | uctKey":"a13FN5T
    [LK-030A] < 70 6C 4B 71 22 7D 2C 7B  22 64 65 76 69 63 65 4E | plKq"},{"deviceN
    [LK-030A] < 61 6D 65 22 3A 22 73 75  62 64 65 76 5F 62 61 73 | ame":"subdev_bas
    [LK-030A] < 69 63 5F 64 65 6D 6F 5F  30 33 22 2C 22 70 72 6F | ic_demo_03","pro
    [LK-030A] < 64 75 63 74 4B 65 79 22  3A 22 61 31 33 46 4E 35 | ductKey":"a13FN5
    [LK-030A] < 54 70 6C 4B 71 22 7D 2C  7B 22 64 65 76 69 63 65 | TplKq"},{"device
    [LK-030A] < 4E 61 6D 65 22 3A 22 73  75 62 64 65 76 5F 62 61 | Name":"subdev_ba
    [LK-030A] < 73 69 63 5F 64 65 6D 6F  5F 30 34 22 2C 22 70 72 | sic_demo_04","pr
    [LK-030A] < 6F 64 75 63 74 4B 65 79  22 3A 22 61 31 33 46 4E | oductKey":"a13FN
    [LK-030A] < 35 54 70 6C 4B 71 22 7D  5D 2C 22 73 74 61 74 75 | 5TplKq"}],"statu
    [LK-030A] < 73 22 3A 30 7D 2C 22 76  65 72 73 69 6F 6E 22 3A | s":0},"version":
    [LK-030A] < 22 31 2E 30 2E 30 22 7D                          | "1.0.0"}        
    
    msgid        : 1180781866
    product key  : a1tmc66UyDK
    device name  : subdev_basic_demo
    params       : {"subList":[{"deviceName":"subdev_basic_demo_01","productKey":"a13FNXXXXXX"},{"deviceName":"subdev_basic_demo_02","productKey":"a13FNXXXXXX"},{"deviceName":"subdev_basic_demo_03","productKey":"a13FNXXXXXX"},{"deviceName":"subdev_basic_demo_04","productKey":"a13FNXXXXXX"}],"status":0}
    [1592187047.767][LK-0309] pub: /ext/session/a1tmc66UyDK/subdev_basic_demo/combine/batch_login
    
    [LK-030A] > 7B 22 69 64 22 3A 22 32  22 2C 22 76 65 72 73 69 | {"id":"2","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 7B 22 73 69 67  6E 4D 65 74 68 6F 64 22 | s":{"signMethod"
    [LK-030A] > 3A 22 68 6D 61 63 53 68  61 32 35 36 22 2C 22 64 | :"hmacSha256","d
    [LK-030A] > 65 76 69 63 65 4C 69 73  74 22 3A 5B 7B 22 70 72 | eviceList":[{"pr
    [LK-030A] > 6F 64 75 63 74 4B 65 79  22 3A 22 61 31 33 46 4E | oductKey":"a13FN
    [LK-030A] > 35 54 70 6C 4B 71 22 2C  22 64 65 76 69 63 65 4E | XXXXXX","deviceN
    [LK-030A] > 61 6D 65 22 3A 22 73 75  62 64 65 76 5F 62 61 73 | ame":"subdev_bas
    [LK-030A] > 69 63 5F 64 65 6D 6F 5F  30 31 22 2C 22 63 6C 69 | ic_demo_01","cli
    [LK-030A] > 65 6E 74 49 64 22 3A 22  61 31 33 46 4E 35 54 70 | entId":"a13FNXXX
    [LK-030A] > 6C 4B 71 2E 73 75 62 64  65 76 5F 62 61 73 69 63 | XXX.subdev_basic
    [LK-030A] > 5F 64 65 6D 6F 5F 30 31  22 2C 22 74 69 6D 65 73 | _demo_01","times
    [LK-030A] > 74 61 6D 70 22 3A 22 31  35 39 32 31 38 37 30 34 | tamp":"159218704
    [LK-030A] > 37 37 36 37 22 2C 22 63  6C 65 61 6E 53 65 73 73 | 7767","cleanSess
    [LK-030A] > 69 6F 6E 22 3A 22 66 61  6C 73 65 22 2C 22 73 69 | ion":"false","si
    [LK-030A] > 67 6E 22 3A 22 46 46 38  44 45 38 36 30 42 46 44 | gn":"FF8DE860BFD
    [LK-030A] > 30 36 42 39 32 41 37 31  46 32 46 34 43 38 36 42 | 06B92A71F2F4C86B
    [LK-030A] > 32 31 36 42 37 34 39 44  36 41 37 31 45 37 42 46 | 216B749D6A71E7BF
    [LK-030A] > 38 35 35 36 33 34 43 41  42 45 44 35 44 37 45 39 | 855634CABED5D7E9
    [LK-030A] > 42 38 41 35 39 22 7D 2C  7B 22 70 72 6F 64 75 63 | B8A59"},{"produc
    [LK-030A] > 74 4B 65 79 22 3A 22 61  31 33 46 4E 35 54 70 6C | tKey":"a13FNXXXX
    [LK-030A] > 4B 71 22 2C 22 64 65 76  69 63 65 4E 61 6D 65 22 | XX","deviceName"
    [LK-030A] > 3A 22 73 75 62 64 65 76  5F 62 61 73 69 63 5F 64 | :"subdev_basic_d
    [LK-030A] > 65 6D 6F 5F 30 32 22 2C  22 63 6C 69 65 6E 74 49 | emo_02","clientI
    [LK-030A] > 64 22 3A 22 61 31 33 46  4E 35 54 70 6C 4B 71 2E | d":"a13FNXXXXXX.
    [LK-030A] > 73 75 62 64 65 76 5F 62  61 73 69 63 5F 64 65 6D | subdev_basic_dem
    [LK-030A] > 6F 5F 30 32 22 2C 22 74  69 6D 65 73 74 61 6D 70 | o_02","timestamp
    [LK-030A] > 22 3A 22 31 35 39 32 31  38 37 30 34 37 37 36 37 | ":"1592187047767
    [LK-030A] > 22 2C 22 63 6C 65 61 6E  53 65 73 73 69 6F 6E 22 | ","cleanSession"
    [LK-030A] > 3A 22 66 61 6C 73 65 22  2C 22 73 69 67 6E 22 3A | :"false","sign":
    [LK-030A] > 22 30 33 38 44 35 46 33  31 31 38 46 44 41 37 44 | "038D5F3118FDA7D
    [LK-030A] > 33 30 42 42 45 39 44 37  41 31 44 30 41 30 30 37 | 30BBE9D7A1D0A007
    [LK-030A] > 35 30 39 31 35 39 32 30  39 43 38 33 46 35 32 34 | 509159209C83F524
    [LK-030A] > 46 38 43 34 34 37 46 32  44 42 44 38 42 42 45 34 | F8C447F2DBD8BBE4
    [LK-030A] > 33 22 7D 2C 7B 22 70 72  6F 64 75 63 74 4B 65 79 | 3"},{"productKey
    [LK-030A] > 22 3A 22 61 31 33 46 4E  35 54 70 6C 4B 71 22 2C | ":"a13FNXXXXXX",
    [LK-030A] > 22 64 65 76 69 63 65 4E  61 6D 65 22 3A 22 73 75 | "deviceName":"su
    [LK-030A] > 62 64 65 76 5F 62 61 73  69 63 5F 64 65 6D 6F 5F | bdev_basic_demo_
    [LK-030A] > 30 33 22 2C 22 63 6C 69  65 6E 74 49 64 22 3A 22 | 03","clientId":"
    [LK-030A] > 61 31 33 46 4E 35 54 70  6C 4B 71 2E 73 75 62 64 | a13FNXXXXXX.subd
    [LK-030A] > 65 76 5F 62 61 73 69 63  5F 64 65 6D 6F 5F 30 33 | ev_basic_demo_03
    [LK-030A] > 22 2C 22 74 69 6D 65 73  74 61 6D 70 22 3A 22 31 | ","timestamp":"1
    [LK-030A] > 35 39 32 31 38 37 30 34  37 37 36 37 22 2C 22 63 | 592187047767","c
    [LK-030A] > 6C 65 61 6E 53 65 73 73  69 6F 6E 22 3A 22 66 61 | leanSession":"fa
    [LK-030A] > 6C 73 65 22 2C 22 73 69  67 6E 22 3A 22 43 35 44 | lse","sign":"C5D
    [LK-030A] > 32 35 41 35 46 30 35 35  35 33 45 41 34 44 44 37 | 25A5F05553EA4DD7
    [LK-030A] > 43 42 34 37 46 33 45 43  32 45 30 43 35 35 30 33 | CB47F3EC2E0C5503
    [LK-030A] > 30 39 44 37 46 30 34 38  35 31 33 32 42 35 31 36 | 09D7F0485132B516
    [LK-030A] > 38 39 31 36 34 38 37 39  31 33 31 44 45 22 7D 2C | 89164879131DE"},
    [LK-030A] > 7B 22 70 72 6F 64 75 63  74 4B 65 79 22 3A 22 61 | {"productKey":"a
    [LK-030A] > 31 33 46 4E 35 54 70 6C  4B 71 22 2C 22 64 65 76 | 13FN5TplKq","dev
    [LK-030A] > 69 63 65 4E 61 6D 65 22  3A 22 73 75 62 64 65 76 | iceName":"subdev
    [LK-030A] > 5F 62 61 73 69 63 5F 64  65 6D 6F 5F 30 34 22 2C | _basic_demo_04",
    [LK-030A] > 22 63 6C 69 65 6E 74 49  64 22 3A 22 61 31 33 46 | "clientId":"a13F
    [LK-030A] > 4E 35 54 70 6C 4B 71 2E  73 75 62 64 65 76 5F 62 | N5TplKq.subdev_b
    [LK-030A] > 61 73 69 63 5F 64 65 6D  6F 5F 30 34 22 2C 22 74 | asic_demo_04","t
    [LK-030A] > 69 6D 65 73 74 61 6D 70  22 3A 22 31 35 39 32 31 | imestamp":"15921
    [LK-030A] > 38 37 30 34 37 37 36 37  22 2C 22 63 6C 65 61 6E | 87047767","clean
    [LK-030A] > 53 65 73 73 69 6F 6E 22  3A 22 66 61 6C 73 65 22 | Session":"false"
    [LK-030A] > 2C 22 73 69 67 6E 22 3A  22 30 38 37 32 36 36 39 | ,"sign":"0872669
    [LK-030A] > 36 44 42 42 35 43 36 46  32 30 31 45 43 38 41 44 | 6DBB5C6F201EC8AD
    [LK-030A] > 45 38 43 46 33 46 35 32  39 31 42 41 41 32 39 45 | E8CF3F5291BAA29E
    [LK-030A] > 32 31 30 39 38 44 43 30  30 39 35 43 41 37 41 32 | 21098DC0095CA7A2
    [LK-030A] > 37 43 37 45 30 32 35 46  34 22 7D 5D 7D 7D       | 7C7E025F4"}]}}  
    
    [1592187048.042][LK-0309] pub: /ext/session/a1tmc66UyDK/subdev_basic_demo/combine/batch_login_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 5B 7B 22 70 72  6F 64 75 63 74 4B 65 79 | a":[{"productKey
    [LK-030A] < 22 3A 22 61 31 33 46 4E  35 54 70 6C 4B 71 22 2C | ":"a13FNXXXXXX",
    [LK-030A] < 22 64 65 76 69 63 65 4E  61 6D 65 22 3A 22 73 75 | "deviceName":"su
    [LK-030A] < 62 64 65 76 5F 62 61 73  69 63 5F 64 65 6D 6F 5F | bdev_basic_demo_
    [LK-030A] < 30 31 22 7D 2C 7B 22 70  72 6F 64 75 63 74 4B 65 | 01"},{"productKe
    [LK-030A] < 79 22 3A 22 61 31 33 46  4E 35 54 70 6C 4B 71 22 | y":"a13FNXXXXXX"
    [LK-030A] < 2C 22 64 65 76 69 63 65  4E 61 6D 65 22 3A 22 73 | ,"deviceName":"s
    [LK-030A] < 75 62 64 65 76 5F 62 61  73 69 63 5F 64 65 6D 6F | ubdev_basic_demo
    [LK-030A] < 5F 30 32 22 7D 2C 7B 22  70 72 6F 64 75 63 74 4B | _02"},{"productK
    [LK-030A] < 65 79 22 3A 22 61 31 33  46 4E 35 54 70 6C 4B 71 | ey":"a13FNXXXXXX
    [LK-030A] < 22 2C 22 64 65 76 69 63  65 4E 61 6D 65 22 3A 22 | ","deviceName":"
    [LK-030A] < 73 75 62 64 65 76 5F 62  61 73 69 63 5F 64 65 6D | subdev_basic_dem
    [LK-030A] < 6F 5F 30 33 22 7D 2C 7B  22 70 72 6F 64 75 63 74 | o_03"},{"product
    [LK-030A] < 4B 65 79 22 3A 22 61 31  33 46 4E 35 54 70 6C 4B | Key":"a13FNXXXXX
    [LK-030A] < 71 22 2C 22 64 65 76 69  63 65 4E 61 6D 65 22 3A | X","deviceName":
    [LK-030A] < 22 73 75 62 64 65 76 5F  62 61 73 69 63 5F 64 65 | "subdev_basic_de
    [LK-030A] < 6D 6F 5F 30 34 22 7D 5D  2C 22 69 64 22 3A 22 32 | mo_04"}],"id":"2
    [LK-030A] < 22 2C 22 6D 65 73 73 61  67 65 22 3A 22 73 75 63 | ","message":"suc
    [LK-030A] < 63 65 73 73 22 7D                                | cess"}          
    
    msgid        : 2
    code         : 200
    product key  : a1tmc66UyDK
    device name  : subdev_basic_demo
    message      : success
    data         : [{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_01"},{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_02"},{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_03"},{"productKey":"a13FNXXXXXX","deviceName":"subdev_basic_demo_04"}]