@cpzxrobot/sdk 1.0.37 → 1.0.39
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/camera_gateway.ts +24 -8
- package/dist/camera_gateway.js +9 -4
- package/dist/transport_gateway.js +1 -1
- package/package.json +1 -1
- package/readme.md +10 -1
- package/transport_gateway.ts +2 -2
- package/types.d.ts +2 -0
package/camera_gateway.ts
CHANGED
|
@@ -6,21 +6,37 @@ export class CameraGateway extends Object {
|
|
|
6
6
|
super();
|
|
7
7
|
this.context = context;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
async search(
|
|
9
|
+
//搜索摄像头,传入unit对象或者unit的id
|
|
10
|
+
async search(
|
|
11
|
+
data:
|
|
12
|
+
| Unit
|
|
13
|
+
| {
|
|
14
|
+
workshop_id: number;
|
|
15
|
+
factory_id: number;
|
|
16
|
+
unit_id: number;
|
|
17
|
+
}
|
|
18
|
+
): Promise<any> {
|
|
11
19
|
var axios = await this.context.ready;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
var params = {};
|
|
21
|
+
|
|
22
|
+
if (!("id" in data)) {
|
|
23
|
+
params = data as {
|
|
24
|
+
workshop_id: number;
|
|
25
|
+
factory_id: number;
|
|
26
|
+
unit_id: number;
|
|
27
|
+
};
|
|
28
|
+
}else{
|
|
29
|
+
params = {unit_id:data.id}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const response = await axios.post("/api/v1/camera/search", params);
|
|
15
33
|
return response.data;
|
|
16
34
|
}
|
|
17
35
|
|
|
18
36
|
//获得摄像头的播放地址
|
|
19
37
|
async getUrl(data: Camera): Promise<any> {
|
|
20
38
|
var axios = await this.context.ready;
|
|
21
|
-
const response = await axios.get(
|
|
22
|
-
`/api/v1/camera/${data.id}/url/wss`
|
|
23
|
-
);
|
|
39
|
+
const response = await axios.get(`/api/v1/camera/${data.id}/url/wss`);
|
|
24
40
|
return response.data;
|
|
25
41
|
}
|
|
26
42
|
//获取工厂天气
|
package/dist/camera_gateway.js
CHANGED
|
@@ -6,12 +6,17 @@ class CameraGateway extends Object {
|
|
|
6
6
|
super();
|
|
7
7
|
this.context = context;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
//搜索摄像头,传入unit对象或者unit的id
|
|
10
10
|
async search(data) {
|
|
11
11
|
var axios = await this.context.ready;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
var params = {};
|
|
13
|
+
if (!("id" in data)) {
|
|
14
|
+
params = data;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
params = { unit_id: data.id };
|
|
18
|
+
}
|
|
19
|
+
const response = await axios.post("/api/v1/camera/search", params);
|
|
15
20
|
return response.data;
|
|
16
21
|
}
|
|
17
22
|
//获得摄像头的播放地址
|
|
@@ -37,7 +37,7 @@ class TransportGateway extends Object {
|
|
|
37
37
|
getDeviceByFodderld: (id) => {
|
|
38
38
|
return this.context.ready.then(() => {
|
|
39
39
|
return this.context.axios
|
|
40
|
-
.get("/api/v1/pigfarm/device/fodderTower/
|
|
40
|
+
.get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderId", {
|
|
41
41
|
params: {
|
|
42
42
|
fodderld: id,
|
|
43
43
|
},
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -125,4 +125,13 @@ factory_id: 工厂id
|
|
|
125
125
|
|
|
126
126
|
`cpzxrobot().saveBase64(base64,filename)`
|
|
127
127
|
|
|
128
|
-
保存Base64内容为文件
|
|
128
|
+
保存Base64内容为文件
|
|
129
|
+
|
|
130
|
+
### 保温灯相关接口
|
|
131
|
+
|
|
132
|
+
heatlamp 属性提供了一组方法,用于管理猪场的热灯配置。它包含以下方法:
|
|
133
|
+
|
|
134
|
+
**cpzxrobot().pigfarm.heatlamp.add(unit, data)**:添加新的热灯配置。
|
|
135
|
+
**cpzxrobot().pigfarm.heatlamp.list(unit)**:列出指定单元的所有热灯配置。
|
|
136
|
+
**cpzxrobot().pigfarm.heatlamp.get(id)**:获取指定 ID 的热灯配置。
|
|
137
|
+
**cpzxrobot().pigfarm.heatlamp.update(lamp)**:更新热灯配置。
|
package/transport_gateway.ts
CHANGED
|
@@ -44,10 +44,10 @@ export class TransportGateway extends Object {
|
|
|
44
44
|
return this.getDetail;
|
|
45
45
|
},
|
|
46
46
|
//按料单获得对应的料塔
|
|
47
|
-
getDeviceByFodderld: (id:
|
|
47
|
+
getDeviceByFodderld: (id: string): Promise<any> => {
|
|
48
48
|
return this.context.ready.then(() => {
|
|
49
49
|
return this.context.axios
|
|
50
|
-
.get("/api/v1/pigfarm/device/fodderTower/
|
|
50
|
+
.get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderId", {
|
|
51
51
|
params: {
|
|
52
52
|
fodderld: id,
|
|
53
53
|
},
|