model-action 1.0.19 → 1.0.21

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/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { PoiAction } from './modules/Poi';
4
4
  export { TrackAction } from './modules/Track';
5
5
  export { SceneAction } from './modules/Scene';
6
6
  export { WindowAction } from './modules/Window';
7
+ export { RoutingAction } from './modules/Routing';
package/dist/index.js CHANGED
@@ -4,3 +4,4 @@ export { PoiAction } from './modules/Poi';
4
4
  export { TrackAction } from './modules/Track';
5
5
  export { SceneAction } from './modules/Scene';
6
6
  export { WindowAction } from './modules/Window';
7
+ export { RoutingAction } from './modules/Routing';
@@ -1,7 +1,7 @@
1
1
  export type RequiredSome<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
2
2
  export interface SendParam {
3
3
  cmd: string;
4
- action: string;
4
+ action?: string;
5
5
  }
6
6
  interface IdItem {
7
7
  id: string;
@@ -17,6 +17,10 @@ type PoiType = {
17
17
  lowestFloor?: string;
18
18
  state?: 'normal' | 'alarm';
19
19
  } & SendParam;
20
+ type IdList = Array<{
21
+ id: string;
22
+ state: 'normal' | 'alarm';
23
+ }>;
20
24
  export declare class PoiAction extends Action {
21
25
  /**
22
26
  * 添加poi
@@ -62,6 +66,12 @@ export declare class PoiAction extends Action {
62
66
  * @param {*} state normal一般状态 alarm 告警状态
63
67
  */
64
68
  static poiNormal(state: 'normal' | 'alarm'): void;
69
+ /**
70
+ * 切换指定ID设备的poi状态
71
+ * @param {*} ids 设备ID列表
72
+ * @param {*} isLocation 是否定位到第一个ID对应的设备
73
+ */
74
+ static poiSwitchStatus(ids: IdList, isLocation?: boolean): void;
65
75
  /**
66
76
  * 获取指定POI
67
77
  * @param {*} type 相机type
@@ -107,6 +107,20 @@ export class PoiAction extends Action {
107
107
  };
108
108
  this.sendParam(param, `恢复poi至${state}状态`);
109
109
  }
110
+ /**
111
+ * 切换指定ID设备的poi状态
112
+ * @param {*} ids 设备ID列表
113
+ * @param {*} isLocation 是否定位到第一个ID对应的设备
114
+ */
115
+ static poiSwitchStatus(ids, isLocation = false) {
116
+ const param = {
117
+ cmd: "status",
118
+ isLocation,
119
+ type: 'POI',
120
+ ids
121
+ };
122
+ this.sendParam(param, `切换poi至指定状态`);
123
+ }
110
124
  /**
111
125
  * 获取指定POI
112
126
  * @param {*} type 相机type
@@ -0,0 +1,44 @@
1
+ /**
2
+ * 巡更
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class RoutingAction extends Action {
6
+ /**
7
+ * 巡检开始
8
+ * @param {*} id (必须)巡检的唯一ID)
9
+ * @param {*} type (必须)巡检的类型)
10
+ * videoPatrol => 视频巡更
11
+ * cameraRoute => 视角跟随样条线
12
+ */
13
+ static videoPatrolStart(id: string, type?: string): void;
14
+ /**
15
+ * 巡检结束
16
+ * @param {*} id (必须)巡检的唯一ID)
17
+ * @param {*} type (必须)巡检的类型)
18
+ */
19
+ static videoPatrolStop(id: string, type?: string): void;
20
+ /**
21
+ * 巡检暂停
22
+ * @param {*} id (必须)巡检的唯一ID)
23
+ * @param {*} type (必须)巡检的类型)
24
+ */
25
+ static videoPatrolPause(id: string, type?: string): void;
26
+ /**
27
+ * 巡检下一步
28
+ * @param {*} id (必须)巡检的唯一ID)
29
+ * @param {*} type (必须)巡检的类型)
30
+ */
31
+ static videoPatrolNext(id: string, type?: string): void;
32
+ /**
33
+ * 巡更上一步
34
+ * @param {*} id (必须)巡检的唯一ID)
35
+ * @param {*} type (必须)巡检的类型)
36
+ */
37
+ static videoPatrolPrev(id: string, type?: string): void;
38
+ /**
39
+ * 巡更重新开始,从暂停点开始
40
+ * @param {*} id (必须)巡检的唯一ID)
41
+ * @param {*} type (必须)巡检的类型)
42
+ */
43
+ static videoPatrolRestart(id: string, type?: string): void;
44
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * 巡更
3
+ */
4
+ import { Action, } from "./Action";
5
+ export class RoutingAction extends Action {
6
+ /**
7
+ * 巡检开始
8
+ * @param {*} id (必须)巡检的唯一ID)
9
+ * @param {*} type (必须)巡检的类型)
10
+ * videoPatrol => 视频巡更
11
+ * cameraRoute => 视角跟随样条线
12
+ */
13
+ static videoPatrolStart(id, type = "videoPatrol") {
14
+ const param = {
15
+ cmd: "routing",
16
+ action: "start",
17
+ type,
18
+ id,
19
+ };
20
+ this.sendParam(param, '巡更开始');
21
+ }
22
+ /**
23
+ * 巡检结束
24
+ * @param {*} id (必须)巡检的唯一ID)
25
+ * @param {*} type (必须)巡检的类型)
26
+ */
27
+ static videoPatrolStop(id, type = "videoPatrol") {
28
+ const param = {
29
+ cmd: "routing",
30
+ action: "stop",
31
+ type,
32
+ id,
33
+ };
34
+ this.sendParam(param, '巡更结束');
35
+ }
36
+ /**
37
+ * 巡检暂停
38
+ * @param {*} id (必须)巡检的唯一ID)
39
+ * @param {*} type (必须)巡检的类型)
40
+ */
41
+ static videoPatrolPause(id, type = "videoPatrol") {
42
+ const param = {
43
+ cmd: "routing",
44
+ action: "pause",
45
+ type,
46
+ id,
47
+ };
48
+ this.sendParam(param, '巡更暂停');
49
+ }
50
+ /**
51
+ * 巡检下一步
52
+ * @param {*} id (必须)巡检的唯一ID)
53
+ * @param {*} type (必须)巡检的类型)
54
+ */
55
+ static videoPatrolNext(id, type = "videoPatrol") {
56
+ const param = {
57
+ cmd: "routing",
58
+ action: "next",
59
+ type,
60
+ id,
61
+ };
62
+ this.sendParam(param, '巡更下一步');
63
+ }
64
+ /**
65
+ * 巡更上一步
66
+ * @param {*} id (必须)巡检的唯一ID)
67
+ * @param {*} type (必须)巡检的类型)
68
+ */
69
+ static videoPatrolPrev(id, type = "videoPatrol") {
70
+ const param = {
71
+ cmd: "routing",
72
+ action: "last",
73
+ type,
74
+ id,
75
+ };
76
+ this.sendParam(param, '巡更上一步');
77
+ }
78
+ /**
79
+ * 巡更重新开始,从暂停点开始
80
+ * @param {*} id (必须)巡检的唯一ID)
81
+ * @param {*} type (必须)巡检的类型)
82
+ */
83
+ static videoPatrolRestart(id, type = "videoPatrol") {
84
+ const param = {
85
+ cmd: "routing",
86
+ action: "restart",
87
+ type,
88
+ id,
89
+ };
90
+ this.sendParam(param, '巡更重新开始,从暂停点开始');
91
+ }
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "model-action",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "与三维交互api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@ export { PoiAction } from './modules/Poi'
4
4
  export { TrackAction } from './modules/Track'
5
5
  export { SceneAction } from './modules/Scene'
6
6
  export { WindowAction } from './modules/Window'
7
+ export { RoutingAction } from './modules/Routing';
@@ -2,7 +2,7 @@ export type RequiredSome<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T,
2
2
 
3
3
  export interface SendParam {
4
4
  cmd: string,
5
- action: string,
5
+ action?: string,
6
6
  }
7
7
 
8
8
 
@@ -20,6 +20,11 @@ type PoiType = {
20
20
  state?: 'normal' | 'alarm'
21
21
  } & SendParam
22
22
 
23
+ type IdList = Array<{
24
+ id: string;
25
+ state: 'normal' | 'alarm'
26
+ }>
27
+
23
28
  export class PoiAction extends Action {
24
29
  /**
25
30
  * 添加poi
@@ -44,16 +49,16 @@ export class PoiAction extends Action {
44
49
  this.sendParam(param, '新增POI')
45
50
  }
46
51
 
47
- /**
48
- * 更新poi
49
- * @param {*} type 相机type
50
- * @param {*} location poi点位置
51
- * @param {*} text POI标题
52
- * @param {*} place POI所在位置
53
- * @param {*} description POI描述
54
- * @param {*} linkId POI关联的设备ID
55
- */
56
- static poiUpdate(type: PoiType['type'] = 'Camera', location: LocationItem, text: PoiType['text'] = '', place: PoiType['place'] = '', description: PoiType['description'] = '', linkId: PoiType['linkId'] = '') {
52
+ /**
53
+ * 更新poi
54
+ * @param {*} type 相机type
55
+ * @param {*} location poi点位置
56
+ * @param {*} text POI标题
57
+ * @param {*} place POI所在位置
58
+ * @param {*} description POI描述
59
+ * @param {*} linkId POI关联的设备ID
60
+ */
61
+ static poiUpdate(type: PoiType['type'] = 'Camera', location: LocationItem, text: PoiType['text'] = '', place: PoiType['place'] = '', description: PoiType['description'] = '', linkId: PoiType['linkId'] = '') {
57
62
  const param: RequiredSome<PoiType, 'action' | 'type' | 'location'> = {
58
63
  cmd: "POI",
59
64
  action: "update",
@@ -133,6 +138,21 @@ export class PoiAction extends Action {
133
138
  this.sendParam(param, `恢复poi至${state}状态`)
134
139
  }
135
140
 
141
+ /**
142
+ * 切换指定ID设备的poi状态
143
+ * @param {*} ids 设备ID列表
144
+ * @param {*} isLocation 是否定位到第一个ID对应的设备
145
+ */
146
+ static poiSwitchStatus(ids: IdList, isLocation: boolean = false) {
147
+ const param = {
148
+ cmd: "status",
149
+ isLocation,
150
+ type: 'POI',
151
+ ids
152
+ }
153
+ this.sendParam(param, `切换poi至指定状态`)
154
+ }
155
+
136
156
  /**
137
157
  * 获取指定POI
138
158
  * @param {*} type 相机type
@@ -0,0 +1,99 @@
1
+
2
+ /**
3
+ * 巡更
4
+ */
5
+ import { Action, } from "./Action";
6
+
7
+ export class RoutingAction extends Action {
8
+ /**
9
+ * 巡检开始
10
+ * @param {*} id (必须)巡检的唯一ID)
11
+ * @param {*} type (必须)巡检的类型)
12
+ * videoPatrol => 视频巡更
13
+ * cameraRoute => 视角跟随样条线
14
+ */
15
+ static videoPatrolStart(id: string, type: string = "videoPatrol") {
16
+ const param: any = {
17
+ cmd: "routing",
18
+ action: "start",
19
+ type,
20
+ id,
21
+ };
22
+ this.sendParam(param, '巡更开始')
23
+ }
24
+
25
+ /**
26
+ * 巡检结束
27
+ * @param {*} id (必须)巡检的唯一ID)
28
+ * @param {*} type (必须)巡检的类型)
29
+ */
30
+ static videoPatrolStop(id: string, type: string = "videoPatrol") {
31
+ const param: any = {
32
+ cmd: "routing",
33
+ action: "stop",
34
+ type,
35
+ id,
36
+ };
37
+ this.sendParam(param, '巡更结束')
38
+ }
39
+
40
+ /**
41
+ * 巡检暂停
42
+ * @param {*} id (必须)巡检的唯一ID)
43
+ * @param {*} type (必须)巡检的类型)
44
+ */
45
+ static videoPatrolPause(id: string, type: string = "videoPatrol") {
46
+ const param: any = {
47
+ cmd: "routing",
48
+ action: "pause",
49
+ type,
50
+ id,
51
+ };
52
+ this.sendParam(param, '巡更暂停')
53
+ }
54
+
55
+ /**
56
+ * 巡检下一步
57
+ * @param {*} id (必须)巡检的唯一ID)
58
+ * @param {*} type (必须)巡检的类型)
59
+ */
60
+ static videoPatrolNext(id: string, type: string = "videoPatrol") {
61
+ const param: any = {
62
+ cmd: "routing",
63
+ action: "next",
64
+ type,
65
+ id,
66
+ };
67
+ this.sendParam(param, '巡更下一步')
68
+ }
69
+
70
+ /**
71
+ * 巡更上一步
72
+ * @param {*} id (必须)巡检的唯一ID)
73
+ * @param {*} type (必须)巡检的类型)
74
+ */
75
+ static videoPatrolPrev(id: string, type: string = "videoPatrol") {
76
+ const param: any = {
77
+ cmd: "routing",
78
+ action: "last",
79
+ type,
80
+ id,
81
+ };
82
+ this.sendParam(param, '巡更上一步')
83
+ }
84
+
85
+ /**
86
+ * 巡更重新开始,从暂停点开始
87
+ * @param {*} id (必须)巡检的唯一ID)
88
+ * @param {*} type (必须)巡检的类型)
89
+ */
90
+ static videoPatrolRestart(id: string, type: string = "videoPatrol") {
91
+ const param: any = {
92
+ cmd: "routing",
93
+ action: "restart",
94
+ type,
95
+ id,
96
+ };
97
+ this.sendParam(param, '巡更重新开始,从暂停点开始')
98
+ }
99
+ }