@cpzxrobot/sdk 1.1.1 → 1.1.3
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/car_gateway.ts +7 -1
- package/chickenfarm_gateway.ts +0 -6
- package/device_gateway.ts +0 -1
- package/dist/car_gateway.js +5 -0
- package/dist/pigfarm_gateway.js +2 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +2 -0
- package/types.d.ts +4 -1
package/car_gateway.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cpzxrobot, Device,
|
|
1
|
+
import { Cpzxrobot, Device, Factory } from ".";
|
|
2
2
|
|
|
3
3
|
export class CarGateway extends Object {
|
|
4
4
|
context: Cpzxrobot;
|
|
@@ -12,4 +12,10 @@ export class CarGateway extends Object {
|
|
|
12
12
|
.get(`/api/v2/car/${car.id}/weightRecords?date=`+date.toISOString())
|
|
13
13
|
.then((res) => res.data);
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
detections(factory: Factory,date: Date) {
|
|
17
|
+
return this.context.axios
|
|
18
|
+
.get(`/api/v2/car/${factory.pid}/detections?date=`+ date.toISOString())
|
|
19
|
+
.then((res) => res.data);
|
|
20
|
+
}
|
|
15
21
|
}
|
package/chickenfarm_gateway.ts
CHANGED
package/device_gateway.ts
CHANGED
package/dist/car_gateway.js
CHANGED
|
@@ -11,5 +11,10 @@ class CarGateway extends Object {
|
|
|
11
11
|
.get(`/api/v2/car/${car.id}/weightRecords?date=` + date.toISOString())
|
|
12
12
|
.then((res) => res.data);
|
|
13
13
|
}
|
|
14
|
+
detections(factory, date) {
|
|
15
|
+
return this.context.axios
|
|
16
|
+
.get(`/api/v2/car/${factory.pid}/detections?date=` + date.toISOString())
|
|
17
|
+
.then((res) => res.data);
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
exports.CarGateway = CarGateway;
|
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -76,11 +76,13 @@ class PigfarmGateway extends Object {
|
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
78
|
add: (unit, data) => {
|
|
79
|
+
data.unitId = unit.id;
|
|
79
80
|
return this.context.ready.then((axios) => {
|
|
80
81
|
return axios.post(`/api/v2/pigfarm/relay/config/add`, data);
|
|
81
82
|
});
|
|
82
83
|
},
|
|
83
84
|
update: (unit, data) => {
|
|
85
|
+
data.unitId = unit.id;
|
|
84
86
|
return this.context.ready.then((axios) => {
|
|
85
87
|
return axios.post(`/api/v2/pigfarm/relay/config/update`, data);
|
|
86
88
|
});
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -99,11 +99,13 @@ export class PigfarmGateway extends Object {
|
|
|
99
99
|
});
|
|
100
100
|
},
|
|
101
101
|
add: (unit: Unit, data: DeviceConfig) => {
|
|
102
|
+
data.unitId = unit.id;
|
|
102
103
|
return this.context.ready.then((axios) => {
|
|
103
104
|
return axios.post(`/api/v2/pigfarm/relay/config/add`, data);
|
|
104
105
|
});
|
|
105
106
|
},
|
|
106
107
|
update: (unit: Unit, data: DeviceConfig) => {
|
|
108
|
+
data.unitId = unit.id;
|
|
107
109
|
return this.context.ready.then((axios) => {
|
|
108
110
|
return axios.post(`/api/v2/pigfarm/relay/config/update`, data);
|
|
109
111
|
});
|
package/types.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { UserGateway } from "@cpzxrobot/sdk/user_gateway";
|
|
|
5
5
|
import { CameraGateway } from "@cpzxrobot/sdk/camera_gateway";
|
|
6
6
|
import { PigfarmGateway } from "@cpzxrobot/sdk/pigfarm_gateway";
|
|
7
7
|
import { ChickenFarmGateway } from "@cpzxrobot/sdk/chickenfarm_gateway";
|
|
8
|
-
import { UnitGateway } from "@cpzxrobot/sdk
|
|
8
|
+
import { UnitGateway } from "@cpzxrobot/sdk/unit_gateway";
|
|
9
|
+
import { CarGateway } from "@cpzxrobot/sdk/car_gateway";
|
|
9
10
|
import { FieldDatas } from "./sensor_datas";
|
|
10
11
|
|
|
11
12
|
type Device = {
|
|
@@ -75,6 +76,7 @@ type Factory = {
|
|
|
75
76
|
company_code: string;
|
|
76
77
|
id?: number;
|
|
77
78
|
type?: string;
|
|
79
|
+
pid?: number;
|
|
78
80
|
};
|
|
79
81
|
type Unit = {
|
|
80
82
|
name?: string;
|
|
@@ -302,6 +304,7 @@ class Cpzxrobot {
|
|
|
302
304
|
camera: CameraGateway;
|
|
303
305
|
pigfarm: PigfarmGateway;
|
|
304
306
|
chickenfarm: ChickenfarmGateway;
|
|
307
|
+
car: CarGateway;
|
|
305
308
|
dict: (key: string) => any;
|
|
306
309
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
307
310
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|