@cpzxrobot/sdk 1.0.42 → 1.0.44
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 +1 -0
- package/dist/camera_gateway.js +1 -0
- package/dist/index.js +16 -0
- package/dist/pigfarm_gateway.js +9 -1
- package/dist/transport_gateway.js +1 -0
- package/index.ts +16 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +17 -7
- package/transport_gateway.ts +2 -0
package/camera_gateway.ts
CHANGED
package/dist/camera_gateway.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -229,6 +229,22 @@ class Cpzxrobot {
|
|
|
229
229
|
}
|
|
230
230
|
this.resolveReady(this.axios);
|
|
231
231
|
});
|
|
232
|
+
//load www.cpzxrobot.com/web_components.js as web components
|
|
233
|
+
// const script = document.createElement("script");
|
|
234
|
+
// script.src = "https://www.cpzxrobot.com/web_components.js";
|
|
235
|
+
// document.body.appendChild(script);
|
|
236
|
+
// //insert cpzxrobot_web_components into body
|
|
237
|
+
// const div = document.createElement("cpzxrobot_web_components");
|
|
238
|
+
// document.body.appendChild(div);
|
|
239
|
+
// //register onUnitChanged and onFactoryChanged on div
|
|
240
|
+
// div.addEventListener("unitChanged", function (e: any) {
|
|
241
|
+
// // @ts-ignore
|
|
242
|
+
// window._notifyUnitChanged(e.detail);
|
|
243
|
+
// });
|
|
244
|
+
// div.addEventListener("factoryChanged", function (e: any) {
|
|
245
|
+
// // @ts-ignore
|
|
246
|
+
// window._notifyFactoryChanged(e.detail);
|
|
247
|
+
// });
|
|
232
248
|
return;
|
|
233
249
|
}
|
|
234
250
|
else {
|
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -61,7 +61,15 @@ class PigfarmGateway extends Object {
|
|
|
61
61
|
},
|
|
62
62
|
update: async (lamp) => {
|
|
63
63
|
var axios = await this.context.ready;
|
|
64
|
-
return axios.
|
|
64
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
65
|
+
},
|
|
66
|
+
control: async (lamp, action) => {
|
|
67
|
+
var axios = await this.context.ready;
|
|
68
|
+
var id = typeof lamp === "number" ? lamp : lamp.id;
|
|
69
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/control`, {
|
|
70
|
+
id,
|
|
71
|
+
action,
|
|
72
|
+
});
|
|
65
73
|
},
|
|
66
74
|
};
|
|
67
75
|
}
|
package/index.ts
CHANGED
|
@@ -264,6 +264,22 @@ export class Cpzxrobot {
|
|
|
264
264
|
}
|
|
265
265
|
this.resolveReady(this.axios);
|
|
266
266
|
});
|
|
267
|
+
//load www.cpzxrobot.com/web_components.js as web components
|
|
268
|
+
// const script = document.createElement("script");
|
|
269
|
+
// script.src = "https://www.cpzxrobot.com/web_components.js";
|
|
270
|
+
// document.body.appendChild(script);
|
|
271
|
+
// //insert cpzxrobot_web_components into body
|
|
272
|
+
// const div = document.createElement("cpzxrobot_web_components");
|
|
273
|
+
// document.body.appendChild(div);
|
|
274
|
+
// //register onUnitChanged and onFactoryChanged on div
|
|
275
|
+
// div.addEventListener("unitChanged", function (e: any) {
|
|
276
|
+
// // @ts-ignore
|
|
277
|
+
// window._notifyUnitChanged(e.detail);
|
|
278
|
+
// });
|
|
279
|
+
// div.addEventListener("factoryChanged", function (e: any) {
|
|
280
|
+
// // @ts-ignore
|
|
281
|
+
// window._notifyFactoryChanged(e.detail);
|
|
282
|
+
// });
|
|
267
283
|
return;
|
|
268
284
|
} else {
|
|
269
285
|
//if url has access_token and app_code, use it
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -55,7 +55,7 @@ export class PigfarmGateway extends Object {
|
|
|
55
55
|
|
|
56
56
|
get heatlamp() {
|
|
57
57
|
return {
|
|
58
|
-
add: (unit:Unit, data: HeatLamp) => {
|
|
58
|
+
add: (unit: Unit, data: HeatLamp) => {
|
|
59
59
|
return this.context.ready.then((axios) => {
|
|
60
60
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, {
|
|
61
61
|
...data,
|
|
@@ -63,17 +63,27 @@ export class PigfarmGateway extends Object {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
|
-
list: async (unit:Unit):Promise<any
|
|
66
|
+
list: async (unit: Unit): Promise<any> => {
|
|
67
67
|
var axios = await this.context.ready;
|
|
68
|
-
return axios.post(
|
|
68
|
+
return axios.post(
|
|
69
|
+
`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`
|
|
70
|
+
);
|
|
69
71
|
},
|
|
70
|
-
get: async (id: number):Promise<any
|
|
72
|
+
get: async (id: number): Promise<any> => {
|
|
71
73
|
var axios = await this.context.ready;
|
|
72
|
-
return axios.get(`/api/v1/pigfarm/heatLamp/config/${id}`)
|
|
74
|
+
return axios.get(`/api/v1/pigfarm/heatLamp/config/${id}`);
|
|
73
75
|
},
|
|
74
|
-
update:async (lamp: HeatLamp):Promise<any
|
|
76
|
+
update: async (lamp: HeatLamp): Promise<any> => {
|
|
75
77
|
var axios = await this.context.ready;
|
|
76
|
-
return axios.
|
|
78
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
79
|
+
},
|
|
80
|
+
control: async (lamp: HeatLamp | number, action: "on" | "off") => {
|
|
81
|
+
var axios = await this.context.ready;
|
|
82
|
+
var id = typeof lamp === "number" ? lamp : lamp.id;
|
|
83
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/control`, {
|
|
84
|
+
id,
|
|
85
|
+
action,
|
|
86
|
+
});
|
|
77
87
|
},
|
|
78
88
|
};
|
|
79
89
|
}
|
package/transport_gateway.ts
CHANGED
|
@@ -19,11 +19,13 @@ export class TransportGateway extends Object {
|
|
|
19
19
|
pageSize: number;
|
|
20
20
|
deviceId: number | undefined;
|
|
21
21
|
unitId: number | undefined;
|
|
22
|
+
factoryId: number | undefined;
|
|
22
23
|
} = {
|
|
23
24
|
current: 1,
|
|
24
25
|
pageSize: 10,
|
|
25
26
|
deviceId: id,
|
|
26
27
|
unitId: undefined,
|
|
28
|
+
factoryId: undefined,
|
|
27
29
|
}
|
|
28
30
|
): Promise<FodderOrder[]> => {
|
|
29
31
|
return this.context.ready.then(() => {
|