langjie-m-play 0.0.6 → 0.0.8

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.
@@ -0,0 +1,6 @@
1
+ export interface SubscribeDatagramResult {
2
+ tag: string;
3
+ maxScale: number;
4
+ unitCode: number;
5
+ unitName: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langjie-m-play",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -5,6 +5,7 @@ import { ReadDataDO } from "../domain/ReadDataDO";
5
5
  import { VinChnl } from "../domain/VinChnl";
6
6
  import { OutMsg } from "../domain/OutMsg";
7
7
  import { AtsLoadResponse } from "../domain/AtsLoadResponse";
8
+ import { SubscribeDatagramResult } from "../domain/SubscribeDatagramResult";
8
9
  /**
9
10
  * 提供给前端接口调用
10
11
  */
@@ -88,7 +89,7 @@ export declare class GtcClient {
88
89
  * @param serviceType 服务类型
89
90
  * @param tags 通道列表 Time,Event,Disp,Load
90
91
  */
91
- static subscribeForDatagram(slaveInstId: string | null, serviceType: ServiceTypeEnum, tags: string): Promise<string[]>;
92
+ static subscribeForDatagram(slaveInstId: string | null, serviceType: ServiceTypeEnum, tags: string): Promise<Array<SubscribeDatagramResult>>;
92
93
  /**
93
94
  * 取消订阅通道数据流
94
95
  *
@@ -246,7 +247,7 @@ export declare class GtcClient {
246
247
  * @param keys 参数keys
247
248
  * @param values 参数values
248
249
  */
249
- static atsSetParam(slaveInstId: string | null, serviceType: ServiceTypeEnum, ctrlIndex: number, atsHandle: number, keys: string[], values: Array<string | number>): Promise<null>;
250
+ static atsSetParam<K extends string, V>(slaveInstId: string | null, serviceType: ServiceTypeEnum, ctrlIndex: number, atsHandle: number, keys: string[], values: Array<string | number>): Promise<Record<K, V>>;
250
251
  /**
251
252
  * 获取ats参数
252
253
  *
@@ -1,5 +1,6 @@
1
1
  import { ServiceTypeEnum } from "../domain/enums/ServiceTypeEnum";
2
2
  import { AtsLoadResponse } from "../domain/AtsLoadResponse";
3
+ import { SubscribeDatagramResult } from "../domain/SubscribeDatagramResult";
3
4
  export declare class MPlay {
4
5
  private readonly instId;
5
6
  private readonly serviceType;
@@ -27,7 +28,7 @@ export declare class MPlay {
27
28
  * @param tags The channel tags to subscribe.
28
29
  * @param fn The callback function to handle the datagram.
29
30
  */
30
- subscribeForDatagram(tags: string, fn: (data: Array<Array<string>>) => void): Promise<void>;
31
+ subscribeForDatagram(tags: string, fn: (data: Array<Array<string>>) => void): Promise<Array<SubscribeDatagramResult>>;
31
32
  /**
32
33
  * Unsubscribe datagram from the MPlay server.
33
34
  */
@@ -64,5 +65,5 @@ export declare class MPlay {
64
65
  * @param atsHandle The handle of the ATS script.
65
66
  * @param param The parameter to set.
66
67
  */
67
- atsSetParam(atsHandle: number, param: Record<string, number>): Promise<void>;
68
+ atsSetParam(atsHandle: number, param: Record<string, number>): Promise<Record<string, number>>;
68
69
  }
package/service/MPlay.js CHANGED
@@ -73,7 +73,8 @@ class MPlay {
73
73
  }
74
74
  else if (msg.msgId >= 0x0700 && msg.msgId < 0x0800) {
75
75
  // ats跳转到指定步骤
76
- // PubSubUtil.publish(SubKeyEnum.ATS_JUMP_ACTION, { instId, ctrlIndex });
76
+ const hAts = msg.msgId & 0x00F0 >> 4;
77
+ PubSubUtil_1.PubSubUtil.publish(SubKeyEnum_1.SubKeyEnum.ATS_JUMP_ACTION, { instId, ctrlIndex, hAts, step: msg.msg });
77
78
  }
78
79
  else if (msg.msgId >= 0x0800 && msg.msgId < 0x0900) {
79
80
  // ats异常停止
@@ -97,8 +98,8 @@ class MPlay {
97
98
  */
98
99
  subscribeForDatagram(tags, fn) {
99
100
  return __awaiter(this, void 0, void 0, function* () {
100
- yield GtcClient_1.GtcClient.subscribeForDatagram(this.instId, this.serviceType, tags);
101
101
  this.dataGramCallBack = fn;
102
+ return yield GtcClient_1.GtcClient.subscribeForDatagram(this.instId, this.serviceType, tags);
102
103
  });
103
104
  }
104
105
  /**
@@ -184,7 +185,7 @@ class MPlay {
184
185
  for (const key in param) {
185
186
  values.push(param[key]);
186
187
  }
187
- yield GtcClient_1.GtcClient.atsSetParam(this.instId, this.serviceType, this.ctrlIndex, atsHandle, keys, values);
188
+ return yield GtcClient_1.GtcClient.atsSetParam(this.instId, this.serviceType, this.ctrlIndex, atsHandle, keys, values);
188
189
  });
189
190
  }
190
191
  }