nayota-show-sdk 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/api/product.js +121 -61
  2. package/package.json +1 -1
package/api/product.js CHANGED
@@ -5,66 +5,126 @@
5
5
  */
6
6
  import { requestShow as request } from '../utils'
7
7
 
8
- // name 是 string 设备名称。
9
- // shortAddress 是 number 485设备/Http设备为设备短地址,TCP设备为设备mac地址,注意:Hardware(485)/NetDrive(TCP)/HttpDrive(Http)设备类型才有此参数且是必选。
10
- // depart 是 string 可视化层级的id。
11
- // control 是 number 网关id。
12
- // parentType 否 string 485设备所属父级设备的类型,tcp1,mqtt2.注意:Hardware(485)设备类型才有此参数。
13
- // parentId 否 string 所属mqtt设备的id或者所属tcp设备的id,注意:Hardware(485)设备类型才有此参数。
14
- // type 否 number 0:OTTA,1:ABP,Loranwan设备类型,注意:Lorawan设备类型才有此参数。
15
- // devEui 否 string 注意:Lorawan设备类型才有此参数,type为0和1时必选。
16
- // deviceProfileId 否 string 注意:Lorawan设备类型才有此参数,type为0和1时必选。
17
- // deviceKeys 否 string 注意:Lorawan设备类型才有此参数,type为0时必选。
18
- // devAddr 否 string 注意:Lorawan设备类型才有此参数,type为1时必选。
19
- // nwkSkey 否 string 注意:Lorawan设备类型才有此参数,type为1时必选。
20
- // appSkey 否 string 注意:Lorawan设备类型才有此参数,type为1时必选。
21
- // type 否 number 0:tcp客户端,1:tcp服务端,2:udp客户端,3:udp服务端,tcp设备类型,注意:NetDrive设备类型才有此参数。
22
- // range 否 number 设备轮询时间ms单位
23
- // tcp_client_ip 否 string tcpIp,注意:NetDrive设备类型才有此参数且必选。
24
- // tcp_client_port 否 string tcp端口,注意:NetDrive设备类型才有此参数,type为1时必选。
25
- // udp_client_ip 否 string udpIp,注意:NetDrive设备类型才有此参数且必选。
26
- // udp_client_port 否 string udp端口,注意:NetDrive设备类型才有此参数,type为3时必选。
27
- // ip 否 string 设备IP地址,注意:HttpDrive设备类型才有此参数且必选。
28
- // port 否 string 设备端口默认80,注意:HttpDrive设备类型才有此参数且必选。
29
- // url 否 string 设备url,注意:HttpDrive设备类型才有此参数且必选。
30
- // range 否 number 设备轮询时间ms单位,默认为3000ms,注意:HttpDrive设备类型才有此参数且必选。
31
- // describe, line, hasPtz
8
+
9
+ // * RS485设备创建所需参数
10
+ // * {
11
+ // * name: '485设备',
12
+ // * shortAddress: '06',
13
+ // * depart: '667d2ecc52d21700095b58b4',
14
+ // * control: '667a30ea3d569977280ea5fc',
15
+ // * parentType: 1,
16
+ // * parentId: '667a30ea3d569977280ea5fc',
17
+ // * }
18
+
19
+ /**
20
+ * RS485父级设备类型枚举
21
+ * @readonly
22
+ * @enum {number}
23
+ */
24
+ var parentType = {
25
+ TCP: 1,
26
+ MQTT: 2
27
+ }
28
+
29
+ /**
30
+ * Lorawan设备类型枚举
31
+ * @readonly
32
+ * @enum {number}
33
+ */
34
+ var lorawanType = {
35
+ OTTA: 0,
36
+ ABP: 1
37
+ }
38
+
39
+ /**
40
+ * TCP设备类型枚举
41
+ * @readonly
42
+ * @enum {number}
43
+ */
44
+ var tcpType = {
45
+ tcp客户端: 0,
46
+ tcp服务端: 1,
47
+ udp客户端: 2,
48
+ udp服务端: 3
49
+ }
50
+ /**
51
+ * @typedef {Object} Hardware设备创建所需参数
52
+ * @property {string} _id - 产品id
53
+ * @property {string} name - 设备名称
54
+ * @property {string} shortAddress - 短地址
55
+ * @property {string} depart - 可视化层级的id
56
+ * @property {string} control - 网关id
57
+ * @property {number} parentType - 查看枚举类型parentType{@link parentType}。
58
+ * @property {string} parentId - 所属父级设备的id。
59
+ */
60
+
61
+ /**
62
+ * @typedef {Object} Lorawan设备创建所需参数
63
+ * @property {string} _id - 产品id
64
+ * @property {string} name - 设备名称
65
+ * @property {string} shortAddress - 短地址
66
+ * @property {string} depart - 可视化层级的id
67
+ * @property {string} control - 网关id
68
+ * @property {number} type - 查看枚举类型lorawanType{@link lorawanType}。
69
+ * @property {string} devEui - devEui。
70
+ * @property {string} deviceProfileId - deviceProfileId。
71
+ * @property {string} deviceKeys - deviceKeys当type字段为0时必选。
72
+ * @property {string} devAddr - devAddr当type字段为1时必选。
73
+ * @property {string} nwkSkey - nwkSkey当type字段为1时必选。
74
+ * @property {string} appSkey - appSkey当type字段为1时必选。
75
+ */
76
+
77
+
78
+ /**
79
+ * @typedef {Object} TCP设备创建所需参数
80
+ * @property {string} _id - 产品id
81
+ * @property {string} name - 设备名称
82
+ * @property {string} shortAddress - 短地址
83
+ * @property {string} depart - 可视化层级的id
84
+ * @property {string} control - 网关id
85
+ * @property {number} type - 查看枚举类型tcpType。
86
+ * @property {number} range - 设备轮询时间ms单位,默认为3000ms。
87
+ * @property {string} tcp_client_ip - tcpIp,type为0或者1时必选。
88
+ * @property {string} tcp_client_port - tcp端口,type为1时必选。
89
+ * @property {string} udp_client_ip - udpIp,type为2或者3时必选。
90
+ * @property {string} udp_client_port - udp端口,type为3时必选。
91
+ */
92
+
93
+ /**
94
+ * @typedef {Object} HttpDrive设备创建所需参数
95
+ * @property {string} _id - 产品id
96
+ * @property {string} name - 设备名称
97
+ * @property {string} shortAddress - 短地址
98
+ * @property {string} depart - 可视化层级的id
99
+ * @property {string} control - 网关id
100
+ * @property {string} ip - 设备IP地址。
101
+ * @property {string} port - 设备端口默认80。
102
+ * @property {string} url - 设备url。
103
+ * @property {number} range - 设备轮询时间ms单位,默认为3000ms。
104
+ */
105
+
106
+ /**
107
+ * @typedef {Object} 摄像头设备创建所需参数
108
+ * @property {string} _id - 产品id
109
+ * @property {string} name - 设备名称
110
+ * @property {string} depart - 可视化层级的id
111
+ * @property {string} thirdPartyCameraAccount - 平台账号id,查config三方摄像头账号接口,平台摄像头必选。
112
+ * @property {number} number - 设备序号,平台摄像头必选。
113
+ * @property {number} channelNo - 通道号,平台摄像头且三方摄像头的类型为2时必选,其余三方摄像头类型可选。
114
+ * @property {string} iconName - 设备图标。
115
+ * @property {string} local_ip - 本地RTSP地址,本地摄像头必选。
116
+ * @property {string} local_username - 本地用户名,本地摄像头必选。
117
+ * @property {string} local_password - 本地密码,本地摄像头必选。
118
+ * @property {string} describe - 设备备注。
119
+ * @property {boolean} line - 设备在离线。
120
+ * @property {boolean} hasPtz - 是否带云台。
121
+ */
122
+
123
+
124
+
32
125
  /**
33
- * 创建多平台设备
34
- *
35
- * @param {Object} data - 包含参数的请求体。
36
- * @param {string} data.name - 设备名称。
37
- * @param {number} data.shortAddress - 485设备/Http设备为设备短地址,TCP设备为设备mac地址,注意:Hardware(485)/NetDrive(TCP)/HttpDrive(Http)设备类型才有此参数且是必选。
38
- * @param {string} data.depart - 可视化层级的id。
39
- * @param {string} data.control - 网关id。
40
- * @param {number} data.parentType - 485设备所属父级设备的类型,tcp1,mqtt2.注意:Hardware(485)设备类型才有此参数。
41
- * @param {string} data.parentId - 所属mqtt设备的id或者所属tcp设备的id,注意:Hardware(485)设备类型才有此参数。
42
- * @param {number} data.type - 0:OTTA,1:ABP,Loranwan设备类型,注意:Lorawan设备类型才有此参数。
43
- * @param {string} data.devEui - 注意:Lorawan设备类型才有此参数,type为0和1时必选。
44
- * @param {string} data.deviceProfileId - 注意:Lorawan设备类型才有此参数,type为0和1时必选。
45
- * @param {string} data.deviceKeys - 注意:Lorawan设备类型才有此参数,type为0时必选。
46
- * @param {string} data.devAddr - 注意:Lorawan设备类型才有此参数,type为1时必选。
47
- * @param {string} data.nwkSkey - 注意:Lorawan设备类型才有此参数,type为1时必选。
48
- * @param {string} data.appSkey - 注意:Lorawan设备类型才有此参数,type为1时必选。
49
- * @param {number} data.type - 0:tcp客户端,1:tcp服务端,2:udp客户端,3:udp服务端,tcp设备类型,注意:NetDrive设备类型才有此参数。
50
- * @param {string} data.tcp_client_ip - tcpIp,注意:NetDrive设备类型才有此参数且必选。
51
- * @param {string} data.tcp_client_port - tcp端口,注意:NetDrive设备类型才有此参数,type为1时必选。
52
- * @param {string} data.udp_client_ip - udpIp,注意:NetDrive设备类型才有此参数且必选。
53
- * @param {string} data.udp_client_port - udp端口,注意:NetDrive设备类型才有此参数,type为3时必选。
54
- * @param {string} data.ip - 设备IP地址,注意:HttpDrive设备类型才有此参数且必选。
55
- * @param {string} data.port - 设备端口默认80,注意:HttpDrive设备类型才有此参数且必选。
56
- * @param {string} data.url - 设备url,注意:HttpDrive设备类型才有此参数且必选。
57
- * @param {number} data.range - 设备轮询时间ms单位,默认为3000ms,注意:HttpDrive设备类型和NetDrive设备类型才有此参数且必选。
58
- * @param {string} data.thirdPartyCameraAccount - 平台账号,查config三方摄像头账号接口,注意:摄像头类型才有此参数。
59
- * @param {number} data.number - 设备序号,注意:摄像头类型才有此参数。
60
- * @param {number} data.channelNo - 通道号,注意:摄像头类型才有此参数。
61
- * @param {string} data.iconName - 设备图标,注意:摄像头类型才有此参数。
62
- * @param {string} data.local_ip - 本地RTSP地址,注意:摄像头类型才有此参数。
63
- * @param {string} data.local_username - 本地用户名,注意:摄像头类型才有此参数。
64
- * @param {string} data.local_password - 本地密码,注意:摄像头类型才有此参数。
65
- * @param {string} data.describe - 设备备注,注意:摄像头类型才有此参数。
66
- * @param {boolean} data.line - 设备在离线,注意:摄像头类型才有此参数。
67
- * @param {boolean} data.hasPtz - 是否带云台,注意:摄像头类型才有此参数。
126
+ * 通过产品类型添加设备,该接口会同时创建IOT设备、展示设备及可视化设备。
127
+ * @param {Object} data - 包含参数的请求体,data对象通过判断产品类型中的IOT设备类型字段创建不同类型的设备,摄像头设备则通过判断产品标签去判断,以下为不同类型设备创建所需参数。
68
128
  * @example <caption>请求范例</caption>
69
129
  * RS485设备创建所需参数
70
130
  * {
@@ -223,7 +283,7 @@ function list(query) {
223
283
  * 创建产品信息
224
284
  * @param {Object} data - 创建产品信息
225
285
  * @param {string} data.name - 产品名称。
226
- * @param {string} data.productCode - 产品名称。
286
+ * @param {string} data.productCode - 产品型号。
227
287
  * @param {string} data.tags - 产品标签
228
288
  * @param {string} data.brand - 产品品牌
229
289
  * @param {string} data.img - 产品图片
@@ -234,7 +294,7 @@ function list(query) {
234
294
  * @param {string} data.description - 产品描述
235
295
  * @param {string} data.hardwareWord - 设备字典
236
296
  * @param {string} data.addressDesc - 地址介绍
237
- * @param {string} data.deviceUI - 产品名称。
297
+ * @param {string} data.deviceUI - 展示模型UIid。
238
298
  * @param {string} data.deviceType - IOT设备类型
239
299
  */
240
300
  function create(data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nayota-show-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "nayota-show-server rest-api",
5
5
  "type": "module",
6
6
  "main": "index.js",