@cpzxrobot/sdk 1.0.72 → 1.0.74
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_types/feedtower.ts +5 -0
- package/dist/device_types/feedtower.js +5 -0
- package/dist/index.js +7 -5
- package/index.ts +9 -7
- package/package.json +1 -1
- package/pigfarm_gateway.ts +0 -1
- package/readme.md +2 -0
|
@@ -190,6 +190,11 @@ export class FeedTowerGateway extends DeviceFilter<FeedTower> {
|
|
|
190
190
|
update: (ft: FeedTowerV2) => {
|
|
191
191
|
return this.context.axios.post("/api/v2/device/feedTower/update", ft);
|
|
192
192
|
},
|
|
193
|
+
adzero: (ft: FeedTowerV2) => {
|
|
194
|
+
return this.context.axios.post(`/api/v2/device/feedTower/adzero`,{
|
|
195
|
+
id: ft.id
|
|
196
|
+
});
|
|
197
|
+
}
|
|
193
198
|
};
|
|
194
199
|
}
|
|
195
200
|
}
|
|
@@ -128,6 +128,11 @@ class FeedTowerGateway extends device_filter_1.DeviceFilter {
|
|
|
128
128
|
update: (ft) => {
|
|
129
129
|
return this.context.axios.post("/api/v2/device/feedTower/update", ft);
|
|
130
130
|
},
|
|
131
|
+
adzero: (ft) => {
|
|
132
|
+
return this.context.axios.post(`/api/v2/device/feedTower/adzero`, {
|
|
133
|
+
id: ft.id
|
|
134
|
+
});
|
|
135
|
+
}
|
|
131
136
|
};
|
|
132
137
|
}
|
|
133
138
|
}
|
package/dist/index.js
CHANGED
|
@@ -93,11 +93,13 @@ class Cpzxrobot {
|
|
|
93
93
|
// @ts-ignore
|
|
94
94
|
this._jumpToMiniApp = window.miniapp.open;
|
|
95
95
|
// @ts-ignore
|
|
96
|
-
this.
|
|
96
|
+
this.scanQrcode = window.miniapp.scanQrcode;
|
|
97
97
|
// @ts-ignore
|
|
98
98
|
this.setTitle = window.miniapp.setTitle;
|
|
99
99
|
// @ts-ignore
|
|
100
100
|
this.saveBase64 = window.miniapp.saveBase64;
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
this.vibrate = window.miniapp.vibrate;
|
|
101
103
|
this.saveBlob = this._saveBlobAsBase64;
|
|
102
104
|
}
|
|
103
105
|
else if (domain == "appassets.androidplatform.net" ||
|
|
@@ -115,7 +117,7 @@ class Cpzxrobot {
|
|
|
115
117
|
this._jumpToMiniApp = function (url) {
|
|
116
118
|
return platform.callHandler("app.openMiniapp", url);
|
|
117
119
|
};
|
|
118
|
-
this.
|
|
120
|
+
this.scanQrcode = function () {
|
|
119
121
|
return platform.callHandler("app.scanQrcode");
|
|
120
122
|
};
|
|
121
123
|
this.setTitle = function (title) {
|
|
@@ -125,6 +127,9 @@ class Cpzxrobot {
|
|
|
125
127
|
this.saveBase64 = function (base64, filename) {
|
|
126
128
|
return platform.callHandler("app.saveBase64", base64, filename);
|
|
127
129
|
};
|
|
130
|
+
this.vibrate = function (time) {
|
|
131
|
+
return platform.callHandler("app.vibrate", time);
|
|
132
|
+
};
|
|
128
133
|
this.axios = {
|
|
129
134
|
get: function (url, data) {
|
|
130
135
|
console.log(url, data);
|
|
@@ -210,9 +215,6 @@ class Cpzxrobot {
|
|
|
210
215
|
dict(dictName) {
|
|
211
216
|
return this.axios.get(`/api/v1/dict/${dictName}`);
|
|
212
217
|
}
|
|
213
|
-
scanQrcode() {
|
|
214
|
-
return this._scanQrcode();
|
|
215
|
-
}
|
|
216
218
|
//打开其他小程序
|
|
217
219
|
openMiniApp(url) {
|
|
218
220
|
this._jumpToMiniApp(url);
|
package/index.ts
CHANGED
|
@@ -32,10 +32,11 @@ export class Cpzxrobot {
|
|
|
32
32
|
_getSelectedFarmFromMiniApp!: () => any;
|
|
33
33
|
_getSelectedUnitFromMiniApp!: () => any;
|
|
34
34
|
_jumpToMiniApp!: (url: string) => any;
|
|
35
|
-
|
|
35
|
+
scanQrcode!:() => Promise<string>;
|
|
36
36
|
setTitle!: (title: string) => void;
|
|
37
37
|
saveBase64!: (base64: string, filename: string) => void;
|
|
38
38
|
saveBlob!: (blob: Blob, filename: string) => void;
|
|
39
|
+
vibrate!: (time?: number) => void;
|
|
39
40
|
assistant: AssistantGateway;
|
|
40
41
|
energy: EnergyGateway;
|
|
41
42
|
camera: CameraGateway;
|
|
@@ -121,11 +122,13 @@ export class Cpzxrobot {
|
|
|
121
122
|
// @ts-ignore
|
|
122
123
|
this._jumpToMiniApp = window.miniapp.open;
|
|
123
124
|
// @ts-ignore
|
|
124
|
-
this.
|
|
125
|
+
this.scanQrcode = window.miniapp.scanQrcode;
|
|
125
126
|
// @ts-ignore
|
|
126
127
|
this.setTitle = window.miniapp.setTitle;
|
|
127
128
|
// @ts-ignore
|
|
128
129
|
this.saveBase64 = window.miniapp.saveBase64;
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
this.vibrate = window.miniapp.vibrate;
|
|
129
132
|
this.saveBlob = this._saveBlobAsBase64;
|
|
130
133
|
} else if (
|
|
131
134
|
domain == "appassets.androidplatform.net" ||
|
|
@@ -146,7 +149,7 @@ export class Cpzxrobot {
|
|
|
146
149
|
this._jumpToMiniApp = function (url: string) {
|
|
147
150
|
return platform.callHandler("app.openMiniapp", url);
|
|
148
151
|
};
|
|
149
|
-
this.
|
|
152
|
+
this.scanQrcode = function(){
|
|
150
153
|
return platform.callHandler("app.scanQrcode");
|
|
151
154
|
}
|
|
152
155
|
this.setTitle = function (title: string) {
|
|
@@ -156,6 +159,9 @@ export class Cpzxrobot {
|
|
|
156
159
|
this.saveBase64 = function (base64: string, filename: string) {
|
|
157
160
|
return platform.callHandler("app.saveBase64", base64, filename);
|
|
158
161
|
};
|
|
162
|
+
this.vibrate = function (time?: number) {
|
|
163
|
+
return platform.callHandler("app.vibrate", time);
|
|
164
|
+
};
|
|
159
165
|
this.axios = {
|
|
160
166
|
get: function (url, data) {
|
|
161
167
|
console.log(url, data);
|
|
@@ -247,10 +253,6 @@ export class Cpzxrobot {
|
|
|
247
253
|
return this.axios.get(`/api/v1/dict/${dictName}`);
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
scanQrcode(){
|
|
251
|
-
return this._scanQrcode();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
256
|
//打开其他小程序
|
|
255
257
|
openMiniApp(url: string) {
|
|
256
258
|
this._jumpToMiniApp(url);
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -119,7 +119,6 @@ export class PigfarmGateway extends Object {
|
|
|
119
119
|
return axios.get(`/api/v2/pigfarm/weightMeter/list/${factory.id}`);
|
|
120
120
|
});
|
|
121
121
|
},
|
|
122
|
-
|
|
123
122
|
add: (data: WeightMeter) => {
|
|
124
123
|
return this.context.ready.then((axios) => {
|
|
125
124
|
return axios.post(`/api/v2/pigfarm/weightMeter/add`, data);
|
package/readme.md
CHANGED
|
@@ -78,6 +78,7 @@ baseURL: "/"
|
|
|
78
78
|
| cpzxrobot().device.data | 获得设备的数据,该接口用于获取单个设备的详细数据 |
|
|
79
79
|
| cpzxrobot().device.feedTower.list | 获得料塔设备的列表 |
|
|
80
80
|
| cpzxrobot().device.feedTower.v2.list | 获得料塔设备的列表(新版),暂不支持v1版本的data等附加参数,只支持按工厂获取 |
|
|
81
|
+
| cpzxrobot().device.feedTower.v2.adzero | 将某一个特定料塔设置清零 |
|
|
81
82
|
| cpzxrobot().device.xxx | 获得设备的相关信息 |
|
|
82
83
|
| cpzxrobot().device.v2.add | 新增设备(仅限v2设备) |
|
|
83
84
|
| cpzxrobot().device.v2.update | 更新设备(仅限v2设备) |
|
|
@@ -103,6 +104,7 @@ baseURL: "/"
|
|
|
103
104
|
| cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
|
|
104
105
|
| cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
|
|
105
106
|
| cpzxrobot().scanQrcode | 调用扫码功能,获得扫码文字 |
|
|
107
|
+
| cpzxrobot().vibrate | 调用震动功能 |
|
|
106
108
|
| cpzxrobot().unit.v2.list | 获得单元列表,v2版本 |
|
|
107
109
|
| cpzxrobot().unit.v2.add | 添加单元,v2版本 |
|
|
108
110
|
| cpzxrobot().unit.v2.update | 更新单元,v2版本 |
|