langjie-m-play 0.0.4 → 0.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langjie-m-play",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -5,6 +5,7 @@ export declare class MPlay {
5
5
  private readonly ctrlIndex;
6
6
  private dataGramCallBack;
7
7
  private atsHandleNameMap;
8
+ private atsStartedMark;
8
9
  /**
9
10
  * Connect to the MPlay server.
10
11
  *
package/service/MPlay.js CHANGED
@@ -36,6 +36,7 @@ class MPlay {
36
36
  constructor(instId, serviceType, ctrlIndex) {
37
37
  this.ctrlIndex = 0;
38
38
  this.atsHandleNameMap = {};
39
+ this.atsStartedMark = {};
39
40
  if (instId) {
40
41
  this.instId = instId;
41
42
  }
@@ -120,6 +121,7 @@ class MPlay {
120
121
  if (atsHandle === 0) {
121
122
  throw new Error("Failed to load ATS script");
122
123
  }
124
+ this.atsStartedMark[atsHandle] = false;
123
125
  this.atsHandleNameMap[atsHandle] = atsScriptName;
124
126
  return atsHandle;
125
127
  });
@@ -137,6 +139,7 @@ class MPlay {
137
139
  yield GtcClient_1.GtcClient.atsStart(this.instId, this.serviceType, this.ctrlIndex, atsHandle, this.atsHandleNameMap[atsHandle]);
138
140
  yield atsStartSynchronizer.waitAll();
139
141
  PubSubUtil_1.PubSubUtil.unsubscribe(SubKeyEnum_1.SubKeyEnum.ATS_START_OK, atsHandle.toString());
142
+ this.atsStartedMark[atsHandle] = true;
140
143
  });
141
144
  }
142
145
  /**
@@ -150,6 +153,9 @@ class MPlay {
150
153
  if (!this.atsHandleNameMap[atsHandle]) {
151
154
  throw new Error("Please load ATS script first");
152
155
  }
156
+ if (!this.atsStartedMark[atsHandle]) {
157
+ yield this.start(atsHandle);
158
+ }
153
159
  yield GtcClient_1.GtcClient.atsPushButton(this.instId, this.serviceType, this.ctrlIndex, atsHandle, buttonName);
154
160
  });
155
161
  }