@cpzxrobot/sdk 1.0.75 → 1.0.76
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 +1 -0
- package/dist/device_filter.js +3 -2
- package/dist/sensor_datas.js +4 -0
- package/package.json +1 -1
- package/sensor_datas.ts +2 -3
- package/types.d.ts +30 -12
package/device_filter.ts
CHANGED
package/dist/device_filter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeviceFilter = void 0;
|
|
4
|
+
const sensor_datas_1 = require("./sensor_datas");
|
|
4
5
|
class DeviceFilter {
|
|
5
6
|
// private getDetail!: (info: T, id: number, context: Shzx) => Promise<any> | null
|
|
6
7
|
// axios: MyAxiosInstance;
|
|
@@ -128,7 +129,7 @@ class DeviceFilter {
|
|
|
128
129
|
string = string.replace(/\r/g, "");
|
|
129
130
|
var arr = string.split("\n");
|
|
130
131
|
var inAnnotation = false;
|
|
131
|
-
var dataGroups = new SensorDatas();
|
|
132
|
+
var dataGroups = new sensor_datas_1.SensorDatas();
|
|
132
133
|
var field = null;
|
|
133
134
|
for (var i = 0; i < arr.length; i++) {
|
|
134
135
|
var values = arr[i].split(",");
|
|
@@ -138,7 +139,7 @@ class DeviceFilter {
|
|
|
138
139
|
if (field) {
|
|
139
140
|
dataGroups.push(field);
|
|
140
141
|
}
|
|
141
|
-
field = new FieldDatas();
|
|
142
|
+
field = new sensor_datas_1.FieldDatas();
|
|
142
143
|
}
|
|
143
144
|
switch (values[0]) {
|
|
144
145
|
case "#datatype":
|
package/dist/sensor_datas.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SensorDatas = exports.FieldDatas = void 0;
|
|
2
4
|
class FieldDatas {
|
|
3
5
|
constructor() {
|
|
4
6
|
this.datatypes = [];
|
|
@@ -33,6 +35,7 @@ class FieldDatas {
|
|
|
33
35
|
return fields;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
38
|
+
exports.FieldDatas = FieldDatas;
|
|
36
39
|
class SensorDatas {
|
|
37
40
|
constructor() {
|
|
38
41
|
this.data_fields = [];
|
|
@@ -70,3 +73,4 @@ class SensorDatas {
|
|
|
70
73
|
return fields;
|
|
71
74
|
}
|
|
72
75
|
}
|
|
76
|
+
exports.SensorDatas = SensorDatas;
|
package/package.json
CHANGED
package/sensor_datas.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
class FieldDatas {
|
|
1
|
+
export class FieldDatas {
|
|
3
2
|
datatypes: string[] = [];
|
|
4
3
|
groups: boolean[] = [];
|
|
5
4
|
defaults: string[] = [];
|
|
@@ -36,7 +35,7 @@ class FieldDatas {
|
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
class SensorDatas {
|
|
38
|
+
export class SensorDatas {
|
|
40
39
|
push(datas: FieldDatas) {
|
|
41
40
|
this.data_fields.push(datas);
|
|
42
41
|
}
|
package/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ 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 { UnitGateway } from "@cpzxrobot/sdk//unit_gateway";
|
|
8
|
+
import { FieldDatas } from "./sensor_datas";
|
|
8
9
|
|
|
9
10
|
type Device = {
|
|
10
11
|
id: number;
|
|
@@ -19,7 +20,7 @@ type Device = {
|
|
|
19
20
|
typeCode: string;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
type FeedTowerExtraInfo = {
|
|
23
24
|
currentAmount: number;
|
|
24
25
|
loadAmount: number;
|
|
25
26
|
feedTowerAmount: number;
|
|
@@ -29,7 +30,7 @@ export type FeedTowerExtraInfo = {
|
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
//FodderOrder 料单信息
|
|
32
|
-
|
|
33
|
+
type FodderOrder = {
|
|
33
34
|
id?: number;
|
|
34
35
|
fodderId?: string;
|
|
35
36
|
fodderAmount: number;
|
|
@@ -42,7 +43,7 @@ export type FodderOrder = {
|
|
|
42
43
|
type?: string;
|
|
43
44
|
};
|
|
44
45
|
//
|
|
45
|
-
|
|
46
|
+
type FodderOrderList = {
|
|
46
47
|
car: string; //车牌号
|
|
47
48
|
date: string; //日期
|
|
48
49
|
source: string; //来源
|
|
@@ -55,7 +56,7 @@ type FodderOrderInFactory = {
|
|
|
55
56
|
towers: FodderOrderInTower[];
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
type FodderOrderInTower = {
|
|
59
60
|
name: string; //料塔名称
|
|
60
61
|
unit: string; //单位
|
|
61
62
|
weight: number; //重量
|
|
@@ -67,7 +68,7 @@ type Assistant = {
|
|
|
67
68
|
name: String;
|
|
68
69
|
id: Number;
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
+
type Factory = {
|
|
71
72
|
code: string;
|
|
72
73
|
name?: string;
|
|
73
74
|
company_code: string;
|
|
@@ -115,6 +116,21 @@ type DeviceConfig = {
|
|
|
115
116
|
type?: string;
|
|
116
117
|
};
|
|
117
118
|
|
|
119
|
+
type FieldDatas = {
|
|
120
|
+
length: number;
|
|
121
|
+
valuesAt(at: string): Map<string, any>;
|
|
122
|
+
fields: string[];
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
type SensorDatas = {
|
|
126
|
+
push: (data: FieldDatas) => void;
|
|
127
|
+
datas: {
|
|
128
|
+
time: string;
|
|
129
|
+
[key: string]: any;
|
|
130
|
+
}[];
|
|
131
|
+
fields: string[];
|
|
132
|
+
};
|
|
133
|
+
|
|
118
134
|
type Electricity = {
|
|
119
135
|
deviceId: string;
|
|
120
136
|
nextDeviceList: number[] | [];
|
|
@@ -219,7 +235,7 @@ type FeedTowerV2 = {
|
|
|
219
235
|
buildTime: string;
|
|
220
236
|
};
|
|
221
237
|
|
|
222
|
-
|
|
238
|
+
type FeedTower = {
|
|
223
239
|
id: number;
|
|
224
240
|
name: string;
|
|
225
241
|
currentAmount: number;
|
|
@@ -237,23 +253,23 @@ export type FeedTower = {
|
|
|
237
253
|
diff: number;
|
|
238
254
|
};
|
|
239
255
|
|
|
240
|
-
|
|
256
|
+
interface MyAxiosInstance {
|
|
241
257
|
get: (url: string, config?: any) => Promise<any>;
|
|
242
258
|
post: (url: string, data?: any, config?: any) => Promise<any>;
|
|
243
259
|
}
|
|
244
260
|
|
|
245
|
-
|
|
261
|
+
interface Assistant {
|
|
246
262
|
info: String;
|
|
247
263
|
status: Number;
|
|
248
264
|
name: String;
|
|
249
265
|
id: Number;
|
|
250
266
|
}
|
|
251
|
-
|
|
267
|
+
interface ElectricMeter extends Device {
|
|
252
268
|
coefficient: number;
|
|
253
269
|
status: string;
|
|
254
270
|
}
|
|
255
271
|
|
|
256
|
-
|
|
272
|
+
interface DataQueryArgs {
|
|
257
273
|
start?: string;
|
|
258
274
|
stop?: string;
|
|
259
275
|
type?:
|
|
@@ -271,7 +287,7 @@ export interface DataQueryArgs {
|
|
|
271
287
|
[key: string]: any;
|
|
272
288
|
}
|
|
273
289
|
|
|
274
|
-
|
|
290
|
+
class Cpzxrobot {
|
|
275
291
|
transport: TransportGateway;
|
|
276
292
|
ready: Promise<MyAxiosInstance>;
|
|
277
293
|
factory: FactoryGateway;
|
|
@@ -290,7 +306,7 @@ export class Cpzxrobot {
|
|
|
290
306
|
setTitle: (title: string) => void;
|
|
291
307
|
saveBase64: (base64: string, filename: string) => void;
|
|
292
308
|
saveBlob: (blob: Blob, filename: string) => void;
|
|
293
|
-
scanQrcode:() => Promise<string>;
|
|
309
|
+
scanQrcode: () => Promise<string>;
|
|
294
310
|
vibrate: (time?: number) => void;
|
|
295
311
|
}
|
|
296
312
|
|
|
@@ -342,5 +358,7 @@ declare module "@cpzxrobot/sdk" {
|
|
|
342
358
|
DataQueryArgs,
|
|
343
359
|
HeatLamp,
|
|
344
360
|
DeviceV2,
|
|
361
|
+
FieldDatas,
|
|
362
|
+
SensorDatas,
|
|
345
363
|
};
|
|
346
364
|
}
|