@cpzxrobot/sdk 1.1.88 → 1.1.90
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.
- package/device_gateway.ts +25 -17
- package/dist/device_gateway.js +7 -0
- package/dist/transport_gateway.js +2 -2
- package/package.json +1 -1
- package/product_gateway.ts +1 -1
- package/readme.md +1 -0
- package/transport_gateway.ts +2 -2
package/device_gateway.ts
CHANGED
|
@@ -58,7 +58,7 @@ export class DeviceGateway extends Object {
|
|
|
58
58
|
}) => {
|
|
59
59
|
let axios = await this.context.ready;
|
|
60
60
|
|
|
61
|
-
return axios.post(`/api/v2/device/list`,condition).then((res) => {
|
|
61
|
+
return axios.post(`/api/v2/device/list`, condition).then((res) => {
|
|
62
62
|
return res.data;
|
|
63
63
|
});
|
|
64
64
|
},
|
|
@@ -102,7 +102,7 @@ export class DeviceGateway extends Object {
|
|
|
102
102
|
},
|
|
103
103
|
delete: async (id: string) => {
|
|
104
104
|
let axios = await this.context.ready;
|
|
105
|
-
return axios.post(`/api/v2/threshold/config/delete`,{
|
|
105
|
+
return axios.post(`/api/v2/threshold/config/delete`, {
|
|
106
106
|
id: id
|
|
107
107
|
});
|
|
108
108
|
},
|
|
@@ -160,21 +160,21 @@ export class DeviceGateway extends Object {
|
|
|
160
160
|
options:
|
|
161
161
|
| undefined
|
|
162
162
|
| {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
163
|
+
id?: Number | null | undefined;
|
|
164
|
+
data?:
|
|
165
|
+
| "diffPerDay"
|
|
166
|
+
| "sumPerDay"
|
|
167
|
+
| "latest"
|
|
168
|
+
| "weekoverweek"
|
|
169
|
+
| "last"
|
|
170
|
+
| "rangeToday"
|
|
171
|
+
| null; //如果data为null,则不获取数据,只获取设备列表,否则获取设备列表和数据
|
|
172
|
+
status?: string;
|
|
173
|
+
unit?: Number;
|
|
174
|
+
type?: string;
|
|
175
|
+
detail?: boolean;
|
|
176
|
+
supplier?: string; //供应商,可用于过滤设备
|
|
177
|
+
} = undefined
|
|
178
178
|
) {
|
|
179
179
|
return this.normalFilter.list(options);
|
|
180
180
|
}
|
|
@@ -193,4 +193,12 @@ export class DeviceGateway extends Object {
|
|
|
193
193
|
) {
|
|
194
194
|
return this.normalFilter.getData(id, args);
|
|
195
195
|
}
|
|
196
|
+
|
|
197
|
+
async validate(serialNumbers: string[],type: string = "pywl") {
|
|
198
|
+
let axios = await this.context.ready;
|
|
199
|
+
return axios.post(`/api/v2/device/validateSerialNumber`, {
|
|
200
|
+
serialNumbers,
|
|
201
|
+
type,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
196
204
|
}
|
package/dist/device_gateway.js
CHANGED
|
@@ -128,5 +128,12 @@ class DeviceGateway extends Object {
|
|
|
128
128
|
}) {
|
|
129
129
|
return this.normalFilter.getData(id, args);
|
|
130
130
|
}
|
|
131
|
+
async validate(serialNumbers, type = "pywl") {
|
|
132
|
+
let axios = await this.context.ready;
|
|
133
|
+
return axios.post(`/api/v2/device/validateSerialNumber`, {
|
|
134
|
+
serialNumbers,
|
|
135
|
+
type,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
131
138
|
}
|
|
132
139
|
exports.DeviceGateway = DeviceGateway;
|
|
@@ -76,10 +76,10 @@ class TransportGateway extends Object {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
},
|
|
79
|
-
addImage: () => {
|
|
79
|
+
addImage: (args) => {
|
|
80
80
|
return this.context.ready.then(() => {
|
|
81
81
|
return this.context.axios
|
|
82
|
-
.upload("/api/v2/pigfarm/feedTower/fodder/photo/add")
|
|
82
|
+
.upload("/api/v2/pigfarm/feedTower/fodder/photo/add", args)
|
|
83
83
|
.then((res) => {
|
|
84
84
|
if (res.data.code != 200) {
|
|
85
85
|
throw res.data.message;
|
package/package.json
CHANGED
package/product_gateway.ts
CHANGED
package/readme.md
CHANGED
|
@@ -84,6 +84,7 @@ baseURL: "/"
|
|
|
84
84
|
| cpzxrobot().device.v2.update | 更新设备(仅限v2设备) |
|
|
85
85
|
| cpzxrobot().device.v2.list | 删除设备(仅限v2设备) |
|
|
86
86
|
| cpzxrobot().device.v2.delete | 删除设备(仅限v2设备) |
|
|
87
|
+
| cpzxrobot().device.validate | 校验设备是否有效,传入serialNumbers数组,返回包含状态的设备列表 |
|
|
87
88
|
| cpzxrobot().camera.xxx | 获得摄像头的相关信息 |
|
|
88
89
|
| cpzxrobot().camera.control | 控制摄像头,例如:左移,右移,上移,下移等,如果传输start为true,则开始控制,如果传输stop为true,则停止控制,如果都没传输,则执行3秒后自动停止,传输start为true时,前端必须在需要停止时自行发送stop为true的消息 |
|
|
89
90
|
| cpzxrobot().factory.entry | 获得工厂的可显示动态信息 |
|
package/transport_gateway.ts
CHANGED
|
@@ -87,10 +87,10 @@ export class TransportGateway extends Object {
|
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
|
-
addImage: () => {
|
|
90
|
+
addImage: (args: any) => {
|
|
91
91
|
return this.context.ready.then(() => {
|
|
92
92
|
return this.context.axios
|
|
93
|
-
.upload("/api/v2/pigfarm/feedTower/fodder/photo/add")
|
|
93
|
+
.upload("/api/v2/pigfarm/feedTower/fodder/photo/add",args)
|
|
94
94
|
.then((res) => {
|
|
95
95
|
if (res.data.code != 200) {
|
|
96
96
|
throw res.data.message;
|