Skip to content

Commit 153bfec

Browse files
authored
Merge pull request #567 from hxy7yx/2.12
datalayers api
2 parents 1fd0193 + b9abd8f commit 153bfec

File tree

7 files changed

+336
-10
lines changed

7 files changed

+336
-10
lines changed

directory.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,13 @@
578578
},
579579
{
580580
"title": "DataStorage",
581-
"path": "configuration/north-apps/DataStorage/DataStorage"
581+
"path": "configuration/north-apps/DataStorage/DataStorage",
582+
"children": [
583+
{
584+
"title": "订阅信息查询 API",
585+
"path": "configuration/north-apps/DataStorage/api"
586+
}
587+
]
582588
}
583589
]
584590
},
@@ -1298,7 +1304,13 @@
12981304
},
12991305
{
13001306
"title": "DataStorage",
1301-
"path": "configuration/north-apps/DataStorage/DataStorage"
1307+
"path": "configuration/north-apps/DataStorage/DataStorage",
1308+
"children": [
1309+
{
1310+
"title": "Subscription Information Query API",
1311+
"path": "configuration/north-apps/DataStorage/api"
1312+
}
1313+
]
13021314
}
13031315
]
13041316
},

en_US/api/error-code.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ This document describes the errors that neuron will reply to sender when calling
120120
* 4102 file read failure
121121
* 4103 file write failure
122122

123+
## DATALAYERS error codes
124+
125+
* 4200 datalayers error
126+
* 4201 datalayers init failed
127+
* 4202 datalayers connect failed
128+
* 4203 datalayers client is null
129+
123130
## OPCUA error codes
124131

125132
* 10001 opcua tag does not exist

en_US/configuration/north-apps/DataStorage/DataStorage.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ The following parameters are available when configuring the DataStorage node:
1717
| **Username** | Datalayers username |
1818
| **Password** | Datalayers password |
1919

20-
:::tip
21-
When submitting the configuration, the connection to Datalayers will be verified, and if the connection fails, the configuration will be rejected.
22-
:::
23-
2420
## Add Subscription
2521

2622
After plugin configuration, data forwarding can be enabled via southbound device subscriptions.
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Subscription Information Query API
2+
3+
The following content describes the API service for querying the subscription information of the DataStorage node.
4+
5+
6+
## Get All Subscription Groups
7+
8+
*GET* /api/v2/datalayers/groups
9+
10+
### Request Headers
11+
12+
**Authorization** Bearer \<token\>
13+
14+
### Response Status
15+
16+
* 200 OK
17+
18+
### Response
19+
20+
```json
21+
{
22+
"error": 0,
23+
"children": [
24+
{
25+
"id": "6a0662ef-db11-cdde-6eba-21bff62cb350",
26+
"name": "modbus_node",
27+
"category": 1,
28+
"children": [
29+
{
30+
"id": "ae2601b6-7a11-408d-a815-d493c9e128f0",
31+
"name": "modbus_group",
32+
"category": 2,
33+
"children": []
34+
}
35+
]
36+
}
37+
]
38+
}
39+
```
40+
41+
## Get Tags under a Specified Subscription Group
42+
43+
*GET* /api/v2/datalayers/tags
44+
45+
### Request Params
46+
47+
**driver** required
48+
49+
**group** required
50+
51+
### Request Headers
52+
53+
**Authorization** Bearer \<token\>
54+
55+
### Response Status
56+
57+
* 200 OK
58+
59+
### Response
60+
61+
```json
62+
{
63+
"error": 0,
64+
"children": [
65+
{
66+
"id": "ae2601b6-7a11-408d-a815-d493c9e128f0",
67+
"name": "modbus_group",
68+
"category": 2,
69+
"children": [
70+
{
71+
"id": "6af5975f-171b-28b5-5aaf-cf77ed801cee",
72+
"name": "abc",
73+
"type": 3,
74+
"category": 3,
75+
"leaf": true,
76+
"children": []
77+
},
78+
{
79+
"id": "44ef919e-2e04-7b52-9491-4056ac3da8c6",
80+
"name": "def",
81+
"type": 3,
82+
"category": 3,
83+
"leaf": true,
84+
"children": []
85+
},
86+
{
87+
"id": "a3da88b9-e202-509a-a2aa-b6f3d050ad19",
88+
"name": "abcdef",
89+
"type": 3,
90+
"category": 3,
91+
"leaf": true,
92+
"children": []
93+
}
94+
]
95+
}
96+
]
97+
}
98+
```
99+
100+
## Fuzzy Search for Subscription Tags
101+
102+
*GET* /api/v2/datalayers/tag
103+
104+
### Request Params
105+
106+
**tag** required
107+
108+
### Request Headers
109+
110+
**Authorization** Bearer \<token\>
111+
112+
### Response Status
113+
114+
* 200 OK
115+
116+
### Response
117+
118+
```json
119+
{
120+
"error": 0,
121+
"children": [
122+
{
123+
"id": "6a0662ef-db11-cdde-6eba-21bff62cb350",
124+
"name": "modbus_node",
125+
"category": 1,
126+
"children": [
127+
{
128+
"id": "ae2601b6-7a11-408d-a815-d493c9e128f0",
129+
"name": "modbus_group",
130+
"category": 2,
131+
"children": [
132+
{
133+
"id": "6af5975f-171b-28b5-5aaf-cf77ed801cee",
134+
"name": "abc",
135+
"type": 3,
136+
"category": 3,
137+
"leaf": true,
138+
"children": []
139+
},
140+
{
141+
"id": "a3da88b9-e202-509a-a2aa-b6f3d050ad19",
142+
"name": "abcdef",
143+
"type": 3,
144+
"category": 3,
145+
"leaf": true,
146+
"children": []
147+
}
148+
]
149+
}
150+
]
151+
}
152+
]
153+
}
154+
```

zh_CN/api/error-code.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@
126126
* 4102 读文件失败
127127
* 4103 写文件失败
128128

129+
## DATALAYERS 错误码
130+
131+
* 4200 datalayers 错误
132+
* 4201 datalayers 初始化失败
133+
* 4202 datalayers 连接失败
134+
* 4203 datalayers 连接为空
135+
129136
## OPCUA 错误码
130137

131138
* 10001 opcua tag 不存在

zh_CN/configuration/north-apps/DataStorage/DataStorage.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ Neuron 会在启动时创建一个 *DataStorage* 单例节点,用户不能直
1616
| **用户名** | Datalayers 用户名 |
1717
| **密码** | Datalayers 密码 |
1818

19-
:::tip
20-
提交配置时,将验证与 Datalayers 的连接,如果连接失败,配置将被拒绝。
21-
:::
22-
2319
## 添加订阅
2420

2521
完成插件的添加和配置后,我们将继续通过订阅南向设备实现数据的转发。
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# 订阅信息查询 API
2+
3+
以下内容描述查询 DataStorage 节点订阅信息的 API 服务。
4+
5+
6+
## 获取所有订阅组
7+
8+
*GET* /api/v2/datalayers/groups
9+
10+
### 请求头部
11+
12+
**Authorization** Bearer \<token\>
13+
14+
### 响应状态
15+
16+
* 200 OK
17+
18+
### 响应
19+
20+
```json
21+
{
22+
"error": 0,
23+
"children": [
24+
{
25+
"id": "6a0662ef-db11-cdde-6eba-21bff62cb350",
26+
"name": "modbus_node",
27+
"category": 1,
28+
"children": [
29+
{
30+
"id": "ae2601b6-7a11-408d-a815-d493c9e128f0",
31+
"name": "modbus_group",
32+
"category": 2,
33+
"children": []
34+
}
35+
]
36+
}
37+
]
38+
}
39+
```
40+
41+
## 获取指定订阅组下的点位
42+
43+
*GET* /api/v2/datalayers/tags
44+
45+
### 请求参数
46+
47+
**driver** 必需
48+
49+
**group** 必需
50+
51+
### 请求头部
52+
53+
**Authorization** Bearer \<token\>
54+
55+
### 响应状态
56+
57+
* 200 OK
58+
59+
### 响应
60+
61+
```json
62+
{
63+
"error": 0,
64+
"children": [
65+
{
66+
"id": "ae2601b6-7a11-408d-a815-d493c9e128f0",
67+
"name": "modbus_group",
68+
"category": 2,
69+
"children": [
70+
{
71+
"id": "6af5975f-171b-28b5-5aaf-cf77ed801cee",
72+
"name": "abc",
73+
"type": 3,
74+
"category": 3,
75+
"leaf": true,
76+
"children": []
77+
},
78+
{
79+
"id": "44ef919e-2e04-7b52-9491-4056ac3da8c6",
80+
"name": "def",
81+
"type": 3,
82+
"category": 3,
83+
"leaf": true,
84+
"children": []
85+
},
86+
{
87+
"id": "a3da88b9-e202-509a-a2aa-b6f3d050ad19",
88+
"name": "abcdef",
89+
"type": 3,
90+
"category": 3,
91+
"leaf": true,
92+
"children": []
93+
}
94+
]
95+
}
96+
]
97+
}
98+
```
99+
100+
## 模糊搜索订阅点位
101+
102+
*GET* /api/v2/datalayers/tag
103+
104+
### 请求参数
105+
106+
**tag** 必需
107+
108+
### 请求头部
109+
110+
**Authorization** Bearer \<token\>
111+
112+
### 响应状态
113+
114+
* 200 OK
115+
116+
### 响应
117+
118+
```json
119+
{
120+
"error": 0,
121+
"children": [
122+
{
123+
"id": "6a0662ef-db11-cdde-6eba-21bff62cb350",
124+
"name": "modbus_node",
125+
"category": 1,
126+
"children": [
127+
{
128+
"id": "ae2601b6-7a11-408d-a815-d493c9e128f0",
129+
"name": "modbus_group",
130+
"category": 2,
131+
"children": [
132+
{
133+
"id": "6af5975f-171b-28b5-5aaf-cf77ed801cee",
134+
"name": "abc",
135+
"type": 3,
136+
"category": 3,
137+
"leaf": true,
138+
"children": []
139+
},
140+
{
141+
"id": "a3da88b9-e202-509a-a2aa-b6f3d050ad19",
142+
"name": "abcdef",
143+
"type": 3,
144+
"category": 3,
145+
"leaf": true,
146+
"children": []
147+
}
148+
]
149+
}
150+
]
151+
}
152+
]
153+
}
154+
```

0 commit comments

Comments
 (0)