@cpzxrobot/sdk 1.0.64 → 1.0.66

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 CHANGED
@@ -27,8 +27,8 @@ export class CameraGateway extends Object {
27
27
  factory_id?: number;
28
28
  unit_id?: number;
29
29
  };
30
- }else{
31
- params = {unit_id:data.id}
30
+ } else {
31
+ params = { unit_id: data.id };
32
32
  }
33
33
 
34
34
  const response = await axios.post("/api/v1/camera/search", params);
@@ -48,9 +48,24 @@ export class CameraGateway extends Object {
48
48
  return response.data;
49
49
  }
50
50
 
51
- async control(data: Camera, action: "left" | "right" | "up" | "down" | "zoom_in" | "zoom_out"): Promise<any> {
51
+ async control(
52
+ data: Camera,
53
+ action:
54
+ | "left"
55
+ | "left_up"
56
+ | "left_down"
57
+ | "right"
58
+ | "right_up"
59
+ | "right_down"
60
+ | "up"
61
+ | "down"
62
+ | "zoom_in"
63
+ | "zoom_out"
64
+ ): Promise<any> {
52
65
  var axios = await this.context.ready;
53
- const response = await axios.get(`/api/v1/camera/${data.id}/control/${action}`);
66
+ const response = await axios.get(
67
+ `/api/v1/camera/${data.id}/control/${action}`
68
+ );
54
69
  return response.data;
55
70
  }
56
71
  }
package/dist/index.js CHANGED
@@ -93,6 +93,8 @@ class Cpzxrobot {
93
93
  // @ts-ignore
94
94
  this._jumpToMiniApp = window.miniapp.open;
95
95
  // @ts-ignore
96
+ this._scanQrcode = window.miniapp.scanQrcode;
97
+ // @ts-ignore
96
98
  this.setTitle = window.miniapp.setTitle;
97
99
  // @ts-ignore
98
100
  this.saveBase64 = window.miniapp.saveBase64;
@@ -113,6 +115,9 @@ class Cpzxrobot {
113
115
  this._jumpToMiniApp = function (url) {
114
116
  return platform.callHandler("app.openMiniapp", url);
115
117
  };
118
+ this._scanQrcode = function () {
119
+ return platform.callHandler("app.scanQrcode");
120
+ };
116
121
  this.setTitle = function (title) {
117
122
  platform.callHandler("app.setTitle", title);
118
123
  };
@@ -205,6 +210,9 @@ class Cpzxrobot {
205
210
  dict(dictName) {
206
211
  return this.axios.get(`/api/v1/dict/${dictName}`);
207
212
  }
213
+ scanQrcode() {
214
+ return this._scanQrcode();
215
+ }
208
216
  //打开其他小程序
209
217
  openMiniApp(url) {
210
218
  this._jumpToMiniApp(url);
package/index.ts CHANGED
@@ -32,6 +32,7 @@ export class Cpzxrobot {
32
32
  _getSelectedFarmFromMiniApp!: () => any;
33
33
  _getSelectedUnitFromMiniApp!: () => any;
34
34
  _jumpToMiniApp!: (url: string) => any;
35
+ _scanQrcode!:() => Promise<string>;
35
36
  setTitle!: (title: string) => void;
36
37
  saveBase64!: (base64: string, filename: string) => void;
37
38
  saveBlob!: (blob: Blob, filename: string) => void;
@@ -120,6 +121,8 @@ export class Cpzxrobot {
120
121
  // @ts-ignore
121
122
  this._jumpToMiniApp = window.miniapp.open;
122
123
  // @ts-ignore
124
+ this._scanQrcode = window.miniapp.scanQrcode;
125
+ // @ts-ignore
123
126
  this.setTitle = window.miniapp.setTitle;
124
127
  // @ts-ignore
125
128
  this.saveBase64 = window.miniapp.saveBase64;
@@ -143,6 +146,9 @@ export class Cpzxrobot {
143
146
  this._jumpToMiniApp = function (url: string) {
144
147
  return platform.callHandler("app.openMiniapp", url);
145
148
  };
149
+ this._scanQrcode = function(){
150
+ return platform.callHandler("app.scanQrcode");
151
+ }
146
152
  this.setTitle = function (title: string) {
147
153
  platform.callHandler("app.setTitle", title);
148
154
  };
@@ -241,6 +247,10 @@ export class Cpzxrobot {
241
247
  return this.axios.get(`/api/v1/dict/${dictName}`);
242
248
  }
243
249
 
250
+ scanQrcode(){
251
+ return this._scanQrcode();
252
+ }
253
+
244
254
  //打开其他小程序
245
255
  openMiniApp(url: string) {
246
256
  this._jumpToMiniApp(url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -88,11 +88,13 @@ baseURL: "/"
88
88
  | cpzxrobot().pigfarm.heatlamp.xxx | 操作保温灯 |
89
89
  | cpzxrobot().device.feedTower.stat | 获得料塔设备的料耗,饲料重量 |
90
90
  | cpzxrobot().device.feedTower.setAlarmParam | 设置料塔设备的报警参数 |
91
+ | cpzxrobot().device.feedTower.updateAlarmParam | 更新料塔设备的报警参数 |
91
92
  | cpzxrobot().device.feedTower.getAlarmParam | 获得料塔设备的报警参数 |
92
93
  | cpzxrobot().pigfarm.unitStat | 获得单元的统计信息,包括每日料耗,饲料消耗,日龄,存栏量等 |
93
94
  | cpzxrobot().pigfarm.heatlamp.set | 设置保温灯的当前工作日龄,调用时,action传"dayage",argc传天数 |
94
95
  | cpzxrobot().pigfarm.heatlamp.switch | 设置保温灯的当前工作日龄,调用时,action"on"或"off" |
95
96
  | cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
97
+ | cpzxrobot().scanQrcode | 调用扫码功能,获得扫码文字 |
96
98
 
97
99
 
98
100
  ### 工厂信息接口