@danidoble/webserial 4.4.0-beta.2 → 4.4.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boardroid.cjs +1 -1
- package/dist/boardroid.js +99 -95
- package/dist/hopper.cjs +2 -2
- package/dist/hopper.js +66 -51
- package/dist/jofemar.cjs +1 -1
- package/dist/jofemar.js +57 -141
- package/dist/kernel-C1HLYiV1.cjs +1 -0
- package/dist/kernel-C8ISUhzV.cjs +1 -0
- package/dist/kernel-CQcZ_OiG.js +831 -0
- package/dist/{kernel-CXM5xoJD.js → kernel-DkC7Kj3m.js} +147 -124
- package/dist/kernel-DtXV8d8B.js +831 -0
- package/dist/kernel-DyNuXvtW.cjs +1 -0
- package/dist/kernel-aqBCxtkj.js +831 -0
- package/dist/kernel-pO_elWba.cjs +1 -0
- package/dist/kernel.cjs +2 -2
- package/dist/kernel.d.ts +14 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +3 -4
- package/dist/locker.cjs +1 -1
- package/dist/locker.js +32 -26
- package/dist/main.d.ts +28 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/pinpad.cjs +14 -14
- package/dist/pinpad.js +816 -791
- package/dist/pinpax.cjs +4 -4
- package/dist/pinpax.js +54 -54
- package/dist/relay.cjs +1 -1
- package/dist/relay.js +11 -18
- package/dist/serial/boardroid.d.ts +206 -0
- package/dist/serial/boardroid.d.ts.map +1 -0
- package/dist/serial/hopper.d.ts +85 -0
- package/dist/serial/hopper.d.ts.map +1 -0
- package/dist/serial/jofemar.d.ts +218 -0
- package/dist/serial/jofemar.d.ts.map +1 -0
- package/dist/serial/kernel.d.ts +137 -0
- package/dist/serial/kernel.d.ts.map +1 -0
- package/dist/serial/locker.d.ts +33 -0
- package/dist/serial/locker.d.ts.map +1 -0
- package/dist/serial/pinpad.d.ts +263 -0
- package/dist/serial/pinpad.d.ts.map +1 -0
- package/dist/serial/pinpax.d.ts +60 -0
- package/dist/serial/pinpax.d.ts.map +1 -0
- package/dist/serial/relay.d.ts +13 -0
- package/dist/serial/relay.d.ts.map +1 -0
- package/dist/utils/devices.d.ts +26 -0
- package/dist/utils/devices.d.ts.map +1 -0
- package/dist/utils/dispatcher.d.ts +17 -0
- package/dist/utils/dispatcher.d.ts.map +1 -0
- package/dist/utils/emulator.d.ts +80 -0
- package/dist/utils/emulator.d.ts.map +1 -0
- package/dist/utils/utils.d.ts +7 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/webserial-core-CH2Xov2y.js +3325 -0
- package/dist/webserial-core-Cj_EZjAU.cjs +4 -0
- package/dist/webserial.cjs +2 -2
- package/dist/webserial.js +16 -16
- package/package.json +88 -76
- package/dist/kernel-Dizfdw3M.cjs +0 -1
package/dist/jofemar.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { K as C, w as u, g as
|
|
1
|
+
import { K as C, D as f, w as u, g as y } from "./kernel-DtXV8d8B.js";
|
|
2
2
|
import { o as i } from "./relay-DP8PLsDP.js";
|
|
3
|
-
|
|
4
|
-
class b extends C {
|
|
3
|
+
class w extends C {
|
|
5
4
|
__device = {
|
|
6
5
|
type: "esplus",
|
|
7
6
|
support_cart: !1,
|
|
@@ -29,20 +28,20 @@ class b extends C {
|
|
|
29
28
|
};
|
|
30
29
|
constructor({
|
|
31
30
|
filters: t = null,
|
|
32
|
-
config_port: e
|
|
31
|
+
config_port: e,
|
|
33
32
|
no_device: n = 1,
|
|
34
|
-
|
|
33
|
+
device_listen_on_channel: r = 1,
|
|
35
34
|
type: a = "esplus",
|
|
36
35
|
support_cart: o = !0,
|
|
37
36
|
socket: c = !1
|
|
38
37
|
} = {}) {
|
|
39
|
-
if (super({ filters: t, config_port: e, no_device: n,
|
|
38
|
+
if (super({ filters: t, config_port: e, no_device: n, device_listen_on_channel: r, socket: c }), this.__internal__.device.type = "jofemar", f.getCustom(this.typeDevice, n))
|
|
40
39
|
throw new Error(`Device ${this.typeDevice} ${n} already exists`);
|
|
41
40
|
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.listenOnChannel).toString(16), this.__internal__.device.door_open = !1, this.__internal__.dispense.elevator = {
|
|
42
41
|
locking_time: 60,
|
|
43
42
|
locking_interval: 0,
|
|
44
43
|
need_reset: !1
|
|
45
|
-
}, this.deviceType = a, this.supportCart = o, this.#h(),
|
|
44
|
+
}, this.deviceType = a, this.supportCart = o, this.#h(), f.add(this), this.#l();
|
|
46
45
|
}
|
|
47
46
|
set startChannelVerification(t) {
|
|
48
47
|
const e = parseInt(t);
|
|
@@ -119,21 +118,19 @@ class b extends C {
|
|
|
119
118
|
return i.connection({ channel: t });
|
|
120
119
|
}
|
|
121
120
|
async #s() {
|
|
122
|
-
if (this.__internal__.dispense.elevator.locking_interval)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
#d(t, e) {
|
|
136
|
-
return e.name = "ok", e.description = "The last command was executed successfully", e.no_code = 1, this.dispatch("command-executed", e), e;
|
|
121
|
+
if (!this.__internal__.dispense.elevator.locking_interval)
|
|
122
|
+
return this.__internal__.dispense.elevator.need_reset && (this.__internal__.dispense.elevator.need_reset = !1, await this.resetWaitingProductRemovedError(), await u(500)), this.__internal__.dispense.status = "elevator-locked", this.__internal__.dispense.elevator.locking_time = 60, new Promise((t) => {
|
|
123
|
+
this.__internal__.dispense.elevator.locking_interval = setInterval(() => {
|
|
124
|
+
this.dispatch("dispensing:withdrawal", {
|
|
125
|
+
elevator: !0,
|
|
126
|
+
seconds: this.__internal__.dispense.elevator.locking_time,
|
|
127
|
+
description: "Please recall products from the elevator"
|
|
128
|
+
}), this.__internal__.dispense.elevator.locking_time -= 1, this.__internal__.dispense.elevator.locking_time <= 0 && (clearInterval(this.__internal__.dispense.elevator.locking_interval), this.__internal__.dispense.elevator.locking_interval = 0, t(!0));
|
|
129
|
+
}, 1e3);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
#d(t) {
|
|
133
|
+
return t.name = "ok", t.description = "The last command was executed successfully", t.no_code = 1, this.dispatch("command-executed", t), t;
|
|
137
134
|
}
|
|
138
135
|
#p(t, e) {
|
|
139
136
|
e.additional = {
|
|
@@ -158,8 +155,8 @@ class b extends C {
|
|
|
158
155
|
42: "B",
|
|
159
156
|
43: "C",
|
|
160
157
|
44: "D"
|
|
161
|
-
};
|
|
162
|
-
return e.additional.ascii = n[
|
|
158
|
+
}, r = t.toString().toLowerCase();
|
|
159
|
+
return e.additional.ascii = n[r] ?? 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;
|
|
163
160
|
}
|
|
164
161
|
#u(t, e) {
|
|
165
162
|
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;
|
|
@@ -217,7 +214,7 @@ class b extends C {
|
|
|
217
214
|
64: "Product detector didn't change during its verification test"
|
|
218
215
|
};
|
|
219
216
|
for (const a of n)
|
|
220
|
-
r[a] && (e.additional.faults.push(r[a]), e.additional.no_faults++);
|
|
217
|
+
r[a] && e.additional.faults && typeof e.additional.no_faults < "u" && (e.additional.faults.push(r[a] || "Unknown fault"), e.additional.no_faults++);
|
|
221
218
|
}
|
|
222
219
|
return this.dispatch("machine:faults", e.additional), e;
|
|
223
220
|
}
|
|
@@ -273,7 +270,7 @@ class b extends C {
|
|
|
273
270
|
channel: h,
|
|
274
271
|
selection: h - 109,
|
|
275
272
|
ascii: n,
|
|
276
|
-
meaning: l[n]
|
|
273
|
+
meaning: l[n] || "Unknown"
|
|
277
274
|
};
|
|
278
275
|
} else if (r.length === 13) {
|
|
279
276
|
const a = r.map((v) => String.fromCharCode(this.hexToDec(v))).join(""), o = parseInt(a.slice(0, 2)), c = parseInt(a.slice(2, 4)), h = parseInt(a.slice(4, 6)), l = parseInt(a.slice(7, 9)), s = parseInt(a.slice(9, 11)) - 1, d = 2e3 + parseInt(a.slice(11, 13)), p = new Date(d, s, l, o, c, h), _ = {
|
|
@@ -300,7 +297,7 @@ class b extends C {
|
|
|
300
297
|
hex: r,
|
|
301
298
|
formatted: p.toLocaleString(),
|
|
302
299
|
ascii: n,
|
|
303
|
-
meaning: _[n]
|
|
300
|
+
meaning: _[n] || "Unknown"
|
|
304
301
|
};
|
|
305
302
|
}
|
|
306
303
|
}
|
|
@@ -312,9 +309,9 @@ class b extends C {
|
|
|
312
309
|
31: "English",
|
|
313
310
|
32: "French"
|
|
314
311
|
};
|
|
315
|
-
return e.no_code = 42, e.name = "Language", e.description = `The language is ${n[t]
|
|
312
|
+
return e.no_code = 42, e.name = "Language", e.description = `The language is ${n[t] || "unknown"}`, e.additional = {
|
|
316
313
|
hex: t,
|
|
317
|
-
language: n[t]
|
|
314
|
+
language: n[t] || "unknown"
|
|
318
315
|
}, this.dispatch("check:language", e.additional), e;
|
|
319
316
|
}
|
|
320
317
|
#k(t, e) {
|
|
@@ -437,8 +434,8 @@ class b extends C {
|
|
|
437
434
|
}, t[4] === "2b" ? e.additional.sign = t[4] = "+" : ["2e", "2d"].includes(t[4]) ? e.additional.sign = t[4] = "-" : t[4] === "20" && (e.additional.error = "Error in thermometer"), this.hexToDec(t[5]) >= 48 && this.hexToDec(t[5]) <= 57 ? e.additional.tens = this.hexToDec(t[5]) - 48 : t[5] === "2a" && (e.additional.error = "Error in thermometer"), this.hexToDec(t[6]) >= 48 && this.hexToDec(t[6]) <= 57 ? e.additional.units = this.hexToDec(t[6]) - 48 : t[6] === "2a" && (e.additional.error = "Error in thermometer"), this.hexToDec(t[8]) >= 48 && this.hexToDec(t[8]) <= 57 ? e.additional.decimals = this.hexToDec(t[8]) - 48 : t[8] === "2a" && (e.additional.error = "Error in thermometer"), t[10] === "43" ? e.additional.type_degrees = "C" : t[10] === "46" && (e.additional.type_degrees = "F"), e.additional.error === "Error in thermometer" ? (e.additional.formatted = "Error in thermometer", e.description = "The current temperature cannot be read because there is an error in the thermometer") : (e.additional.formatted = (e.additional.sign ?? "") + (e.additional.tens ?? "") + (e.additional.units ?? "") + (e.additional.decimal_point ?? "") + (e.additional.decimals ?? "") + (e.additional.degrees ?? "") + (e.additional.type_degrees ?? ""), e.description = `The current temperature is ${e.additional.formatted}`), this.dispatch("temperature:current", e.additional), e;
|
|
438
435
|
}
|
|
439
436
|
#B(t, e, n = 128) {
|
|
440
|
-
if (t[1] && (e.additional.machine.hex = t[1], e.additional.machine.dec = this.hexToDec(t[1]) - n), !(t[1] && t[2]))
|
|
441
|
-
e = this.#d(
|
|
437
|
+
if (t[1] && (e.additional.machine || (e.additional.machine = { hex: null, dec: null }), e.additional.machine.hex = t[1], e.additional.machine.dec = this.hexToDec(t[1]) - n), !(t[1] && t[2]))
|
|
438
|
+
e = this.#d(e);
|
|
442
439
|
else
|
|
443
440
|
switch (t[2]) {
|
|
444
441
|
case "54":
|
|
@@ -526,20 +523,16 @@ class b extends C {
|
|
|
526
523
|
#a() {
|
|
527
524
|
this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = "elevator-locked");
|
|
528
525
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
*/
|
|
534
|
-
#t({ type: t = null, severity: e = "low" } = {}) {
|
|
526
|
+
#t({
|
|
527
|
+
type: t = null,
|
|
528
|
+
severity: e = "low"
|
|
529
|
+
} = {}) {
|
|
535
530
|
this.dispatch("jofemar:warning", { type: t, severity: e });
|
|
536
531
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
*/
|
|
542
|
-
#i({ type: t = null, severity: e = "high" } = {}) {
|
|
532
|
+
#i({
|
|
533
|
+
type: t = null,
|
|
534
|
+
severity: e = "high"
|
|
535
|
+
} = {}) {
|
|
543
536
|
this.dispatch("jofemar:error", { type: t, severity: e });
|
|
544
537
|
}
|
|
545
538
|
#W(t, e) {
|
|
@@ -691,12 +684,6 @@ class b extends C {
|
|
|
691
684
|
productRemovedContinueDispensing() {
|
|
692
685
|
this.__internal__.dispense.elevator.locking_interval && (this.__internal__.dispense.elevator.locking_time = 0);
|
|
693
686
|
}
|
|
694
|
-
/**
|
|
695
|
-
* Dispense a product from the machine
|
|
696
|
-
* @param {null|number|string} selection
|
|
697
|
-
* @param {boolean} cart
|
|
698
|
-
* @return {Promise<unknown>}
|
|
699
|
-
*/
|
|
700
687
|
async dispense({ selection: t = 1, cart: e = !1 } = {}) {
|
|
701
688
|
const n = i.dispense({ selection: t, cart: e, machineChannel: this.listenOnChannel }), r = n[5], a = n[6];
|
|
702
689
|
this.__internal__.dispense.backup_dispense = {
|
|
@@ -708,24 +695,22 @@ class b extends C {
|
|
|
708
695
|
let o;
|
|
709
696
|
do
|
|
710
697
|
o = await this.internalDispense(n), this.#F(), o.error === "elevator-locked" ? await this.#s() : o.error === "no-response" && await u(1e3);
|
|
711
|
-
while (["elevator-locked", "no-response"].includes(o.error));
|
|
698
|
+
while (["elevator-locked", "no-response"].includes(o.error || ""));
|
|
712
699
|
return this.__internal__.dispense.backup_dispense = {}, o;
|
|
713
700
|
}
|
|
714
701
|
#F() {
|
|
715
702
|
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;
|
|
716
703
|
}
|
|
717
704
|
#q() {
|
|
718
|
-
this.__internal__.dispense.timeout && clearTimeout(this.__internal__.dispense.timeout), this.__internal__.dispense.interval && clearInterval(this.__internal__.dispense.interval)
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
t.__internal__.dispense.interval = setInterval(() => {
|
|
722
|
-
t.status().then(() => {
|
|
705
|
+
this.__internal__.dispense.timeout && clearTimeout(this.__internal__.dispense.timeout), this.__internal__.dispense.interval && clearInterval(this.__internal__.dispense.interval), this.__internal__.dispense.timeout = setTimeout(() => {
|
|
706
|
+
this.__internal__.dispense.interval = setInterval(() => {
|
|
707
|
+
this.status().then(() => {
|
|
723
708
|
});
|
|
724
|
-
},
|
|
725
|
-
},
|
|
709
|
+
}, this.__internal__.dispense.interval_time);
|
|
710
|
+
}, this.__internal__.dispense.timeout_time);
|
|
726
711
|
}
|
|
727
712
|
internalClearSensing() {
|
|
728
|
-
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.
|
|
713
|
+
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.action !== "status"));
|
|
729
714
|
}
|
|
730
715
|
async endDispense() {
|
|
731
716
|
const t = i.endCartDispense({ machineChannel: this.listenOnChannel });
|
|
@@ -757,7 +742,7 @@ class b extends C {
|
|
|
757
742
|
});
|
|
758
743
|
}
|
|
759
744
|
#o() {
|
|
760
|
-
const t = this.__device.type === "iceplus" ?
|
|
745
|
+
const t = this.__device.type === "iceplus" ? y(40) : y(25), e = /* @__PURE__ */ new Date(), n = 1e3 * t + e.getTime(), r = new Date(n);
|
|
761
746
|
this.dispatch("reset:errors", {
|
|
762
747
|
description: "Resetting machine errors",
|
|
763
748
|
duration: t,
|
|
@@ -796,7 +781,9 @@ class b extends C {
|
|
|
796
781
|
"program"
|
|
797
782
|
);
|
|
798
783
|
}
|
|
799
|
-
async programDisplayLanguage({
|
|
784
|
+
async programDisplayLanguage({
|
|
785
|
+
language: t = "spanish"
|
|
786
|
+
} = {}) {
|
|
800
787
|
return await this.appendToQueue(
|
|
801
788
|
i.programDisplayLanguage({
|
|
802
789
|
machineChannel: this.listenOnChannel,
|
|
@@ -831,11 +818,6 @@ class b extends C {
|
|
|
831
818
|
"program"
|
|
832
819
|
);
|
|
833
820
|
}
|
|
834
|
-
/**
|
|
835
|
-
* Program the machine to work with a specific temperature
|
|
836
|
-
* @param {number|string} degrees
|
|
837
|
-
* @return {Promise<void>}
|
|
838
|
-
*/
|
|
839
821
|
async programWorkingTemperature({ degrees: t = 0.5 } = {}) {
|
|
840
822
|
return await this.appendToQueue(
|
|
841
823
|
i.programWorkingTemperature({
|
|
@@ -846,10 +828,6 @@ class b extends C {
|
|
|
846
828
|
"program"
|
|
847
829
|
);
|
|
848
830
|
}
|
|
849
|
-
/**
|
|
850
|
-
* @param {number|string} tray
|
|
851
|
-
* @return {Promise<void>}
|
|
852
|
-
*/
|
|
853
831
|
async programIsolationTray({ tray: t = 0 } = {}) {
|
|
854
832
|
return await this.appendToQueue(
|
|
855
833
|
i.programIsolationTray({
|
|
@@ -859,10 +837,6 @@ class b extends C {
|
|
|
859
837
|
"program"
|
|
860
838
|
);
|
|
861
839
|
}
|
|
862
|
-
/**
|
|
863
|
-
* @param {number|string} seconds
|
|
864
|
-
* @return {Promise<*>}
|
|
865
|
-
*/
|
|
866
840
|
async programTimeToStandbyAfterCollect({ seconds: t = 15 } = {}) {
|
|
867
841
|
return await this.appendToQueue(
|
|
868
842
|
i.programTimeToStandbyAfterCollect({
|
|
@@ -872,10 +846,6 @@ class b extends C {
|
|
|
872
846
|
"program"
|
|
873
847
|
);
|
|
874
848
|
}
|
|
875
|
-
/**
|
|
876
|
-
* @param {number|string} seconds
|
|
877
|
-
* @return {Promise<*>}
|
|
878
|
-
*/
|
|
879
849
|
async programTimeToStandbyWithoutCollect({ minutes: t = 1 } = {}) {
|
|
880
850
|
return await this.appendToQueue(
|
|
881
851
|
i.programTimeToStandbyWithoutCollect({
|
|
@@ -885,7 +855,9 @@ class b extends C {
|
|
|
885
855
|
"program"
|
|
886
856
|
);
|
|
887
857
|
}
|
|
888
|
-
async programElevatorSpeed({
|
|
858
|
+
async programElevatorSpeed({
|
|
859
|
+
speed: t = "high"
|
|
860
|
+
} = {}) {
|
|
889
861
|
return await this.appendToQueue(
|
|
890
862
|
i.programElevatorSpeed({
|
|
891
863
|
machineChannel: this.listenOnChannel,
|
|
@@ -909,10 +881,6 @@ class b extends C {
|
|
|
909
881
|
async programDisableTemperatureExpiration() {
|
|
910
882
|
return await this.programTemperatureExpiration({ enable: !1 });
|
|
911
883
|
}
|
|
912
|
-
/**
|
|
913
|
-
* @param {number|string} address
|
|
914
|
-
* @return {Promise<*>}
|
|
915
|
-
*/
|
|
916
884
|
async programMachineAddress({ address: t = 1 } = {}) {
|
|
917
885
|
return await this.appendToQueue(
|
|
918
886
|
i.programMachineAddress({
|
|
@@ -922,10 +890,6 @@ class b extends C {
|
|
|
922
890
|
"program"
|
|
923
891
|
);
|
|
924
892
|
}
|
|
925
|
-
/**
|
|
926
|
-
* @param {number|string} degrees
|
|
927
|
-
* @return {Promise<*>}
|
|
928
|
-
*/
|
|
929
893
|
async programTemperatureBeforeExpiration({ degrees: t = 0.5 } = {}) {
|
|
930
894
|
return await this.appendToQueue(
|
|
931
895
|
i.programTemperatureBeforeExpiration({
|
|
@@ -935,10 +899,6 @@ class b extends C {
|
|
|
935
899
|
"program"
|
|
936
900
|
);
|
|
937
901
|
}
|
|
938
|
-
/**
|
|
939
|
-
* @param {number|string} minutes
|
|
940
|
-
* @return {Promise<*>}
|
|
941
|
-
*/
|
|
942
902
|
async programTimeBeforeExpirationByTemperature({ minutes: t = 1 } = {}) {
|
|
943
903
|
return await this.appendToQueue(
|
|
944
904
|
i.programTimeBeforeExpirationByTemperature({
|
|
@@ -948,7 +908,9 @@ class b extends C {
|
|
|
948
908
|
"program"
|
|
949
909
|
);
|
|
950
910
|
}
|
|
951
|
-
async programTemperatureScale({
|
|
911
|
+
async programTemperatureScale({
|
|
912
|
+
scale: t = "celsius"
|
|
913
|
+
} = {}) {
|
|
952
914
|
return await this.appendToQueue(
|
|
953
915
|
i.programTemperatureScale({
|
|
954
916
|
machineChannel: this.listenOnChannel,
|
|
@@ -957,11 +919,6 @@ class b extends C {
|
|
|
957
919
|
"program"
|
|
958
920
|
);
|
|
959
921
|
}
|
|
960
|
-
/**
|
|
961
|
-
* @param {number|string} selection
|
|
962
|
-
* @param {number|string} voltage
|
|
963
|
-
* @return {Promise<void>}
|
|
964
|
-
*/
|
|
965
922
|
async programVoltageEngine({ selection: t = 1, voltage: e = 5 } = {}) {
|
|
966
923
|
return await this.appendToQueue(
|
|
967
924
|
i.programVoltageEngine({
|
|
@@ -972,11 +929,6 @@ class b extends C {
|
|
|
972
929
|
"voltage-engine"
|
|
973
930
|
);
|
|
974
931
|
}
|
|
975
|
-
/**
|
|
976
|
-
* @param {number|string} selection
|
|
977
|
-
* @param {boolean} enable
|
|
978
|
-
* @return {Promise<void>}
|
|
979
|
-
*/
|
|
980
932
|
async programPushOverProducts({ selection: t = 1, enable: e = !0 } = {}) {
|
|
981
933
|
return await this.appendToQueue(
|
|
982
934
|
i.programPushOverProducts({
|
|
@@ -987,11 +939,6 @@ class b extends C {
|
|
|
987
939
|
"push-over-products"
|
|
988
940
|
);
|
|
989
941
|
}
|
|
990
|
-
/**
|
|
991
|
-
* @param {number|string} selection
|
|
992
|
-
* @param {number|string} seconds
|
|
993
|
-
* @return {Promise<void>}
|
|
994
|
-
*/
|
|
995
942
|
async programChannelRunningAfterDispense({ selection: t = 1, seconds: e = 0 } = {}) {
|
|
996
943
|
return await this.appendToQueue(
|
|
997
944
|
i.programChannelRunningAfterDispense({
|
|
@@ -1002,7 +949,7 @@ class b extends C {
|
|
|
1002
949
|
"channel-running-after-dispense"
|
|
1003
950
|
);
|
|
1004
951
|
}
|
|
1005
|
-
async checkData(t, e =
|
|
952
|
+
async checkData(t, e = 255) {
|
|
1006
953
|
return await this.appendToQueue(
|
|
1007
954
|
i.checkData({
|
|
1008
955
|
machineChannel: this.listenOnChannel,
|
|
@@ -1108,10 +1055,6 @@ class b extends C {
|
|
|
1108
1055
|
"check-data"
|
|
1109
1056
|
);
|
|
1110
1057
|
}
|
|
1111
|
-
/**
|
|
1112
|
-
* @param {number|string} selection
|
|
1113
|
-
* @return {Promise<*>}
|
|
1114
|
-
*/
|
|
1115
1058
|
async getVoltageEngine({ selection: t = 1 } = {}) {
|
|
1116
1059
|
return await this.appendToQueue(
|
|
1117
1060
|
i.getVoltageEngine({
|
|
@@ -1121,10 +1064,6 @@ class b extends C {
|
|
|
1121
1064
|
"check-data"
|
|
1122
1065
|
);
|
|
1123
1066
|
}
|
|
1124
|
-
/**
|
|
1125
|
-
* @param {number|string} selection
|
|
1126
|
-
* @return {Promise<*>}
|
|
1127
|
-
*/
|
|
1128
1067
|
async getChannelPresence({ selection: t = 1 } = {}) {
|
|
1129
1068
|
return await this.appendToQueue(
|
|
1130
1069
|
i.getChannelPresence({
|
|
@@ -1134,10 +1073,6 @@ class b extends C {
|
|
|
1134
1073
|
"check-data"
|
|
1135
1074
|
);
|
|
1136
1075
|
}
|
|
1137
|
-
/**
|
|
1138
|
-
* @param {number|string} selection
|
|
1139
|
-
* @return {Promise<*>}
|
|
1140
|
-
*/
|
|
1141
1076
|
async getPushOverProducts({ selection: t = 1 } = {}) {
|
|
1142
1077
|
return await this.appendToQueue(
|
|
1143
1078
|
i.getPushOverProducts({
|
|
@@ -1147,10 +1082,6 @@ class b extends C {
|
|
|
1147
1082
|
"check-data"
|
|
1148
1083
|
);
|
|
1149
1084
|
}
|
|
1150
|
-
/**
|
|
1151
|
-
* @param {number|string} selection
|
|
1152
|
-
* @return {Promise<*>}
|
|
1153
|
-
*/
|
|
1154
1085
|
async getChannelRunningAfterDispense({ selection: t = 1 } = {}) {
|
|
1155
1086
|
return await this.appendToQueue(
|
|
1156
1087
|
i.getChannelRunningAfterDispense({
|
|
@@ -1169,11 +1100,6 @@ class b extends C {
|
|
|
1169
1100
|
"display"
|
|
1170
1101
|
);
|
|
1171
1102
|
}
|
|
1172
|
-
/**
|
|
1173
|
-
* @param {string} message
|
|
1174
|
-
* @param {number|string} seconds
|
|
1175
|
-
* @return {Promise<void>}
|
|
1176
|
-
*/
|
|
1177
1103
|
async setDisplayMessageTemporarily({ message: t = "", seconds: e = 1 }) {
|
|
1178
1104
|
return this.appendToQueue(
|
|
1179
1105
|
i.setDisplayMessageTemporarily({
|
|
@@ -1184,10 +1110,6 @@ class b extends C {
|
|
|
1184
1110
|
"display"
|
|
1185
1111
|
);
|
|
1186
1112
|
}
|
|
1187
|
-
/**
|
|
1188
|
-
* @param {string} message
|
|
1189
|
-
* @return {Promise<void>}
|
|
1190
|
-
*/
|
|
1191
1113
|
async setDisplayMessageUnlimited({ message: t = "" }) {
|
|
1192
1114
|
return await this.appendToQueue(
|
|
1193
1115
|
i.setDisplayMessageUnlimited({
|
|
@@ -1206,11 +1128,6 @@ class b extends C {
|
|
|
1206
1128
|
"clock"
|
|
1207
1129
|
);
|
|
1208
1130
|
}
|
|
1209
|
-
/**
|
|
1210
|
-
* @param {null|string} event
|
|
1211
|
-
* @param {boolean} enable
|
|
1212
|
-
* @return {Promise<void>}
|
|
1213
|
-
*/
|
|
1214
1131
|
async eventsConfig({ event: t = null, enable: e = !0 } = {}) {
|
|
1215
1132
|
return await this.appendToQueue(
|
|
1216
1133
|
i.eventsConfig({
|
|
@@ -1239,10 +1156,9 @@ class b extends C {
|
|
|
1239
1156
|
"events-config"
|
|
1240
1157
|
);
|
|
1241
1158
|
}
|
|
1242
|
-
async sendCustomCode({ code: t = [] } = {}) {
|
|
1159
|
+
async sendCustomCode({ code: t = [] } = { code: [] }) {
|
|
1243
1160
|
return await this.appendToQueue(
|
|
1244
1161
|
i.sendCustomCode({
|
|
1245
|
-
machineChannel: this.listenOnChannel,
|
|
1246
1162
|
code: t
|
|
1247
1163
|
}),
|
|
1248
1164
|
"custom"
|
|
@@ -1255,12 +1171,12 @@ class b extends C {
|
|
|
1255
1171
|
for (let n = t; n <= e; n++)
|
|
1256
1172
|
this.__device.channels.verification.current = n, await this.getChannelPresence({ selection: n });
|
|
1257
1173
|
return new Promise((n) => {
|
|
1258
|
-
|
|
1174
|
+
const r = setInterval(() => {
|
|
1259
1175
|
this.__device.channels.verification.channels.length === e - t + 1 && (clearInterval(r), this.dispatch("channels", { channels: this.__device.channels.verification.channels }), this.__device.channels.verification.clear(), n(!0));
|
|
1260
1176
|
}, 500);
|
|
1261
1177
|
});
|
|
1262
1178
|
}
|
|
1263
1179
|
}
|
|
1264
1180
|
export {
|
|
1265
|
-
|
|
1181
|
+
w as Jofemar
|
|
1266
1182
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("./webserial-core-YjdXyVOx.cjs");function u(o=100){return new Promise(n=>setTimeout(()=>n(),o))}function b(){return"serial"in navigator}function g(){return"geolocation"in navigator}function k(){return"crypto"in window}function y(o=1){return o*1e3}function w(o){return o==null||o===""}class e{static enable=!1;static instance=null;static#i=null;static#r=1;static#d(){if(e.enable===!1)throw new Error("Emulator is disabled");return e.enable}static#o(n){return e.instance=n,e.#i=n.typeDevice,e.#r=n.deviceNumber,!0}static#n(n=null){return!e.#d()||n===null&&e.instance===null?!1:(e.instance===null&&n!==null&&e.#o(n),!0)}static#l(){if(e.#i!=="locker")throw new Error("This function is only available for Locker devices");return!0}static#s(){if(e.#i!=="boardroid")throw new Error("This function is only available for Boardroid devices");return!0}static#t(){if(e.#i!=="jofemar")throw new Error("This function is only available for Jofemar devices");return!0}static#c(){if(e.#i==="locker")throw new Error("This function is not available for Locker devices");return!0}static#e(n){e.instance!==null&&e.instance.__emulate({code:n})}static status(n=null){if(!e.#n(n))return!1;let t=[];switch(e.#i){case"locker":t=["0","8"];break;case"boardroid":t=["2",(5+e.#r).toString(16).toUpperCase()];break;case"jofemar":t=["6"];break;default:return!1}e.#e(t)}static dispensed(n=null){if(!e.#n(n))return!1;let t=[];switch(e.#i){case"locker":t=["0","7","4","4","4"];break;case"boardroid":t=["2","D7","A","0","0","0","0","0","0","0","0","0","F2"];break;case"jofemar":t=["6","30"];break;default:return!1}e.#e(t)}static notDispensed(n=null){if(!e.#n(n))return!1;let t=[];switch(e.#i){case"locker":t=["0","7","5","5","5"];break;case"boardroid":t=["2","D7","A","0","0","1","0","0","0","0","0","0","F2"];break;case"jofemar":t=["6","34"];break;default:return!1}e.#e(t)}static gateInactive(n=null){if(!e.#n(n)||!this.#l())return!1;this.#e(["0","7","5","5","5"])}static gateConfigured(n=null){if(!e.#n(n)||!this.#l())return!1;this.#e(["0","6"])}static keyPressed(n=null){if(!e.#n(n)||!e.#t())return!1;const t=["30","31","32","33","34","35","36","37","38","39","2A","23","41","42","43","44"],s=(128+e.#r).toString(16),i=Math.floor(Math.random()*15);e.#e(["2",s,"54",t[i]])}static doorOpened(n=null){if(!e.#n(n)||!this.#c())return!1;let t=[];const s=(128+e.#r).toString(16);switch(e.#i){case"boardroid":t=["2","D8","dc"];break;case"jofemar":t=["2",s,"50","4F"];break}e.#e(t)}static doorClosed(n=null){if(!e.#n(n)||!this.#c())return!1;let t=[];const s=(128+e.#r).toString(16);switch(e.#i){case"boardroid":t=["2","D8","db"];break;case"jofemar":t=["2",s,"50","43"];break}e.#e(t)}static channelDisconnected(n=null){if(!e.#n(n)||!e.#t())return!1;const t=(128+e.#r).toString(16);e.#e(["2",t,"43","43","43","FD"])}static channelConnected(n=null){if(!e.#n(n)||!e.#t())return!1;const t=(128+e.#r).toString(16);e.#e(["2",t,"43","43","43","FC"])}static channelEmpty(n=null){if(!e.#n(n)||!e.#t())return!1;const t=(128+e.#r).toString(16);e.#e(["2",t,"43","43","43","FF"])}static workingTemperature(n=null){if(!e.#n(n)||!e.#t())return!1;const t=(128+e.#r).toString(16);e.#e(["2",t,"43","54","16"])}static currentTemperature(n=null){if(!e.#n(n)||!e.#c())return!1;let t=[];const s=(128+e.#r).toString(16);switch(e.#i){case"boardroid":t=["2","D9","44","30"];break;case"jofemar":t=["2",s,"43","74","2B","30","39","2E","31","7F","43"];break}e.#e(t)}static ready(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","30"])}static busy(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","31"])}static invalidTray(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","32"])}static invalidChannel(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","33"])}static emptyChannel(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","34"])}static elevatorJam(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","35"])}static elevatorMalfunction(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","36"])}static phototransistorFailure(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","37"])}static allChannelsEmpty(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","38"])}static productDetectorFailure(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","39"])}static displayDisconnected(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","41"])}static productUnderElevator(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","42"])}static elevatorSettingAlarm(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","43"])}static buttonPanelFailure(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","44"])}static errorWritingEeprom(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","45"])}static errorControlTemperature(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","46"])}static thermometerDisconnected(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","47"])}static thermometerMisconfigured(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","48"])}static thermometerFailure(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","49"])}static errorExtractorConsumption(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4A"])}static channelSearchError(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4B"])}static productExitMouthSearchError(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4C"])}static elevatorInteriorLocked(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4D"])}static productDetectorVerifierError(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4E"])}static waitingForProductRecall(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4F"])}static productExpiredByTemperature(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","50"])}static faultyAutomaticDoor(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","51"])}static rejectLever(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","A0","1"])}static resetCoinPurse(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","A0","2"])}static#f(n,t=null){let s=n[Math.floor(Math.random()*5)];if(t!==null&&!isNaN(parseFloat(t)))switch(t.toString()){case"0.5":s=n[1];break;case"1":s=n[2];break;case"2":s=n[3];break;case"5":s=n[4];break;case"10":s=n[5];break}return s}static coinInsertedBox(n=null,t=null){if(!e.#n(n)||!e.#s())return!1;const s=["40","41","42","43","44","45"],i=e.#f(s,t);e.#e(["2","A0",i])}static coinInsertedTube(n=null,t=null){if(!e.#n(n)||!e.#s())return!1;const s=["50","51","52","53","54","55"],i=e.#f(s,t);e.#e(["2","A0",i])}static#a(n,t=null){let s=n[Math.floor(Math.random()*4)];if(t!==null&&!isNaN(parseFloat(t)))switch(t.toString()){case"20":s=n[0];break;case"50":s=n[1];break;case"100":s=n[2];break;case"200":s=n[3];break;case"500":s=n[4];break}return s}static banknoteInsertedStacker(n=null,t=null){if(!e.#n(n)||!e.#s())return!1;const s=["80","81","82","83","84"],i=e.#a(s,t);e.#e(["2","B0",i])}static banknoteInsertedEscrow(n=null,t=null){if(!e.#n(n)||!e.#s())return!1;const s=["90","91","92","93","94"],i=e.#a(s,t);e.#e(["2","B0",i])}static banknoteEjected(n=null,t=null){if(!e.#n(n)||!e.#s())return!1;const s=["A0","A1","A2","A3","A4"],i=e.#a(s,t);e.#e(["2","B0",i])}static banknoteInsertedRecycler(n=null,t=null){if(!e.#n(n)||!e.#s())return!1;const s=["B0","B1","B2","B3","B4"],i=e.#a(s,t);e.#e(["2","B0",i])}static banknoteTaken(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","B0","2a"])}static coinPurseEnabled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D0","1"])}static coinPurseDisabled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D0","0"])}static billPurseDisabled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D1","0","0"])}static billPurseEnabled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D1","1","1"])}static readTubes(n=null){if(!e.#n(n)||!e.#s())return!1;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"],[s,i,a,c,l,f]=[t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)]];e.#e(["2","D2",s,i,a,c,l,f])}static readBillPurse(n=null,t=null){if(!e.#n(n)||!e.#s()||e.instance===null)return!1;const s=e.instance,i=["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"];if(s.__banknote_purse.recycler.ict){const a=i[Math.floor(Math.random()*31)];let c="0",l="0",f="0",d="0",h="0";if(t!==null&&!isNaN(parseInt(t)))switch(t.toString()){case"20":c=a;break;case"50":l=a;break;case"100":f=a;break;case"200":d=a;break;case"500":h=a;break}else switch(s.__banknote_purse.recycler.banknote){case 0:c=a;break;case 1:l=a;break;case 2:f=a;break;case 3:d=a;break;case 4:h=a;break}e.#e(["2","D3",c,l,f,d,h,"0"])}else{const[a,c,l,f,d,h]=[i[Math.floor(Math.random()*30)],i[Math.floor(Math.random()*30)],i[Math.floor(Math.random()*30)],i[Math.floor(Math.random()*2)],i[Math.floor(Math.random())],i[Math.floor(Math.random())]];e.#e(["2","D3",a,c,l,f,d,h])}}static banknoteAccepted(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D4","1"])}static banknoteRejected(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D4","0"])}static banknotesDispensed(n=null){if(!e.#n(n)||!e.#s()||e.instance===null)return!1;const t=e.instance,s=["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"];if(t.__banknote_purse.recycler.ict){const i=s[Math.floor(Math.random()*30)];let a="0",c="0",l="0",f="0",d="0";switch(t.__banknote_purse.recycler.banknote){case 0:a=i;break;case 1:c=i;break;case 2:l=i;break;case 3:f=i;break;case 4:d=i;break}e.#e(["2","D5",a,c,l,f,d,"0"])}else{const[i,a,c,l,f,d]=[s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*2)],s[Math.floor(Math.random())],s[Math.floor(Math.random())]];e.#e(["2","D5",i,a,c,l,f,d])}}static coinsDispensed(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","D6"])}static relayOn(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DA","1"])}static relayOff(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DA","0"])}static nayaxEnabled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","1"])}static nayaxDisabled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","0"])}static nayaxPreCreditAuthorized(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","3"])}static nayaxCancelRequest(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","4"])}static nayaxSellApproved(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","5"])}static nayaxSellDenied(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","6"])}static nayaxEndSession(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","7"])}static nayaxCancelled(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","8"])}static nayaxDispensed(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","A","0"])}static nayaxNotDispensed(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["2","DD","A","1"])}static fullTray(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["6","4F"])}static setConnection(n=null){if(!e.#n(n)||e.instance===null)return!1;e.instance.__internal__.serial.connected=!0}}class r extends p.a{constructor(){super(),r.registerType("boardroid"),r.registerType("hopper"),r.registerType("jofemar"),r.registerType("locker"),r.registerType("pinpad"),r.registerType("pinpax"),r.registerType("relay")}static addCustom(n,t){r.registerType(n),r.add(t)}static getCustomByUuid(n,t){return r.get(n,t)}static getJofemarByUuid(n){return r.get("jofemar",n)}static getLockerByUuid(n){return r.get("locker",n)}static getRelayByUuid(n){return r.get("relay",n)}static getBoardroidByUuid(n){return r.get("boardroid",n)}static getPinPadByUuid(n){return r.get("pinpad",n)}static getPinPaxByUuid(n){return r.get("pinpax",n)}static getHopperByUuid(n){return r.get("hopper",n)}static getJofemar(n=1){return r.getByNumber("jofemar",n)}static getBoardroid(n=1){return r.getByNumber("boardroid",n)}static getLocker(n=1){return r.getByNumber("locker",n)}static getRelay(n=1){return r.getByNumber("relay",n)}static getPinPad(n=1){return r.getByNumber("pinpad",n)}static getPinPax(n=1){return r.getByNumber("pinpax",n)}static getHopper(n=1){return r.getByNumber("hopper",n)}}r.instance=new r;class M extends p.ut{constructor(n={}){super(n),this.__internal__=structuredClone(this.__internal__),this.getResponseAsArrayHex(),this.__internal__.device.door_open=!1,this.__internal__.time.response_engines=2e3,this.__internal__.time.sense=100,this.__internal__.interval.waiting_sense=0,this.__internal__.dispense={must_response:!1,dispensing:!1,status:null,counter:0,limit_counter:20,custom_limit_counter:null,backup_dispense:{}}}get isDoorOpen(){return this.__internal__.device.door_open}get isDispensing(){return this.__internal__.interval.waiting_sense||this.__internal__.dispense.dispensing}async timeout(n,t){await super.timeout(n,t),t==="dispense"&&(this.__internal__.dispense.status="no-response")}internalClearSensing(){this.__internal__.interval.waiting_sense&&clearInterval(this.__internal__.interval.waiting_sense),this.__internal__.interval.waiting_sense=0,this.__internal__.dispense.status=null,this.__internal__.dispense.counter=0,this.__internal__.dispense.dispensing=!1}internalDispensingProcess(){let n=this.__internal__.dispense.limit_counter;return this.__internal__.dispense.custom_limit_counter&&(n=this.__internal__.dispense.custom_limit_counter),n+=Math.ceil(n*.6),this.__internal__.dispense.counter>=n?(this.internalClearSensing(),this.__internal__.dispense.status=!1,this.__internal__.dispense.dispensing=!1,!1):(this.__internal__.dispense.counter=parseFloat((.1+this.__internal__.dispense.counter).toFixed(1)),this.__internal__.dispense.counter%1===0&&this.dispatch("dispensing",{status:this.__internal__.dispense.status,counter:this.__internal__.dispense.counter,limit:n}),null)}async internalDispenseStatus(){return this.__internal__.dispense.must_response&&(await u(this.__internal__.time.response_engines+10),this.__internal__.dispense.status==="no-response")?(this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"no-response"}),{status:!1,error:"no-response"}):(this.__internal__.dispense.status=null,this.__internal__.dispense.dispensing=!0,this.dispatch("internal:dispense:running",{}),new Promise(n=>{this.__internal__.interval.waiting_sense=setInterval(()=>{switch(this.__internal__.dispense.status){case null:this.internalDispensingProcess()===!1&&(this.internalClearSensing(),this.dispatch("not-dispensed",{reason:"timeout"}),n({status:!1,error:"timeout"}));break;case!0:this.internalClearSensing(),this.__internal__.dispense.status=!0,this.dispatch("dispensed",{}),n({status:!0,error:null});break;case!1:this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"no-stock"}),n({status:!1,error:null});break;case"elevator-locked":this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"elevator-locked"}),n({status:!1,error:"elevator-locked"});break;case"no-response":this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"no-response"}),n({status:!1,error:"no-response"});break}},this.__internal__.time.sense)}))}async internalDispense(n){if(this.isDispensing)throw new Error("Another dispensing process is running");if(this.__internal__.dispense.dispensing=!0,!e.enable&&!this.__internal__.serial.connected&&(await this.serialConnect(),!this.__internal__.serial.connected))throw this.__internal__.dispense.dispensing=!1,new Error("Serial device not connected");return this.__internal__.serial.queue.length===0?(await this.appendToQueue(n,"dispense"),await this.internalDispenseStatus()):new Promise(t=>{const s=setInterval(async()=>{if(this.__internal__.serial.queue.length>0)return;clearInterval(s),await this.appendToQueue(n,"dispense");const i=await this.internalDispenseStatus();t(i)},100)})}__emulate(n){if(typeof n.code!="object"){console.error("Invalid data to make an emulation");return}this.__internal__.serial.connected||(this.__internal__.serial.connected=!0,this.dispatch("serial:connected"),r.instance.dispatch("change"),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);const t=[];for(const s in n.code)t.push(n.code[s].toString().padStart(2,"0").toLowerCase());this.serialMessage(t)}set listenOnPort(n){this.listenOnChannel=n}get listenOnPort(){return this.__internal__.device.listen_on_port??1}fixHexArray(n){return n.map(t=>typeof t=="string"?t.padStart(2,"0").toLowerCase():t.toString(16).padStart(2,"0").toLowerCase())}}exports.Devices=r;exports.Emulator=e;exports.Kernel=M;exports.getSeconds=y;exports.isEmpty=w;exports.supportCrypto=k;exports.supportGeolocation=g;exports.supportWebSerial=b;exports.wait=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("./webserial-core-Cj_EZjAU.cjs");function u(o=100){return new Promise(n=>setTimeout(()=>n(),o))}function b(){return"serial"in navigator}function g(){return"geolocation"in navigator}function k(){return"crypto"in window}function y(o=1){return o*1e3}function w(o){return o==null||o===""}class e{static enable=!1;static instance=null;static#i=null;static#r=1;static#d(){if(e.enable===!1)throw new Error("Emulator is disabled");return e.enable}static#o(n){return e.instance=n,e.#i=n.typeDevice,e.#r=n.deviceNumber,!0}static#n(n=null){return!e.#d()||n===null&&e.instance===null?!1:(e.instance===null&&n!==null&&e.#o(n),!0)}static#l(){if(e.#i!=="locker")throw new Error("This function is only available for Locker devices");return!0}static#t(){if(e.#i!=="boardroid")throw new Error("This function is only available for Boardroid devices");return!0}static#s(){if(e.#i!=="jofemar")throw new Error("This function is only available for Jofemar devices");return!0}static#c(){if(e.#i==="locker")throw new Error("This function is not available for Locker devices");return!0}static#e(n){e.instance!==null&&e.instance.__emulate({code:n})}static status(n=null){if(!e.#n(n))return!1;let s=[];switch(e.#i){case"locker":s=["0","8"];break;case"boardroid":s=["2",(5+e.#r).toString(16).toUpperCase()];break;case"jofemar":s=["6"];break;default:return!1}e.#e(s)}static dispensed(n=null){if(!e.#n(n))return!1;let s=[];switch(e.#i){case"locker":s=["0","7","4","4","4"];break;case"boardroid":s=["2","D7","A","0","0","0","0","0","0","0","0","0","F2"];break;case"jofemar":s=["6","30"];break;default:return!1}e.#e(s)}static notDispensed(n=null){if(!e.#n(n))return!1;let s=[];switch(e.#i){case"locker":s=["0","7","5","5","5"];break;case"boardroid":s=["2","D7","A","0","0","1","0","0","0","0","0","0","F2"];break;case"jofemar":s=["6","34"];break;default:return!1}e.#e(s)}static gateInactive(n=null){if(!e.#n(n)||!this.#l())return!1;this.#e(["0","7","5","5","5"])}static gateConfigured(n=null){if(!e.#n(n)||!this.#l())return!1;this.#e(["0","6"])}static keyPressed(n=null){if(!e.#n(n)||!e.#s())return!1;const s=["30","31","32","33","34","35","36","37","38","39","2A","23","41","42","43","44"],t=(128+e.#r).toString(16),i=Math.floor(Math.random()*15);e.#e(["2",t,"54",s[i]])}static doorOpened(n=null){if(!e.#n(n)||!this.#c())return!1;let s=[];const t=(128+e.#r).toString(16);switch(e.#i){case"boardroid":s=["2","D8","dc"];break;case"jofemar":s=["2",t,"50","4F"];break}e.#e(s)}static doorClosed(n=null){if(!e.#n(n)||!this.#c())return!1;let s=[];const t=(128+e.#r).toString(16);switch(e.#i){case"boardroid":s=["2","D8","db"];break;case"jofemar":s=["2",t,"50","43"];break}e.#e(s)}static channelDisconnected(n=null){if(!e.#n(n)||!e.#s())return!1;const s=(128+e.#r).toString(16);e.#e(["2",s,"43","43","43","FD"])}static channelConnected(n=null){if(!e.#n(n)||!e.#s())return!1;const s=(128+e.#r).toString(16);e.#e(["2",s,"43","43","43","FC"])}static channelEmpty(n=null){if(!e.#n(n)||!e.#s())return!1;const s=(128+e.#r).toString(16);e.#e(["2",s,"43","43","43","FF"])}static workingTemperature(n=null){if(!e.#n(n)||!e.#s())return!1;const s=(128+e.#r).toString(16);e.#e(["2",s,"43","54","16"])}static currentTemperature(n=null){if(!e.#n(n)||!e.#c())return!1;let s=[];const t=(128+e.#r).toString(16);switch(e.#i){case"boardroid":s=["2","D9","44","30"];break;case"jofemar":s=["2",t,"43","74","2B","30","39","2E","31","7F","43"];break}e.#e(s)}static ready(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","30"])}static busy(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","31"])}static invalidTray(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","32"])}static invalidChannel(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","33"])}static emptyChannel(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","34"])}static elevatorJam(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","35"])}static elevatorMalfunction(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","36"])}static phototransistorFailure(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","37"])}static allChannelsEmpty(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","38"])}static productDetectorFailure(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","39"])}static displayDisconnected(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","41"])}static productUnderElevator(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","42"])}static elevatorSettingAlarm(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","43"])}static buttonPanelFailure(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","44"])}static errorWritingEeprom(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","45"])}static errorControlTemperature(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","46"])}static thermometerDisconnected(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","47"])}static thermometerMisconfigured(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","48"])}static thermometerFailure(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","49"])}static errorExtractorConsumption(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4A"])}static channelSearchError(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4B"])}static productExitMouthSearchError(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4C"])}static elevatorInteriorLocked(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4D"])}static productDetectorVerifierError(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4E"])}static waitingForProductRecall(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4F"])}static productExpiredByTemperature(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","50"])}static faultyAutomaticDoor(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","51"])}static rejectLever(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","A0","1"])}static resetCoinPurse(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","A0","2"])}static#f(n,s=null){let t=n[Math.floor(Math.random()*5)];if(s!==null&&!isNaN(parseFloat(s)))switch(s.toString()){case"0.5":t=n[1];break;case"1":t=n[2];break;case"2":t=n[3];break;case"5":t=n[4];break;case"10":t=n[5];break}return t}static coinInsertedBox(n=null,s=null){if(!e.#n(n)||!e.#t())return!1;const t=["40","41","42","43","44","45"],i=e.#f(t,s);e.#e(["2","A0",i])}static coinInsertedTube(n=null,s=null){if(!e.#n(n)||!e.#t())return!1;const t=["50","51","52","53","54","55"],i=e.#f(t,s);e.#e(["2","A0",i])}static#a(n,s=null){let t=n[Math.floor(Math.random()*4)];if(s!==null&&!isNaN(parseFloat(s)))switch(s.toString()){case"20":t=n[0];break;case"50":t=n[1];break;case"100":t=n[2];break;case"200":t=n[3];break;case"500":t=n[4];break}return t}static banknoteInsertedStacker(n=null,s=null){if(!e.#n(n)||!e.#t())return!1;const t=["80","81","82","83","84"],i=e.#a(t,s);e.#e(["2","B0",i])}static banknoteInsertedEscrow(n=null,s=null){if(!e.#n(n)||!e.#t())return!1;const t=["90","91","92","93","94"],i=e.#a(t,s);e.#e(["2","B0",i])}static banknoteEjected(n=null,s=null){if(!e.#n(n)||!e.#t())return!1;const t=["A0","A1","A2","A3","A4"],i=e.#a(t,s);e.#e(["2","B0",i])}static banknoteInsertedRecycler(n=null,s=null){if(!e.#n(n)||!e.#t())return!1;const t=["B0","B1","B2","B3","B4"],i=e.#a(t,s);e.#e(["2","B0",i])}static banknoteTaken(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","B0","2a"])}static coinPurseEnabled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D0","1"])}static coinPurseDisabled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D0","0"])}static billPurseDisabled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D1","0","0"])}static billPurseEnabled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D1","1","1"])}static readTubes(n=null){if(!e.#n(n)||!e.#t())return!1;const s=["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"],[t,i,a,c,l,f]=[s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)],s[Math.floor(Math.random()*30)]];e.#e(["2","D2",t,i,a,c,l,f])}static readBillPurse(n=null,s=null){if(!e.#n(n)||!e.#t()||e.instance===null)return!1;const t=e.instance,i=["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"];if(t.__banknote_purse.recycler.ict){const a=i[Math.floor(Math.random()*31)];let c="0",l="0",f="0",d="0",h="0";if(s!==null&&!isNaN(parseInt(s)))switch(s.toString()){case"20":c=a;break;case"50":l=a;break;case"100":f=a;break;case"200":d=a;break;case"500":h=a;break}else switch(t.__banknote_purse.recycler.banknote){case 0:c=a;break;case 1:l=a;break;case 2:f=a;break;case 3:d=a;break;case 4:h=a;break}e.#e(["2","D3",c,l,f,d,h,"0"])}else{const[a,c,l,f,d,h]=[i[Math.floor(Math.random()*30)],i[Math.floor(Math.random()*30)],i[Math.floor(Math.random()*30)],i[Math.floor(Math.random()*2)],i[Math.floor(Math.random())],i[Math.floor(Math.random())]];e.#e(["2","D3",a,c,l,f,d,h])}}static banknoteAccepted(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D4","1"])}static banknoteRejected(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D4","0"])}static banknotesDispensed(n=null){if(!e.#n(n)||!e.#t()||e.instance===null)return!1;const s=e.instance,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"];if(s.__banknote_purse.recycler.ict){const i=t[Math.floor(Math.random()*30)];let a="0",c="0",l="0",f="0",d="0";switch(s.__banknote_purse.recycler.banknote){case 0:a=i;break;case 1:c=i;break;case 2:l=i;break;case 3:f=i;break;case 4:d=i;break}e.#e(["2","D5",a,c,l,f,d,"0"])}else{const[i,a,c,l,f,d]=[t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*30)],t[Math.floor(Math.random()*2)],t[Math.floor(Math.random())],t[Math.floor(Math.random())]];e.#e(["2","D5",i,a,c,l,f,d])}}static coinsDispensed(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","D6"])}static relayOn(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DA","1"])}static relayOff(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DA","0"])}static nayaxEnabled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","1"])}static nayaxDisabled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","0"])}static nayaxPreCreditAuthorized(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","3"])}static nayaxCancelRequest(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","4"])}static nayaxSellApproved(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","5"])}static nayaxSellDenied(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","6"])}static nayaxEndSession(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","7"])}static nayaxCancelled(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","8"])}static nayaxDispensed(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","A","0"])}static nayaxNotDispensed(n=null){if(!e.#n(n)||!e.#t())return!1;e.#e(["2","DD","A","1"])}static fullTray(n=null){if(!e.#n(n)||!e.#s())return!1;e.#e(["6","4F"])}static setConnection(n=null){if(!e.#n(n)||e.instance===null)return!1;e.instance.__internal__.serial.connected=!0}}class r extends p.a{constructor(){super();const n={relay:[],locker:[],jofemar:[],boardroid:[],pinpad:[],pinpax:[],hopper:[]};r.devices={...structuredClone(p.a.devices),...n}}addCustom(n,s){r.registerType(n),r.add(s)}getCustomByUuid(n,s){return r.get(n,s)}getJofemarByUuid(n){return r.get("jofemar",n)}getLockerByUuid(n){return r.get("locker",n)}getRelayByUuid(n){return r.get("relay",n)}getBoardroidByUuid(n){return r.get("boardroid",n)}getPinPadByUuid(n){return r.get("pinpad",n)}getPinPaxByUuid(n){return r.get("pinpax",n)}getHopperByUuid(n){return r.get("hopper",n)}getJofemar(n=1){return r.getByNumber("jofemar",n)}getBoardroid(n=1){return r.getByNumber("boardroid",n)}getLocker(n=1){return r.getByNumber("locker",n)}getRelay(n=1){return r.getByNumber("relay",n)}getPinPad(n=1){return r.getByNumber("pinpad",n)}getPinPax(n=1){return r.getByNumber("pinpax",n)}getHopper(n=1){return r.getByNumber("hopper",n)}}r.instance||(r.instance=new r);class D extends p.ut{constructor(n={}){super(n),this.__internal__=structuredClone(this.__internal__),this.getResponseAsArrayHex(),this.__internal__.device.door_open=!1,this.__internal__.time.response_engines=2e3,this.__internal__.time.sense=100,this.__internal__.interval.waiting_sense=0,this.__internal__.dispense={must_response:!1,dispensing:!1,status:null,counter:0,limit_counter:20,custom_limit_counter:null,backup_dispense:{}}}get isDoorOpen(){return this.__internal__.device.door_open}get isDispensing(){return this.__internal__.interval.waiting_sense||this.__internal__.dispense.dispensing}async timeout(n,s){await super.timeout(n,s),s==="dispense"&&(this.__internal__.dispense.status="no-response")}internalClearSensing(){this.__internal__.interval.waiting_sense&&clearInterval(this.__internal__.interval.waiting_sense),this.__internal__.interval.waiting_sense=0,this.__internal__.dispense.status=null,this.__internal__.dispense.counter=0,this.__internal__.dispense.dispensing=!1}internalDispensingProcess(){let n=this.__internal__.dispense.limit_counter;return this.__internal__.dispense.custom_limit_counter&&(n=this.__internal__.dispense.custom_limit_counter),n+=Math.ceil(n*.6),this.__internal__.dispense.counter>=n?(this.internalClearSensing(),this.__internal__.dispense.status=!1,this.__internal__.dispense.dispensing=!1,!1):(this.__internal__.dispense.counter=parseFloat((.1+this.__internal__.dispense.counter).toFixed(1)),this.__internal__.dispense.counter%1===0&&this.dispatch("dispensing",{status:this.__internal__.dispense.status,counter:this.__internal__.dispense.counter,limit:n}),null)}async internalDispenseStatus(){return this.__internal__.dispense.must_response&&(await u(this.__internal__.time.response_engines+10),this.__internal__.dispense.status==="no-response")?(this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"no-response"}),{status:!1,error:"no-response"}):(this.__internal__.dispense.status=null,this.__internal__.dispense.dispensing=!0,this.dispatch("internal:dispense:running",{}),new Promise(n=>{this.__internal__.interval.waiting_sense=setInterval(()=>{switch(this.__internal__.dispense.status){case null:this.internalDispensingProcess()===!1&&(this.internalClearSensing(),this.dispatch("not-dispensed",{reason:"timeout"}),n({status:!1,error:"timeout"}));break;case!0:this.internalClearSensing(),this.__internal__.dispense.status=!0,this.dispatch("dispensed",{}),n({status:!0,error:null});break;case!1:this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"no-stock"}),n({status:!1,error:null});break;case"elevator-locked":this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"elevator-locked"}),n({status:!1,error:"elevator-locked"});break;case"no-response":this.internalClearSensing(),this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{reason:"no-response"}),n({status:!1,error:"no-response"});break}},this.__internal__.time.sense)}))}async internalDispense(n){if(this.isDispensing)throw new Error("Another dispensing process is running");if(this.__internal__.dispense.dispensing=!0,!e.enable&&!this.__internal__.serial.connected&&(await this.serialConnect(),!this.__internal__.serial.connected))throw this.__internal__.dispense.dispensing=!1,new Error("Serial device not connected");return this.__internal__.serial.queue.length===0?(await this.appendToQueue(n,"dispense"),await this.internalDispenseStatus()):new Promise(s=>{const t=setInterval(async()=>{if(this.__internal__.serial.queue.length>0)return;clearInterval(t),await this.appendToQueue(n,"dispense");const i=await this.internalDispenseStatus();s(i)},100)})}__emulate(n){if(typeof n.code!="object"){console.error("Invalid data to make an emulation");return}this.__internal__.serial.connected||(this.__internal__.serial.connected=!0,this.dispatch("serial:connected"),r.instance.dispatch("change"),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);const s=[];for(const t in n.code)s.push(n.code[t].toString().padStart(2,"0").toLowerCase());this.serialMessage(s)}set listenOnPort(n){this.listenOnChannel=n}get listenOnPort(){return this.__internal__.device.listen_on_port??1}fixHexArray(n){return n.map(s=>typeof s=="string"?s.padStart(2,"0").toLowerCase():s.toString(16).padStart(2,"0").toLowerCase())}}exports.Devices=r;exports.Emulator=e;exports.Kernel=D;exports.getSeconds=y;exports.isEmpty=w;exports.supportCrypto=k;exports.supportGeolocation=g;exports.supportWebSerial=b;exports.wait=u;
|