@cpzxrobot/sdk 1.3.94 → 1.3.96

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
@@ -12,10 +12,10 @@ export class CameraGateway extends Object {
12
12
  data:
13
13
  | Unit
14
14
  | {
15
- workshop_id?: number;
16
- factory_id?: number;
17
- unit_id?: number;
18
- }
15
+ workshop_id?: number;
16
+ factory_id?: number;
17
+ unit_id?: number;
18
+ }
19
19
  ): Promise<any> {
20
20
  var axios = await this.context.ready;
21
21
  var params = {};
@@ -50,7 +50,8 @@ export class CameraGateway extends Object {
50
50
 
51
51
  async control(
52
52
  data: Camera,
53
- action:
53
+ args: {
54
+ action:
54
55
  | "left"
55
56
  | "left_up"
56
57
  | "left_down"
@@ -63,15 +64,20 @@ export class CameraGateway extends Object {
63
64
  | "focus_far"
64
65
  | "zoom_in"
65
66
  | "zoom_out",
66
- start?: boolean,
67
- stop?: boolean
67
+ start?: boolean,
68
+ stop?: boolean,
69
+ speed?: number
70
+ }
68
71
  ): Promise<any> {
69
72
  var axios = await this.context.ready;
70
- var url = `/api/v1/camera/${data.id}/control/${action}`;
71
- if (start) {
72
- url += `?start=${start}`;
73
- } else if (stop) {
74
- url += `?stop=${stop}`;
73
+ var url = `/api/v1/camera/${data.id}/control/${args.action}`;
74
+ if (args.start) {
75
+ url += `?start=${args.start}`;
76
+ } else if (args.stop) {
77
+ url += `?stop=${args.stop}`;
78
+ }
79
+ if (args.speed) {
80
+ url += `${args.start || args.stop ? '&' : '?'}speed=${args.speed}`;
75
81
  }
76
82
  const response = await axios.get(url);
77
83
  return response.data;
@@ -47,15 +47,18 @@ class CameraGateway extends Object {
47
47
  return response.data;
48
48
  });
49
49
  }
50
- control(data, action, start, stop) {
50
+ control(data, args) {
51
51
  return __awaiter(this, void 0, void 0, function* () {
52
52
  var axios = yield this.context.ready;
53
- var url = `/api/v1/camera/${data.id}/control/${action}`;
54
- if (start) {
55
- url += `?start=${start}`;
53
+ var url = `/api/v1/camera/${data.id}/control/${args.action}`;
54
+ if (args.start) {
55
+ url += `?start=${args.start}`;
56
56
  }
57
- else if (stop) {
58
- url += `?stop=${stop}`;
57
+ else if (args.stop) {
58
+ url += `?stop=${args.stop}`;
59
+ }
60
+ if (args.speed) {
61
+ url += `${args.start || args.stop ? '&' : '?'}speed=${args.speed}`;
59
62
  }
60
63
  const response = yield axios.get(url);
61
64
  return response.data;
@@ -23,9 +23,14 @@ class WebPlatform {
23
23
  }
24
24
  openFactorySelector() {
25
25
  //call open function of factory-selector
26
- var factorySelector = document.getElementById("cpzxrobot-factory-selector");
27
- //@ts-ignore
28
- factorySelector.open();
26
+ var factorySelector = document.querySelector("cpzxrobot-factory-selector");
27
+ if (factorySelector) {
28
+ //@ts-ignore
29
+ factorySelector.open();
30
+ }
31
+ else {
32
+ console.warn("Factory selector element not found");
33
+ }
29
34
  }
30
35
  addMessage(_message) {
31
36
  throw new Error("Method not implemented.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.94",
3
+ "version": "1.3.96",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { AiAssistRequest, type Factory, type MyAxiosInstance, type Unit } from "./types";
1
+ import { type AiAssistRequest, type Factory, type MyAxiosInstance, type Unit } from "./types";
2
2
 
3
3
  export abstract class PlatformInterface {
4
4
  appCode: string;
package/types.d.ts CHANGED
@@ -565,6 +565,10 @@ interface AlarmRuleAlarmConfig {
565
565
  triggerCondition?: number;
566
566
  /** 分级后的报警是否生效 */
567
567
  active?: boolean;
568
+ /** 重复报警间隔(分钟) */
569
+ repeatInterval?: number;
570
+ /** 最大重复报警次数 */
571
+ maxRepeatCount?: number;
568
572
  }
569
573
 
570
574
  /**
@@ -617,8 +621,10 @@ interface AlarmRuleDetail {
617
621
  ruleDescription?: string;
618
622
  /** 规则是否启用 */
619
623
  ruleActive: boolean;
620
- /** 栋舍id列表 */
624
+ /** 单元id列表 */
621
625
  unitIds?: number[];
626
+ /** 栋舍id列表 */
627
+ workshopIds?: number[];
622
628
  /** 报警方式 */
623
629
  alarmType?: "OFFLINE" | "FAULT" | "THRESHOLD" | "TREND";
624
630
  /** 设备类型列表 */
package/web_platform.ts CHANGED
@@ -20,9 +20,13 @@ export class WebPlatform implements PlatformInterface {
20
20
  }
21
21
  openFactorySelector() {
22
22
  //call open function of factory-selector
23
- var factorySelector = document.getElementById("cpzxrobot-factory-selector");
24
- //@ts-ignore
25
- factorySelector.open();
23
+ var factorySelector = document.querySelector("cpzxrobot-factory-selector");
24
+ if (factorySelector) {
25
+ //@ts-ignore
26
+ factorySelector.open();
27
+ } else {
28
+ console.warn("Factory selector element not found");
29
+ }
26
30
  }
27
31
  addMessage(_message: any): void {
28
32
  throw new Error("Method not implemented.");