@danidoble/webserial 4.0.5 → 4.0.6
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 +202 -184
- package/dist/webserial.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/webserial.js
CHANGED
|
@@ -4,7 +4,7 @@ var Me = (f) => {
|
|
|
4
4
|
};
|
|
5
5
|
var _n = (f, r, t) => r in f ? pn(f, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[r] = t;
|
|
6
6
|
var A = (f, r, t) => _n(f, typeof r != "symbol" ? r + "" : r, t), be = (f, r, t) => r.has(f) || Me("Cannot " + t);
|
|
7
|
-
var y = (f, r, t) => (be(f, r, "read from private field"), t ? t.call(f) : r.get(f)), S = (f, r, t) => r.has(f) ? Me("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(f) : r.set(f, t),
|
|
7
|
+
var y = (f, r, t) => (be(f, r, "read from private field"), t ? t.call(f) : r.get(f)), S = (f, r, t) => r.has(f) ? Me("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(f) : r.set(f, t), g = (f, r, t, e) => (be(f, r, "write to private field"), e ? e.call(f, t) : r.set(f, t), t), i = (f, r, t) => (be(f, r, "access private method"), t);
|
|
8
8
|
var M = [];
|
|
9
9
|
for (var ye = 0; ye < 256; ++ye)
|
|
10
10
|
M.push((ye + 256).toString(16).slice(1));
|
|
@@ -67,13 +67,13 @@ class vn extends CustomEvent {
|
|
|
67
67
|
function W(f = 100) {
|
|
68
68
|
return new Promise((r) => setTimeout(() => r(), f));
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Be() {
|
|
71
71
|
return "serial" in navigator;
|
|
72
72
|
}
|
|
73
73
|
function we(f = 1) {
|
|
74
74
|
return f * 1e3;
|
|
75
75
|
}
|
|
76
|
-
var R, H, o, Ae,
|
|
76
|
+
var R, H, o, Ae, Ne, _, ke, x, m, ne, p, ve, Y;
|
|
77
77
|
const a = class a {
|
|
78
78
|
static status(r = null) {
|
|
79
79
|
var e, n;
|
|
@@ -354,78 +354,78 @@ const a = class a {
|
|
|
354
354
|
}
|
|
355
355
|
static rejectLever(r = null) {
|
|
356
356
|
var t, e, n;
|
|
357
|
-
if (!i(t = a, o, _).call(t, r) || !i(e = a, o,
|
|
357
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
358
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
362
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
363
363
|
i(n = a, o, p).call(n, ["2", "A0", "2"]);
|
|
364
364
|
}
|
|
365
365
|
static coinInsertedBox(r = null, t = null) {
|
|
366
366
|
var s, c, u, h;
|
|
367
|
-
if (!i(s = a, o, _).call(s, r) || !i(c = a, o,
|
|
367
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
|
|
368
368
|
const e = ["40", "41", "42", "43", "44", "45"], n = i(u = a, o, ve).call(u, e, t);
|
|
369
369
|
i(h = a, o, p).call(h, ["2", "A0", n]);
|
|
370
370
|
}
|
|
371
371
|
static coinInsertedTube(r = null, t = null) {
|
|
372
372
|
var s, c, u, h;
|
|
373
|
-
if (!i(s = a, o, _).call(s, r) || !i(c = a, o,
|
|
373
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
|
|
374
374
|
const e = ["50", "51", "52", "53", "54", "55"], n = i(u = a, o, ve).call(u, e, t);
|
|
375
375
|
i(h = a, o, p).call(h, ["2", "A0", n]);
|
|
376
376
|
}
|
|
377
377
|
static banknoteInsertedStacker(r = null, t = null) {
|
|
378
378
|
var s, c, u, h;
|
|
379
|
-
if (!i(s = a, o, _).call(s, r) || !i(c = a, o,
|
|
379
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
|
|
380
380
|
const e = ["80", "81", "82", "83", "84"], n = i(u = a, o, Y).call(u, e, t);
|
|
381
381
|
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
382
382
|
}
|
|
383
383
|
static banknoteInsertedEscrow(r = null, t = null) {
|
|
384
384
|
var s, c, u, h;
|
|
385
|
-
if (!i(s = a, o, _).call(s, r) || !i(c = a, o,
|
|
385
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
|
|
386
386
|
const e = ["90", "91", "92", "93", "94"], n = i(u = a, o, Y).call(u, e, t);
|
|
387
387
|
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
388
388
|
}
|
|
389
389
|
static banknoteEjected(r = null, t = null) {
|
|
390
390
|
var s, c, u, h;
|
|
391
|
-
if (!i(s = a, o, _).call(s, r) || !i(c = a, o,
|
|
391
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
|
|
392
392
|
const e = ["A0", "A1", "A2", "A3", "A4"], n = i(u = a, o, Y).call(u, e, t);
|
|
393
393
|
i(h = a, o, p).call(h, ["2", "B0", n]);
|
|
394
394
|
}
|
|
395
395
|
static banknoteInsertedRecycler(r = null, t = null) {
|
|
396
396
|
var s, c, u, h;
|
|
397
|
-
if (!i(s = a, o, _).call(s, r) || !i(c = a, o,
|
|
397
|
+
if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
|
|
398
398
|
const e = ["B0", "B1", "B2", "B3", "B4"], n = i(u = a, o, Y).call(u, e, t);
|
|
399
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
403
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
404
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
408
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
409
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
413
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
414
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
418
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
419
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
423
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
424
424
|
i(n = a, o, p).call(n, ["2", "D1", "1", "1"]);
|
|
425
425
|
}
|
|
426
426
|
static readTubes(r = null) {
|
|
427
|
-
var b,
|
|
428
|
-
if (!i(b = a, o, _).call(b, r) || !i(
|
|
427
|
+
var b, C, T;
|
|
428
|
+
if (!i(b = a, o, _).call(b, r) || !i(C = a, o, x).call(C)) return !1;
|
|
429
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)],
|
|
@@ -438,18 +438,18 @@ const a = class a {
|
|
|
438
438
|
}
|
|
439
439
|
static readBillPurse(r = null, t = null) {
|
|
440
440
|
var n, s, c, u;
|
|
441
|
-
if (!i(n = a, o, _).call(n, r) || !i(s = a, o,
|
|
441
|
+
if (!i(n = a, o, _).call(n, r) || !i(s = a, o, x).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)];
|
|
445
|
-
let b = "0",
|
|
445
|
+
let b = "0", C = "0", T = "0", I = "0", U = "0";
|
|
446
446
|
if (t !== null && !isNaN(parseInt(t)))
|
|
447
447
|
switch (t.toString()) {
|
|
448
448
|
case "20":
|
|
449
449
|
b = h;
|
|
450
450
|
break;
|
|
451
451
|
case "50":
|
|
452
|
-
|
|
452
|
+
C = h;
|
|
453
453
|
break;
|
|
454
454
|
case "100":
|
|
455
455
|
T = h;
|
|
@@ -467,7 +467,7 @@ const a = class a {
|
|
|
467
467
|
b = h;
|
|
468
468
|
break;
|
|
469
469
|
case 1:
|
|
470
|
-
|
|
470
|
+
C = h;
|
|
471
471
|
break;
|
|
472
472
|
case 2:
|
|
473
473
|
T = h;
|
|
@@ -479,9 +479,9 @@ const a = class a {
|
|
|
479
479
|
U = h;
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
|
-
i(c = a, o, p).call(c, ["2", "D3", b,
|
|
482
|
+
i(c = a, o, p).call(c, ["2", "D3", b, C, T, I, U, "0"]);
|
|
483
483
|
} else {
|
|
484
|
-
const [h, b,
|
|
484
|
+
const [h, b, C, T, I, U] = [
|
|
485
485
|
e[Math.floor(Math.random() * 30)],
|
|
486
486
|
e[Math.floor(Math.random() * 30)],
|
|
487
487
|
e[Math.floor(Math.random() * 30)],
|
|
@@ -489,26 +489,26 @@ const a = class a {
|
|
|
489
489
|
e[Math.floor(Math.random())],
|
|
490
490
|
e[Math.floor(Math.random())]
|
|
491
491
|
];
|
|
492
|
-
i(u = a, o, p).call(u, ["2", "D3", h, b,
|
|
492
|
+
i(u = a, o, p).call(u, ["2", "D3", h, b, C, T, I, U]);
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
static banknoteAccepted(r = null) {
|
|
496
496
|
var t, e, n;
|
|
497
|
-
if (!i(t = a, o, _).call(t, r) || !i(e = a, o,
|
|
497
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
498
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
502
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
503
503
|
i(n = a, o, p).call(n, ["2", "D4", "0"]);
|
|
504
504
|
}
|
|
505
505
|
static banknotesDispensed(r = null) {
|
|
506
506
|
var e, n, s, c;
|
|
507
|
-
if (!i(e = a, o, _).call(e, r) || !i(n = a, o,
|
|
507
|
+
if (!i(e = a, o, _).call(e, r) || !i(n = a, o, x).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)];
|
|
511
|
-
let h = "0", b = "0",
|
|
511
|
+
let h = "0", b = "0", C = "0", T = "0", I = "0";
|
|
512
512
|
switch (r._recycler.bill) {
|
|
513
513
|
case 0:
|
|
514
514
|
h = u;
|
|
@@ -517,7 +517,7 @@ const a = class a {
|
|
|
517
517
|
b = u;
|
|
518
518
|
break;
|
|
519
519
|
case 2:
|
|
520
|
-
|
|
520
|
+
C = u;
|
|
521
521
|
break;
|
|
522
522
|
case 3:
|
|
523
523
|
T = u;
|
|
@@ -526,9 +526,9 @@ const a = class a {
|
|
|
526
526
|
I = u;
|
|
527
527
|
break;
|
|
528
528
|
}
|
|
529
|
-
i(s = a, o, p).call(s, ["2", "D5", h, b,
|
|
529
|
+
i(s = a, o, p).call(s, ["2", "D5", h, b, C, T, I, "0"]);
|
|
530
530
|
} else {
|
|
531
|
-
const [u, h, b,
|
|
531
|
+
const [u, h, b, C, T, I] = [
|
|
532
532
|
t[Math.floor(Math.random() * 30)],
|
|
533
533
|
t[Math.floor(Math.random() * 30)],
|
|
534
534
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -536,72 +536,72 @@ const a = class a {
|
|
|
536
536
|
t[Math.floor(Math.random())],
|
|
537
537
|
t[Math.floor(Math.random())]
|
|
538
538
|
];
|
|
539
|
-
i(c = a, o, p).call(c, ["2", "D5", u, h, b,
|
|
539
|
+
i(c = a, o, p).call(c, ["2", "D5", u, h, b, C, T, I]);
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
static coinsDispensed(r = null) {
|
|
543
543
|
var t, e, n;
|
|
544
|
-
if (!i(t = a, o, _).call(t, r) || !i(e = a, o,
|
|
544
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
545
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
549
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
550
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
554
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
555
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
559
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
560
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
564
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
565
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
569
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
570
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
574
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
575
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
579
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
580
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
584
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
585
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
589
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
590
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
594
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
595
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
599
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
600
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 = a, o, _).call(t, r) || !i(e = a, o,
|
|
604
|
+
if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
|
|
605
605
|
i(n = a, o, p).call(n, ["2", "DD", "A", "1"]);
|
|
606
606
|
}
|
|
607
607
|
static fullTray(r = null) {
|
|
@@ -618,16 +618,16 @@ const a = class a {
|
|
|
618
618
|
R = new WeakMap(), H = new WeakMap(), o = new WeakSet(), Ae = function() {
|
|
619
619
|
if (a.enable === !1) throw new Error("Emulator is disabled");
|
|
620
620
|
return a.enable;
|
|
621
|
-
},
|
|
621
|
+
}, Ne = function(r) {
|
|
622
622
|
if (typeof r != "object" || !(r instanceof G)) throw new Error(`Type ${r.typeDevice} is not supported`);
|
|
623
|
-
return a.instance = r,
|
|
623
|
+
return a.instance = r, g(a, R, r.typeDevice), g(a, H, r.deviceNumber), !0;
|
|
624
624
|
}, _ = function(r = null) {
|
|
625
625
|
var t, e;
|
|
626
|
-
return !i(t = a, o, Ae).call(t) || r === null && a.instance === null ? !1 : (a.instance === null && i(e = a, o,
|
|
626
|
+
return !i(t = a, o, Ae).call(t) || r === null && a.instance === null ? !1 : (a.instance === null && i(e = a, o, Ne).call(e, r), !0);
|
|
627
627
|
}, ke = function() {
|
|
628
628
|
if (y(a, R) !== "locker") throw new Error("This function is only available for Locker devices");
|
|
629
629
|
return !0;
|
|
630
|
-
},
|
|
630
|
+
}, x = function() {
|
|
631
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() {
|
|
@@ -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, qe, me,
|
|
751
|
+
var w, qe, me, Q, Re, He, Le, Oe, Ue, je, We, Qe, Ve, Je, ze, $e;
|
|
752
752
|
class G extends Pe {
|
|
753
753
|
/**
|
|
754
754
|
*
|
|
@@ -825,7 +825,7 @@ class G extends Pe {
|
|
|
825
825
|
backup_dispense: {}
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
t && (this.serialFilters = t), e && (this.serialConfigPort = e), n && i(this, w,
|
|
828
|
+
t && (this.serialFilters = t), e && (this.serialConfigPort = e), n && i(this, w, ze).call(this, n), s && (typeof s == "number" || typeof s == "string") && (this.listenOnPort = s), i(this, w, We).call(this), i(this, w, Qe).call(this);
|
|
829
829
|
}
|
|
830
830
|
set listenOnPort(t) {
|
|
831
831
|
if (t = parseInt(t), isNaN(t) || t < 1 || t > 255) throw new Error("Invalid port number");
|
|
@@ -882,7 +882,7 @@ class G extends Pe {
|
|
|
882
882
|
}
|
|
883
883
|
async connect() {
|
|
884
884
|
return new Promise((t, e) => {
|
|
885
|
-
|
|
885
|
+
Be() || e("Web Serial not supported"), setTimeout(async () => {
|
|
886
886
|
await W(499), await this.serialConnect(), this.isConnected ? t(`${this.typeDevice} device ${this.deviceNumber} connected`) : e(`${this.typeDevice} device ${this.deviceNumber} not connected`);
|
|
887
887
|
}, 1);
|
|
888
888
|
});
|
|
@@ -971,7 +971,7 @@ class G extends Pe {
|
|
|
971
971
|
}, this.__internal__.time.response_connection), await i(this, w, me).call(this, this.__internal__.serial.bytes_connection), this.dispatch("serial:sent", {
|
|
972
972
|
action: "connect",
|
|
973
973
|
bytes: this.__internal__.serial.bytes_connection
|
|
974
|
-
}), this.typeDevice === "relay" && i(this, w,
|
|
974
|
+
}), this.typeDevice === "relay" && i(this, w, Q).call(this, ["DD", "DD"], null), await i(this, w, Ue).call(this);
|
|
975
975
|
} catch (t) {
|
|
976
976
|
this.serialErrors(t);
|
|
977
977
|
}
|
|
@@ -1112,7 +1112,7 @@ class G extends Pe {
|
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
softReload() {
|
|
1115
|
-
i(this, w,
|
|
1115
|
+
i(this, w, $e).call(this), this.dispatch("serial:soft-reload", {});
|
|
1116
1116
|
}
|
|
1117
1117
|
async sendConnect() {
|
|
1118
1118
|
await this.appendToQueue(this.__internal__.serial.bytes_connection, "connect");
|
|
@@ -1135,7 +1135,7 @@ w = new WeakSet(), qe = function(t) {
|
|
|
1135
1135
|
}, // #bytesToLowerCase(code = []) {
|
|
1136
1136
|
// return code.map((item) => item.toString().toLowerCase());
|
|
1137
1137
|
// }
|
|
1138
|
-
|
|
1138
|
+
Q = function(t = [], e = null) {
|
|
1139
1139
|
if (t && t.length > 0) {
|
|
1140
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);
|
|
1141
1141
|
const n = [];
|
|
@@ -1162,14 +1162,14 @@ $ = function(t = [], e = null) {
|
|
|
1162
1162
|
let t = [];
|
|
1163
1163
|
for (const e in this.__internal__.serial.response.buffer)
|
|
1164
1164
|
t.push(this.__internal__.serial.response.buffer[e].toString(16));
|
|
1165
|
-
this.__internal__.serial.response.buffer && i(this, w,
|
|
1165
|
+
this.__internal__.serial.response.buffer && i(this, w, Q).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1166
1166
|
}, 400);
|
|
1167
1167
|
}, Oe = async function() {
|
|
1168
1168
|
if (this.__internal__.serial.response.length === this.__internal__.serial.response.buffer.length) {
|
|
1169
1169
|
const t = [];
|
|
1170
1170
|
for (const e in this.__internal__.serial.response.buffer)
|
|
1171
1171
|
t.push(this.__internal__.serial.response.buffer[e].toString(16));
|
|
1172
|
-
await i(this, w,
|
|
1172
|
+
await i(this, w, Q).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1173
1173
|
} else if (this.__internal__.serial.response.length < this.__internal__.serial.response.buffer.length) {
|
|
1174
1174
|
let t = [];
|
|
1175
1175
|
for (let n = 0; n < this.__internal__.serial.response.length; n++)
|
|
@@ -1178,7 +1178,7 @@ $ = function(t = [], e = null) {
|
|
|
1178
1178
|
const n = [];
|
|
1179
1179
|
for (const s in t)
|
|
1180
1180
|
n.push(t[s].toString(16));
|
|
1181
|
-
await i(this, w,
|
|
1181
|
+
await i(this, w, Q).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1182
1182
|
return;
|
|
1183
1183
|
}
|
|
1184
1184
|
t = [];
|
|
@@ -1190,7 +1190,7 @@ $ = function(t = [], e = null) {
|
|
|
1190
1190
|
const n = [];
|
|
1191
1191
|
for (const s in t)
|
|
1192
1192
|
n.push(t[s].toString(16));
|
|
1193
|
-
await i(this, w,
|
|
1193
|
+
await i(this, w, Q).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
@@ -1239,19 +1239,19 @@ $ = function(t = [], e = null) {
|
|
|
1239
1239
|
].forEach((e) => {
|
|
1240
1240
|
this.serialRegisterAvailableListener(e);
|
|
1241
1241
|
});
|
|
1242
|
-
},
|
|
1242
|
+
}, Qe = function() {
|
|
1243
1243
|
const t = this;
|
|
1244
1244
|
this.on("internal:queue", async () => {
|
|
1245
1245
|
var e;
|
|
1246
|
-
await i(e = t, w,
|
|
1247
|
-
}), i(this, w,
|
|
1248
|
-
},
|
|
1246
|
+
await i(e = t, w, Je).call(e);
|
|
1247
|
+
}), i(this, w, Ve).call(this);
|
|
1248
|
+
}, Ve = function() {
|
|
1249
1249
|
const t = this;
|
|
1250
1250
|
navigator.serial.addEventListener("connect", async () => {
|
|
1251
1251
|
t.isDisconnected && await t.serialConnect().catch(() => {
|
|
1252
1252
|
});
|
|
1253
1253
|
});
|
|
1254
|
-
},
|
|
1254
|
+
}, Je = async function() {
|
|
1255
1255
|
if (!this.__internal__.serial.connected) {
|
|
1256
1256
|
await this.serialConnect();
|
|
1257
1257
|
return;
|
|
@@ -1264,16 +1264,16 @@ $ = function(t = [], e = null) {
|
|
|
1264
1264
|
}, e), await i(this, w, me).call(this, t.bytes), this.dispatch("serial:sent", {
|
|
1265
1265
|
action: t.action,
|
|
1266
1266
|
bytes: t.bytes
|
|
1267
|
-
}), this.typeDevice === "relay" && i(this, w,
|
|
1267
|
+
}), this.typeDevice === "relay" && i(this, w, Q).call(this, ["DD", "DD"], null);
|
|
1268
1268
|
const n = [...this.__internal__.serial.queue];
|
|
1269
1269
|
this.__internal__.serial.queue = n.splice(1);
|
|
1270
|
-
},
|
|
1270
|
+
}, ze = function(t = 1) {
|
|
1271
1271
|
this.__internal__.device_number = t, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(t);
|
|
1272
|
-
},
|
|
1272
|
+
}, $e = function() {
|
|
1273
1273
|
this.__internal__.last_error = { message: null, action: null, code: null, no_code: 0 };
|
|
1274
1274
|
};
|
|
1275
1275
|
var X, _e, Ge;
|
|
1276
|
-
class
|
|
1276
|
+
class Cn extends G {
|
|
1277
1277
|
constructor({
|
|
1278
1278
|
filters: t = null,
|
|
1279
1279
|
config_port: e = null,
|
|
@@ -1334,8 +1334,8 @@ class gn extends G {
|
|
|
1334
1334
|
X = new WeakMap(), _e = new WeakSet(), Ge = function() {
|
|
1335
1335
|
D.add(this);
|
|
1336
1336
|
};
|
|
1337
|
-
var
|
|
1338
|
-
class
|
|
1337
|
+
var B, E, j, v, Ye, Ke, Ze, Ce, K, V, ie, re, se;
|
|
1338
|
+
class xn extends G {
|
|
1339
1339
|
constructor({
|
|
1340
1340
|
filters: t = null,
|
|
1341
1341
|
config_port: e = null,
|
|
@@ -1344,7 +1344,7 @@ class Cn extends G {
|
|
|
1344
1344
|
} = {}) {
|
|
1345
1345
|
super({ filters: t, config_port: e, no_device: n, device_listen_on_port: s });
|
|
1346
1346
|
S(this, v);
|
|
1347
|
-
S(this,
|
|
1347
|
+
S(this, B, !1);
|
|
1348
1348
|
S(this, E, 0);
|
|
1349
1349
|
S(this, j, 0);
|
|
1350
1350
|
if (this.__internal__.device.type = "locker", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
|
|
@@ -1365,14 +1365,14 @@ class Cn extends G {
|
|
|
1365
1365
|
case "07":
|
|
1366
1366
|
switch (t[4]) {
|
|
1367
1367
|
case "00":
|
|
1368
|
-
e.name = "Cell closed.", e.description = "The selected cell is closed.", e.request = "dispense", e.no_code = 1102, this.__internal__.dispense.status = !1, this.dispatch("dispensed", {}), y(this,
|
|
1368
|
+
e.name = "Cell closed.", e.description = "The selected cell is closed.", e.request = "dispense", e.no_code = 1102, this.__internal__.dispense.status = !1, this.dispatch("dispensed", {}), y(this, B) && y(this, E) >= 89 ? (e.finished_test = !0, g(this, B, !1), g(this, E, 0)) : y(this, B) && (e.finished_test = !1);
|
|
1369
1369
|
break;
|
|
1370
1370
|
case "01":
|
|
1371
1371
|
case "04":
|
|
1372
|
-
e.name = "Cell open.", e.description = "The selected cell was open successfully.", e.request = "dispense", e.no_code = 102, this.__internal__.dispense.status = !0, this.dispatch("dispensed", {}), y(this,
|
|
1372
|
+
e.name = "Cell open.", e.description = "The selected cell was open successfully.", e.request = "dispense", e.no_code = 102, this.__internal__.dispense.status = !0, this.dispatch("dispensed", {}), y(this, B) && y(this, E) >= 89 ? (e.finished_test = !0, g(this, B, !1), g(this, E, 0)) : y(this, B) && (e.finished_test = !1);
|
|
1373
1373
|
break;
|
|
1374
1374
|
case "05":
|
|
1375
|
-
e.name = "Cell inactive.", e.description = "The selected cell is inactive or doesn't exist.", e.request = "dispense", e.no_code = 101, this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", {}), y(this,
|
|
1375
|
+
e.name = "Cell inactive.", e.description = "The selected cell is inactive or doesn't exist.", e.request = "dispense", e.no_code = 101, this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", {}), y(this, B) && y(this, E) >= 89 ? (e.finished_test = !0, g(this, B, !1), g(this, E, 0)) : y(this, B) && (e.finished_test = !1);
|
|
1376
1376
|
break;
|
|
1377
1377
|
}
|
|
1378
1378
|
break;
|
|
@@ -1435,38 +1435,38 @@ class Cn extends G {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
async enable({ cell: t = 1 } = {}) {
|
|
1437
1437
|
t = i(this, v, K).call(this, t);
|
|
1438
|
-
const [e, n] = this.parseCellToColumnRow(t), s = i(this, v,
|
|
1438
|
+
const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, Ce).call(this, { enable: !0, column: e, row: n });
|
|
1439
1439
|
await this.appendToQueue(s, "activate");
|
|
1440
1440
|
}
|
|
1441
1441
|
async disable({ cell: t = 1 } = {}) {
|
|
1442
1442
|
t = i(this, v, K).call(this, t);
|
|
1443
|
-
const [e, n] = this.parseCellToColumnRow(t), s = i(this, v,
|
|
1443
|
+
const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, Ce).call(this, { enable: !1, column: e, row: n });
|
|
1444
1444
|
await this.appendToQueue(s, "disable");
|
|
1445
1445
|
}
|
|
1446
1446
|
async openAll() {
|
|
1447
1447
|
if (this.isDispensing) throw new Error("Another dispensing process is running");
|
|
1448
|
-
i(this, v,
|
|
1448
|
+
i(this, v, V).call(this), g(this, B, !0), i(this, v, ie).call(this);
|
|
1449
1449
|
const t = [];
|
|
1450
1450
|
for (let e = 1; e <= 90; e++) {
|
|
1451
1451
|
const n = await this.dispense(e);
|
|
1452
|
-
t.push(n),
|
|
1452
|
+
t.push(n), g(this, E, e), i(this, v, ie).call(this);
|
|
1453
1453
|
}
|
|
1454
|
-
|
|
1454
|
+
g(this, E, 90), i(this, v, ie).call(this, t), i(this, v, V).call(this);
|
|
1455
1455
|
}
|
|
1456
1456
|
async enableAll() {
|
|
1457
|
-
i(this, v,
|
|
1457
|
+
i(this, v, V).call(this), g(this, B, !0), i(this, v, re).call(this);
|
|
1458
1458
|
for (let t = 1; t <= 90; t++)
|
|
1459
|
-
await this.enable(t),
|
|
1460
|
-
|
|
1459
|
+
await this.enable(t), g(this, E, t), i(this, v, re).call(this);
|
|
1460
|
+
g(this, E, 90), i(this, v, re).call(this), i(this, v, V).call(this);
|
|
1461
1461
|
}
|
|
1462
1462
|
async disableAll() {
|
|
1463
|
-
i(this, v,
|
|
1463
|
+
i(this, v, V).call(this), g(this, B, !0), i(this, v, se).call(this);
|
|
1464
1464
|
for (let t = 1; t <= 90; t++)
|
|
1465
|
-
await this.enable(t),
|
|
1466
|
-
|
|
1465
|
+
await this.enable(t), g(this, E, t), i(this, v, se).call(this);
|
|
1466
|
+
g(this, E, 90), i(this, v, se).call(this), i(this, v, V).call(this);
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
|
-
|
|
1469
|
+
B = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye = function() {
|
|
1470
1470
|
const t = [
|
|
1471
1471
|
"percentage:disable",
|
|
1472
1472
|
"percentage:enable",
|
|
@@ -1478,7 +1478,7 @@ N = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye =
|
|
|
1478
1478
|
D.add(this);
|
|
1479
1479
|
}, Ze = function(t = 1) {
|
|
1480
1480
|
return t = i(this, v, K).call(this, t), this.serialLockerHexCmd(new Uint8Array([16, this.__internal__.device.listen_on_port, t]));
|
|
1481
|
-
},
|
|
1481
|
+
}, Ce = function({ enable: t = !0, column: e = 0, row: n = 10 } = {}) {
|
|
1482
1482
|
if (e < 0 || e > 8) throw new Error("Invalid column number");
|
|
1483
1483
|
if (n < 0 || n > 10) throw new Error("Invalid row number");
|
|
1484
1484
|
let s = 1;
|
|
@@ -1495,17 +1495,17 @@ K = function(t) {
|
|
|
1495
1495
|
const e = parseInt(t);
|
|
1496
1496
|
if (isNaN(e) || e < 1 || e > 90) throw new Error("Invalid cell number");
|
|
1497
1497
|
return e;
|
|
1498
|
-
},
|
|
1499
|
-
|
|
1498
|
+
}, V = function() {
|
|
1499
|
+
g(this, B, !1), g(this, E, 0), g(this, j, 0);
|
|
1500
1500
|
}, ie = function(t = null) {
|
|
1501
|
-
|
|
1501
|
+
g(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:open", { percentage: y(this, j), dispensed: t });
|
|
1502
1502
|
}, re = function() {
|
|
1503
|
-
|
|
1503
|
+
g(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:enable", { percentage: y(this, j) });
|
|
1504
1504
|
}, se = function() {
|
|
1505
|
-
|
|
1505
|
+
g(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:disable", { percentage: y(this, j) });
|
|
1506
1506
|
};
|
|
1507
|
-
var l, Xe, et, tt,
|
|
1508
|
-
class
|
|
1507
|
+
var l, Xe, et, tt, N, ae, nt, it, rt, st, at, ot, lt, ct, ht, dt, ut, pt, _t, ft, bt, yt, wt, kt, vt, mt, Ct, xt, gt, Tt, Dt, Et, L, F, oe, P, O, It, St, Mt, Ft, Z, xe, ge, le, ce, Pt;
|
|
1508
|
+
class gn extends G {
|
|
1509
1509
|
constructor({
|
|
1510
1510
|
filters: t = null,
|
|
1511
1511
|
config_port: e = null,
|
|
@@ -1660,7 +1660,7 @@ class xn extends G {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
async collect() {
|
|
1662
1662
|
const t = ["02", "30", "30", "81", "4E", "FF", "FF"];
|
|
1663
|
-
return await i(this, l,
|
|
1663
|
+
return await i(this, l, N).call(this, t, "collect");
|
|
1664
1664
|
}
|
|
1665
1665
|
async resetSoldOutErrors() {
|
|
1666
1666
|
return await i(this, l, Z).call(this, "80");
|
|
@@ -1669,9 +1669,9 @@ class xn extends G {
|
|
|
1669
1669
|
return await i(this, l, Z).call(this, "81");
|
|
1670
1670
|
}
|
|
1671
1671
|
async resetMachineErrors() {
|
|
1672
|
-
return this.__internal__.serial.queue.length === 0 ? (i(this, l,
|
|
1672
|
+
return this.__internal__.serial.queue.length === 0 ? (i(this, l, xe).call(this), await i(this, l, Z).call(this, "FF")) : new Promise((t) => {
|
|
1673
1673
|
const e = setInterval(async () => {
|
|
1674
|
-
this.__internal__.serial.queue.length > 0 || (clearInterval(e), await i(this, l, Z).call(this, "FF"), i(this, l,
|
|
1674
|
+
this.__internal__.serial.queue.length > 0 || (clearInterval(e), await i(this, l, Z).call(this, "FF"), i(this, l, xe).call(this), t(!0));
|
|
1675
1675
|
}, 100);
|
|
1676
1676
|
});
|
|
1677
1677
|
}
|
|
@@ -1680,17 +1680,17 @@ class xn extends G {
|
|
|
1680
1680
|
}
|
|
1681
1681
|
async status() {
|
|
1682
1682
|
const t = ["02", "30", "30", "81", "53", "FF", "FF"];
|
|
1683
|
-
return await i(this, l,
|
|
1683
|
+
return await i(this, l, N).call(this, t, "status");
|
|
1684
1684
|
}
|
|
1685
1685
|
async lightsOn() {
|
|
1686
|
-
return await i(this, l,
|
|
1686
|
+
return await i(this, l, ge).call(this, "81");
|
|
1687
1687
|
}
|
|
1688
1688
|
async lightsOff() {
|
|
1689
|
-
return await i(this, l,
|
|
1689
|
+
return await i(this, l, ge).call(this, "80");
|
|
1690
1690
|
}
|
|
1691
1691
|
async program(t, e) {
|
|
1692
1692
|
const n = ["02", "30", "30", "81", "50", t, e];
|
|
1693
|
-
return await i(this, l,
|
|
1693
|
+
return await i(this, l, N).call(this, n, "program");
|
|
1694
1694
|
}
|
|
1695
1695
|
async programDisplayLanguage({ language: t = "spanish" } = {}) {
|
|
1696
1696
|
const e = { spanish: "30", english: "31", french: "32" };
|
|
@@ -1803,7 +1803,7 @@ class xn extends G {
|
|
|
1803
1803
|
if (e = parseFloat(e), t = parseInt(t), isNaN(t) || t < 1 || t > this.__device.channels.verification.end) throw new Error(`Invalid selection, valid range is 1 to ${this.__device.channels.verification.end}`);
|
|
1804
1804
|
if (isNaN(e) || e < 5 || e > 9.5 || e % 0.5 !== 0) throw new Error("Invalid voltage, valid range is 5 to 9.5");
|
|
1805
1805
|
const n = 109 + t, c = (128 + (e - 5) * 2).toString(16), u = ["02", "30", "30", "81", "47", n, c];
|
|
1806
|
-
return await i(this, l,
|
|
1806
|
+
return await i(this, l, N).call(this, u, "voltage-engine");
|
|
1807
1807
|
}
|
|
1808
1808
|
/**
|
|
1809
1809
|
* @param {number|string} selection
|
|
@@ -1813,7 +1813,7 @@ class xn extends G {
|
|
|
1813
1813
|
async programPushOverProducts({ selection: t = 1, enable: e = !0 } = {}) {
|
|
1814
1814
|
if (t = parseInt(t), isNaN(t) || t < 1 || t > this.__device.channels.verification.end) throw new Error(`Invalid selection, valid range is 1 to ${this.__device.channels.verification.end}`);
|
|
1815
1815
|
const c = ["02", "30", "30", "81", "4F", 109 + t, e ? "31" : "30"];
|
|
1816
|
-
return await i(this, l,
|
|
1816
|
+
return await i(this, l, N).call(this, c, "push-over-products");
|
|
1817
1817
|
}
|
|
1818
1818
|
/**
|
|
1819
1819
|
* @param {number|string} selection
|
|
@@ -1826,11 +1826,11 @@ class xn extends G {
|
|
|
1826
1826
|
const n = 109 + t;
|
|
1827
1827
|
e = e.toFixed(1);
|
|
1828
1828
|
const s = 128 + e * 10, c = ["02", "30", "30", "81", "45", n, s];
|
|
1829
|
-
return await i(this, l,
|
|
1829
|
+
return await i(this, l, N).call(this, c, "channel-running-after-dispense");
|
|
1830
1830
|
}
|
|
1831
1831
|
async checkData(t, e = "FF") {
|
|
1832
1832
|
const n = ["02", "30", "30", "81", "43", t, e];
|
|
1833
|
-
return await i(this, l,
|
|
1833
|
+
return await i(this, l, N).call(this, n, "check-data");
|
|
1834
1834
|
}
|
|
1835
1835
|
async getDisplayLanguage() {
|
|
1836
1836
|
return await this.checkData("49");
|
|
@@ -1946,7 +1946,7 @@ class xn extends G {
|
|
|
1946
1946
|
async programClock({ date: t = /* @__PURE__ */ new Date() } = {}) {
|
|
1947
1947
|
if (!(t instanceof Date)) throw new Error("Invalid date, must be an instance of Date");
|
|
1948
1948
|
const e = ["02", "30", "30", "81", "72", ...i(this, l, Pt).call(this, t)];
|
|
1949
|
-
return await i(this, l,
|
|
1949
|
+
return await i(this, l, N).call(this, e, "clock");
|
|
1950
1950
|
}
|
|
1951
1951
|
/**
|
|
1952
1952
|
* @param {null|string} event
|
|
@@ -1956,7 +1956,7 @@ class xn extends G {
|
|
|
1956
1956
|
async eventsConfig({ event: t = null, enable: e = !0 } = {}) {
|
|
1957
1957
|
if (t === null) throw new Error("Invalid event");
|
|
1958
1958
|
const s = ["02", "30", "30", "81", "41", t, e ? "31" : "30"];
|
|
1959
|
-
return await i(this, l,
|
|
1959
|
+
return await i(this, l, N).call(this, s, "events-config");
|
|
1960
1960
|
}
|
|
1961
1961
|
async eventEnable({ event: t = null } = {}) {
|
|
1962
1962
|
if (t === null) throw new Error("Invalid event");
|
|
@@ -1972,7 +1972,7 @@ class xn extends G {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
async sendCustomCode({ code: t = [] } = {}) {
|
|
1974
1974
|
if (t.length < 5) throw new Error("Invalid code, minimum length is 5");
|
|
1975
|
-
return await i(this, l,
|
|
1975
|
+
return await i(this, l, N).call(this, t, "custom");
|
|
1976
1976
|
}
|
|
1977
1977
|
async assignChannels() {
|
|
1978
1978
|
const t = this.__device.channels.verification.start, e = this.__device.channels.verification.end;
|
|
@@ -2027,7 +2027,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2027
2027
|
this.on("internal:dispense:running", i(this, l, Ft).bind(this));
|
|
2028
2028
|
}, tt = function() {
|
|
2029
2029
|
D.add(this);
|
|
2030
|
-
},
|
|
2030
|
+
}, N = function(t, e) {
|
|
2031
2031
|
return t[3] = this.__internal__.device.hex_number, this.appendToQueue(i(this, l, ae).call(this, t), e);
|
|
2032
2032
|
}, ae = function(t) {
|
|
2033
2033
|
let e = this.hexToDec(this.sumHex(t)), n = this.calcCheckSums(e.toString());
|
|
@@ -2132,9 +2132,9 @@ l = new WeakSet(), Xe = function() {
|
|
|
2132
2132
|
return this.dispatch("machine:faults", e.additional), e;
|
|
2133
2133
|
}, ct = function(t, e) {
|
|
2134
2134
|
e.no_code = 40, e.name = "Clock registers", e.description = "Clock registers";
|
|
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(":"), [
|
|
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(":"), [C, T, I] = u.split("-"), U = new Date(2e3 + parseInt(I), parseInt(T) - 1, parseInt(C), parseInt(h), parseInt(b));
|
|
2136
2136
|
return e.additional = {
|
|
2137
|
-
day:
|
|
2137
|
+
day: C,
|
|
2138
2138
|
month: T,
|
|
2139
2139
|
year: I,
|
|
2140
2140
|
hours: h,
|
|
@@ -2143,7 +2143,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2143
2143
|
date: U,
|
|
2144
2144
|
hex: n
|
|
2145
2145
|
}, this.dispatch("clock:registers", e.additional), e;
|
|
2146
|
-
},
|
|
2146
|
+
}, ht = function(t, e) {
|
|
2147
2147
|
e.no_code = 41, e.name = "Machine activity", e.description = "Events from read machine activity";
|
|
2148
2148
|
const n = String.fromCharCode(this.hexToDec(t[4]));
|
|
2149
2149
|
if (n !== "0") {
|
|
@@ -2160,7 +2160,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2160
2160
|
meaning: "Extraction time (in seconds)"
|
|
2161
2161
|
};
|
|
2162
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}`),
|
|
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}`), C = {
|
|
2164
2164
|
B: "Error on going to tray channel",
|
|
2165
2165
|
D: "Error on product detector",
|
|
2166
2166
|
E: "Extraction of channel ok",
|
|
@@ -2175,10 +2175,10 @@ l = new WeakSet(), Xe = function() {
|
|
|
2175
2175
|
channel: b,
|
|
2176
2176
|
selection: b - 109,
|
|
2177
2177
|
ascii: n,
|
|
2178
|
-
meaning:
|
|
2178
|
+
meaning: C[n] ?? "Unknown"
|
|
2179
2179
|
};
|
|
2180
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)),
|
|
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)), C = parseInt(c.slice(7, 9)), T = parseInt(c.slice(9, 11)) - 1, I = 2e3 + parseInt(c.slice(11, 13)), U = new Date(I, T, C, u, h, b), fe = {
|
|
2182
2182
|
A: "Attempt to close product exit door",
|
|
2183
2183
|
C: "Closing of exterior door",
|
|
2184
2184
|
H: "Error on opening of product exit door",
|
|
@@ -2207,7 +2207,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
}
|
|
2209
2209
|
return this.dispatch("machine:activity", e.additional), e;
|
|
2210
|
-
},
|
|
2210
|
+
}, dt = function(t, e) {
|
|
2211
2211
|
const n = {
|
|
2212
2212
|
30: "Spanish",
|
|
2213
2213
|
31: "English",
|
|
@@ -2285,21 +2285,21 @@ l = new WeakSet(), Xe = function() {
|
|
|
2285
2285
|
hex: t,
|
|
2286
2286
|
temperature: n
|
|
2287
2287
|
}, this.dispatch("check:temperature-before-expiration", e.additional), e;
|
|
2288
|
-
},
|
|
2288
|
+
}, Ct = function(t, e) {
|
|
2289
2289
|
e.no_code = 53, e.name = "Time before expiration", e.description = "Time before expiration";
|
|
2290
2290
|
const n = this.hexToDec(t) - 128;
|
|
2291
2291
|
return e.additional = {
|
|
2292
2292
|
hex: t,
|
|
2293
2293
|
minutes: n
|
|
2294
2294
|
}, this.dispatch("check:expiration-after", e.additional), e;
|
|
2295
|
-
},
|
|
2295
|
+
}, xt = function(t, e) {
|
|
2296
2296
|
e.no_code = 54, e.name = "Temperature scale", e.description = "Temperature scale";
|
|
2297
2297
|
const n = t === "43" ? "Celsius" : "Fahrenheit";
|
|
2298
2298
|
return e.additional = {
|
|
2299
2299
|
hex: t,
|
|
2300
2300
|
scale: n
|
|
2301
2301
|
}, this.dispatch("check:temperature-scale", e.additional), e;
|
|
2302
|
-
},
|
|
2302
|
+
}, gt = function(t, e) {
|
|
2303
2303
|
return e.no_code = 54, e.name = "Machine ID", e.description = "Machine ID", e.additional = { hex: t[4], full_hex: t }, this.dispatch("check:machine-id", e.additional), e;
|
|
2304
2304
|
}, Tt = function(t, e) {
|
|
2305
2305
|
return e.no_code = 7, e.name = "working temperature", e.description = `The working temperature is ${t}`, e.additional = {
|
|
@@ -2334,7 +2334,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2334
2334
|
case "43":
|
|
2335
2335
|
switch (e.request = "check-data", t[3]) {
|
|
2336
2336
|
case "41":
|
|
2337
|
-
e = i(this, l,
|
|
2337
|
+
e = i(this, l, ht).call(this, t, e);
|
|
2338
2338
|
break;
|
|
2339
2339
|
case "43":
|
|
2340
2340
|
e.request = "channel-status", e = i(this, l, at).call(this, t, e);
|
|
@@ -2355,7 +2355,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2355
2355
|
e.request = "current-temperature", e = i(this, l, Dt).call(this, t, e);
|
|
2356
2356
|
break;
|
|
2357
2357
|
case "49":
|
|
2358
|
-
e = i(this, l,
|
|
2358
|
+
e = i(this, l, dt).call(this, t[4], e);
|
|
2359
2359
|
break;
|
|
2360
2360
|
case "5a":
|
|
2361
2361
|
e = i(this, l, ut).call(this, t[4], e);
|
|
@@ -2367,7 +2367,7 @@ l = new WeakSet(), Xe = function() {
|
|
|
2367
2367
|
e = i(this, l, _t).call(this, t[4], e);
|
|
2368
2368
|
break;
|
|
2369
2369
|
case "4e":
|
|
2370
|
-
e = i(this, l,
|
|
2370
|
+
e = i(this, l, gt).call(this, t, e);
|
|
2371
2371
|
break;
|
|
2372
2372
|
case "4f":
|
|
2373
2373
|
e = i(this, l, ft).call(this, t[4], e);
|
|
@@ -2391,10 +2391,10 @@ l = new WeakSet(), Xe = function() {
|
|
|
2391
2391
|
e = i(this, l, mt).call(this, t[4], e);
|
|
2392
2392
|
break;
|
|
2393
2393
|
case "66":
|
|
2394
|
-
e = i(this, l,
|
|
2394
|
+
e = i(this, l, Ct).call(this, t[4], e);
|
|
2395
2395
|
break;
|
|
2396
2396
|
case "67":
|
|
2397
|
-
e = i(this, l,
|
|
2397
|
+
e = i(this, l, xt).call(this, t[4], e);
|
|
2398
2398
|
break;
|
|
2399
2399
|
}
|
|
2400
2400
|
break;
|
|
@@ -2551,8 +2551,8 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
|
|
|
2551
2551
|
}, t.__internal__.dispense.timeout_time);
|
|
2552
2552
|
}, Z = async function(t) {
|
|
2553
2553
|
const e = ["02", "30", "30", "81", "52", t, "FF"];
|
|
2554
|
-
return await i(this, l,
|
|
2555
|
-
},
|
|
2554
|
+
return await i(this, l, N).call(this, e, "reset");
|
|
2555
|
+
}, xe = function() {
|
|
2556
2556
|
const t = this.__device.type === "iceplus" ? we(40) : we(25), e = /* @__PURE__ */ new Date(), n = 1e3 * t + e.getTime(), s = new Date(n);
|
|
2557
2557
|
this.dispatch("reset:errors", {
|
|
2558
2558
|
description: "Resetting machine errors",
|
|
@@ -2560,12 +2560,12 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
|
|
|
2560
2560
|
started_at: e,
|
|
2561
2561
|
finished_at: s
|
|
2562
2562
|
});
|
|
2563
|
-
},
|
|
2563
|
+
}, ge = async function(t) {
|
|
2564
2564
|
const e = ["02", "30", "30", "81", "4C", t, "FF"];
|
|
2565
|
-
return await i(this, l,
|
|
2565
|
+
return await i(this, l, N).call(this, e, "lights");
|
|
2566
2566
|
}, le = async function(t = "80", e = []) {
|
|
2567
2567
|
const n = ["02", "30", "30", "81", "44", t, ...e];
|
|
2568
|
-
return await i(this, l,
|
|
2568
|
+
return await i(this, l, N).call(this, n, "display");
|
|
2569
2569
|
}, ce = function(t = "") {
|
|
2570
2570
|
t = t.padEnd(32, " ");
|
|
2571
2571
|
const e = [];
|
|
@@ -2575,11 +2575,11 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
|
|
|
2575
2575
|
}, Pt = function(t) {
|
|
2576
2576
|
if (!(t instanceof Date)) throw new Error("Invalid date, must be an instance of Date");
|
|
2577
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 = [];
|
|
2578
|
-
for (let
|
|
2579
|
-
b.push(h.charCodeAt(
|
|
2578
|
+
for (let C = 0; C < 14; C++)
|
|
2579
|
+
b.push(h.charCodeAt(C).toString(16));
|
|
2580
2580
|
return b;
|
|
2581
2581
|
};
|
|
2582
|
-
var ee,
|
|
2582
|
+
var ee, J, z, d, Bt, At, he, Nt, qt, Rt, Ht, Lt, Ot, Ut, jt, Te, Wt, Qt, Vt, Jt, zt, $t, Gt, Yt, Kt, Zt, Xt, en, tn, nn, q, de, rn, sn, an, on, De, ue, ln, cn, Ee, Ie, Se;
|
|
2583
2583
|
class Tn extends G {
|
|
2584
2584
|
constructor({
|
|
2585
2585
|
filters: t = null,
|
|
@@ -2635,15 +2635,15 @@ class Tn extends G {
|
|
|
2635
2635
|
max_pre_credit: 0
|
|
2636
2636
|
});
|
|
2637
2637
|
S(this, ee, !1);
|
|
2638
|
-
S(this, V, 0);
|
|
2639
2638
|
S(this, J, 0);
|
|
2639
|
+
S(this, z, 0);
|
|
2640
2640
|
if (this.__internal__.device.type = "boardroid", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
|
|
2641
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 = {
|
|
2642
2642
|
channel: 1,
|
|
2643
2643
|
second_channel: null,
|
|
2644
2644
|
sensor: !0,
|
|
2645
2645
|
seconds: null
|
|
2646
|
-
}, i(this, d,
|
|
2646
|
+
}, i(this, d, Bt).call(this), i(this, d, At).call(this);
|
|
2647
2647
|
}
|
|
2648
2648
|
get totalInTubes() {
|
|
2649
2649
|
return this.coins.tubes.g50 * 0.5 + this.coins.tubes.c50 * 0.5 + this.coins.tubes.p1 + this.coins.tubes.p2 * 2 + this.coins.tubes.p5 * 5 + this.coins.tubes.p10 * 10;
|
|
@@ -2709,19 +2709,19 @@ class Tn extends G {
|
|
|
2709
2709
|
e.request = "--automatic", e = i(this, d, Wt).call(this, t, e);
|
|
2710
2710
|
break;
|
|
2711
2711
|
case "b0":
|
|
2712
|
-
e.request = "--automatic", e = i(this, d,
|
|
2712
|
+
e.request = "--automatic", e = i(this, d, Qt).call(this, t, e);
|
|
2713
2713
|
break;
|
|
2714
2714
|
case "d0":
|
|
2715
|
-
e.request = "coin-purse:config", e = i(this, d,
|
|
2715
|
+
e.request = "coin-purse:config", e = i(this, d, Vt).call(this, t[2], e);
|
|
2716
2716
|
break;
|
|
2717
2717
|
case "d1":
|
|
2718
|
-
e.request = "banknote-purse:config", e.additional = { scrow: null }, e = i(this, d,
|
|
2718
|
+
e.request = "banknote-purse:config", e.additional = { scrow: null }, e = i(this, d, Jt).call(this, t, e);
|
|
2719
2719
|
break;
|
|
2720
2720
|
case "d2":
|
|
2721
|
-
e.request = "coin-purse:read-tubes", e = i(this, d,
|
|
2721
|
+
e.request = "coin-purse:read-tubes", e = i(this, d, zt).call(this, t, e);
|
|
2722
2722
|
break;
|
|
2723
2723
|
case "d3":
|
|
2724
|
-
e.request = "banknote-purse:read-recycler", e = i(this, d,
|
|
2724
|
+
e.request = "banknote-purse:read-recycler", e = i(this, d, $t).call(this, t, e);
|
|
2725
2725
|
break;
|
|
2726
2726
|
case "d4":
|
|
2727
2727
|
e.request = "banknote-purse:banknote-scrow-status", e = i(this, d, Gt).call(this, t[2], e);
|
|
@@ -2796,13 +2796,13 @@ class Tn extends G {
|
|
|
2796
2796
|
async banknotePurseConfigure({ enable: t = !1, scrow: e = !1 } = {}) {
|
|
2797
2797
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2798
2798
|
let n;
|
|
2799
|
-
return i(this, d,
|
|
2799
|
+
return i(this, d, he).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");
|
|
2800
2800
|
}
|
|
2801
2801
|
async banknotePurseDispense({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200: s = 0, $_500: c = 0, $_1000: u = 0 } = {}) {
|
|
2802
2802
|
if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
|
|
2803
2803
|
if (!this.__banknote_purse.isRecycler) throw new Error("Banknote purse is not recycler");
|
|
2804
2804
|
let h;
|
|
2805
|
-
if (i(this, d,
|
|
2805
|
+
if (i(this, d, he).call(this)) {
|
|
2806
2806
|
const b = [t, e, n, s, c];
|
|
2807
2807
|
h = i(this, d, an).call(this, b[this.__banknote_purse.recycler.banknote]);
|
|
2808
2808
|
} else
|
|
@@ -2871,11 +2871,11 @@ class Tn extends G {
|
|
|
2871
2871
|
if (c > this.card_reader.max_pre_credit) throw new Error("Price is greater than pre-credit configured");
|
|
2872
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");
|
|
2873
2873
|
const u = this.decToHex(c / 256), h = this.decToHex(c % 256), b = this.decToHex(t + 9);
|
|
2874
|
-
let
|
|
2875
|
-
e && (
|
|
2874
|
+
let C = "00";
|
|
2875
|
+
e && (C = this.decToHex(e + 9));
|
|
2876
2876
|
let T = "00";
|
|
2877
2877
|
n || (T = this.decToHex(s * 10));
|
|
2878
|
-
const I = ["F1", "CD", "01", b,
|
|
2878
|
+
const I = ["F1", "CD", "01", b, C, T, u, h, "00", "00", "F2", "00"];
|
|
2879
2879
|
await i(this, d, q).call(this, I, "card-reader:dispense");
|
|
2880
2880
|
}
|
|
2881
2881
|
async paymentPursesDisable({ coin: t = !0, banknote: e = !0, cardReader: n = !1 } = {}) {
|
|
@@ -2928,13 +2928,13 @@ class Tn extends G {
|
|
|
2928
2928
|
e && (e += 9, h = this.decToHex(e));
|
|
2929
2929
|
let b = "00";
|
|
2930
2930
|
n || (b = this.decToHex(Math.round(s * 6.2)), this.__internal__.dispense.custom_limit_counter = s);
|
|
2931
|
-
const
|
|
2932
|
-
let T = await this.internalDispense(
|
|
2933
|
-
return !T.dispensed && c && (T = await this.internalDispense(
|
|
2931
|
+
const C = i(this, d, de).call(this, ["F1", "C7", u, h, b, "00", "00", "00", "00", "00", "F2", "00"]);
|
|
2932
|
+
let T = await this.internalDispense(C);
|
|
2933
|
+
return !T.dispensed && c && (T = await this.internalDispense(C)), this.__internal__.dispense.custom_limit_counter = null, T;
|
|
2934
2934
|
}
|
|
2935
2935
|
async testEngines({ singleEngine: t = !1 } = {}) {
|
|
2936
2936
|
if (this.isDispensing) throw new Error("Another dispensing process is running");
|
|
2937
|
-
i(this, d, De).call(this),
|
|
2937
|
+
i(this, d, De).call(this), g(this, ee, !0);
|
|
2938
2938
|
const e = [];
|
|
2939
2939
|
i(this, d, ue).call(this);
|
|
2940
2940
|
for (let n = 1; n <= 80; n++) {
|
|
@@ -2945,13 +2945,13 @@ class Tn extends G {
|
|
|
2945
2945
|
seconds: 0.4,
|
|
2946
2946
|
retry: !1
|
|
2947
2947
|
});
|
|
2948
|
-
e.push(s),
|
|
2948
|
+
e.push(s), g(this, J, n), i(this, d, ue).call(this), t || n++;
|
|
2949
2949
|
}
|
|
2950
|
-
|
|
2950
|
+
g(this, J, 80), i(this, d, ue).call(this, { dispensed: e }), i(this, d, De).call(this);
|
|
2951
2951
|
}
|
|
2952
2952
|
async sendCustomCode({ code: t = [] } = {}) {
|
|
2953
2953
|
if (t.length === 0) throw new Error("Invalid code");
|
|
2954
|
-
const e = i(this, d,
|
|
2954
|
+
const e = i(this, d, de).call(this, t);
|
|
2955
2955
|
await this.appendToQueue(e, "custom");
|
|
2956
2956
|
}
|
|
2957
2957
|
hasToReturnChange(t = 0) {
|
|
@@ -2968,7 +2968,7 @@ class Tn extends G {
|
|
|
2968
2968
|
this.dispatch("corrupt:message", { data: t, message: e });
|
|
2969
2969
|
}
|
|
2970
2970
|
}
|
|
2971
|
-
ee = new WeakMap(),
|
|
2971
|
+
ee = new WeakMap(), J = new WeakMap(), z = new WeakMap(), d = new WeakSet(), Bt = function() {
|
|
2972
2972
|
const t = [
|
|
2973
2973
|
"banknote-purse:banknote-scrow-status",
|
|
2974
2974
|
"banknote-purse:config",
|
|
@@ -2996,9 +2996,9 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
2996
2996
|
this.serialRegisterAvailableListener(e);
|
|
2997
2997
|
}, At = function() {
|
|
2998
2998
|
D.add(this);
|
|
2999
|
-
},
|
|
2999
|
+
}, he = function() {
|
|
3000
3000
|
return this.__banknote_purse.isRecycler && this.__banknote_purse.recycler.ict;
|
|
3001
|
-
},
|
|
3001
|
+
}, Nt = function() {
|
|
3002
3002
|
return this.hasCoinPurse || this.hasRecycler;
|
|
3003
3003
|
}, qt = function(t) {
|
|
3004
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;
|
|
@@ -3087,16 +3087,16 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3087
3087
|
}, Wt = function(t, e) {
|
|
3088
3088
|
const n = parseInt(t[2], 16);
|
|
3089
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;
|
|
3090
|
-
},
|
|
3090
|
+
}, Qt = function(t, e) {
|
|
3091
3091
|
const n = parseInt(t[2], 16);
|
|
3092
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;
|
|
3093
|
-
},
|
|
3093
|
+
}, Vt = function(t, e) {
|
|
3094
3094
|
const n = parseInt(t, 16);
|
|
3095
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;
|
|
3096
|
-
},
|
|
3096
|
+
}, Jt = function(t, e) {
|
|
3097
3097
|
const n = parseInt(t[2], 16), s = parseInt(t[3], 16);
|
|
3098
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;
|
|
3099
|
-
},
|
|
3099
|
+
}, zt = function(t, e) {
|
|
3100
3100
|
e.no_code = 6;
|
|
3101
3101
|
const [n, s, c, u, h, b] = [
|
|
3102
3102
|
parseInt(t[2], 16),
|
|
@@ -3109,7 +3109,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3109
3109
|
return e.additional = {
|
|
3110
3110
|
coins: { g50: n, c50: s, p1: c, p2: u, p5: h, p10: b }
|
|
3111
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;
|
|
3112
|
-
},
|
|
3112
|
+
}, $t = function(t, e) {
|
|
3113
3113
|
e.no_code = 7;
|
|
3114
3114
|
const [n, s, c, u, h, b] = [
|
|
3115
3115
|
parseInt(t[2], 16),
|
|
@@ -3133,10 +3133,10 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3133
3133
|
parseInt(t[5], 16),
|
|
3134
3134
|
parseInt(t[6], 16),
|
|
3135
3135
|
parseInt(t[7], 16)
|
|
3136
|
-
],
|
|
3137
|
-
return e.name = "Banknotes dispensed", e.description =
|
|
3136
|
+
], C = n * 20 + s * 50 + c * 100 + u * 200 + h * 500 + b * 1e3;
|
|
3137
|
+
return e.name = "Banknotes dispensed", e.description = C > 0 ? "Banknotes dispensed by request" : "No banknotes dispensed, recycler empty", e.no_code = 9, e.additional = {
|
|
3138
3138
|
banknotes: { b20: n, b50: s, b100: c, b200: u, b500: h, b1000: b },
|
|
3139
|
-
total_dispensed:
|
|
3139
|
+
total_dispensed: C
|
|
3140
3140
|
}, this.dispatch("session:money-dispensed", {
|
|
3141
3141
|
type_money: null,
|
|
3142
3142
|
retired: null,
|
|
@@ -3192,8 +3192,8 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3192
3192
|
}
|
|
3193
3193
|
return this.dispatch("card-reader:event", e), e;
|
|
3194
3194
|
}, q = function(t, e) {
|
|
3195
|
-
return this.appendToQueue(i(this, d,
|
|
3196
|
-
},
|
|
3195
|
+
return this.appendToQueue(i(this, d, de).call(this, t), e);
|
|
3196
|
+
}, de = function(t) {
|
|
3197
3197
|
return t[11] = this.serialBoardroidSumHex(t), t.map((e, n) => {
|
|
3198
3198
|
t[n] = this.hexMaker(e);
|
|
3199
3199
|
}), t;
|
|
@@ -3218,39 +3218,57 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt
|
|
|
3218
3218
|
this.decToHex(u)
|
|
3219
3219
|
], ["F1", "C5", t, e, n, s, c, u, "00", "00", "F2", "00"];
|
|
3220
3220
|
}, De = function() {
|
|
3221
|
-
|
|
3221
|
+
g(this, ee, !1), g(this, J, 0), g(this, z, 0);
|
|
3222
3222
|
}, /**
|
|
3223
3223
|
*
|
|
3224
3224
|
* @param {null|object} dispensed
|
|
3225
3225
|
* @param {number} limit
|
|
3226
3226
|
*/
|
|
3227
3227
|
ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
|
|
3228
|
-
|
|
3228
|
+
g(this, z, Math.round(y(this, J) * 100 / e)), this.dispatch("percentage:test", { percentage: y(this, z), dispensed: t });
|
|
3229
3229
|
}, ln = function(t) {
|
|
3230
|
-
const e = ["20", "50", "100", "200", "500"], n = "$_" + e[
|
|
3230
|
+
const e = ["20", "50", "100", "200", "500"], n = this.__banknote_purse.recycler.banknote, s = "$_" + e[n], c = parseInt(e[n]), u = this.banknotes.recycler[`p${e[n]}`], h = Math.min(
|
|
3231
|
+
Math.floor(t / c),
|
|
3232
|
+
u
|
|
3233
|
+
), b = {
|
|
3231
3234
|
banknotes: { $_20: 0, $_50: 0, $_100: 0, $_200: 0, $_500: 0, $_1000: 0 },
|
|
3232
3235
|
pending: t,
|
|
3233
|
-
will_dispense:
|
|
3236
|
+
will_dispense: h > 0
|
|
3234
3237
|
};
|
|
3235
|
-
return this.totalInRecycler === 0 ||
|
|
3238
|
+
return this.totalInRecycler === 0 || h < 1 || t === 0 || (b.banknotes[s] = h, b.pending = parseFloat((t - h * c).toFixed(2))), b;
|
|
3236
3239
|
}, cn = function(t) {
|
|
3237
3240
|
const e = {
|
|
3238
3241
|
banknotes: { $_20: 0, $_50: 0, $_100: 0, $_200: 0, $_500: 0, $_1000: 0 },
|
|
3239
3242
|
pending: t,
|
|
3240
3243
|
will_dispense: !1
|
|
3241
3244
|
};
|
|
3242
|
-
|
|
3245
|
+
if (this.totalInRecycler === 0 || t === 0) return e;
|
|
3246
|
+
const n = (s, c) => {
|
|
3247
|
+
if (this.banknotes.recycler[c] > 0) {
|
|
3248
|
+
const u = Math.floor(e.pending / s), h = Math.min(u, this.banknotes.recycler[c]);
|
|
3249
|
+
e.banknotes[`$_${s}`] = h, e.pending = parseFloat((e.pending - h * s).toFixed(2));
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
return n(1e3, "p1000"), n(500, "p500"), n(200, "p200"), n(100, "p100"), n(50, "p50"), n(20, "p20"), e.will_dispense = Object.values(e.banknotes).some((s) => s > 0), e;
|
|
3243
3253
|
}, Ee = function(t) {
|
|
3244
|
-
return i(this, d,
|
|
3254
|
+
return i(this, d, he).call(this) ? i(this, d, ln).call(this, t) : i(this, d, cn).call(this, t);
|
|
3245
3255
|
}, Ie = function(t) {
|
|
3246
3256
|
const e = {
|
|
3247
3257
|
coins: { $_50c: 0, $_1: 0, $_2: 0, $_5: 0, $_10: 0 },
|
|
3248
3258
|
pending: t,
|
|
3249
3259
|
will_dispense: !1
|
|
3250
3260
|
};
|
|
3251
|
-
|
|
3261
|
+
if (t <= 0 || this.totalInTubes === 0) return e;
|
|
3262
|
+
const n = (s, c, u = null) => {
|
|
3263
|
+
if (this.coins.tubes[c] > 0) {
|
|
3264
|
+
u === null && (u = "$_" + s);
|
|
3265
|
+
const h = Math.floor(e.pending / s), b = Math.min(h, this.coins.tubes[c]);
|
|
3266
|
+
e.coins[u] = b, e.pending = parseFloat((e.pending - b * s).toFixed(2));
|
|
3267
|
+
}
|
|
3268
|
+
};
|
|
3269
|
+
return n(10, "p10"), n(5, "p5"), n(2, "p2"), n(1, "p1"), n(0.5, "g50", "$_50c"), e.will_dispense = Object.values(e.coins).some((s) => s > 0), e;
|
|
3252
3270
|
}, Se = async function(t = null) {
|
|
3253
|
-
if (!i(this, d,
|
|
3271
|
+
if (!i(this, d, Nt).call(this)) throw new Error("Change not available");
|
|
3254
3272
|
let e = this.change, n = this.change;
|
|
3255
3273
|
if (t !== null && (e = t, n = t), n <= 0) return !1;
|
|
3256
3274
|
const s = i(this, d, Ee).call(this, n);
|
|
@@ -3258,7 +3276,7 @@ ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
|
|
|
3258
3276
|
const c = i(this, d, Ie).call(this, n);
|
|
3259
3277
|
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);
|
|
3260
3278
|
};
|
|
3261
|
-
var
|
|
3279
|
+
var $, hn, dn;
|
|
3262
3280
|
class Dn extends G {
|
|
3263
3281
|
constructor({
|
|
3264
3282
|
filters: t = null,
|
|
@@ -3266,9 +3284,9 @@ class Dn extends G {
|
|
|
3266
3284
|
no_device: n = 1
|
|
3267
3285
|
} = {}) {
|
|
3268
3286
|
super({ filters: t, config_port: e, no_device: n });
|
|
3269
|
-
S(this,
|
|
3287
|
+
S(this, $);
|
|
3270
3288
|
if (this.__internal__.device.type = "arduino", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
|
|
3271
|
-
this.__internal__.time.response_connection = 2e3, this.__internal__.time.response_general = 2e3, this.__internal__.serial.delay_first_connection = 1e3, i(this,
|
|
3289
|
+
this.__internal__.time.response_connection = 2e3, this.__internal__.time.response_general = 2e3, this.__internal__.serial.delay_first_connection = 1e3, i(this, $, dn).call(this), i(this, $, hn).call(this);
|
|
3272
3290
|
}
|
|
3273
3291
|
serialMessage(t) {
|
|
3274
3292
|
const e = {
|
|
@@ -3330,9 +3348,9 @@ class Dn extends G {
|
|
|
3330
3348
|
await this.sayCredits(), await this.sayAra(), await this.sayHi();
|
|
3331
3349
|
}
|
|
3332
3350
|
}
|
|
3333
|
-
|
|
3351
|
+
$ = new WeakSet(), hn = function() {
|
|
3334
3352
|
D.addCustom("arduino", this);
|
|
3335
|
-
},
|
|
3353
|
+
}, dn = function() {
|
|
3336
3354
|
};
|
|
3337
3355
|
/**
|
|
3338
3356
|
* @license Webserial
|
|
@@ -3346,17 +3364,17 @@ z = new WeakSet(), dn = function() {
|
|
|
3346
3364
|
const En = {
|
|
3347
3365
|
wait: W,
|
|
3348
3366
|
getSeconds: we,
|
|
3349
|
-
supportWebSerial:
|
|
3350
|
-
}, In = "
|
|
3367
|
+
supportWebSerial: Be
|
|
3368
|
+
}, In = "4.0.6";
|
|
3351
3369
|
export {
|
|
3352
3370
|
Dn as Arduino,
|
|
3353
3371
|
Tn as Boardroid,
|
|
3354
3372
|
D as Devices,
|
|
3355
3373
|
pe as Emulator,
|
|
3356
|
-
|
|
3374
|
+
gn as Jofemar,
|
|
3357
3375
|
G as Kernel,
|
|
3358
|
-
|
|
3359
|
-
|
|
3376
|
+
xn as Locker,
|
|
3377
|
+
Cn as Relay,
|
|
3360
3378
|
En as utils,
|
|
3361
3379
|
In as version
|
|
3362
3380
|
};
|