From 83d37d44d0541871d873244c4ffa2ae67232af66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Wed, 3 Jul 2024 09:22:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/datacollect/README.md | 97 +++++++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/docs/datacollect/README.md b/docs/datacollect/README.md index 108d7fbd..f91edfbe 100644 --- a/docs/datacollect/README.md +++ b/docs/datacollect/README.md @@ -6,19 +6,90 @@ 如果系统配置更新将生成配置更新文件: `/das/conf/collector.json.update`。 -!> 此处为配置文件的内容说明。 +配置文件内容如下: + +```json +{ + //版本号 + "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 。 +采集程序与系统间采用Websocket方式通讯, 访问系统服务器端口: 7790 -报文格式为`json` +报文格式为`json`, 字符集: `utf-8`。 + +### 通道建立 + +采集程序建立连接时,需要带上自身节点ID,连接URL如下所示: + +`ws://127.0.0.1:7790/gate/{nodeId}` ## 通讯报文 ### 节点上线请求 -?> 方向: `采集` -> `系统` +?> 方向: `采集程序` -> `系统` ```json { @@ -30,21 +101,3 @@ "action" : "online" } ``` - -### 节点上线响应 - -?> 方向: `系统` -> `采集` - -```json -{ - //节点ID - "nodeId" : "nx10928234", - //消息ID - "messageId": "123512351235123", - //命令 - "action" : "online", - //名称执行结果 - "result" : true, - //出错时的消息。 - "error" : "" -}