langjie-m-play 0.0.3 → 0.0.4

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.
@@ -49,11 +49,13 @@ export declare enum JsonRpcMethodEnum {
49
49
  CALL_ATS_START = "R_CALL_PACK.atsStart",
50
50
  CALL_ATS_TERMINATE = "R_CALL_PACK.atsTerminate",
51
51
  CALL_ATS_SET_PARAM = "R_CALL_PACK.atsSetParam",
52
+ CALL_ATS_GET_PARAM = "R_CALL_PACK.atsGetParam",
52
53
  CALL_ATS_PUSH_BUTTON = "R_CALL_PACK.atsPushButton",
53
54
  REPLY_ATS_LOAD = "R_REPLY_PACK.atsLoad",
54
55
  REPLY_ATS_START = "R_REPLY_PACK.atsStart",
55
56
  REPLY_ATS_TERMINATE = "R_REPLY_PACK.atsTerminate",
56
57
  REPLY_ATS_SET_PARAM = "R_REPLY_PACK.atsSetParam",
58
+ REPLY_ATS_GET_PARAM = "R_REPLY_PACK.atsGetParam",
57
59
  REPLY_ATS_PUSH_BUTTON = "R_REPLY_PACK.atsPushButton",
58
60
  CALL_SUBSCRIBE_FOR_DATA_GRAM = "R_CALL_PACK.subscribeForDatagram",
59
61
  REPLY_SUBSCRIBE_FOR_DATA_GRAM = "R_REPLY_PACK.subscribeForDatagram",
@@ -54,11 +54,13 @@ var JsonRpcMethodEnum;
54
54
  JsonRpcMethodEnum["CALL_ATS_START"] = "R_CALL_PACK.atsStart";
55
55
  JsonRpcMethodEnum["CALL_ATS_TERMINATE"] = "R_CALL_PACK.atsTerminate";
56
56
  JsonRpcMethodEnum["CALL_ATS_SET_PARAM"] = "R_CALL_PACK.atsSetParam";
57
+ JsonRpcMethodEnum["CALL_ATS_GET_PARAM"] = "R_CALL_PACK.atsGetParam";
57
58
  JsonRpcMethodEnum["CALL_ATS_PUSH_BUTTON"] = "R_CALL_PACK.atsPushButton";
58
59
  JsonRpcMethodEnum["REPLY_ATS_LOAD"] = "R_REPLY_PACK.atsLoad";
59
60
  JsonRpcMethodEnum["REPLY_ATS_START"] = "R_REPLY_PACK.atsStart";
60
61
  JsonRpcMethodEnum["REPLY_ATS_TERMINATE"] = "R_REPLY_PACK.atsTerminate";
61
62
  JsonRpcMethodEnum["REPLY_ATS_SET_PARAM"] = "R_REPLY_PACK.atsSetParam";
63
+ JsonRpcMethodEnum["REPLY_ATS_GET_PARAM"] = "R_REPLY_PACK.atsGetParam";
62
64
  JsonRpcMethodEnum["REPLY_ATS_PUSH_BUTTON"] = "R_REPLY_PACK.atsPushButton";
63
65
  JsonRpcMethodEnum["CALL_SUBSCRIBE_FOR_DATA_GRAM"] = "R_CALL_PACK.subscribeForDatagram";
64
66
  JsonRpcMethodEnum["REPLY_SUBSCRIBE_FOR_DATA_GRAM"] = "R_REPLY_PACK.subscribeForDatagram";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langjie-m-play",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -246,4 +246,13 @@ export declare class GtcClient {
246
246
  * @param values 参数values
247
247
  */
248
248
  static atsSetParam(slaveInstId: string | null, serviceType: ServiceTypeEnum, ctrlIndex: number, atsHandle: number, keys: string[], values: Array<string | number>): Promise<null>;
249
+ /**
250
+ * 获取ats参数
251
+ *
252
+ * @param slaveInstId 从机id
253
+ * @param serviceType 服务类型
254
+ * @param ctrlIndex 卡索引
255
+ * @param atsHandle ats句柄
256
+ */
257
+ static atsGetParam<K extends string, V>(slaveInstId: string | null, serviceType: ServiceTypeEnum, ctrlIndex: number, atsHandle: number): Promise<Record<K, V>>;
249
258
  }
@@ -469,5 +469,22 @@ class GtcClient {
469
469
  return GtcServiceFactory_1.default.getGtcService().call(request);
470
470
  });
471
471
  }
472
+ /**
473
+ * 获取ats参数
474
+ *
475
+ * @param slaveInstId 从机id
476
+ * @param serviceType 服务类型
477
+ * @param ctrlIndex 卡索引
478
+ * @param atsHandle ats句柄
479
+ */
480
+ static atsGetParam(slaveInstId, serviceType, ctrlIndex, atsHandle) {
481
+ return __awaiter(this, void 0, void 0, function* () {
482
+ const request = GtcClient.generateRequest(JsonRpcMethodEnum_1.JsonRpcMethodEnum.CALL_ATS_GET_PARAM, slaveInstId);
483
+ request.params[JsonRpcConstant_1.JsonRpcConstant.SERVICE_TYPE] = serviceType;
484
+ request.params[JsonRpcConstant_1.JsonRpcConstant.CTRL_INDEX] = ctrlIndex;
485
+ request.params[JsonRpcConstant_1.JsonRpcConstant.ATS_HANDLE] = atsHandle;
486
+ return GtcServiceFactory_1.default.getGtcService().call(request);
487
+ });
488
+ }
472
489
  }
473
490
  exports.GtcClient = GtcClient;
@@ -50,4 +50,17 @@ export declare class MPlay {
50
50
  * @param buttonName The name of the button to trigger.
51
51
  */
52
52
  pushButton(atsHandle: number, buttonName: string): Promise<void>;
53
+ /**
54
+ * Get the parameter of the ATS script by ATS handle.
55
+ *
56
+ * @param atsHandle The handle of the ATS script.
57
+ */
58
+ atsGetParam(atsHandle: number): Promise<Record<string, number>>;
59
+ /**
60
+ * Set the parameter of the ATS script by ATS handle.
61
+ *
62
+ * @param atsHandle The handle of the ATS script.
63
+ * @param param The parameter to set.
64
+ */
65
+ atsSetParam(atsHandle: number, param: Record<string, number>): Promise<void>;
53
66
  }
package/service/MPlay.js CHANGED
@@ -148,10 +148,36 @@ class MPlay {
148
148
  pushButton(atsHandle, buttonName) {
149
149
  return __awaiter(this, void 0, void 0, function* () {
150
150
  if (!this.atsHandleNameMap[atsHandle]) {
151
- throw new Error("Please reload ATS script");
151
+ throw new Error("Please load ATS script first");
152
152
  }
153
153
  yield GtcClient_1.GtcClient.atsPushButton(this.instId, this.serviceType, this.ctrlIndex, atsHandle, buttonName);
154
154
  });
155
155
  }
156
+ /**
157
+ * Get the parameter of the ATS script by ATS handle.
158
+ *
159
+ * @param atsHandle The handle of the ATS script.
160
+ */
161
+ atsGetParam(atsHandle) {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ return yield GtcClient_1.GtcClient.atsGetParam(this.instId, this.serviceType, this.ctrlIndex, atsHandle);
164
+ });
165
+ }
166
+ /**
167
+ * Set the parameter of the ATS script by ATS handle.
168
+ *
169
+ * @param atsHandle The handle of the ATS script.
170
+ * @param param The parameter to set.
171
+ */
172
+ atsSetParam(atsHandle, param) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ const keys = Object.keys(param);
175
+ const values = [];
176
+ for (const key in param) {
177
+ values.push(param[key]);
178
+ }
179
+ yield GtcClient_1.GtcClient.atsSetParam(this.instId, this.serviceType, this.ctrlIndex, atsHandle, keys, values);
180
+ });
181
+ }
156
182
  }
157
183
  exports.MPlay = MPlay;