map/docs/datacollect/README.md
2024-07-03 09:22:02 +08:00

2.2 KiB
Raw Blame History

数据采集

采集配置说明

采集程序配置存放在: /das/conf/collector.json

如果系统配置更新将生成配置更新文件: /das/conf/collector.json.update

配置文件内容如下:

{
    //版本号
    "version": 101,
    //配置创建时间(毫秒值)
    "createTime": 1235235623433,
    //节点ID
    "nodeId": "nx10928234",
    //链路列表
    "links" : [
        {
            //链路ID
            "linkId": "1235123",
            //链路名称
            "linkName": "1#风机",
            //协议号
            "protocol": 1,
            //协议参数
            "params": {},
            "devices": ["11234131","1234123"]
        }
    ],
    //物模型信息
    "equipments": [
        {
            //设备ID
            "id": "11234131",
            //属性列表
            "attrs":[
                {
                    //属性名
                    "name": "Ia",
                    //属性类型
                    "type": "yc",
                    //属性参数
                    "params": {

                    }
                },
                {
                    "name": "Ib",
                    "type": "yc",
                    "params": {
                    }
                }
            ],
            //服务列表
            "services": [
                {
                    //服务名
                    "name": "start",
                    //服务类型
                    "type": "yk",
                    //服务参数
                    "params": {
                    
                    }
                }
            ]
        }
    ]    

}

采集程序与系统交互通道

采集程序与系统间采用Websocket方式通讯 访问系统服务器端口: 7790

报文格式为json, 字符集: utf-8

通道建立

采集程序建立连接时需要带上自身节点ID连接URL如下所示:

ws://127.0.0.1:7790/gate/{nodeId}

通讯报文

节点上线请求

?> 方向: 采集程序 -> 系统

{
    //节点ID
    "nodeId" : "nx10928234",
    //消息ID
    "messageId": "123512351235123",
    //命令
    "action" : "online"
}