model-action 1.0.20 → 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.
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "model-action",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "与三维交互api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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