@cpzxrobot/sdk 1.0.19 → 1.0.20
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_filter.ts +2 -14
- package/device_gateway.ts +12 -1
- package/device_types/feedtower.ts +2 -2
- package/dist/device_gateway.js +7 -0
- package/package.json +1 -1
- package/readme.md +2 -2
- package/types.d.ts +15 -1
package/device_filter.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { Cpzxrobot } from ".";
|
|
1
|
+
import { Cpzxrobot, DataQueryArgs } from ".";
|
|
2
2
|
import type { AxiosResponse } from "axios";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
start?: string;
|
|
6
|
-
stop?: string;
|
|
7
|
-
type?:
|
|
8
|
-
| "diffPerDay"
|
|
9
|
-
| "sumPerDay"
|
|
10
|
-
| "latest"
|
|
11
|
-
| "latestInRangePerDay"
|
|
12
|
-
| "last"
|
|
13
|
-
| "difference";
|
|
14
|
-
period?: "1mo" | "1d" | null;
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
4
|
+
|
|
17
5
|
|
|
18
6
|
export abstract class DeviceFilter<T extends { id: number }> {
|
|
19
7
|
context: Cpzxrobot;
|
package/device_gateway.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeviceTypeGateway } from "./device_type_gateway";
|
|
2
2
|
import { DeviceFilter } from "./device_filter";
|
|
3
|
-
import type { ElectricMeter, Cpzxrobot } from ".";
|
|
3
|
+
import type { ElectricMeter, Cpzxrobot, DataQueryArgs } from ".";
|
|
4
4
|
import { FeedTowerGateway } from "./device_types/feedtower";
|
|
5
5
|
import { ElectricMeterGateway } from "./device_types/electricmeter";
|
|
6
6
|
import { NormalGateway } from "./device_types/normal_type";
|
|
@@ -88,4 +88,15 @@ export class DeviceGateway extends Object {
|
|
|
88
88
|
get getHistoryDatas() {
|
|
89
89
|
return this.normalFilter.getHistoryDatas;
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
data(
|
|
93
|
+
id: number,
|
|
94
|
+
args: DataQueryArgs = {
|
|
95
|
+
start: "",
|
|
96
|
+
stop: "",
|
|
97
|
+
type: "diffPerDay", // diffPerDay, sumPerDay, latest
|
|
98
|
+
}
|
|
99
|
+
) {
|
|
100
|
+
return this.normalFilter.getData(id,args);
|
|
101
|
+
}
|
|
91
102
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type FodderOrderList, type FeedTower,type FeedTowerExtraInfo } from '..'
|
|
2
|
-
import { DeviceFilter
|
|
1
|
+
import { type FodderOrderList, type FeedTower,type FeedTowerExtraInfo, DataQueryArgs } from '..'
|
|
2
|
+
import { DeviceFilter } from '../device_filter'
|
|
3
3
|
|
|
4
4
|
export class FeedTowerGateway extends DeviceFilter<FeedTower> {
|
|
5
5
|
// Add properties and methods specific to the FeedTower type here
|
package/dist/device_gateway.js
CHANGED
|
@@ -53,5 +53,12 @@ class DeviceGateway extends Object {
|
|
|
53
53
|
get getHistoryDatas() {
|
|
54
54
|
return this.normalFilter.getHistoryDatas;
|
|
55
55
|
}
|
|
56
|
+
data(id, args = {
|
|
57
|
+
start: "",
|
|
58
|
+
stop: "",
|
|
59
|
+
type: "diffPerDay", // diffPerDay, sumPerDay, latest
|
|
60
|
+
}) {
|
|
61
|
+
return this.normalFilter.getData(id, args);
|
|
62
|
+
}
|
|
56
63
|
}
|
|
57
64
|
exports.DeviceGateway = DeviceGateway;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -74,8 +74,8 @@ baseURL: "/"
|
|
|
74
74
|
| 调用入口 | 功能说明 |
|
|
75
75
|
| ----------------------- | -------------------- |
|
|
76
76
|
| cpzxrobot().factory.xxx | 获得工厂的相关信息 |
|
|
77
|
-
| cpzxrobot().device.
|
|
78
|
-
| cpzxrobot().device.
|
|
77
|
+
| cpzxrobot().device.list | 获得常见设备的列表(当没有特殊类型需求时调用) |
|
|
78
|
+
| cpzxrobot().device.data | 获得设备的数据 |
|
|
79
79
|
| cpzxrobot().device.feedTower.list | 获得料塔设备的列表 |
|
|
80
80
|
| cpzxrobot().device.xxx | 获得设备的相关信息 |
|
|
81
81
|
| cpzxrobot().camera.xxx | 获得摄像头的相关信息 |
|
package/types.d.ts
CHANGED
|
@@ -124,6 +124,20 @@ export interface ElectricMeter extends Device {
|
|
|
124
124
|
status: string;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
export interface DataQueryArgs {
|
|
128
|
+
start?: string;
|
|
129
|
+
stop?: string;
|
|
130
|
+
type?:
|
|
131
|
+
| "diffPerDay"
|
|
132
|
+
| "sumPerDay"
|
|
133
|
+
| "latest"
|
|
134
|
+
| "latestInRangePerDay"
|
|
135
|
+
| "last"
|
|
136
|
+
| "difference";
|
|
137
|
+
period?: "1mo" | "1d" | null;
|
|
138
|
+
[key: string]: any;
|
|
139
|
+
}
|
|
140
|
+
|
|
127
141
|
export class Cpzxrobot {
|
|
128
142
|
transport: TransportGateway;
|
|
129
143
|
ready: Promise<MyAxiosInstance>;
|
|
@@ -151,7 +165,7 @@ declare module "@cpzxrobot/sdk" {
|
|
|
151
165
|
export default function (
|
|
152
166
|
args: {
|
|
153
167
|
devAuth: string;
|
|
154
|
-
baseURL
|
|
168
|
+
baseURL?: string;
|
|
155
169
|
appCode: string;
|
|
156
170
|
selectedFarm: Factory;
|
|
157
171
|
selectedUnit: Unit;
|