@danidoble/webserial 4.0.3 → 4.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/dist/webserial.js +403 -388
- package/dist/webserial.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/webserial.js
CHANGED
|
@@ -38,9 +38,9 @@ class Pe extends EventTarget {
|
|
|
38
38
|
this.dispatchEvent(n);
|
|
39
39
|
}
|
|
40
40
|
dispatchAsync(t, e = null, n = 100) {
|
|
41
|
-
const
|
|
41
|
+
const s = this;
|
|
42
42
|
setTimeout(() => {
|
|
43
|
-
|
|
43
|
+
s.dispatch(t, e);
|
|
44
44
|
}, n);
|
|
45
45
|
}
|
|
46
46
|
on(t, e) {
|
|
@@ -73,18 +73,18 @@ function Ne() {
|
|
|
73
73
|
function we(f = 1) {
|
|
74
74
|
return f * 1e3;
|
|
75
75
|
}
|
|
76
|
-
var
|
|
77
|
-
const
|
|
76
|
+
var R, H, o, Ae, Be, _, ke, C, m, ne, p, ve, Y;
|
|
77
|
+
const a = class a {
|
|
78
78
|
static status(r = null) {
|
|
79
79
|
var e, n;
|
|
80
|
-
if (!i(e =
|
|
80
|
+
if (!i(e = a, o, _).call(e, r)) return !1;
|
|
81
81
|
let t = [];
|
|
82
|
-
switch (y(
|
|
82
|
+
switch (y(a, R)) {
|
|
83
83
|
case "locker":
|
|
84
84
|
t = ["0", "8"];
|
|
85
85
|
break;
|
|
86
86
|
case "boardroid":
|
|
87
|
-
t = ["2", (5 + y(
|
|
87
|
+
t = ["2", (5 + y(a, H)).toString(16).toUpperCase()];
|
|
88
88
|
break;
|
|
89
89
|
case "jofemar":
|
|
90
90
|
t = ["6"];
|
|
@@ -92,13 +92,13 @@ const s = class s {
|
|
|
92
92
|
default:
|
|
93
93
|
return !1;
|
|
94
94
|
}
|
|
95
|
-
i(n =
|
|
95
|
+
i(n = a, o, p).call(n, t);
|
|
96
96
|
}
|
|
97
97
|
static dispensed(r = null) {
|
|
98
98
|
var e, n;
|
|
99
|
-
if (!i(e =
|
|
99
|
+
if (!i(e = a, o, _).call(e, r)) return !1;
|
|
100
100
|
let t = [];
|
|
101
|
-
switch (y(
|
|
101
|
+
switch (y(a, R)) {
|
|
102
102
|
case "locker":
|
|
103
103
|
t = ["0", "7", "4", "4", "4"];
|
|
104
104
|
break;
|
|
@@ -111,13 +111,13 @@ const s = class s {
|
|
|
111
111
|
default:
|
|
112
112
|
return !1;
|
|
113
113
|
}
|
|
114
|
-
i(n =
|
|
114
|
+
i(n = a, o, p).call(n, t);
|
|
115
115
|
}
|
|
116
116
|
static notDispensed(r = null) {
|
|
117
117
|
var e, n;
|
|
118
|
-
if (!i(e =
|
|
118
|
+
if (!i(e = a, o, _).call(e, r)) return !1;
|
|
119
119
|
let t = [];
|
|
120
|
-
switch (y(
|
|
120
|
+
switch (y(a, R)) {
|
|
121
121
|
case "locker":
|
|
122
122
|
t = ["0", "7", "5", "5", "5"];
|
|
123
123
|
break;
|
|
@@ -130,30 +130,30 @@ const s = class s {
|
|
|
130
130
|
default:
|
|
131
131
|
return !1;
|
|
132
132
|
}
|
|
133
|
-
i(n =
|
|
133
|
+
i(n = a, o, p).call(n, t);
|
|
134
134
|
}
|
|
135
135
|
static gateInactive(r = null) {
|
|
136
136
|
var t;
|
|
137
|
-
if (!i(t =
|
|
137
|
+
if (!i(t = a, o, _).call(t, r) || !i(this, o, ke).call(this)) return !1;
|
|
138
138
|
i(this, o, p).call(this, ["0", "7", "5", "5", "5"]);
|
|
139
139
|
}
|
|
140
140
|
static gateConfigured(r = null) {
|
|
141
141
|
var t;
|
|
142
|
-
if (!i(t =
|
|
142
|
+
if (!i(t = a, o, _).call(t, r) || !i(this, o, ke).call(this)) return !1;
|
|
143
143
|
i(this, o, p).call(this, ["0", "6"]);
|
|
144
144
|
}
|
|
145
145
|
static keyPressed(r = null) {
|
|
146
|
-
var
|
|
147
|
-
if (!i(
|
|
148
|
-
const t = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], e = (128 + y(
|
|
149
|
-
i(u =
|
|
146
|
+
var s, c, u;
|
|
147
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, m).call(c)) return !1;
|
|
148
|
+
const t = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], e = (128 + y(a, H)).toString(16), n = Math.floor(Math.random() * 15);
|
|
149
|
+
i(u = a, o, p).call(u, ["2", e, "54", t[n]]);
|
|
150
150
|
}
|
|
151
151
|
static doorOpened(r = null) {
|
|
152
|
-
var n,
|
|
153
|
-
if (!i(n =
|
|
152
|
+
var n, s;
|
|
153
|
+
if (!i(n = a, o, _).call(n, r) || !i(this, o, ne).call(this)) return !1;
|
|
154
154
|
let t = [];
|
|
155
|
-
const e = (128 + y(
|
|
156
|
-
switch (y(
|
|
155
|
+
const e = (128 + y(a, H)).toString(16);
|
|
156
|
+
switch (y(a, R)) {
|
|
157
157
|
case "boardroid":
|
|
158
158
|
t = ["2", "D8", "dc"];
|
|
159
159
|
break;
|
|
@@ -161,14 +161,14 @@ const s = class s {
|
|
|
161
161
|
t = ["2", e, "50", "4F"];
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
|
-
i(
|
|
164
|
+
i(s = a, o, p).call(s, t);
|
|
165
165
|
}
|
|
166
166
|
static doorClosed(r = null) {
|
|
167
|
-
var n,
|
|
168
|
-
if (!i(n =
|
|
167
|
+
var n, s;
|
|
168
|
+
if (!i(n = a, o, _).call(n, r) || !i(this, o, ne).call(this)) return !1;
|
|
169
169
|
let t = [];
|
|
170
|
-
const e = (128 + y(
|
|
171
|
-
switch (y(
|
|
170
|
+
const e = (128 + y(a, H)).toString(16);
|
|
171
|
+
switch (y(a, R)) {
|
|
172
172
|
case "boardroid":
|
|
173
173
|
t = ["2", "D8", "db"];
|
|
174
174
|
break;
|
|
@@ -176,38 +176,38 @@ const s = class s {
|
|
|
176
176
|
t = ["2", e, "50", "43"];
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
|
-
i(
|
|
179
|
+
i(s = a, o, p).call(s, t);
|
|
180
180
|
}
|
|
181
181
|
static channelDisconnected(r = null) {
|
|
182
|
-
var e, n,
|
|
183
|
-
if (!i(e =
|
|
184
|
-
const t = (128 + y(
|
|
185
|
-
i(
|
|
182
|
+
var e, n, s;
|
|
183
|
+
if (!i(e = a, o, _).call(e, r) || !i(n = a, o, m).call(n)) return !1;
|
|
184
|
+
const t = (128 + y(a, H)).toString(16);
|
|
185
|
+
i(s = a, o, p).call(s, ["2", t, "43", "43", "43", "FD"]);
|
|
186
186
|
}
|
|
187
187
|
static channelConnected(r = null) {
|
|
188
|
-
var e, n,
|
|
189
|
-
if (!i(e =
|
|
190
|
-
const t = (128 + y(
|
|
191
|
-
i(
|
|
188
|
+
var e, n, s;
|
|
189
|
+
if (!i(e = a, o, _).call(e, r) || !i(n = a, o, m).call(n)) return !1;
|
|
190
|
+
const t = (128 + y(a, H)).toString(16);
|
|
191
|
+
i(s = a, o, p).call(s, ["2", t, "43", "43", "43", "FC"]);
|
|
192
192
|
}
|
|
193
193
|
static channelEmpty(r = null) {
|
|
194
|
-
var e, n,
|
|
195
|
-
if (!i(e =
|
|
196
|
-
const t = (128 + y(
|
|
197
|
-
i(
|
|
194
|
+
var e, n, s;
|
|
195
|
+
if (!i(e = a, o, _).call(e, r) || !i(n = a, o, m).call(n)) return !1;
|
|
196
|
+
const t = (128 + y(a, H)).toString(16);
|
|
197
|
+
i(s = a, o, p).call(s, ["2", t, "43", "43", "43", "FF"]);
|
|
198
198
|
}
|
|
199
199
|
static workingTemperature(r = null) {
|
|
200
|
-
var e, n,
|
|
201
|
-
if (!i(e =
|
|
202
|
-
const t = (128 + y(
|
|
203
|
-
i(
|
|
200
|
+
var e, n, s;
|
|
201
|
+
if (!i(e = a, o, _).call(e, r) || !i(n = a, o, m).call(n)) return !1;
|
|
202
|
+
const t = (128 + y(a, H)).toString(16);
|
|
203
|
+
i(s = a, o, p).call(s, ["2", t, "43", "54", "16"]);
|
|
204
204
|
}
|
|
205
205
|
static currentTemperature(r = null) {
|
|
206
|
-
var n,
|
|
207
|
-
if (!i(n =
|
|
206
|
+
var n, s, c;
|
|
207
|
+
if (!i(n = a, o, _).call(n, r) || !i(s = a, o, ne).call(s)) return !1;
|
|
208
208
|
let t = [];
|
|
209
|
-
const e = (128 + y(
|
|
210
|
-
switch (y(
|
|
209
|
+
const e = (128 + y(a, H)).toString(16);
|
|
210
|
+
switch (y(a, R)) {
|
|
211
211
|
case "boardroid":
|
|
212
212
|
t = ["2", "D9", "44", "30"];
|
|
213
213
|
break;
|
|
@@ -215,218 +215,218 @@ const s = class s {
|
|
|
215
215
|
t = ["2", e, "43", "74", "2B", "30", "39", "2E", "31", "7F", "43"];
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
|
-
i(c =
|
|
218
|
+
i(c = a, o, p).call(c, t);
|
|
219
219
|
}
|
|
220
220
|
static ready(r = null) {
|
|
221
221
|
var t, e, n;
|
|
222
|
-
if (!i(t =
|
|
223
|
-
i(n =
|
|
222
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
223
|
+
i(n = a, o, p).call(n, ["6", "30"]);
|
|
224
224
|
}
|
|
225
225
|
static busy(r = null) {
|
|
226
226
|
var t, e, n;
|
|
227
|
-
if (!i(t =
|
|
228
|
-
i(n =
|
|
227
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
228
|
+
i(n = a, o, p).call(n, ["6", "31"]);
|
|
229
229
|
}
|
|
230
230
|
static invalidTray(r = null) {
|
|
231
231
|
var t, e, n;
|
|
232
|
-
if (!i(t =
|
|
233
|
-
i(n =
|
|
232
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
233
|
+
i(n = a, o, p).call(n, ["6", "32"]);
|
|
234
234
|
}
|
|
235
235
|
static invalidChannel(r = null) {
|
|
236
236
|
var t, e, n;
|
|
237
|
-
if (!i(t =
|
|
238
|
-
i(n =
|
|
237
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
238
|
+
i(n = a, o, p).call(n, ["6", "33"]);
|
|
239
239
|
}
|
|
240
240
|
static emptyChannel(r = null) {
|
|
241
241
|
var t, e, n;
|
|
242
|
-
if (!i(t =
|
|
243
|
-
i(n =
|
|
242
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
243
|
+
i(n = a, o, p).call(n, ["6", "34"]);
|
|
244
244
|
}
|
|
245
245
|
static elevatorJam(r = null) {
|
|
246
246
|
var t, e, n;
|
|
247
|
-
if (!i(t =
|
|
248
|
-
i(n =
|
|
247
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
248
|
+
i(n = a, o, p).call(n, ["6", "35"]);
|
|
249
249
|
}
|
|
250
250
|
static elevatorMalfunction(r = null) {
|
|
251
251
|
var t, e, n;
|
|
252
|
-
if (!i(t =
|
|
253
|
-
i(n =
|
|
252
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
253
|
+
i(n = a, o, p).call(n, ["6", "36"]);
|
|
254
254
|
}
|
|
255
255
|
static phototransistorFailure(r = null) {
|
|
256
256
|
var t, e, n;
|
|
257
|
-
if (!i(t =
|
|
258
|
-
i(n =
|
|
257
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
258
|
+
i(n = a, o, p).call(n, ["6", "37"]);
|
|
259
259
|
}
|
|
260
260
|
static allChannelsEmpty(r = null) {
|
|
261
261
|
var t, e, n;
|
|
262
|
-
if (!i(t =
|
|
263
|
-
i(n =
|
|
262
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
263
|
+
i(n = a, o, p).call(n, ["6", "38"]);
|
|
264
264
|
}
|
|
265
265
|
static productDetectorFailure(r = null) {
|
|
266
266
|
var t, e, n;
|
|
267
|
-
if (!i(t =
|
|
268
|
-
i(n =
|
|
267
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
268
|
+
i(n = a, o, p).call(n, ["6", "39"]);
|
|
269
269
|
}
|
|
270
270
|
static displayDisconnected(r = null) {
|
|
271
271
|
var t, e, n;
|
|
272
|
-
if (!i(t =
|
|
273
|
-
i(n =
|
|
272
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
273
|
+
i(n = a, o, p).call(n, ["6", "41"]);
|
|
274
274
|
}
|
|
275
275
|
static productUnderElevator(r = null) {
|
|
276
276
|
var t, e, n;
|
|
277
|
-
if (!i(t =
|
|
278
|
-
i(n =
|
|
277
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
278
|
+
i(n = a, o, p).call(n, ["6", "42"]);
|
|
279
279
|
}
|
|
280
280
|
static elevatorSettingAlarm(r = null) {
|
|
281
281
|
var t, e, n;
|
|
282
|
-
if (!i(t =
|
|
283
|
-
i(n =
|
|
282
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
283
|
+
i(n = a, o, p).call(n, ["6", "43"]);
|
|
284
284
|
}
|
|
285
285
|
static buttonPanelFailure(r = null) {
|
|
286
286
|
var t, e, n;
|
|
287
|
-
if (!i(t =
|
|
288
|
-
i(n =
|
|
287
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
288
|
+
i(n = a, o, p).call(n, ["6", "44"]);
|
|
289
289
|
}
|
|
290
290
|
static errorWritingEeprom(r = null) {
|
|
291
291
|
var t, e, n;
|
|
292
|
-
if (!i(t =
|
|
293
|
-
i(n =
|
|
292
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
293
|
+
i(n = a, o, p).call(n, ["6", "45"]);
|
|
294
294
|
}
|
|
295
295
|
static errorControlTemperature(r = null) {
|
|
296
296
|
var t, e, n;
|
|
297
|
-
if (!i(t =
|
|
298
|
-
i(n =
|
|
297
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
298
|
+
i(n = a, o, p).call(n, ["6", "46"]);
|
|
299
299
|
}
|
|
300
300
|
static thermometerDisconnected(r = null) {
|
|
301
301
|
var t, e, n;
|
|
302
|
-
if (!i(t =
|
|
303
|
-
i(n =
|
|
302
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
303
|
+
i(n = a, o, p).call(n, ["6", "47"]);
|
|
304
304
|
}
|
|
305
305
|
static thermometerMisconfigured(r = null) {
|
|
306
306
|
var t, e, n;
|
|
307
|
-
if (!i(t =
|
|
308
|
-
i(n =
|
|
307
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
308
|
+
i(n = a, o, p).call(n, ["6", "48"]);
|
|
309
309
|
}
|
|
310
310
|
static thermometerFailure(r = null) {
|
|
311
311
|
var t, e, n;
|
|
312
|
-
if (!i(t =
|
|
313
|
-
i(n =
|
|
312
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
313
|
+
i(n = a, o, p).call(n, ["6", "49"]);
|
|
314
314
|
}
|
|
315
315
|
static errorExtractorConsumption(r = null) {
|
|
316
316
|
var t, e, n;
|
|
317
|
-
if (!i(t =
|
|
318
|
-
i(n =
|
|
317
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
318
|
+
i(n = a, o, p).call(n, ["6", "4A"]);
|
|
319
319
|
}
|
|
320
320
|
static channelSearchError(r = null) {
|
|
321
321
|
var t, e, n;
|
|
322
|
-
if (!i(t =
|
|
323
|
-
i(n =
|
|
322
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
323
|
+
i(n = a, o, p).call(n, ["6", "4B"]);
|
|
324
324
|
}
|
|
325
325
|
static productExitMouthSearchError(r = null) {
|
|
326
326
|
var t, e, n;
|
|
327
|
-
if (!i(t =
|
|
328
|
-
i(n =
|
|
327
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
328
|
+
i(n = a, o, p).call(n, ["6", "4C"]);
|
|
329
329
|
}
|
|
330
330
|
static elevatorInteriorLocked(r = null) {
|
|
331
331
|
var t, e, n;
|
|
332
|
-
if (!i(t =
|
|
333
|
-
i(n =
|
|
332
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
333
|
+
i(n = a, o, p).call(n, ["6", "4D"]);
|
|
334
334
|
}
|
|
335
335
|
static productDetectorVerifierError(r = null) {
|
|
336
336
|
var t, e, n;
|
|
337
|
-
if (!i(t =
|
|
338
|
-
i(n =
|
|
337
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
338
|
+
i(n = a, o, p).call(n, ["6", "4E"]);
|
|
339
339
|
}
|
|
340
340
|
static waitingForProductRecall(r = null) {
|
|
341
341
|
var t, e, n;
|
|
342
|
-
if (!i(t =
|
|
343
|
-
i(n =
|
|
342
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
343
|
+
i(n = a, o, p).call(n, ["6", "4F"]);
|
|
344
344
|
}
|
|
345
345
|
static productExpiredByTemperature(r = null) {
|
|
346
346
|
var t, e, n;
|
|
347
|
-
if (!i(t =
|
|
348
|
-
i(n =
|
|
347
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
348
|
+
i(n = a, o, p).call(n, ["6", "50"]);
|
|
349
349
|
}
|
|
350
350
|
static faultyAutomaticDoor(r = null) {
|
|
351
351
|
var t, e, n;
|
|
352
|
-
if (!i(t =
|
|
353
|
-
i(n =
|
|
352
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
353
|
+
i(n = a, o, p).call(n, ["6", "51"]);
|
|
354
354
|
}
|
|
355
355
|
static rejectLever(r = null) {
|
|
356
356
|
var t, e, n;
|
|
357
|
-
if (!i(t =
|
|
358
|
-
i(n =
|
|
357
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
358
|
+
i(n = a, o, p).call(n, ["2", "A0", "1"]);
|
|
359
359
|
}
|
|
360
360
|
static resetCoinPurse(r = null) {
|
|
361
361
|
var t, e, n;
|
|
362
|
-
if (!i(t =
|
|
363
|
-
i(n =
|
|
362
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
363
|
+
i(n = a, o, p).call(n, ["2", "A0", "2"]);
|
|
364
364
|
}
|
|
365
365
|
static coinInsertedBox(r = null, t = null) {
|
|
366
|
-
var
|
|
367
|
-
if (!i(
|
|
368
|
-
const e = ["40", "41", "42", "43", "44", "45"], n = i(u =
|
|
369
|
-
i(h =
|
|
366
|
+
var s, c, u, h;
|
|
367
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
|
|
368
|
+
const e = ["40", "41", "42", "43", "44", "45"], n = i(u = a, o, ve).call(u, e, t);
|
|
369
|
+
i(h = a, o, p).call(h, ["2", "A0", n]);
|
|
370
370
|
}
|
|
371
371
|
static coinInsertedTube(r = null, t = null) {
|
|
372
|
-
var
|
|
373
|
-
if (!i(
|
|
374
|
-
const e = ["50", "51", "52", "53", "54", "55"], n = i(u =
|
|
375
|
-
i(h =
|
|
372
|
+
var s, c, u, h;
|
|
373
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
|
|
374
|
+
const e = ["50", "51", "52", "53", "54", "55"], n = i(u = a, o, ve).call(u, e, t);
|
|
375
|
+
i(h = a, o, p).call(h, ["2", "A0", n]);
|
|
376
376
|
}
|
|
377
377
|
static banknoteInsertedStacker(r = null, t = null) {
|
|
378
|
-
var
|
|
379
|
-
if (!i(
|
|
380
|
-
const e = ["80", "81", "82", "83", "84"], n = i(u =
|
|
381
|
-
i(h =
|
|
378
|
+
var s, c, u, h;
|
|
379
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
|
|
380
|
+
const e = ["80", "81", "82", "83", "84"], n = i(u = a, o, Y).call(u, e, t);
|
|
381
|
+
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
382
382
|
}
|
|
383
383
|
static banknoteInsertedEscrow(r = null, t = null) {
|
|
384
|
-
var
|
|
385
|
-
if (!i(
|
|
386
|
-
const e = ["90", "91", "92", "93", "94"], n = i(u =
|
|
387
|
-
i(h =
|
|
384
|
+
var s, c, u, h;
|
|
385
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
|
|
386
|
+
const e = ["90", "91", "92", "93", "94"], n = i(u = a, o, Y).call(u, e, t);
|
|
387
|
+
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
388
388
|
}
|
|
389
389
|
static banknoteEjected(r = null, t = null) {
|
|
390
|
-
var
|
|
391
|
-
if (!i(
|
|
392
|
-
const e = ["A0", "A1", "A2", "A3", "A4"], n = i(u =
|
|
393
|
-
i(h =
|
|
390
|
+
var s, c, u, h;
|
|
391
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
|
|
392
|
+
const e = ["A0", "A1", "A2", "A3", "A4"], n = i(u = a, o, Y).call(u, e, t);
|
|
393
|
+
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
394
394
|
}
|
|
395
395
|
static banknoteInsertedRecycler(r = null, t = null) {
|
|
396
|
-
var
|
|
397
|
-
if (!i(
|
|
398
|
-
const e = ["B0", "B1", "B2", "B3", "B4"], n = i(u =
|
|
399
|
-
i(h =
|
|
396
|
+
var s, c, u, h;
|
|
397
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
|
|
398
|
+
const e = ["B0", "B1", "B2", "B3", "B4"], n = i(u = a, o, Y).call(u, e, t);
|
|
399
|
+
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
400
400
|
}
|
|
401
401
|
static banknoteTaken(r = null) {
|
|
402
402
|
var t, e, n;
|
|
403
|
-
if (!i(t =
|
|
404
|
-
i(n =
|
|
403
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
404
|
+
i(n = a, o, p).call(n, ["2", "B0", "2a"]);
|
|
405
405
|
}
|
|
406
406
|
static coinPurseEnabled(r = null) {
|
|
407
407
|
var t, e, n;
|
|
408
|
-
if (!i(t =
|
|
409
|
-
i(n =
|
|
408
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
409
|
+
i(n = a, o, p).call(n, ["2", "D0", "1"]);
|
|
410
410
|
}
|
|
411
411
|
static coinPurseDisabled(r = null) {
|
|
412
412
|
var t, e, n;
|
|
413
|
-
if (!i(t =
|
|
414
|
-
i(n =
|
|
413
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
414
|
+
i(n = a, o, p).call(n, ["2", "D0", "0"]);
|
|
415
415
|
}
|
|
416
416
|
static billPurseDisabled(r = null) {
|
|
417
417
|
var t, e, n;
|
|
418
|
-
if (!i(t =
|
|
419
|
-
i(n =
|
|
418
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
419
|
+
i(n = a, o, p).call(n, ["2", "D1", "0", "0"]);
|
|
420
420
|
}
|
|
421
421
|
static billPurseEnabled(r = null) {
|
|
422
422
|
var t, e, n;
|
|
423
|
-
if (!i(t =
|
|
424
|
-
i(n =
|
|
423
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
424
|
+
i(n = a, o, p).call(n, ["2", "D1", "1", "1"]);
|
|
425
425
|
}
|
|
426
426
|
static readTubes(r = null) {
|
|
427
427
|
var b, g, T;
|
|
428
|
-
if (!i(b =
|
|
429
|
-
const t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f"], [e, n,
|
|
428
|
+
if (!i(b = a, o, _).call(b, r) || !i(g = a, o, C).call(g)) return !1;
|
|
429
|
+
const t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f"], [e, n, s, c, u, h] = [
|
|
430
430
|
t[Math.floor(Math.random() * 30)],
|
|
431
431
|
t[Math.floor(Math.random() * 30)],
|
|
432
432
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -434,11 +434,11 @@ const s = class s {
|
|
|
434
434
|
t[Math.floor(Math.random() * 30)],
|
|
435
435
|
t[Math.floor(Math.random() * 30)]
|
|
436
436
|
];
|
|
437
|
-
i(T =
|
|
437
|
+
i(T = a, o, p).call(T, ["2", "D2", e, n, s, c, u, h]);
|
|
438
438
|
}
|
|
439
439
|
static readBillPurse(r = null, t = null) {
|
|
440
|
-
var n,
|
|
441
|
-
if (!i(n =
|
|
440
|
+
var n, s, c, u;
|
|
441
|
+
if (!i(n = a, o, _).call(n, r) || !i(s = a, o, C).call(s)) return !1;
|
|
442
442
|
let e = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c"];
|
|
443
443
|
if (r._recycler.ict) {
|
|
444
444
|
const h = e[Math.floor(Math.random() * 31)];
|
|
@@ -479,7 +479,7 @@ const s = class s {
|
|
|
479
479
|
U = h;
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
|
-
i(c =
|
|
482
|
+
i(c = a, o, p).call(c, ["2", "D3", b, g, T, I, U, "0"]);
|
|
483
483
|
} else {
|
|
484
484
|
const [h, b, g, T, I, U] = [
|
|
485
485
|
e[Math.floor(Math.random() * 30)],
|
|
@@ -489,22 +489,22 @@ const s = class s {
|
|
|
489
489
|
e[Math.floor(Math.random())],
|
|
490
490
|
e[Math.floor(Math.random())]
|
|
491
491
|
];
|
|
492
|
-
i(u =
|
|
492
|
+
i(u = a, o, p).call(u, ["2", "D3", h, b, g, T, I, U]);
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
static banknoteAccepted(r = null) {
|
|
496
496
|
var t, e, n;
|
|
497
|
-
if (!i(t =
|
|
498
|
-
i(n =
|
|
497
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
498
|
+
i(n = a, o, p).call(n, ["2", "D4", "1"]);
|
|
499
499
|
}
|
|
500
500
|
static banknoteRejected(r = null) {
|
|
501
501
|
var t, e, n;
|
|
502
|
-
if (!i(t =
|
|
503
|
-
i(n =
|
|
502
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
503
|
+
i(n = a, o, p).call(n, ["2", "D4", "0"]);
|
|
504
504
|
}
|
|
505
505
|
static banknotesDispensed(r = null) {
|
|
506
|
-
var e, n,
|
|
507
|
-
if (!i(e =
|
|
506
|
+
var e, n, s, c;
|
|
507
|
+
if (!i(e = a, o, _).call(e, r) || !i(n = a, o, C).call(n)) return !1;
|
|
508
508
|
let t = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c"];
|
|
509
509
|
if (r._recycler.ict) {
|
|
510
510
|
const u = t[Math.floor(Math.random() * 30)];
|
|
@@ -526,7 +526,7 @@ const s = class s {
|
|
|
526
526
|
I = u;
|
|
527
527
|
break;
|
|
528
528
|
}
|
|
529
|
-
i(
|
|
529
|
+
i(s = a, o, p).call(s, ["2", "D5", h, b, g, T, I, "0"]);
|
|
530
530
|
} else {
|
|
531
531
|
const [u, h, b, g, T, I] = [
|
|
532
532
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -536,108 +536,108 @@ const s = class s {
|
|
|
536
536
|
t[Math.floor(Math.random())],
|
|
537
537
|
t[Math.floor(Math.random())]
|
|
538
538
|
];
|
|
539
|
-
i(c =
|
|
539
|
+
i(c = a, o, p).call(c, ["2", "D5", u, h, b, g, T, I]);
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
static coinsDispensed(r = null) {
|
|
543
543
|
var t, e, n;
|
|
544
|
-
if (!i(t =
|
|
545
|
-
i(n =
|
|
544
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
545
|
+
i(n = a, o, p).call(n, ["2", "D6"]);
|
|
546
546
|
}
|
|
547
547
|
static relayOn(r = null) {
|
|
548
548
|
var t, e, n;
|
|
549
|
-
if (!i(t =
|
|
550
|
-
i(n =
|
|
549
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
550
|
+
i(n = a, o, p).call(n, ["2", "DA", "1"]);
|
|
551
551
|
}
|
|
552
552
|
static relayOff(r = null) {
|
|
553
553
|
var t, e, n;
|
|
554
|
-
if (!i(t =
|
|
555
|
-
i(n =
|
|
554
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
555
|
+
i(n = a, o, p).call(n, ["2", "DA", "0"]);
|
|
556
556
|
}
|
|
557
557
|
static nayaxEnabled(r = null) {
|
|
558
558
|
var t, e, n;
|
|
559
|
-
if (!i(t =
|
|
560
|
-
i(n =
|
|
559
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
560
|
+
i(n = a, o, p).call(n, ["2", "DD", "1"]);
|
|
561
561
|
}
|
|
562
562
|
static nayaxDisabled(r = null) {
|
|
563
563
|
var t, e, n;
|
|
564
|
-
if (!i(t =
|
|
565
|
-
i(n =
|
|
564
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
565
|
+
i(n = a, o, p).call(n, ["2", "DD", "0"]);
|
|
566
566
|
}
|
|
567
567
|
static nayaxPreCreditAuthorized(r = null) {
|
|
568
568
|
var t, e, n;
|
|
569
|
-
if (!i(t =
|
|
570
|
-
i(n =
|
|
569
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
570
|
+
i(n = a, o, p).call(n, ["2", "DD", "3"]);
|
|
571
571
|
}
|
|
572
572
|
static nayaxCancelRequest(r = null) {
|
|
573
573
|
var t, e, n;
|
|
574
|
-
if (!i(t =
|
|
575
|
-
i(n =
|
|
574
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
575
|
+
i(n = a, o, p).call(n, ["2", "DD", "4"]);
|
|
576
576
|
}
|
|
577
577
|
static nayaxSellApproved(r = null) {
|
|
578
578
|
var t, e, n;
|
|
579
|
-
if (!i(t =
|
|
580
|
-
i(n =
|
|
579
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
580
|
+
i(n = a, o, p).call(n, ["2", "DD", "5"]);
|
|
581
581
|
}
|
|
582
582
|
static nayaxSellDenied(r = null) {
|
|
583
583
|
var t, e, n;
|
|
584
|
-
if (!i(t =
|
|
585
|
-
i(n =
|
|
584
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
585
|
+
i(n = a, o, p).call(n, ["2", "DD", "6"]);
|
|
586
586
|
}
|
|
587
587
|
static nayaxEndSession(r = null) {
|
|
588
588
|
var t, e, n;
|
|
589
|
-
if (!i(t =
|
|
590
|
-
i(n =
|
|
589
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
590
|
+
i(n = a, o, p).call(n, ["2", "DD", "7"]);
|
|
591
591
|
}
|
|
592
592
|
static nayaxCancelled(r = null) {
|
|
593
593
|
var t, e, n;
|
|
594
|
-
if (!i(t =
|
|
595
|
-
i(n =
|
|
594
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
595
|
+
i(n = a, o, p).call(n, ["2", "DD", "8"]);
|
|
596
596
|
}
|
|
597
597
|
static nayaxDispensed(r = null) {
|
|
598
598
|
var t, e, n;
|
|
599
|
-
if (!i(t =
|
|
600
|
-
i(n =
|
|
599
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
600
|
+
i(n = a, o, p).call(n, ["2", "DD", "A", "0"]);
|
|
601
601
|
}
|
|
602
602
|
static nayaxNotDispensed(r = null) {
|
|
603
603
|
var t, e, n;
|
|
604
|
-
if (!i(t =
|
|
605
|
-
i(n =
|
|
604
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
|
|
605
|
+
i(n = a, o, p).call(n, ["2", "DD", "A", "1"]);
|
|
606
606
|
}
|
|
607
607
|
static fullTray(r = null) {
|
|
608
608
|
var t, e, n;
|
|
609
|
-
if (!i(t =
|
|
610
|
-
i(n =
|
|
609
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, m).call(e)) return !1;
|
|
610
|
+
i(n = a, o, p).call(n, ["6", "4F"]);
|
|
611
611
|
}
|
|
612
612
|
static setConnection(r = null) {
|
|
613
613
|
var t;
|
|
614
|
-
if (!i(t =
|
|
614
|
+
if (!i(t = a, o, _).call(t, r)) return !1;
|
|
615
615
|
r.__internal__.serial.connected = !0;
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
|
-
|
|
619
|
-
if (
|
|
620
|
-
return
|
|
618
|
+
R = new WeakMap(), H = new WeakMap(), o = new WeakSet(), Ae = function() {
|
|
619
|
+
if (a.enable === !1) throw new Error("Emulator is disabled");
|
|
620
|
+
return a.enable;
|
|
621
621
|
}, Be = function(r) {
|
|
622
622
|
if (typeof r != "object" || !(r instanceof G)) throw new Error(`Type ${r.typeDevice} is not supported`);
|
|
623
|
-
return
|
|
623
|
+
return a.instance = r, x(a, R, r.typeDevice), x(a, H, r.deviceNumber), !0;
|
|
624
624
|
}, _ = function(r = null) {
|
|
625
625
|
var t, e;
|
|
626
|
-
return !i(t =
|
|
626
|
+
return !i(t = a, o, Ae).call(t) || r === null && a.instance === null ? !1 : (a.instance === null && i(e = a, o, Be).call(e, r), !0);
|
|
627
627
|
}, ke = function() {
|
|
628
|
-
if (y(
|
|
628
|
+
if (y(a, R) !== "locker") throw new Error("This function is only available for Locker devices");
|
|
629
629
|
return !0;
|
|
630
630
|
}, C = function() {
|
|
631
|
-
if (y(
|
|
631
|
+
if (y(a, R) !== "boardroid") throw new Error("This function is only available for Boardroid devices");
|
|
632
632
|
return !0;
|
|
633
633
|
}, m = function() {
|
|
634
|
-
if (y(
|
|
634
|
+
if (y(a, R) !== "jofemar") throw new Error("This function is only available for Jofemar devices");
|
|
635
635
|
return !0;
|
|
636
636
|
}, ne = function() {
|
|
637
|
-
if (y(
|
|
637
|
+
if (y(a, R) === "locker") throw new Error("This function is not available for Locker devices");
|
|
638
638
|
return !0;
|
|
639
639
|
}, p = function(r) {
|
|
640
|
-
|
|
640
|
+
a.instance.__emulate({ code: r });
|
|
641
641
|
}, ve = function(r, t = null) {
|
|
642
642
|
let e = r[Math.floor(Math.random() * 5)];
|
|
643
643
|
if (t !== null && !isNaN(parseFloat(t)))
|
|
@@ -680,8 +680,8 @@ q = new WeakMap(), H = new WeakMap(), o = new WeakSet(), Ae = function() {
|
|
|
680
680
|
break;
|
|
681
681
|
}
|
|
682
682
|
return e;
|
|
683
|
-
}, S(
|
|
684
|
-
let pe =
|
|
683
|
+
}, S(a, o), A(a, "enable", !1), A(a, "instance", null), S(a, R, null), S(a, H, 1);
|
|
684
|
+
let pe = a;
|
|
685
685
|
const k = class k extends Pe {
|
|
686
686
|
static typeError(r) {
|
|
687
687
|
const t = new Error();
|
|
@@ -748,7 +748,7 @@ A(k, "instance", null), A(k, "devices", {
|
|
|
748
748
|
});
|
|
749
749
|
let D = k;
|
|
750
750
|
D.instance || (D.instance = new D());
|
|
751
|
-
var w,
|
|
751
|
+
var w, qe, me, $, Re, He, Le, Oe, Ue, je, We, $e, Qe, Ve, Je, ze;
|
|
752
752
|
class G extends Pe {
|
|
753
753
|
/**
|
|
754
754
|
*
|
|
@@ -761,7 +761,7 @@ class G extends Pe {
|
|
|
761
761
|
filters: t = null,
|
|
762
762
|
config_port: e = null,
|
|
763
763
|
no_device: n = 1,
|
|
764
|
-
device_listen_on_port:
|
|
764
|
+
device_listen_on_port: s = 1
|
|
765
765
|
} = {}) {
|
|
766
766
|
super();
|
|
767
767
|
S(this, w);
|
|
@@ -799,11 +799,13 @@ class G extends Pe {
|
|
|
799
799
|
device: {
|
|
800
800
|
type: "unknown",
|
|
801
801
|
id: kn(),
|
|
802
|
-
listen_on_port: null
|
|
802
|
+
listen_on_port: null,
|
|
803
|
+
door_open: !1
|
|
803
804
|
},
|
|
804
805
|
time: {
|
|
805
806
|
response_connection: 500,
|
|
806
807
|
response_general: 2e3,
|
|
808
|
+
response_engines: 2e3,
|
|
807
809
|
sense: 100
|
|
808
810
|
},
|
|
809
811
|
timeout: {
|
|
@@ -814,6 +816,7 @@ class G extends Pe {
|
|
|
814
816
|
waiting_sense: 0
|
|
815
817
|
},
|
|
816
818
|
dispense: {
|
|
819
|
+
must_response: !1,
|
|
817
820
|
dispensing: !1,
|
|
818
821
|
status: null,
|
|
819
822
|
counter: 0,
|
|
@@ -822,12 +825,15 @@ class G extends Pe {
|
|
|
822
825
|
backup_dispense: {}
|
|
823
826
|
}
|
|
824
827
|
});
|
|
825
|
-
t && (this.serialFilters = t), e && (this.serialConfigPort = e), n && i(this, w, Je).call(this, n),
|
|
828
|
+
t && (this.serialFilters = t), e && (this.serialConfigPort = e), n && i(this, w, Je).call(this, n), s && (typeof s == "number" || typeof s == "string") && (this.listenOnPort = s), i(this, w, We).call(this), i(this, w, $e).call(this);
|
|
826
829
|
}
|
|
827
830
|
set listenOnPort(t) {
|
|
828
831
|
if (t = parseInt(t), isNaN(t) || t < 1 || t > 255) throw new Error("Invalid port number");
|
|
829
832
|
this.__internal__.device.listen_on_port = t, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(t);
|
|
830
833
|
}
|
|
834
|
+
get isDoorOpen() {
|
|
835
|
+
return this.__internal__.device.door_open;
|
|
836
|
+
}
|
|
831
837
|
get listenOnPort() {
|
|
832
838
|
return this.__internal__.device.listen_on_port ?? 1;
|
|
833
839
|
}
|
|
@@ -884,7 +890,7 @@ class G extends Pe {
|
|
|
884
890
|
async serialDisconnect() {
|
|
885
891
|
try {
|
|
886
892
|
const t = this.__internal__.serial.reader, e = this.__internal__.serial.output_stream;
|
|
887
|
-
t && (await t.cancel().catch((
|
|
893
|
+
t && (await t.cancel().catch((s) => this.serialErrors(s)), await this.__internal__.serial.input_done), e && (await e.getWriter().close(), await this.__internal__.serial.output_done), this.__internal__.serial.connected && this.__internal__.serial && await this.__internal__.serial.port.close();
|
|
888
894
|
} catch (t) {
|
|
889
895
|
this.serialErrors(t);
|
|
890
896
|
} finally {
|
|
@@ -946,20 +952,20 @@ class G extends Pe {
|
|
|
946
952
|
async serialConnect() {
|
|
947
953
|
try {
|
|
948
954
|
this.dispatch("serial:connecting", {});
|
|
949
|
-
const t = await i(this, w,
|
|
955
|
+
const t = await i(this, w, Re).call(this);
|
|
950
956
|
if (t.length > 0)
|
|
951
957
|
await this.serialPortsSaved(t);
|
|
952
958
|
else {
|
|
953
|
-
const
|
|
954
|
-
this.__internal__.serial.port = await navigator.serial.requestPort({ filters:
|
|
959
|
+
const s = this.serialFilters;
|
|
960
|
+
this.__internal__.serial.port = await navigator.serial.requestPort({ filters: s });
|
|
955
961
|
}
|
|
956
962
|
const e = this.__internal__.serial.port;
|
|
957
963
|
await e.open(this.serialConfigPort);
|
|
958
964
|
const n = this;
|
|
959
|
-
e.onconnect = (
|
|
960
|
-
n.dispatch("serial:connected",
|
|
961
|
-
}, e.ondisconnect = async (
|
|
962
|
-
await n.disconnect(
|
|
965
|
+
e.onconnect = (s) => {
|
|
966
|
+
n.dispatch("serial:connected", s.detail), D.instance.dispatch("change"), n.__internal__.serial.queue.length > 0 && n.dispatch("internal:queue", {});
|
|
967
|
+
}, e.ondisconnect = async (s) => {
|
|
968
|
+
await n.disconnect(s.detail ?? null);
|
|
963
969
|
}, await W(this.__internal__.serial.delay_first_connection), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
964
970
|
await n.timeout(n.__internal__.serial.bytes_connection, "connection:start");
|
|
965
971
|
}, this.__internal__.time.response_connection), await i(this, w, me).call(this, this.__internal__.serial.bytes_connection), this.dispatch("serial:sent", {
|
|
@@ -984,8 +990,8 @@ class G extends Pe {
|
|
|
984
990
|
}
|
|
985
991
|
add0x(t) {
|
|
986
992
|
let e = [];
|
|
987
|
-
return t.forEach((n,
|
|
988
|
-
e[
|
|
993
|
+
return t.forEach((n, s) => {
|
|
994
|
+
e[s] = "0x" + n;
|
|
989
995
|
}), e;
|
|
990
996
|
}
|
|
991
997
|
bytesToHex(t) {
|
|
@@ -1046,6 +1052,8 @@ class G extends Pe {
|
|
|
1046
1052
|
}), null);
|
|
1047
1053
|
}
|
|
1048
1054
|
async internalDispenseStatus() {
|
|
1055
|
+
if (this.__internal__.dispense.must_response && (await W(this.__internal__.time.response_engines + 10), this.__internal__.dispense.status === "no-response"))
|
|
1056
|
+
return this.internalClearSensing(), this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", { reason: "no-response" }), { status: !1, error: "no-response" };
|
|
1049
1057
|
this.__internal__.dispense.status = null, this.__internal__.dispense.dispensing = !0, this.dispatch("internal:dispense:running", {});
|
|
1050
1058
|
const t = this;
|
|
1051
1059
|
return new Promise((e) => {
|
|
@@ -1078,8 +1086,8 @@ class G extends Pe {
|
|
|
1078
1086
|
const n = setInterval(async () => {
|
|
1079
1087
|
if (this.__internal__.serial.queue.length > 0) return;
|
|
1080
1088
|
clearInterval(n), await this.appendToQueue(t, "dispense");
|
|
1081
|
-
const
|
|
1082
|
-
e(
|
|
1089
|
+
const s = await this.internalDispenseStatus();
|
|
1090
|
+
e(s);
|
|
1083
1091
|
}, 100);
|
|
1084
1092
|
});
|
|
1085
1093
|
}
|
|
@@ -1113,7 +1121,7 @@ class G extends Pe {
|
|
|
1113
1121
|
await this.appendToQueue(t, "custom");
|
|
1114
1122
|
}
|
|
1115
1123
|
}
|
|
1116
|
-
w = new WeakSet(),
|
|
1124
|
+
w = new WeakSet(), qe = function(t) {
|
|
1117
1125
|
return !!(t.readable && t.writable);
|
|
1118
1126
|
}, me = async function(t) {
|
|
1119
1127
|
const e = this.__internal__.serial.port;
|
|
@@ -1122,8 +1130,8 @@ w = new WeakSet(), Re = function(t) {
|
|
|
1122
1130
|
return;
|
|
1123
1131
|
throw new Error("The port is closed.");
|
|
1124
1132
|
}
|
|
1125
|
-
const n = new Uint8Array(t),
|
|
1126
|
-
await
|
|
1133
|
+
const n = new Uint8Array(t), s = e.writable.getWriter();
|
|
1134
|
+
await s.write(n), s.releaseLock();
|
|
1127
1135
|
}, // #bytesToLowerCase(code = []) {
|
|
1128
1136
|
// return code.map((item) => item.toString().toLowerCase());
|
|
1129
1137
|
// }
|
|
@@ -1131,18 +1139,18 @@ $ = function(t = [], e = null) {
|
|
|
1131
1139
|
if (t && t.length > 0) {
|
|
1132
1140
|
this.__internal__.serial.connected || (this.dispatch("serial:connected"), D.instance.dispatch("change")), this.__internal__.serial.connected = !0, this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0);
|
|
1133
1141
|
const n = [];
|
|
1134
|
-
for (const
|
|
1135
|
-
n.push(t[
|
|
1142
|
+
for (const s in t)
|
|
1143
|
+
n.push(t[s].toString().padStart(2, "0").toLowerCase());
|
|
1136
1144
|
this.serialMessage(n);
|
|
1137
1145
|
} else
|
|
1138
1146
|
this.serialCorruptMessage(t, e);
|
|
1139
1147
|
this.__internal__.serial.queue.length !== 0 && this.dispatch("internal:queue", {});
|
|
1140
|
-
},
|
|
1148
|
+
}, Re = async function() {
|
|
1141
1149
|
const t = this.serialFilters, e = await navigator.serial.getPorts({ filters: t });
|
|
1142
|
-
return t.length === 0 ? e : e.filter((
|
|
1143
|
-
const c =
|
|
1150
|
+
return t.length === 0 ? e : e.filter((s) => {
|
|
1151
|
+
const c = s.getInfo();
|
|
1144
1152
|
return t.some((u) => c.usbProductId === u.usbProductId && c.usbVendorId === u.usbVendorId);
|
|
1145
|
-
}).filter((
|
|
1153
|
+
}).filter((s) => !i(this, w, qe).call(this, s));
|
|
1146
1154
|
}, He = function(t) {
|
|
1147
1155
|
if (t) {
|
|
1148
1156
|
const e = this.__internal__.serial.response.buffer;
|
|
@@ -1168,8 +1176,8 @@ $ = function(t = [], e = null) {
|
|
|
1168
1176
|
t[n] = this.__internal__.serial.response.buffer[n];
|
|
1169
1177
|
if (t.length === this.__internal__.serial.response.length) {
|
|
1170
1178
|
const n = [];
|
|
1171
|
-
for (const
|
|
1172
|
-
n.push(t[
|
|
1179
|
+
for (const s in t)
|
|
1180
|
+
n.push(t[s].toString(16));
|
|
1173
1181
|
await i(this, w, $).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1174
1182
|
return;
|
|
1175
1183
|
}
|
|
@@ -1180,8 +1188,8 @@ $ = function(t = [], e = null) {
|
|
|
1180
1188
|
t[n - this.__internal__.serial.response.length] = this.__internal__.serial.response.buffer[n];
|
|
1181
1189
|
if (t.length === this.__internal__.serial.response.length) {
|
|
1182
1190
|
const n = [];
|
|
1183
|
-
for (const
|
|
1184
|
-
n.push(t[
|
|
1191
|
+
for (const s in t)
|
|
1192
|
+
n.push(t[s].toString(16));
|
|
1185
1193
|
await i(this, w, $).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1186
1194
|
}
|
|
1187
1195
|
}
|
|
@@ -1194,12 +1202,12 @@ $ = function(t = [], e = null) {
|
|
|
1194
1202
|
try {
|
|
1195
1203
|
let n = !0;
|
|
1196
1204
|
for (; n; ) {
|
|
1197
|
-
const { value:
|
|
1205
|
+
const { value: s, done: c } = await e.read();
|
|
1198
1206
|
if (c) {
|
|
1199
1207
|
e.releaseLock(), this.__internal__.serial.keep_reading = !1, n = !1;
|
|
1200
1208
|
break;
|
|
1201
1209
|
}
|
|
1202
|
-
i(this, w, He).call(this,
|
|
1210
|
+
i(this, w, He).call(this, s), this.__internal__.serial.response.length === null ? await i(this, w, Le).call(this) : await i(this, w, Oe).call(this);
|
|
1203
1211
|
}
|
|
1204
1212
|
} catch (n) {
|
|
1205
1213
|
this.serialErrors(n);
|
|
@@ -1232,8 +1240,10 @@ $ = function(t = [], e = null) {
|
|
|
1232
1240
|
this.serialRegisterAvailableListener(e);
|
|
1233
1241
|
});
|
|
1234
1242
|
}, $e = function() {
|
|
1243
|
+
const t = this;
|
|
1235
1244
|
this.on("internal:queue", async () => {
|
|
1236
|
-
|
|
1245
|
+
var e;
|
|
1246
|
+
await i(e = t, w, Ve).call(e);
|
|
1237
1247
|
}), i(this, w, Qe).call(this);
|
|
1238
1248
|
}, Qe = function() {
|
|
1239
1249
|
const t = this;
|
|
@@ -1249,7 +1259,7 @@ $ = function(t = [], e = null) {
|
|
|
1249
1259
|
if (this.__internal__.timeout.until_response || this.__internal__.serial.queue.length === 0) return;
|
|
1250
1260
|
const t = this.__internal__.serial.queue[0];
|
|
1251
1261
|
let e = this.__internal__.time.response_general;
|
|
1252
|
-
t.action === "dispense" && (e =
|
|
1262
|
+
t.action === "connect" ? e = this.__internal__.time.response_connection : t.action === "dispense" && (e = this.__internal__.time.response_engines), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
1253
1263
|
await this.timeout(t.bytes, t.action);
|
|
1254
1264
|
}, e), await i(this, w, me).call(this, t.bytes), this.dispatch("serial:sent", {
|
|
1255
1265
|
action: t.action,
|
|
@@ -1300,8 +1310,8 @@ class gn extends G {
|
|
|
1300
1310
|
}
|
|
1301
1311
|
serialRelaySumHex(t) {
|
|
1302
1312
|
let e = 0;
|
|
1303
|
-
return t.forEach((n,
|
|
1304
|
-
|
|
1313
|
+
return t.forEach((n, s) => {
|
|
1314
|
+
s !== 3 && (e += parseInt(n, 16));
|
|
1305
1315
|
}), e.toString(16).toUpperCase();
|
|
1306
1316
|
}
|
|
1307
1317
|
serialSetConnectionConstant(t = 1) {
|
|
@@ -1324,15 +1334,15 @@ class gn extends G {
|
|
|
1324
1334
|
X = new WeakMap(), _e = new WeakSet(), Ge = function() {
|
|
1325
1335
|
D.add(this);
|
|
1326
1336
|
};
|
|
1327
|
-
var N, E, j, v, Ye, Ke, Ze, ge, K, Q, ie, re,
|
|
1337
|
+
var N, E, j, v, Ye, Ke, Ze, ge, K, Q, ie, re, se;
|
|
1328
1338
|
class Cn extends G {
|
|
1329
1339
|
constructor({
|
|
1330
1340
|
filters: t = null,
|
|
1331
1341
|
config_port: e = null,
|
|
1332
1342
|
no_device: n = 1,
|
|
1333
|
-
device_listen_on_port:
|
|
1343
|
+
device_listen_on_port: s = 3
|
|
1334
1344
|
} = {}) {
|
|
1335
|
-
super({ filters: t, config_port: e, no_device: n, device_listen_on_port:
|
|
1345
|
+
super({ filters: t, config_port: e, no_device: n, device_listen_on_port: s });
|
|
1336
1346
|
S(this, v);
|
|
1337
1347
|
S(this, N, !1);
|
|
1338
1348
|
S(this, E, 0);
|
|
@@ -1383,10 +1393,10 @@ class Cn extends G {
|
|
|
1383
1393
|
let n = null;
|
|
1384
1394
|
try {
|
|
1385
1395
|
n = new Uint8Array(t.length + 8), n.set(t, 2), n[0] = 2, n[1] = t.length + 4, n[n.length - 2] = 3;
|
|
1386
|
-
let
|
|
1396
|
+
let s = 0;
|
|
1387
1397
|
for (let h = 1; h < t.length; h++)
|
|
1388
|
-
|
|
1389
|
-
n[t.length + 2] =
|
|
1398
|
+
s += t[h], s *= parseInt(Math.pow(2, h - 1).toString());
|
|
1399
|
+
n[t.length + 2] = s % 256, n[t.length + 3] = e * 3 % 256, n[t.length + 4] = e * 8 % 256;
|
|
1390
1400
|
let c = 0;
|
|
1391
1401
|
for (let h = 3; h < t.length + 5; h++)
|
|
1392
1402
|
c += n[h];
|
|
@@ -1395,15 +1405,15 @@ class Cn extends G {
|
|
|
1395
1405
|
for (let h = 0; h < n.length - 1; h++)
|
|
1396
1406
|
u ^= n[h];
|
|
1397
1407
|
n[n.length - 1] = u;
|
|
1398
|
-
} catch (
|
|
1399
|
-
this.serialErrors(`Error generating command: ${
|
|
1408
|
+
} catch (s) {
|
|
1409
|
+
this.serialErrors(`Error generating command: ${s.message}`), n = null;
|
|
1400
1410
|
}
|
|
1401
1411
|
return n;
|
|
1402
1412
|
}
|
|
1403
1413
|
serialLockerHexCmd(t) {
|
|
1404
1414
|
const e = this.serialLockerCmdMaker(t), n = [];
|
|
1405
|
-
for (let
|
|
1406
|
-
n.push(this.decToHex(e[
|
|
1415
|
+
for (let s = 0; s < e.length; s++)
|
|
1416
|
+
n.push(this.decToHex(e[s]));
|
|
1407
1417
|
return n;
|
|
1408
1418
|
}
|
|
1409
1419
|
serialLockerGetConnectionCmd(t = 3) {
|
|
@@ -1425,13 +1435,13 @@ class Cn extends G {
|
|
|
1425
1435
|
}
|
|
1426
1436
|
async enable({ cell: t = 1 } = {}) {
|
|
1427
1437
|
t = i(this, v, K).call(this, t);
|
|
1428
|
-
const [e, n] = this.parseCellToColumnRow(t),
|
|
1429
|
-
await this.appendToQueue(
|
|
1438
|
+
const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, ge).call(this, { enable: !0, column: e, row: n });
|
|
1439
|
+
await this.appendToQueue(s, "activate");
|
|
1430
1440
|
}
|
|
1431
1441
|
async disable({ cell: t = 1 } = {}) {
|
|
1432
1442
|
t = i(this, v, K).call(this, t);
|
|
1433
|
-
const [e, n] = this.parseCellToColumnRow(t),
|
|
1434
|
-
await this.appendToQueue(
|
|
1443
|
+
const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, ge).call(this, { enable: !1, column: e, row: n });
|
|
1444
|
+
await this.appendToQueue(s, "disable");
|
|
1435
1445
|
}
|
|
1436
1446
|
async openAll() {
|
|
1437
1447
|
if (this.isDispensing) throw new Error("Another dispensing process is running");
|
|
@@ -1450,10 +1460,10 @@ class Cn extends G {
|
|
|
1450
1460
|
x(this, E, 90), i(this, v, re).call(this), i(this, v, Q).call(this);
|
|
1451
1461
|
}
|
|
1452
1462
|
async disableAll() {
|
|
1453
|
-
i(this, v, Q).call(this), x(this, N, !0), i(this, v,
|
|
1463
|
+
i(this, v, Q).call(this), x(this, N, !0), i(this, v, se).call(this);
|
|
1454
1464
|
for (let t = 1; t <= 90; t++)
|
|
1455
|
-
await this.enable(t), x(this, E, t), i(this, v,
|
|
1456
|
-
x(this, E, 90), i(this, v,
|
|
1465
|
+
await this.enable(t), x(this, E, t), i(this, v, se).call(this);
|
|
1466
|
+
x(this, E, 90), i(this, v, se).call(this), i(this, v, Q).call(this);
|
|
1457
1467
|
}
|
|
1458
1468
|
}
|
|
1459
1469
|
N = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye = function() {
|
|
@@ -1471,8 +1481,8 @@ N = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye =
|
|
|
1471
1481
|
}, ge = function({ enable: t = !0, column: e = 0, row: n = 10 } = {}) {
|
|
1472
1482
|
if (e < 0 || e > 8) throw new Error("Invalid column number");
|
|
1473
1483
|
if (n < 0 || n > 10) throw new Error("Invalid row number");
|
|
1474
|
-
let
|
|
1475
|
-
return t || (
|
|
1484
|
+
let s = 1;
|
|
1485
|
+
return t || (s = 0), this.serialLockerHexCmd(new Uint8Array([48, this.__internal__.device.listen_on_port, e, n, s]));
|
|
1476
1486
|
}, // #serialLockerGetOpenCmd(cell = 1) {
|
|
1477
1487
|
// cell = this.#validateCell(cell);
|
|
1478
1488
|
// const time = this.__internal__.device.milliseconds;
|
|
@@ -1491,20 +1501,20 @@ K = function(t) {
|
|
|
1491
1501
|
x(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:open", { percentage: y(this, j), dispensed: t });
|
|
1492
1502
|
}, re = function() {
|
|
1493
1503
|
x(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:enable", { percentage: y(this, j) });
|
|
1494
|
-
},
|
|
1504
|
+
}, se = function() {
|
|
1495
1505
|
x(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:disable", { percentage: y(this, j) });
|
|
1496
1506
|
};
|
|
1497
|
-
var l, Xe, et, tt, B,
|
|
1507
|
+
var l, Xe, et, tt, B, ae, nt, it, rt, st, at, ot, lt, ct, dt, ht, ut, pt, _t, ft, bt, yt, wt, kt, vt, mt, gt, Ct, xt, Tt, Dt, Et, L, F, oe, P, O, It, St, Mt, Ft, Z, Ce, xe, le, ce, Pt;
|
|
1498
1508
|
class xn extends G {
|
|
1499
1509
|
constructor({
|
|
1500
1510
|
filters: t = null,
|
|
1501
1511
|
config_port: e = null,
|
|
1502
1512
|
no_device: n = 1,
|
|
1503
|
-
device_listen_on_port:
|
|
1513
|
+
device_listen_on_port: s = 1,
|
|
1504
1514
|
type: c = "esplus",
|
|
1505
1515
|
support_cart: u = !0
|
|
1506
1516
|
} = {}) {
|
|
1507
|
-
super({ filters: t, config_port: e, no_device: n, device_listen_on_port:
|
|
1517
|
+
super({ filters: t, config_port: e, no_device: n, device_listen_on_port: s });
|
|
1508
1518
|
S(this, l);
|
|
1509
1519
|
A(this, "__device", {
|
|
1510
1520
|
type: "esplus",
|
|
@@ -1532,7 +1542,7 @@ class xn extends G {
|
|
|
1532
1542
|
}
|
|
1533
1543
|
});
|
|
1534
1544
|
if (this.__internal__.device.type = "jofemar", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
|
|
1535
|
-
this.__internal__.time.response_general = 800, this.__internal__.dispense.limit_counter = 40, this.__internal__.dispense.timeout = 0, this.__internal__.dispense.timeout_time = 4e3, this.__internal__.dispense.interval = 0, this.__internal__.dispense.interval_time = 1e3, this.__internal__.device.hex_number = (128 + this.listenOnPort).toString(16), this.__internal__.dispense.elevator = {
|
|
1545
|
+
this.__internal__.dispense.must_response = !0, this.__internal__.time.response_general = 800, this.__internal__.time.response_engines = 800, this.__internal__.dispense.limit_counter = 40, this.__internal__.dispense.timeout = 0, this.__internal__.dispense.timeout_time = 4e3, this.__internal__.dispense.interval = 0, this.__internal__.dispense.interval_time = 1e3, this.__internal__.device.hex_number = (128 + this.listenOnPort).toString(16), this.__internal__.device.door_open = !1, this.__internal__.dispense.elevator = {
|
|
1536
1546
|
locking_time: 60,
|
|
1537
1547
|
locking_interval: 0,
|
|
1538
1548
|
need_reset: !1
|
|
@@ -1567,8 +1577,8 @@ class xn extends G {
|
|
|
1567
1577
|
}
|
|
1568
1578
|
serialJofemarMakeBytes(t) {
|
|
1569
1579
|
let e = this.hexToDec(this.sumHex(t)), n = this.calcCheckSums(e.toString());
|
|
1570
|
-
for (let
|
|
1571
|
-
t.push(this.hexMaker(n[
|
|
1580
|
+
for (let s = 0; s < 2; s++)
|
|
1581
|
+
t.push(this.hexMaker(n[s]));
|
|
1572
1582
|
return t.push("03"), this.add0x(t);
|
|
1573
1583
|
}
|
|
1574
1584
|
calcCheckSums(t) {
|
|
@@ -1578,8 +1588,8 @@ class xn extends G {
|
|
|
1578
1588
|
}
|
|
1579
1589
|
serialSetConnectionConstant(t = 1) {
|
|
1580
1590
|
let e = ["02", "30", "30", (128 + t).toString(16), "53", "FF", "FF"], n = [];
|
|
1581
|
-
return e.forEach((
|
|
1582
|
-
n.push(this.hexMaker(
|
|
1591
|
+
return e.forEach((s) => {
|
|
1592
|
+
n.push(this.hexMaker(s));
|
|
1583
1593
|
}), this.serialJofemarMakeBytes(n);
|
|
1584
1594
|
}
|
|
1585
1595
|
serialMessage(t) {
|
|
@@ -1626,24 +1636,27 @@ class xn extends G {
|
|
|
1626
1636
|
cart: e = !1
|
|
1627
1637
|
} = {}) {
|
|
1628
1638
|
if (t = parseInt(t), isNaN(t) || t < 1 || t > 130) throw new Error("Invalid selection");
|
|
1629
|
-
const { channel: n, tray:
|
|
1639
|
+
const { channel: n, tray: s } = i(this, l, St).call(this, t);
|
|
1630
1640
|
this.__internal__.dispense.backup_dispense = {
|
|
1631
1641
|
selection: t,
|
|
1632
1642
|
cart: e,
|
|
1633
1643
|
channel: n,
|
|
1634
|
-
tray:
|
|
1644
|
+
tray: s
|
|
1635
1645
|
};
|
|
1636
|
-
let u = ["02", "30", "30", this.__internal__.device.hex_number, "56",
|
|
1637
|
-
e && (u[4] = "4D"), u = i(this, l,
|
|
1646
|
+
let u = ["02", "30", "30", this.__internal__.device.hex_number, "56", s, n];
|
|
1647
|
+
e && (u[4] = "4D"), u = i(this, l, ae).call(this, u);
|
|
1638
1648
|
let h;
|
|
1639
1649
|
do
|
|
1640
1650
|
h = await this.internalDispense(u), i(this, l, Mt).call(this), h.error === "elevator-locked" ? await i(this, l, nt).call(this) : h.error === "no-response" && await W(1e3);
|
|
1641
1651
|
while (["elevator-locked", "no-response"].includes(h.error));
|
|
1642
1652
|
return this.__internal__.dispense.backup_dispense = {}, h;
|
|
1643
1653
|
}
|
|
1654
|
+
internalClearSensing() {
|
|
1655
|
+
super.internalClearSensing(), this.__internal__.dispense.timeout && clearTimeout(this.__internal__.dispense.timeout), this.__internal__.dispense.interval && clearInterval(this.__internal__.dispense.interval), this.__internal__.serial.queue.length > 0 && (this.__internal__.serial.queue = this.__internal__.serial.queue.filter((t) => t.type !== "status"));
|
|
1656
|
+
}
|
|
1644
1657
|
async endDispense() {
|
|
1645
1658
|
let e = ["02", "30", "30", this.__internal__.device.hex_number, "4D", "80", "80"];
|
|
1646
|
-
return e = i(this, l,
|
|
1659
|
+
return e = i(this, l, ae).call(this, e), await this.internalDispense(e);
|
|
1647
1660
|
}
|
|
1648
1661
|
async collect() {
|
|
1649
1662
|
const t = ["02", "30", "30", "81", "4E", "FF", "FF"];
|
|
@@ -1704,8 +1717,8 @@ class xn extends G {
|
|
|
1704
1717
|
t = parseFloat(t);
|
|
1705
1718
|
const e = this.__device.type === "iceplus" ? 6.5 : 32, n = this.__device.type === "iceplus" ? -25 : 0.5;
|
|
1706
1719
|
if (isNaN(t) || t < n || t > e || t % 0.5 !== 0) throw new Error("Invalid degrees, must be a multiple of 0.5 and between 0.5 and 32");
|
|
1707
|
-
let
|
|
1708
|
-
return this.__device.type === "iceplus" && (
|
|
1720
|
+
let s = t * 2 + 128;
|
|
1721
|
+
return this.__device.type === "iceplus" && (s += 51), s = Math.ceil(s), await this.program("54", s.toString(16));
|
|
1709
1722
|
}
|
|
1710
1723
|
/**
|
|
1711
1724
|
* @param {number|string} tray
|
|
@@ -1812,7 +1825,7 @@ class xn extends G {
|
|
|
1812
1825
|
if (isNaN(e) || e < 0 || e > 10 || e % 0.1 !== 0) throw new Error("Invalid seconds, valid range is 0.0 to 10.0 with a step of 0.1");
|
|
1813
1826
|
const n = 109 + t;
|
|
1814
1827
|
e = e.toFixed(1);
|
|
1815
|
-
const
|
|
1828
|
+
const s = 128 + e * 10, c = ["02", "30", "30", "81", "45", n, s];
|
|
1816
1829
|
return await i(this, l, B).call(this, c, "channel-running-after-dispense");
|
|
1817
1830
|
}
|
|
1818
1831
|
async checkData(t, e = "FF") {
|
|
@@ -1918,8 +1931,8 @@ class xn extends G {
|
|
|
1918
1931
|
*/
|
|
1919
1932
|
async setDisplayMessageTemporarily({ message: t = "", seconds: e = 1 }) {
|
|
1920
1933
|
if (t = t.substring(0, 32), e = parseInt(e), isNaN(e) || e < 1 || e > 125) throw new Error("Invalid seconds, valid range is 1 to 125");
|
|
1921
|
-
const n = i(this, l, ce).call(this, t),
|
|
1922
|
-
return await i(this, l, le).call(this,
|
|
1934
|
+
const n = i(this, l, ce).call(this, t), s = (128 + e).toString(16);
|
|
1935
|
+
return await i(this, l, le).call(this, s, n);
|
|
1923
1936
|
}
|
|
1924
1937
|
/**
|
|
1925
1938
|
* @param {string} message
|
|
@@ -1942,8 +1955,8 @@ class xn extends G {
|
|
|
1942
1955
|
*/
|
|
1943
1956
|
async eventsConfig({ event: t = null, enable: e = !0 } = {}) {
|
|
1944
1957
|
if (t === null) throw new Error("Invalid event");
|
|
1945
|
-
const
|
|
1946
|
-
return await i(this, l, B).call(this,
|
|
1958
|
+
const s = ["02", "30", "30", "81", "41", t, e ? "31" : "30"];
|
|
1959
|
+
return await i(this, l, B).call(this, s, "events-config");
|
|
1947
1960
|
}
|
|
1948
1961
|
async eventEnable({ event: t = null } = {}) {
|
|
1949
1962
|
if (t === null) throw new Error("Invalid event");
|
|
@@ -1968,8 +1981,8 @@ class xn extends G {
|
|
|
1968
1981
|
for (let n = t; n <= e; n++)
|
|
1969
1982
|
this.__device.channels.verification.current = n, await this.getChannelPresence({ selection: n });
|
|
1970
1983
|
return new Promise((n) => {
|
|
1971
|
-
let
|
|
1972
|
-
this.__device.channels.verification.channels.length === e - t + 1 && (clearInterval(
|
|
1984
|
+
let s = setInterval(() => {
|
|
1985
|
+
this.__device.channels.verification.channels.length === e - t + 1 && (clearInterval(s), this.dispatch("channels", { channels: this.__device.channels.verification.channels }), this.__device.channels.verification.clear(), n(!0));
|
|
1973
1986
|
}, 500);
|
|
1974
1987
|
});
|
|
1975
1988
|
}
|
|
@@ -2011,15 +2024,15 @@ l = new WeakSet(), Xe = function() {
|
|
|
2011
2024
|
for (const e of t)
|
|
2012
2025
|
this.serialRegisterAvailableListener(e);
|
|
2013
2026
|
}, et = function() {
|
|
2014
|
-
this.on("internal:dispense:running",
|
|
2027
|
+
this.on("internal:dispense:running", i(this, l, Ft).bind(this));
|
|
2015
2028
|
}, tt = function() {
|
|
2016
2029
|
D.add(this);
|
|
2017
2030
|
}, B = function(t, e) {
|
|
2018
|
-
return t[3] = this.__internal__.device.hex_number, this.appendToQueue(i(this, l,
|
|
2019
|
-
},
|
|
2031
|
+
return t[3] = this.__internal__.device.hex_number, this.appendToQueue(i(this, l, ae).call(this, t), e);
|
|
2032
|
+
}, ae = function(t) {
|
|
2020
2033
|
let e = this.hexToDec(this.sumHex(t)), n = this.calcCheckSums(e.toString());
|
|
2021
|
-
for (let
|
|
2022
|
-
t.push(this.hexMaker(n[
|
|
2034
|
+
for (let s = 0; s < 2; s++)
|
|
2035
|
+
t.push(this.hexMaker(n[s]));
|
|
2023
2036
|
return t.push("03"), t;
|
|
2024
2037
|
}, nt = async function() {
|
|
2025
2038
|
if (this.__internal__.dispense.elevator.locking_interval) return;
|
|
@@ -2061,9 +2074,9 @@ l = new WeakSet(), Xe = function() {
|
|
|
2061
2074
|
44: "D"
|
|
2062
2075
|
};
|
|
2063
2076
|
return e.additional.ascii = n[t] ?? null, e.name = "Key pressed", e.description = `The key ${e.additional.ascii} was pressed`, e.no_code = 2, this.dispatch("keyboard:pressed", e.additional), e;
|
|
2064
|
-
}, at = function(t, e) {
|
|
2065
|
-
return e.additional = { open: !1 }, e.no_code = 3, t === "4f" ? (e.name = "door open", e.description = "The door was opened", e.additional.open = !0, this.dispatch("door:event", e.additional)) : t === "43" ? (e.name = "door close", e.description = "The door was closed", e.additional.open = !1, this.dispatch("door:event", e.additional)) : (e.name = "door event", e.description = "The door event received is unknown", this.dispatch("door:event", { open: e.additional.open, message: e })), e;
|
|
2066
2077
|
}, st = function(t, e) {
|
|
2078
|
+
return e.additional = { open: !1 }, e.no_code = 3, t === "4f" ? (e.name = "door open", e.description = "The door was opened", e.additional.open = !0, this.__internal__.device.door_open = !0, this.dispatch("door:event", e.additional)) : t === "43" ? (e.name = "door close", e.description = "The door was closed", e.additional.open = !1, this.__internal__.device.door_open = !1, this.dispatch("door:event", e.additional)) : (e.name = "door event", e.description = "The door event received is unknown", this.dispatch("door:event", { open: e.additional.open, message: e })), e;
|
|
2079
|
+
}, at = function(t, e) {
|
|
2067
2080
|
e.no_code = 404;
|
|
2068
2081
|
let n = t[5] ?? null;
|
|
2069
2082
|
return n && this.listenOnPort > 1 && (n = this.hexToDec(n) - this.listenOnPort + 1, n = this.decToHex(n)), n && (n === "FD" ? (e.no_code = 4, e.name = "channel disconnected", e.description = "The channel is disconnected", e.additional = { active: !1 }) : n === "FC" ? (e.no_code = 5, e.name = "channel connected", e.description = "The channel is connected", e.additional = { active: !0 }) : (e.no_code = 6, e.name = "channel sold out", e.description = "The channel is empty", e.additional = { active: !0 }), this.__device.channels.verification.running && (this.__device.channels.verification.channels.push({
|
|
@@ -2072,14 +2085,14 @@ l = new WeakSet(), Xe = function() {
|
|
|
2072
2085
|
}), e.additional.selection = this.__device.channels.verification.current), this.dispatch("channel:status", e.additional)), e;
|
|
2073
2086
|
}, ot = function(t, e) {
|
|
2074
2087
|
e.no_code = 39, e.name = "Program version";
|
|
2075
|
-
const n = t.slice(4, 12),
|
|
2076
|
-
return e.additional = { version:
|
|
2088
|
+
const n = t.slice(4, 12), s = n.map((c) => String.fromCharCode(this.hexToDec(c))).join("");
|
|
2089
|
+
return e.additional = { version: s, hex: n }, e.description = `The program version is ${s}`, this.dispatch("program:version", e.additional), e;
|
|
2077
2090
|
}, lt = function(t, e) {
|
|
2078
2091
|
e.no_code = 39, e.name = "Machine faults", e.description = "No faults detected", e.additional = { no_faults: 0, faults: [] };
|
|
2079
2092
|
const n = t.slice(4, -3);
|
|
2080
2093
|
if (n.length > 1 && n[0] !== "30") {
|
|
2081
2094
|
e.description = "Machine has faults";
|
|
2082
|
-
const
|
|
2095
|
+
const s = {
|
|
2083
2096
|
31: "Busy",
|
|
2084
2097
|
32: "Invalid tray",
|
|
2085
2098
|
33: "Invalid channel",
|
|
@@ -2114,19 +2127,19 @@ l = new WeakSet(), Xe = function() {
|
|
|
2114
2127
|
64: "Product detector didn't change during its verification test"
|
|
2115
2128
|
};
|
|
2116
2129
|
for (const c of n)
|
|
2117
|
-
|
|
2130
|
+
s[c] && (e.additional.faults.push(s[c]), e.additional.no_faults++);
|
|
2118
2131
|
}
|
|
2119
2132
|
return this.dispatch("machine:faults", e.additional), e;
|
|
2120
2133
|
}, ct = function(t, e) {
|
|
2121
2134
|
e.no_code = 40, e.name = "Clock registers", e.description = "Clock registers";
|
|
2122
|
-
const n = t.slice(4, -3),
|
|
2135
|
+
const n = t.slice(4, -3), s = n.map((fe) => String.fromCharCode(this.hexToDec(fe))).join(""), [c, u] = s.split(" "), [h, b] = c.split(":"), [g, T, I] = u.split("-"), U = new Date(2e3 + parseInt(I), parseInt(T) - 1, parseInt(g), parseInt(h), parseInt(b));
|
|
2123
2136
|
return e.additional = {
|
|
2124
2137
|
day: g,
|
|
2125
2138
|
month: T,
|
|
2126
2139
|
year: I,
|
|
2127
2140
|
hours: h,
|
|
2128
2141
|
minutes: b,
|
|
2129
|
-
formatted:
|
|
2142
|
+
formatted: s,
|
|
2130
2143
|
date: U,
|
|
2131
2144
|
hex: n
|
|
2132
2145
|
}, this.dispatch("clock:registers", e.additional), e;
|
|
@@ -2134,9 +2147,9 @@ l = new WeakSet(), Xe = function() {
|
|
|
2134
2147
|
e.no_code = 41, e.name = "Machine activity", e.description = "Events from read machine activity";
|
|
2135
2148
|
const n = String.fromCharCode(this.hexToDec(t[4]));
|
|
2136
2149
|
if (n !== "0") {
|
|
2137
|
-
const
|
|
2138
|
-
if (n === "T" &&
|
|
2139
|
-
const c = String.fromCharCode(this.hexToDec(
|
|
2150
|
+
const s = t.slice(5, -3);
|
|
2151
|
+
if (n === "T" && s.length === 4) {
|
|
2152
|
+
const c = String.fromCharCode(this.hexToDec(s[0])), u = String.fromCharCode(this.hexToDec(s[1])), h = String.fromCharCode(this.hexToDec(s[3]));
|
|
2140
2153
|
e.additional = {
|
|
2141
2154
|
ascii: n,
|
|
2142
2155
|
type: "DU.d",
|
|
@@ -2146,8 +2159,8 @@ l = new WeakSet(), Xe = function() {
|
|
|
2146
2159
|
time: parseFloat(`${c}${u}.${h}`),
|
|
2147
2160
|
meaning: "Extraction time (in seconds)"
|
|
2148
2161
|
};
|
|
2149
|
-
} else if (["B", "D", "E", "F", "G"].includes(n) &&
|
|
2150
|
-
const c = String.fromCharCode(this.hexToDec(
|
|
2162
|
+
} else if (["B", "D", "E", "F", "G"].includes(n) && s.length === 3) {
|
|
2163
|
+
const c = String.fromCharCode(this.hexToDec(s[0])), u = String.fromCharCode(this.hexToDec(s[1])), h = String.fromCharCode(this.hexToDec(s[2])), b = parseInt(`${c}${u}${h}`), g = {
|
|
2151
2164
|
B: "Error on going to tray channel",
|
|
2152
2165
|
D: "Error on product detector",
|
|
2153
2166
|
E: "Extraction of channel ok",
|
|
@@ -2164,8 +2177,8 @@ l = new WeakSet(), Xe = function() {
|
|
|
2164
2177
|
ascii: n,
|
|
2165
2178
|
meaning: g[n] ?? "Unknown"
|
|
2166
2179
|
};
|
|
2167
|
-
} else if (
|
|
2168
|
-
const c =
|
|
2180
|
+
} else if (s.length === 13) {
|
|
2181
|
+
const c = s.map((un) => String.fromCharCode(this.hexToDec(un))).join(""), u = parseInt(c.slice(0, 2)), h = parseInt(c.slice(2, 4)), b = parseInt(c.slice(4, 6)), g = parseInt(c.slice(7, 9)), T = parseInt(c.slice(9, 11)) - 1, I = 2e3 + parseInt(c.slice(11, 13)), U = new Date(I, T, g, u, h, b), fe = {
|
|
2169
2182
|
A: "Attempt to close product exit door",
|
|
2170
2183
|
C: "Closing of exterior door",
|
|
2171
2184
|
H: "Error on opening of product exit door",
|
|
@@ -2186,7 +2199,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2186
2199
|
e.additional = {
|
|
2187
2200
|
type: "hhmmssWddMMAA",
|
|
2188
2201
|
date: U,
|
|
2189
|
-
hex:
|
|
2202
|
+
hex: s,
|
|
2190
2203
|
formatted: U.toLocaleString(),
|
|
2191
2204
|
ascii: n,
|
|
2192
2205
|
meaning: fe[n] ?? "Unknown"
|
|
@@ -2316,7 +2329,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2316
2329
|
e.request = "--automatic", e = i(this, l, rt).call(this, t[3], e);
|
|
2317
2330
|
break;
|
|
2318
2331
|
case "50":
|
|
2319
|
-
e.request = "--automatic", e = i(this, l,
|
|
2332
|
+
e.request = "--automatic", e = i(this, l, st).call(this, t[3], e);
|
|
2320
2333
|
break;
|
|
2321
2334
|
case "43":
|
|
2322
2335
|
switch (e.request = "check-data", t[3]) {
|
|
@@ -2324,7 +2337,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2324
2337
|
e = i(this, l, dt).call(this, t, e);
|
|
2325
2338
|
break;
|
|
2326
2339
|
case "43":
|
|
2327
|
-
e.request = "channel-status", e = i(this, l,
|
|
2340
|
+
e.request = "channel-status", e = i(this, l, at).call(this, t, e);
|
|
2328
2341
|
break;
|
|
2329
2342
|
case "50":
|
|
2330
2343
|
e = i(this, l, ot).call(this, t, e);
|
|
@@ -2528,6 +2541,7 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
|
|
|
2528
2541
|
}, Mt = function() {
|
|
2529
2542
|
this.__internal__.dispense.timeout && clearTimeout(this.__internal__.dispense.timeout), this.__internal__.dispense.interval && clearInterval(this.__internal__.dispense.interval), this.__internal__.dispense.timeout = 0, this.__internal__.dispense.interval = 0;
|
|
2530
2543
|
}, Ft = function() {
|
|
2544
|
+
this.__internal__.dispense.timeout && clearTimeout(this.__internal__.dispense.timeout), this.__internal__.dispense.interval && clearInterval(this.__internal__.dispense.interval);
|
|
2531
2545
|
const t = this;
|
|
2532
2546
|
t.__internal__.dispense.timeout = setTimeout(() => {
|
|
2533
2547
|
t.__internal__.dispense.interval = setInterval(() => {
|
|
@@ -2539,12 +2553,12 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
|
|
|
2539
2553
|
const e = ["02", "30", "30", "81", "52", t, "FF"];
|
|
2540
2554
|
return await i(this, l, B).call(this, e, "reset");
|
|
2541
2555
|
}, Ce = function() {
|
|
2542
|
-
const t = this.__device.type === "iceplus" ? we(40) : we(25), e = /* @__PURE__ */ new Date(), n = 1e3 * t + e.getTime(),
|
|
2556
|
+
const t = this.__device.type === "iceplus" ? we(40) : we(25), e = /* @__PURE__ */ new Date(), n = 1e3 * t + e.getTime(), s = new Date(n);
|
|
2543
2557
|
this.dispatch("reset:errors", {
|
|
2544
2558
|
description: "Resetting machine errors",
|
|
2545
2559
|
duration: t,
|
|
2546
2560
|
started_at: e,
|
|
2547
|
-
finished_at:
|
|
2561
|
+
finished_at: s
|
|
2548
2562
|
});
|
|
2549
2563
|
}, xe = async function(t) {
|
|
2550
2564
|
const e = ["02", "30", "30", "81", "4C", t, "FF"];
|
|
@@ -2560,12 +2574,12 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
|
|
|
2560
2574
|
return e;
|
|
2561
2575
|
}, Pt = function(t) {
|
|
2562
2576
|
if (!(t instanceof Date)) throw new Error("Invalid date, must be an instance of Date");
|
|
2563
|
-
const e = t.getHours().toString().padStart(2, "0"), n = t.getMinutes().toString().padStart(2, "0"),
|
|
2577
|
+
const e = t.getHours().toString().padStart(2, "0"), n = t.getMinutes().toString().padStart(2, "0"), s = t.getDate().toString().padStart(2, "0"), c = (t.getMonth() + 1).toString().padStart(2, "0"), u = t.getFullYear().toString().substring(2, 4), h = `${e}:${n} ${s}-${c}-${u}`, b = [];
|
|
2564
2578
|
for (let g = 0; g < 14; g++)
|
|
2565
2579
|
b.push(h.charCodeAt(g).toString(16));
|
|
2566
2580
|
return b;
|
|
2567
2581
|
};
|
|
2568
|
-
var ee, V, J, d, Nt, At, de, Bt,
|
|
2582
|
+
var ee, V, J, d, Nt, At, de, Bt, qt, Rt, Ht, Lt, Ot, Ut, jt, Te, Wt, $t, Qt, Vt, Jt, zt, Gt, Yt, Kt, Zt, Xt, en, tn, nn, q, he, rn, sn, an, on, De, ue, ln, cn, Ee, Ie, Se;
|
|
2569
2583
|
class Tn extends G {
|
|
2570
2584
|
constructor({
|
|
2571
2585
|
filters: t = null,
|
|
@@ -2624,7 +2638,7 @@ class Tn extends G {
|
|
|
2624
2638
|
S(this, V, 0);
|
|
2625
2639
|
S(this, J, 0);
|
|
2626
2640
|
if (this.__internal__.device.type = "boardroid", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
|
|
2627
|
-
this.__internal__.serial.config_port.baudRate = 115200, this.__internal__.serial.response.length = 14, this.__internal__.time.response_connection = 600, this.__internal__.time.response_general = 4e3, this.__internal__.dispense.limit_counter = 15, this.__internal__.dispense.custom_limit_counter = null, this.__internal__.dispense.backup_dispense = {
|
|
2641
|
+
this.__internal__.serial.config_port.baudRate = 115200, this.__internal__.serial.response.length = 14, this.__internal__.time.response_connection = 600, this.__internal__.time.response_general = 4e3, this.__internal__.time.response_engines = 15e3, this.__internal__.dispense.limit_counter = 15, this.__internal__.dispense.custom_limit_counter = null, this.__internal__.dispense.backup_dispense = {
|
|
2628
2642
|
channel: 1,
|
|
2629
2643
|
second_channel: null,
|
|
2630
2644
|
sensor: !0,
|
|
@@ -2674,8 +2688,8 @@ class Tn extends G {
|
|
|
2674
2688
|
}
|
|
2675
2689
|
serialBoardroidSumHex(t) {
|
|
2676
2690
|
let e = 0;
|
|
2677
|
-
return t.forEach((n,
|
|
2678
|
-
|
|
2691
|
+
return t.forEach((n, s) => {
|
|
2692
|
+
s !== 0 && s !== 11 && (e += parseInt(n, 16));
|
|
2679
2693
|
}), e.toString(16).toUpperCase();
|
|
2680
2694
|
}
|
|
2681
2695
|
serialMessage(t) {
|
|
@@ -2689,7 +2703,7 @@ class Tn extends G {
|
|
|
2689
2703
|
const n = (5 + this.deviceNumber).toString(16).padStart(2, "0").toLowerCase();
|
|
2690
2704
|
switch (t[1]) {
|
|
2691
2705
|
case n:
|
|
2692
|
-
e.request = "connect", e = i(this, d,
|
|
2706
|
+
e.request = "connect", e = i(this, d, qt).call(this, e);
|
|
2693
2707
|
break;
|
|
2694
2708
|
case "a0":
|
|
2695
2709
|
e.request = "--automatic", e = i(this, d, Wt).call(this, t, e);
|
|
@@ -2752,7 +2766,7 @@ class Tn extends G {
|
|
|
2752
2766
|
async coinPurseConfigure({ enable: t = !1, high: e = "FF", low: n = "FF" } = {}) {
|
|
2753
2767
|
if (!this.__coin_purse.available) throw new Error("Coin purse not available");
|
|
2754
2768
|
const c = ["F1", "C1", t ? "01" : "00", e, n, "00", "00", "00", "00", "00", "F2", "00"];
|
|
2755
|
-
await i(this, d,
|
|
2769
|
+
await i(this, d, q).call(this, c, "coin-purse:config");
|
|
2756
2770
|
}
|
|
2757
2771
|
async coinPurseEnable() {
|
|
2758
2772
|
await this.coinPurseConfigure({ enable: !0 });
|
|
@@ -2760,40 +2774,40 @@ class Tn extends G {
|
|
|
2760
2774
|
async coinPurseDisable() {
|
|
2761
2775
|
await this.coinPurseConfigure({ enable: !1 });
|
|
2762
2776
|
}
|
|
2763
|
-
async coinPurseDispense({ $_50c: t = 0, $_1: e = 0, $_2: n = 0, $_5:
|
|
2777
|
+
async coinPurseDispense({ $_50c: t = 0, $_1: e = 0, $_2: n = 0, $_5: s = 0, $_10: c = 0 } = {}) {
|
|
2764
2778
|
if (!this.__coin_purse.available) throw new Error("Coin purse not available");
|
|
2765
|
-
if ([t, e, n,
|
|
2779
|
+
if ([t, e, n, s, c].some((h) => isNaN(h) || typeof h == "string"))
|
|
2766
2780
|
throw new Error("One of the values is not a number");
|
|
2767
|
-
if (t < 1 && e < 1 && n < 1 &&
|
|
2768
|
-
[t, e, n,
|
|
2781
|
+
if (t < 1 && e < 1 && n < 1 && s < 1 && c < 1) throw new Error("No coins to dispense");
|
|
2782
|
+
[t, e, n, s, c] = [
|
|
2769
2783
|
this.decToHex(t),
|
|
2770
2784
|
this.decToHex(e),
|
|
2771
2785
|
this.decToHex(n),
|
|
2772
|
-
this.decToHex(
|
|
2786
|
+
this.decToHex(s),
|
|
2773
2787
|
this.decToHex(c)
|
|
2774
2788
|
];
|
|
2775
|
-
let u = ["F1", "C6", t, e, n,
|
|
2776
|
-
await i(this, d,
|
|
2789
|
+
let u = ["F1", "C6", t, e, n, s, c, "00", "00", "00", "F2", "00"];
|
|
2790
|
+
await i(this, d, q).call(this, u, "coin-purse:dispense");
|
|
2777
2791
|
}
|
|
2778
2792
|
async coinPurseReadTubes() {
|
|
2779
2793
|
const t = ["F1", "C2", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
2780
|
-
await i(this, d,
|
|
2794
|
+
await i(this, d, q).call(this, t, "coin-purse:read-tubes");
|
|
2781
2795
|
}
|
|
2782
2796
|
async banknotePurseConfigure({ enable: t = !1, scrow: e = !1 } = {}) {
|
|
2783
2797
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2784
2798
|
let n;
|
|
2785
|
-
return i(this, d, de).call(this) ? n = i(this, d, rn).call(this, { enable: t, scrow: e }) : n = i(this, d,
|
|
2799
|
+
return i(this, d, de).call(this) ? n = i(this, d, rn).call(this, { enable: t, scrow: e }) : n = i(this, d, sn).call(this, { enable: t, scrow: e }), await i(this, d, q).call(this, n, "banknote-purse:config");
|
|
2786
2800
|
}
|
|
2787
|
-
async banknotePurseDispense({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200:
|
|
2801
|
+
async banknotePurseDispense({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200: s = 0, $_500: c = 0, $_1000: u = 0 } = {}) {
|
|
2788
2802
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2789
2803
|
if (!this.__banknote_purse.isRecycler) throw new Error("Banknote purse is not recycler");
|
|
2790
2804
|
let h;
|
|
2791
2805
|
if (i(this, d, de).call(this)) {
|
|
2792
|
-
const b = [t, e, n,
|
|
2793
|
-
h = i(this, d,
|
|
2806
|
+
const b = [t, e, n, s, c];
|
|
2807
|
+
h = i(this, d, an).call(this, b[this.__banknote_purse.recycler.banknote]);
|
|
2794
2808
|
} else
|
|
2795
|
-
h = i(this, d, on).call(this, { $_20: t, $_50: e, $_100: n, $_200:
|
|
2796
|
-
await i(this, d,
|
|
2809
|
+
h = i(this, d, on).call(this, { $_20: t, $_50: e, $_100: n, $_200: s, $_500: c, $_1000: u });
|
|
2810
|
+
await i(this, d, q).call(this, h, "banknote-purse:dispense");
|
|
2797
2811
|
}
|
|
2798
2812
|
async banknotePurseEnable({ scrow: t = !1 }) {
|
|
2799
2813
|
return await this.banknotePurseConfigure({ enable: !0, scrow: t });
|
|
@@ -2804,24 +2818,24 @@ class Tn extends G {
|
|
|
2804
2818
|
async banknotePurseAcceptInScrow() {
|
|
2805
2819
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2806
2820
|
const t = ["F1", "C4", "01", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
2807
|
-
await i(this, d,
|
|
2821
|
+
await i(this, d, q).call(this, t, "banknote-purse:banknote-scrow-status");
|
|
2808
2822
|
}
|
|
2809
2823
|
async banknotePurseRejectInScrow() {
|
|
2810
2824
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2811
2825
|
const t = ["F1", "C4", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
2812
|
-
await i(this, d,
|
|
2826
|
+
await i(this, d, q).call(this, t, "banknote-purse:banknote-scrow-status");
|
|
2813
2827
|
}
|
|
2814
2828
|
async banknotePurseSaveMemory({
|
|
2815
2829
|
channel: t = null,
|
|
2816
2830
|
$_20: e = null,
|
|
2817
2831
|
$_50: n = null,
|
|
2818
|
-
$_100:
|
|
2832
|
+
$_100: s = null,
|
|
2819
2833
|
$_200: c = null,
|
|
2820
2834
|
$_500: u = null,
|
|
2821
2835
|
$_1000: h = null
|
|
2822
2836
|
} = {}) {
|
|
2823
2837
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2824
|
-
if (t === null || e === null || n === null ||
|
|
2838
|
+
if (t === null || e === null || n === null || s === null || c === null || u === null || h === null)
|
|
2825
2839
|
throw new Error("One of the values is not defined");
|
|
2826
2840
|
const b = [
|
|
2827
2841
|
"F1",
|
|
@@ -2830,39 +2844,39 @@ class Tn extends G {
|
|
|
2830
2844
|
"00",
|
|
2831
2845
|
this.decToHex(e),
|
|
2832
2846
|
this.decToHex(n),
|
|
2833
|
-
this.decToHex(
|
|
2847
|
+
this.decToHex(s),
|
|
2834
2848
|
this.decToHex(c),
|
|
2835
2849
|
this.decToHex(u),
|
|
2836
2850
|
this.decToHex(h),
|
|
2837
2851
|
"F2",
|
|
2838
2852
|
"00"
|
|
2839
2853
|
];
|
|
2840
|
-
await i(this, d,
|
|
2854
|
+
await i(this, d, q).call(this, b, "banknote-purse:save-memory");
|
|
2841
2855
|
}
|
|
2842
2856
|
async banknotePurseReadRecycler() {
|
|
2843
2857
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2844
2858
|
if (!this.__banknote_purse.isRecycler) throw new Error("Banknote purse is not recycler");
|
|
2845
2859
|
const t = ["F1", "C3", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "B5"];
|
|
2846
|
-
return await i(this, d,
|
|
2860
|
+
return await i(this, d, q).call(this, t, "banknote-purse:read-recycler");
|
|
2847
2861
|
}
|
|
2848
2862
|
async cardReaderDisable() {
|
|
2849
2863
|
if (!this.card_reader.available) throw new Error("Card reader not available");
|
|
2850
2864
|
const t = ["F1", "CD", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
2851
|
-
return await i(this, d,
|
|
2865
|
+
return await i(this, d, q).call(this, t, "card-reader:disable");
|
|
2852
2866
|
}
|
|
2853
|
-
async cardReaderDispense({ channel: t = 1, second_channel: e = null, sensor: n = !0, seconds:
|
|
2867
|
+
async cardReaderDispense({ channel: t = 1, second_channel: e = null, sensor: n = !0, seconds: s = null, price: c = 0 } = {}) {
|
|
2854
2868
|
if (!this.card_reader.available) throw new Error("Card reader not available");
|
|
2855
2869
|
if (isNaN(this.card_reader.max_pre_credit) || this.card_reader.max_pre_credit === 0) throw new Error("Card reader pre-credit not configured");
|
|
2856
2870
|
if (isNaN(c) || c <= 0) throw new Error("Price must be greater than 0");
|
|
2857
2871
|
if (c > this.card_reader.max_pre_credit) throw new Error("Price is greater than pre-credit configured");
|
|
2858
|
-
if (!n && (
|
|
2872
|
+
if (!n && (s === null || s <= 0 || s > 40)) throw new Error("Invalid time to dispense without sensor, must be between 0.1 and 40.0 seconds");
|
|
2859
2873
|
const u = this.decToHex(c / 256), h = this.decToHex(c % 256), b = this.decToHex(t + 9);
|
|
2860
2874
|
let g = "00";
|
|
2861
2875
|
e && (g = this.decToHex(e + 9));
|
|
2862
2876
|
let T = "00";
|
|
2863
|
-
n || (T = this.decToHex(
|
|
2877
|
+
n || (T = this.decToHex(s * 10));
|
|
2864
2878
|
const I = ["F1", "CD", "01", b, g, T, u, h, "00", "00", "F2", "00"];
|
|
2865
|
-
await i(this, d,
|
|
2879
|
+
await i(this, d, q).call(this, I, "card-reader:dispense");
|
|
2866
2880
|
}
|
|
2867
2881
|
async paymentPursesDisable({ coin: t = !0, banknote: e = !0, cardReader: n = !1 } = {}) {
|
|
2868
2882
|
t && await this.coinPurseDisable(), e && await this.banknotePurseDisable(), n && await this.cardReaderDisable();
|
|
@@ -2872,7 +2886,7 @@ class Tn extends G {
|
|
|
2872
2886
|
}
|
|
2873
2887
|
async coolingRelayConfigure({ enable: t = !1 } = {}) {
|
|
2874
2888
|
const n = ["F1", "CC", t ? "01" : "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
2875
|
-
return await i(this, d,
|
|
2889
|
+
return await i(this, d, q).call(this, n, "status:relay");
|
|
2876
2890
|
}
|
|
2877
2891
|
async coolingRelayEnable() {
|
|
2878
2892
|
return await this.coolingRelayConfigure({ enable: !0 });
|
|
@@ -2882,7 +2896,7 @@ class Tn extends G {
|
|
|
2882
2896
|
}
|
|
2883
2897
|
async readTemperature() {
|
|
2884
2898
|
const t = ["F1", "CB", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
2885
|
-
return await i(this, d,
|
|
2899
|
+
return await i(this, d, q).call(this, t, "status:temperature");
|
|
2886
2900
|
}
|
|
2887
2901
|
/**
|
|
2888
2902
|
* Dispense a product from the machine
|
|
@@ -2897,23 +2911,23 @@ class Tn extends G {
|
|
|
2897
2911
|
selection: t = 1,
|
|
2898
2912
|
second_selection: e = null,
|
|
2899
2913
|
sensor: n = !0,
|
|
2900
|
-
seconds:
|
|
2914
|
+
seconds: s = null,
|
|
2901
2915
|
retry: c = !0
|
|
2902
2916
|
} = {}) {
|
|
2903
2917
|
if (t = parseInt(t), isNaN(t) || t < 1 || t > 80) throw new Error("Invalid channel number");
|
|
2904
2918
|
if (e !== null && (e < 1 || e > 80 || e === t)) throw new Error("Invalid second channel number");
|
|
2905
|
-
if (!n && (
|
|
2919
|
+
if (!n && (s === null || s <= 0 || s > 40)) throw new Error("Invalid time to dispense without sensor, must be between 0.1 and 40.0 seconds");
|
|
2906
2920
|
c && (this.__internal__.dispense.backup_dispense = {
|
|
2907
2921
|
selection: t,
|
|
2908
2922
|
second_selection: e,
|
|
2909
2923
|
sensor: n,
|
|
2910
|
-
seconds:
|
|
2924
|
+
seconds: s
|
|
2911
2925
|
}), t += 9;
|
|
2912
2926
|
const u = this.decToHex(t);
|
|
2913
2927
|
let h = "00";
|
|
2914
2928
|
e && (e += 9, h = this.decToHex(e));
|
|
2915
2929
|
let b = "00";
|
|
2916
|
-
n || (b = this.decToHex(Math.round(
|
|
2930
|
+
n || (b = this.decToHex(Math.round(s * 6.2)), this.__internal__.dispense.custom_limit_counter = s);
|
|
2917
2931
|
const g = i(this, d, he).call(this, ["F1", "C7", u, h, b, "00", "00", "00", "00", "00", "F2", "00"]);
|
|
2918
2932
|
let T = await this.internalDispense(g);
|
|
2919
2933
|
return !T.dispensed && c && (T = await this.internalDispense(g)), this.__internal__.dispense.custom_limit_counter = null, T;
|
|
@@ -2924,14 +2938,14 @@ class Tn extends G {
|
|
|
2924
2938
|
const e = [];
|
|
2925
2939
|
i(this, d, ue).call(this);
|
|
2926
2940
|
for (let n = 1; n <= 80; n++) {
|
|
2927
|
-
const
|
|
2941
|
+
const s = await this.dispense({
|
|
2928
2942
|
selection: n,
|
|
2929
2943
|
second_selection: t ? null : n + 1,
|
|
2930
2944
|
sensor: !1,
|
|
2931
2945
|
seconds: 0.4,
|
|
2932
2946
|
retry: !1
|
|
2933
2947
|
});
|
|
2934
|
-
e.push(
|
|
2948
|
+
e.push(s), x(this, V, n), i(this, d, ue).call(this), t || n++;
|
|
2935
2949
|
}
|
|
2936
2950
|
x(this, V, 80), i(this, d, ue).call(this, { dispensed: e }), i(this, d, De).call(this);
|
|
2937
2951
|
}
|
|
@@ -2974,6 +2988,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
2974
2988
|
"session:money-dispensed",
|
|
2975
2989
|
"session:money-request",
|
|
2976
2990
|
"event:door",
|
|
2991
|
+
"door:event",
|
|
2977
2992
|
"status:relay",
|
|
2978
2993
|
"status:temperature"
|
|
2979
2994
|
];
|
|
@@ -2985,9 +3000,9 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
2985
3000
|
return this.__banknote_purse.isRecycler && this.__banknote_purse.recycler.ict;
|
|
2986
3001
|
}, Bt = function() {
|
|
2987
3002
|
return this.hasCoinPurse || this.hasRecycler;
|
|
2988
|
-
}, Rt = function(t) {
|
|
2989
|
-
return t.name = "Connection with the serial device completed.", t.description = "Your connection with the serial device was successfully completed.", t.no_code = 1, this.dispatch("run:default-load", {}), t;
|
|
2990
3003
|
}, qt = function(t) {
|
|
3004
|
+
return t.name = "Connection with the serial device completed.", t.description = "Your connection with the serial device was successfully completed.", t.no_code = 1, this.dispatch("run:default-load", {}), t;
|
|
3005
|
+
}, Rt = function(t) {
|
|
2991
3006
|
const e = {
|
|
2992
3007
|
g50: ["40", "50", "60", "70", "90"],
|
|
2993
3008
|
c50: ["41", "51", "61", "71", "91"],
|
|
@@ -3055,23 +3070,23 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3055
3070
|
if (i(this, d, Ht).call(this, t)) {
|
|
3056
3071
|
if (typeof this.coins.tubes[t] > "u") return;
|
|
3057
3072
|
e === "tube" ? this.coins.tubes[t] += 1 : e === "box" && (this.coins.box[t] += 1);
|
|
3058
|
-
let
|
|
3059
|
-
["g50", "c50"].includes(t) ?
|
|
3073
|
+
let s = 0;
|
|
3074
|
+
["g50", "c50"].includes(t) ? s = 0.5 : s += parseInt(t.slice(1)), this.coins.totals[t] += s, this.__money_session.inserted += s, this.coins.total += s;
|
|
3060
3075
|
} else if (i(this, d, Ot).call(this, t)) {
|
|
3061
3076
|
if (typeof this.banknotes.tubes[t] > "u") return;
|
|
3062
3077
|
e === "recycler" ? this.banknotes.recycler[t] += 1 : e === "stacker" && (this.banknotes.stacker[t] += 1);
|
|
3063
|
-
let
|
|
3064
|
-
this.banknotes.totals[t] +=
|
|
3078
|
+
let s = parseInt(t.slice(1));
|
|
3079
|
+
this.banknotes.totals[t] += s, this.__money_session.inserted += s, this.banknotes.total += s;
|
|
3065
3080
|
} else if (i(this, d, Ut).call(this, t) && e === "out") {
|
|
3066
3081
|
if (typeof this.banknotes.out[t] > "u") return;
|
|
3067
3082
|
this.banknotes.out[t] += 1;
|
|
3068
|
-
let
|
|
3069
|
-
this.__money_session.retired +=
|
|
3083
|
+
let s = parseInt(t.slice(1));
|
|
3084
|
+
this.__money_session.retired += s, this.banknotes.recycler[t] -= 1, this.banknotes.total -= s, n = !1, this.dispatch("session:money-dispensed", { type_money: t, retired: s, finish: !1, type: "banknotes" });
|
|
3070
3085
|
}
|
|
3071
3086
|
n && this.dispatch("session:money-request", {});
|
|
3072
3087
|
}, Wt = function(t, e) {
|
|
3073
3088
|
const n = parseInt(t[2], 16);
|
|
3074
|
-
return e.name = "Coin Inserted", e.no_code = 2, e.additional = { where: null, coin: null }, n === 1 ? (e.name = "Lever pressed", e.description = "Reject lever", e.no_code = 100, this.dispatch("coin-purse:reject-lever", {})) : n === 2 ? (e.name = "Reset coin purse", e.description = "The configuration of coin purse was reset", e.no_code = 101, this.dispatch("coin-purse:reset", {})) : n >= 64 && n <= 79 ? (e.name = "Coin inserted in profit box", e.additional.where = "box") : n >= 80 && n <= 95 ? (e.name = "Coin inserted in tube", e.additional.where = "tube") : n >= 96 && n <= 111 ? (e.name = "Unused coin", e.description = "Something come from coin changer but in MDB Docs is unused", e.additional.where = "unused") : n >= 112 && n <= 127 ? (e.name = "Coin rejected", e.additional.where = "rejected") : n >= 144 && n <= 159 ? (e.name = "Coin dispensed", e.additional.where = "out", e.description = `Undefined value: ¿${t[2]}?`) : (e.name = "Coin inserted", e.description = "Undefined status. Without information of this", e.no_code = 400), n === 1 || n === 2 || n >= 160 || n >= 128 && n <= 143 || ([e.description, e.additional.coin] = i(this, d,
|
|
3089
|
+
return e.name = "Coin Inserted", e.no_code = 2, e.additional = { where: null, coin: null }, n === 1 ? (e.name = "Lever pressed", e.description = "Reject lever", e.no_code = 100, this.dispatch("coin-purse:reject-lever", {})) : n === 2 ? (e.name = "Reset coin purse", e.description = "The configuration of coin purse was reset", e.no_code = 101, this.dispatch("coin-purse:reset", {})) : n >= 64 && n <= 79 ? (e.name = "Coin inserted in profit box", e.additional.where = "box") : n >= 80 && n <= 95 ? (e.name = "Coin inserted in tube", e.additional.where = "tube") : n >= 96 && n <= 111 ? (e.name = "Unused coin", e.description = "Something come from coin changer but in MDB Docs is unused", e.additional.where = "unused") : n >= 112 && n <= 127 ? (e.name = "Coin rejected", e.additional.where = "rejected") : n >= 144 && n <= 159 ? (e.name = "Coin dispensed", e.additional.where = "out", e.description = `Undefined value: ¿${t[2]}?`) : (e.name = "Coin inserted", e.description = "Undefined status. Without information of this", e.no_code = 400), n === 1 || n === 2 || n >= 160 || n >= 128 && n <= 143 || ([e.description, e.additional.coin] = i(this, d, Rt).call(this, t[2]), e.no_code = 38 + n, i(this, d, Te).call(this, e.additional.coin, e.additional.where), ["tube", "out"].includes(e.additional.where) && this.dispatch("coin-purse:tubes", this.coins.tubes), this.dispatch("coin-purse:coin-event", this.coins)), e;
|
|
3075
3090
|
}, $t = function(t, e) {
|
|
3076
3091
|
const n = parseInt(t[2], 16);
|
|
3077
3092
|
return e.name = "Banknote Inserted", e.no_code = 2, e.additional = { where: null, banknote: null }, n === 42 ? (e.name = "Banknote dispensed", e.description = "Banknote dispensed by request.", e.additional.banknote = i(this, d, jt).call(this), e.additional.where = "out", e.no_code = 200) : n >= 128 && n <= 143 ? (e.name = "Banknote inserted", e.additional.where = "stacker") : n >= 144 && n <= 159 ? (e.name = "Banknote inserted in pre stacker", e.additional.where = "tmp") : n >= 160 && n <= 175 ? (e.name = "Banknote rejected", e.additional.where = "nothing") : n >= 176 && n <= 191 && (e.name = "Banknote inserted", e.additional.where = "recycler"), n >= 128 && n <= 191 && ([e.description, e.additional.banknote] = i(this, d, Lt).call(this, t[2]), e.no_code = 74 + n), i(this, d, Te).call(this, e.additional.banknote, e.additional.where), this.dispatch("banknote-purse:event-banknote", this.banknotes), e;
|
|
@@ -3079,11 +3094,11 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3079
3094
|
const n = parseInt(t, 16);
|
|
3080
3095
|
return n === 1 ? (e.name = "Coin purse enabled", e.description = "Configuration complete, enabled", e.no_code = 3) : n === 0 ? (e.name = "Coin purse disabled", e.description = "Disabled by system request", e.no_code = 4) : (e.name = "Status unknown", e.description = "The response of coin purse doesn't identify successfully", e.no_code = 400), this.dispatch("coin-purse:config", { enabled: n === 1 }), e;
|
|
3081
3096
|
}, Vt = function(t, e) {
|
|
3082
|
-
const n = parseInt(t[2], 16),
|
|
3083
|
-
return n === 0 ? (e.name = "Bill purse disabled", e.description = "Configuration complete, disabled") : n === 1 && (e.name = "Bill purse enabled", e.description = "Configuration complete, enabled"),
|
|
3097
|
+
const n = parseInt(t[2], 16), s = parseInt(t[3], 16);
|
|
3098
|
+
return n === 0 ? (e.name = "Bill purse disabled", e.description = "Configuration complete, disabled") : n === 1 && (e.name = "Bill purse enabled", e.description = "Configuration complete, enabled"), s === 0 ? e.additional.scrow = "Scrow disabled, banknote received automatic" : s === 1 && (e.additional.scrow = "Scrow enabled, require manual action"), e.no_code = 5, this.dispatch("banknote-purse:config", { enabled: n === 1, scrow: s === 1 }), e;
|
|
3084
3099
|
}, Jt = function(t, e) {
|
|
3085
3100
|
e.no_code = 6;
|
|
3086
|
-
const [n,
|
|
3101
|
+
const [n, s, c, u, h, b] = [
|
|
3087
3102
|
parseInt(t[2], 16),
|
|
3088
3103
|
parseInt(t[3], 16),
|
|
3089
3104
|
parseInt(t[4], 16),
|
|
@@ -3092,11 +3107,11 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3092
3107
|
parseInt(t[7], 16)
|
|
3093
3108
|
];
|
|
3094
3109
|
return e.additional = {
|
|
3095
|
-
coins: { g50: n, c50:
|
|
3096
|
-
}, this.coins.tubes.g50 = n, this.coins.tubes.c50 =
|
|
3110
|
+
coins: { g50: n, c50: s, p1: c, p2: u, p5: h, p10: b }
|
|
3111
|
+
}, this.coins.tubes.g50 = n, this.coins.tubes.c50 = s, this.coins.tubes.p1 = c, this.coins.tubes.p2 = u, this.coins.tubes.p5 = h, this.coins.tubes.p10 = b, this.coins.totals.g50 = (this.coins.box.g50 + n) * 0.5, this.coins.totals.c50 = (this.coins.box.c50 + s) * 0.5, this.coins.totals.p1 = this.coins.box.p1 + c, this.coins.totals.p2 = (this.coins.box.p2 + u) * 2, this.coins.totals.p5 = (this.coins.box.p5 + h) * 5, this.coins.totals.p10 = (this.coins.box.p10 + b) * 10, this.coins.total = this.coins.totals.g50 + this.coins.totals.c50 + this.coins.totals.p1 + this.coins.totals.p2 + this.coins.totals.p5 + this.coins.totals.p10, e.name = "Read tubes", e.description = "Quantity of coins approximated", this.dispatch("coin-purse:tubes", this.coins.tubes), e;
|
|
3097
3112
|
}, zt = function(t, e) {
|
|
3098
3113
|
e.no_code = 7;
|
|
3099
|
-
const [n,
|
|
3114
|
+
const [n, s, c, u, h, b] = [
|
|
3100
3115
|
parseInt(t[2], 16),
|
|
3101
3116
|
parseInt(t[3], 16),
|
|
3102
3117
|
parseInt(t[4], 16),
|
|
@@ -3105,22 +3120,22 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3105
3120
|
parseInt(t[7], 16)
|
|
3106
3121
|
];
|
|
3107
3122
|
return e.additional = {
|
|
3108
|
-
banknotes: { b20: n, b50:
|
|
3109
|
-
}, this.banknotes.recycler.p20 = n, this.banknotes.recycler.p50 =
|
|
3123
|
+
banknotes: { b20: n, b50: s, b100: c, b200: u, b500: h, b1000: b }
|
|
3124
|
+
}, this.banknotes.recycler.p20 = n, this.banknotes.recycler.p50 = s, this.banknotes.recycler.p100 = c, this.banknotes.recycler.p200 = u, this.banknotes.recycler.p500 = h, this.banknotes.recycler.p1000 = b, this.banknotes.totals.p20 = (this.banknotes.stacker.p20 + n) * 20, this.banknotes.totals.p50 = (this.banknotes.stacker.p50 + s) * 50, this.banknotes.totals.p100 = (this.banknotes.stacker.p100 + c) * 100, this.banknotes.totals.p200 = (this.banknotes.stacker.p200 + u) * 200, this.banknotes.totals.p500 = (this.banknotes.stacker.p500 + h) * 500, this.banknotes.totals.p1000 = (this.banknotes.stacker.p1000 + b) * 1e3, this.banknotes.total = this.banknotes.totals.p20 + this.banknotes.totals.p50 + this.banknotes.totals.p100 + this.banknotes.totals.p200 + this.banknotes.totals.p500 + this.banknotes.totals.p1000, e.name = "Read recycler", e.description = "Quantity of banknotes approximated", this.dispatch("banknote-purse:recycler", this.banknotes.recycler), e;
|
|
3110
3125
|
}, Gt = function(t, e) {
|
|
3111
3126
|
const n = parseInt(t, 16);
|
|
3112
3127
|
return n === 1 ? e.name = "Banknote accepted" : n === 0 ? e.name = "Banknote rejected" : e.name = "Unknown status banknote", e.no_code = 8, this.dispatch("banknote-purse:banknote-scrow-status", { status: n === 1 }), e;
|
|
3113
3128
|
}, Yt = function(t, e) {
|
|
3114
|
-
const [n,
|
|
3129
|
+
const [n, s, c, u, h, b] = [
|
|
3115
3130
|
parseInt(t[2], 16),
|
|
3116
3131
|
parseInt(t[3], 16),
|
|
3117
3132
|
parseInt(t[4], 16),
|
|
3118
3133
|
parseInt(t[5], 16),
|
|
3119
3134
|
parseInt(t[6], 16),
|
|
3120
3135
|
parseInt(t[7], 16)
|
|
3121
|
-
], g = n * 20 +
|
|
3136
|
+
], g = n * 20 + s * 50 + c * 100 + u * 200 + h * 500 + b * 1e3;
|
|
3122
3137
|
return e.name = "Banknotes dispensed", e.description = g > 0 ? "Banknotes dispensed by request" : "No banknotes dispensed, recycler empty", e.no_code = 9, e.additional = {
|
|
3123
|
-
banknotes: { b20: n, b50:
|
|
3138
|
+
banknotes: { b20: n, b50: s, b100: c, b200: u, b500: h, b1000: b },
|
|
3124
3139
|
total_dispensed: g
|
|
3125
3140
|
}, this.dispatch("session:money-dispensed", {
|
|
3126
3141
|
type_money: null,
|
|
@@ -3141,18 +3156,18 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3141
3156
|
return n === 1 ? (e.name = "Product not delivered", e.description = "The product requested wasn't delivered", e.no_code = 11, this.__internal__.dispense.status = !1) : n === 0 ? (e.name = "Product delivered", e.description = "The product requested was delivered", e.no_code = 12, this.__internal__.dispense.status = !0) : (e.name = "Unknown status product", e.description = "The response of product doesn't identify successfully", e.no_code = 400, this.__internal__.dispense.status = !1), this.dispatch("dispensed", {}), e;
|
|
3142
3157
|
}, Xt = function(t, e) {
|
|
3143
3158
|
let n = "closed";
|
|
3144
|
-
return t === "db" ? (e.name = "Door closed", e.no_code = 13) : t === "dc" ? (e.name = "Door open", e.no_code = 14, n = "open") : (e.name = "Unknown status door", e.description = "The response of door doesn't identify successfully", e.no_code = 400, n = "unknown"), this.dispatch("event:door", { open: n === "open" }), e;
|
|
3159
|
+
return t === "db" ? (e.name = "Door closed", e.no_code = 13) : t === "dc" ? (e.name = "Door open", e.no_code = 14, n = "open") : (e.name = "Unknown status door", e.description = "The response of door doesn't identify successfully", e.no_code = 400, n = "unknown"), this.__internal__.device.door_open = n === "open", this.dispatch("event:door", { open: n === "open" }), this.dispatch("door:event", { open: n === "open" }), e;
|
|
3145
3160
|
}, en = function(t, e) {
|
|
3146
|
-
const n = parseInt(t[2], 16) * 255,
|
|
3161
|
+
const n = parseInt(t[2], 16) * 255, s = parseInt(t[3], 16), c = (n + s) * 0.1;
|
|
3147
3162
|
return e.no_code = 15, e.name = "Temperature status", e.description = `Temperature: ${c}`, e.additional = {
|
|
3148
3163
|
high: n,
|
|
3149
|
-
low:
|
|
3164
|
+
low: s,
|
|
3150
3165
|
temperature: parseFloat(c.toString())
|
|
3151
3166
|
}, this.dispatch("status:temperature", e.additional), e;
|
|
3152
3167
|
}, tn = function(t, e) {
|
|
3153
3168
|
const n = parseInt(t, 16);
|
|
3154
|
-
let
|
|
3155
|
-
return n === 1 ? (e.name = "Relay on", e.description = "Relay on", e.no_code = 16,
|
|
3169
|
+
let s = "unknown";
|
|
3170
|
+
return n === 1 ? (e.name = "Relay on", e.description = "Relay on", e.no_code = 16, s = "on") : n === 0 ? (e.name = "Relay off", e.description = "Relay off", e.no_code = 17, s = "off") : (e.name = "Status unknown", e.description = "Status unknown", e.no_code = 400), this.dispatch("status:relay", { enabled: s === "on" }), e;
|
|
3156
3171
|
}, nn = function(t, e) {
|
|
3157
3172
|
const n = parseInt(t[2], 16);
|
|
3158
3173
|
if (e.no_code = 20 + n, e.name = "Status unknown", e.description = "The status of card reader does not identified correctly", e.no_code = 400, n === 0)
|
|
@@ -3172,36 +3187,36 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3172
3187
|
else if (n === 8)
|
|
3173
3188
|
e.request += ":cancel", e.name = "Cancelled", e.description = "Cancellation complete";
|
|
3174
3189
|
else if (n === 10) {
|
|
3175
|
-
const
|
|
3176
|
-
|
|
3190
|
+
const s = parseInt(t[8], 16);
|
|
3191
|
+
s === 0 ? (e.no_code = 30, e.name = "product not dispensed", e.description = "The product requested wasn't delivered") : s === 1 && (e.no_code = 31, e.name = "product dispensed", e.description = "The product requested was delivered");
|
|
3177
3192
|
}
|
|
3178
3193
|
return this.dispatch("card-reader:event", e), e;
|
|
3179
|
-
},
|
|
3194
|
+
}, q = function(t, e) {
|
|
3180
3195
|
return this.appendToQueue(i(this, d, he).call(this, t), e);
|
|
3181
3196
|
}, he = function(t) {
|
|
3182
3197
|
return t[11] = this.serialBoardroidSumHex(t), t.map((e, n) => {
|
|
3183
3198
|
t[n] = this.hexMaker(e);
|
|
3184
3199
|
}), t;
|
|
3185
3200
|
}, rn = function({ enable: t = !1, scrow: e = !1 } = {}) {
|
|
3186
|
-
const n = t ? "FF" : "00",
|
|
3187
|
-
return ["F1", "C0", n, n,
|
|
3188
|
-
},
|
|
3201
|
+
const n = t ? "FF" : "00", s = e ? "FF" : "00";
|
|
3202
|
+
return ["F1", "C0", n, n, s, s, "00", "00", "00", "00", "F2", "00"];
|
|
3203
|
+
}, sn = function({ enable: t = !1, scrow: e = !1 } = {}) {
|
|
3189
3204
|
return ["F1", "C0", t ? "01" : "00", e ? "01" : "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
3190
|
-
},
|
|
3205
|
+
}, an = function(t = 1) {
|
|
3191
3206
|
if (t < 1) throw new Error("No banknotes to dispense");
|
|
3192
3207
|
return t = this.decToHex(t), ["F1", "C5", this.decToHex(this.__banknote_purse.recycler.banknote.toString()), t, "00", "00", "00", "00", "00", "00", "F2", "00"];
|
|
3193
|
-
}, on = function({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200:
|
|
3194
|
-
if ([t, e, n,
|
|
3208
|
+
}, on = function({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200: s = 0, $_500: c = 0, $_1000: u = 0 } = {}) {
|
|
3209
|
+
if ([t, e, n, s, c, u].some((h) => isNaN(h) || typeof h == "string"))
|
|
3195
3210
|
throw new Error("One of the values is not a number");
|
|
3196
|
-
if (t < 1 && e < 1 && n < 1 &&
|
|
3197
|
-
return [t, e, n,
|
|
3211
|
+
if (t < 1 && e < 1 && n < 1 && s < 1 && c < 1 && u < 1) throw new Error("No banknotes to dispense");
|
|
3212
|
+
return [t, e, n, s, c, u] = [
|
|
3198
3213
|
this.decToHex(t),
|
|
3199
3214
|
this.decToHex(e),
|
|
3200
3215
|
this.decToHex(n),
|
|
3201
|
-
this.decToHex(
|
|
3216
|
+
this.decToHex(s),
|
|
3202
3217
|
this.decToHex(c),
|
|
3203
3218
|
this.decToHex(u)
|
|
3204
|
-
], ["F1", "C5", t, e, n,
|
|
3219
|
+
], ["F1", "C5", t, e, n, s, c, u, "00", "00", "F2", "00"];
|
|
3205
3220
|
}, De = function() {
|
|
3206
3221
|
x(this, ee, !1), x(this, V, 0), x(this, J, 0);
|
|
3207
3222
|
}, /**
|
|
@@ -3212,12 +3227,12 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3212
3227
|
ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
|
|
3213
3228
|
x(this, J, Math.round(y(this, V) * 100 / e)), this.dispatch("percentage:test", { percentage: y(this, J), dispensed: t });
|
|
3214
3229
|
}, ln = function(t) {
|
|
3215
|
-
const e = ["20", "50", "100", "200", "500"], n = "$_" + e[this.__banknote_purse.recycler.banknote],
|
|
3230
|
+
const e = ["20", "50", "100", "200", "500"], n = "$_" + e[this.__banknote_purse.recycler.banknote], s = parseInt(e[this.__banknote_purse.recycler.banknote]), c = parseInt((t / s).toString()), u = {
|
|
3216
3231
|
banknotes: { $_20: 0, $_50: 0, $_100: 0, $_200: 0, $_500: 0, $_1000: 0 },
|
|
3217
3232
|
pending: t,
|
|
3218
3233
|
will_dispense: c > 0
|
|
3219
3234
|
};
|
|
3220
|
-
return this.totalInRecycler === 0 || c < 1 || t === 0 || (u.banknotes[n] = c, u.pending = t %
|
|
3235
|
+
return this.totalInRecycler === 0 || c < 1 || t === 0 || (u.banknotes[n] = c, u.pending = t % s), u;
|
|
3221
3236
|
}, cn = function(t) {
|
|
3222
3237
|
const e = {
|
|
3223
3238
|
banknotes: { $_20: 0, $_50: 0, $_100: 0, $_200: 0, $_500: 0, $_1000: 0 },
|
|
@@ -3238,10 +3253,10 @@ ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
|
|
|
3238
3253
|
if (!i(this, d, Bt).call(this)) throw new Error("Change not available");
|
|
3239
3254
|
let e = this.change, n = this.change;
|
|
3240
3255
|
if (t !== null && (e = t, n = t), n <= 0) return !1;
|
|
3241
|
-
const
|
|
3242
|
-
n =
|
|
3256
|
+
const s = i(this, d, Ee).call(this, n);
|
|
3257
|
+
n = s.pending;
|
|
3243
3258
|
const c = i(this, d, Ie).call(this, n);
|
|
3244
|
-
return n = c.pending, n > 0 && this.dispatch("change:pending", { pending: n }), n === e ? !1 : (
|
|
3259
|
+
return n = c.pending, n > 0 && this.dispatch("change:pending", { pending: n }), n === e ? !1 : (s.will_dispense && await this.banknotePurseDispense(s.banknotes), c.will_dispense && await this.coinPurseDispense(c.coins), !0);
|
|
3245
3260
|
};
|
|
3246
3261
|
var z, dn, hn;
|
|
3247
3262
|
class Dn extends G {
|
|
@@ -3263,8 +3278,8 @@ class Dn extends G {
|
|
|
3263
3278
|
description: null,
|
|
3264
3279
|
request: null,
|
|
3265
3280
|
no_code: 0
|
|
3266
|
-
}, n = t.map((c) => parseInt(c, 16)),
|
|
3267
|
-
switch (e.code =
|
|
3281
|
+
}, n = t.map((c) => parseInt(c, 16)), s = String.fromCharCode(...n).replace(/[\n\r]+/g, "");
|
|
3282
|
+
switch (e.code = s, s) {
|
|
3268
3283
|
case "connected":
|
|
3269
3284
|
e.name = "connected", e.description = "Connection established", e.request = "connect", e.no_code = 100;
|
|
3270
3285
|
break;
|
|
@@ -3288,7 +3303,7 @@ class Dn extends G {
|
|
|
3288
3303
|
t += `
|
|
3289
3304
|
`;
|
|
3290
3305
|
const n = e.encode(t);
|
|
3291
|
-
return Array.from(n).map((
|
|
3306
|
+
return Array.from(n).map((s) => s.toString(16));
|
|
3292
3307
|
}
|
|
3293
3308
|
// eslint-disable-next-line no-unused-vars
|
|
3294
3309
|
serialSetConnectionConstant(t = 1) {
|