@danidoble/webserial 4.2.7 → 4.2.9
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/arduino.cjs +1 -1
- package/dist/arduino.js +1 -1
- package/dist/boardroid.cjs +1 -1
- package/dist/boardroid.js +2 -2
- package/dist/jofemar.cjs +1 -1
- package/dist/jofemar.js +1 -1
- package/dist/{kernel-Bquzoyqh.js → kernel-BLbpgXHp.js} +600 -480
- package/dist/kernel-Dv8bd_hz.cjs +4 -0
- package/dist/kernel.cjs +2 -2
- package/dist/kernel.js +1 -1
- package/dist/locker.cjs +1 -1
- package/dist/locker.js +37 -31
- package/dist/pinpad.cjs +5 -5
- package/dist/pinpad.js +5 -3
- package/dist/pinpax.cjs +4 -3
- package/dist/pinpax.js +68 -23
- package/dist/relay.cjs +1 -1
- package/dist/relay.js +1 -1
- package/dist/webserial.cjs +2 -2
- package/dist/webserial.js +4 -4
- package/package.json +6 -6
- package/dist/kernel-DSUxKxea.cjs +0 -4
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var Q = (l) => {
|
|
3
3
|
throw TypeError(l);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
function
|
|
5
|
+
var he = (l, e, t) => e in l ? ue(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
6
|
+
var U = (l, e, t) => he(l, typeof e != "symbol" ? e + "" : e, t), R = (l, e, t) => e.has(l) || Q("Cannot " + t);
|
|
7
|
+
var v = (l, e, t) => (R(l, e, "read from private field"), t ? t.call(l) : e.get(l)), I = (l, e, t) => e.has(l) ? Q("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t), $ = (l, e, t, n) => (R(l, e, "write to private field"), n ? n.call(l, t) : e.set(l, t), t), a = (l, e, t) => (R(l, e, "access private method"), t);
|
|
8
|
+
function de(l = 100) {
|
|
9
9
|
return new Promise((e) => setTimeout(() => e(), l));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Se() {
|
|
12
12
|
return "serial" in navigator;
|
|
13
13
|
}
|
|
14
14
|
function ke() {
|
|
15
15
|
return "geolocation" in navigator;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function xe() {
|
|
18
18
|
return "crypto" in window;
|
|
19
19
|
}
|
|
20
20
|
function De(l = 1) {
|
|
21
21
|
return l * 1e3;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Ee(l) {
|
|
24
24
|
return l == null || l === "";
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
const
|
|
26
|
+
var S, x, s, ee, te, c, j, m, p, L, o, O, M;
|
|
27
|
+
const i = class i {
|
|
28
28
|
static status(e = null) {
|
|
29
|
-
var n,
|
|
30
|
-
if (!a(n =
|
|
29
|
+
var n, r;
|
|
30
|
+
if (!a(n = i, s, c).call(n, e)) return !1;
|
|
31
31
|
let t = [];
|
|
32
|
-
switch (
|
|
32
|
+
switch (v(i, S)) {
|
|
33
33
|
case "locker":
|
|
34
34
|
t = ["0", "8"];
|
|
35
35
|
break;
|
|
36
36
|
case "boardroid":
|
|
37
|
-
t = ["2", (5 +
|
|
37
|
+
t = ["2", (5 + v(i, x)).toString(16).toUpperCase()];
|
|
38
38
|
break;
|
|
39
39
|
case "jofemar":
|
|
40
40
|
t = ["6"];
|
|
@@ -42,13 +42,13 @@ const r = class r {
|
|
|
42
42
|
default:
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
|
-
a(
|
|
45
|
+
a(r = i, s, o).call(r, t);
|
|
46
46
|
}
|
|
47
47
|
static dispensed(e = null) {
|
|
48
|
-
var n,
|
|
49
|
-
if (!a(n =
|
|
48
|
+
var n, r;
|
|
49
|
+
if (!a(n = i, s, c).call(n, e)) return !1;
|
|
50
50
|
let t = [];
|
|
51
|
-
switch (
|
|
51
|
+
switch (v(i, S)) {
|
|
52
52
|
case "locker":
|
|
53
53
|
t = ["0", "7", "4", "4", "4"];
|
|
54
54
|
break;
|
|
@@ -61,13 +61,13 @@ const r = class r {
|
|
|
61
61
|
default:
|
|
62
62
|
return !1;
|
|
63
63
|
}
|
|
64
|
-
a(
|
|
64
|
+
a(r = i, s, o).call(r, t);
|
|
65
65
|
}
|
|
66
66
|
static notDispensed(e = null) {
|
|
67
|
-
var n,
|
|
68
|
-
if (!a(n =
|
|
67
|
+
var n, r;
|
|
68
|
+
if (!a(n = i, s, c).call(n, e)) return !1;
|
|
69
69
|
let t = [];
|
|
70
|
-
switch (
|
|
70
|
+
switch (v(i, S)) {
|
|
71
71
|
case "locker":
|
|
72
72
|
t = ["0", "7", "5", "5", "5"];
|
|
73
73
|
break;
|
|
@@ -80,30 +80,30 @@ const r = class r {
|
|
|
80
80
|
default:
|
|
81
81
|
return !1;
|
|
82
82
|
}
|
|
83
|
-
a(
|
|
83
|
+
a(r = i, s, o).call(r, t);
|
|
84
84
|
}
|
|
85
85
|
static gateInactive(e = null) {
|
|
86
86
|
var t;
|
|
87
|
-
if (!a(t =
|
|
87
|
+
if (!a(t = i, s, c).call(t, e) || !a(this, s, j).call(this)) return !1;
|
|
88
88
|
a(this, s, o).call(this, ["0", "7", "5", "5", "5"]);
|
|
89
89
|
}
|
|
90
90
|
static gateConfigured(e = null) {
|
|
91
91
|
var t;
|
|
92
|
-
if (!a(t =
|
|
92
|
+
if (!a(t = i, s, c).call(t, e) || !a(this, s, j).call(this)) return !1;
|
|
93
93
|
a(this, s, o).call(this, ["0", "6"]);
|
|
94
94
|
}
|
|
95
95
|
static keyPressed(e = null) {
|
|
96
|
-
var
|
|
97
|
-
if (!a(
|
|
98
|
-
const t = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], n = (128 +
|
|
99
|
-
a(
|
|
96
|
+
var _, f, h;
|
|
97
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, p).call(f)) return !1;
|
|
98
|
+
const t = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], n = (128 + v(i, x)).toString(16), r = Math.floor(Math.random() * 15);
|
|
99
|
+
a(h = i, s, o).call(h, ["2", n, "54", t[r]]);
|
|
100
100
|
}
|
|
101
101
|
static doorOpened(e = null) {
|
|
102
|
-
var
|
|
103
|
-
if (!a(
|
|
102
|
+
var r, _;
|
|
103
|
+
if (!a(r = i, s, c).call(r, e) || !a(this, s, L).call(this)) return !1;
|
|
104
104
|
let t = [];
|
|
105
|
-
const n = (128 +
|
|
106
|
-
switch (
|
|
105
|
+
const n = (128 + v(i, x)).toString(16);
|
|
106
|
+
switch (v(i, S)) {
|
|
107
107
|
case "boardroid":
|
|
108
108
|
t = ["2", "D8", "dc"];
|
|
109
109
|
break;
|
|
@@ -111,14 +111,14 @@ const r = class r {
|
|
|
111
111
|
t = ["2", n, "50", "4F"];
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
-
a(
|
|
114
|
+
a(_ = i, s, o).call(_, t);
|
|
115
115
|
}
|
|
116
116
|
static doorClosed(e = null) {
|
|
117
|
-
var
|
|
118
|
-
if (!a(
|
|
117
|
+
var r, _;
|
|
118
|
+
if (!a(r = i, s, c).call(r, e) || !a(this, s, L).call(this)) return !1;
|
|
119
119
|
let t = [];
|
|
120
|
-
const n = (128 +
|
|
121
|
-
switch (
|
|
120
|
+
const n = (128 + v(i, x)).toString(16);
|
|
121
|
+
switch (v(i, S)) {
|
|
122
122
|
case "boardroid":
|
|
123
123
|
t = ["2", "D8", "db"];
|
|
124
124
|
break;
|
|
@@ -126,38 +126,38 @@ const r = class r {
|
|
|
126
126
|
t = ["2", n, "50", "43"];
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
|
-
a(
|
|
129
|
+
a(_ = i, s, o).call(_, t);
|
|
130
130
|
}
|
|
131
131
|
static channelDisconnected(e = null) {
|
|
132
|
-
var n,
|
|
133
|
-
if (!a(n =
|
|
134
|
-
const t = (128 +
|
|
135
|
-
a(
|
|
132
|
+
var n, r, _;
|
|
133
|
+
if (!a(n = i, s, c).call(n, e) || !a(r = i, s, p).call(r)) return !1;
|
|
134
|
+
const t = (128 + v(i, x)).toString(16);
|
|
135
|
+
a(_ = i, s, o).call(_, ["2", t, "43", "43", "43", "FD"]);
|
|
136
136
|
}
|
|
137
137
|
static channelConnected(e = null) {
|
|
138
|
-
var n,
|
|
139
|
-
if (!a(n =
|
|
140
|
-
const t = (128 +
|
|
141
|
-
a(
|
|
138
|
+
var n, r, _;
|
|
139
|
+
if (!a(n = i, s, c).call(n, e) || !a(r = i, s, p).call(r)) return !1;
|
|
140
|
+
const t = (128 + v(i, x)).toString(16);
|
|
141
|
+
a(_ = i, s, o).call(_, ["2", t, "43", "43", "43", "FC"]);
|
|
142
142
|
}
|
|
143
143
|
static channelEmpty(e = null) {
|
|
144
|
-
var n,
|
|
145
|
-
if (!a(n =
|
|
146
|
-
const t = (128 +
|
|
147
|
-
a(
|
|
144
|
+
var n, r, _;
|
|
145
|
+
if (!a(n = i, s, c).call(n, e) || !a(r = i, s, p).call(r)) return !1;
|
|
146
|
+
const t = (128 + v(i, x)).toString(16);
|
|
147
|
+
a(_ = i, s, o).call(_, ["2", t, "43", "43", "43", "FF"]);
|
|
148
148
|
}
|
|
149
149
|
static workingTemperature(e = null) {
|
|
150
|
-
var n,
|
|
151
|
-
if (!a(n =
|
|
152
|
-
const t = (128 +
|
|
153
|
-
a(
|
|
150
|
+
var n, r, _;
|
|
151
|
+
if (!a(n = i, s, c).call(n, e) || !a(r = i, s, p).call(r)) return !1;
|
|
152
|
+
const t = (128 + v(i, x)).toString(16);
|
|
153
|
+
a(_ = i, s, o).call(_, ["2", t, "43", "54", "16"]);
|
|
154
154
|
}
|
|
155
155
|
static currentTemperature(e = null) {
|
|
156
|
-
var
|
|
157
|
-
if (!a(
|
|
156
|
+
var r, _, f;
|
|
157
|
+
if (!a(r = i, s, c).call(r, e) || !a(_ = i, s, L).call(_)) return !1;
|
|
158
158
|
let t = [];
|
|
159
|
-
const n = (128 +
|
|
160
|
-
switch (
|
|
159
|
+
const n = (128 + v(i, x)).toString(16);
|
|
160
|
+
switch (v(i, S)) {
|
|
161
161
|
case "boardroid":
|
|
162
162
|
t = ["2", "D9", "44", "30"];
|
|
163
163
|
break;
|
|
@@ -165,217 +165,217 @@ const r = class r {
|
|
|
165
165
|
t = ["2", n, "43", "74", "2B", "30", "39", "2E", "31", "7F", "43"];
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
|
-
a(
|
|
168
|
+
a(f = i, s, o).call(f, t);
|
|
169
169
|
}
|
|
170
170
|
static ready(e = null) {
|
|
171
|
-
var t, n,
|
|
172
|
-
if (!a(t =
|
|
173
|
-
a(
|
|
171
|
+
var t, n, r;
|
|
172
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
173
|
+
a(r = i, s, o).call(r, ["6", "30"]);
|
|
174
174
|
}
|
|
175
175
|
static busy(e = null) {
|
|
176
|
-
var t, n,
|
|
177
|
-
if (!a(t =
|
|
178
|
-
a(
|
|
176
|
+
var t, n, r;
|
|
177
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
178
|
+
a(r = i, s, o).call(r, ["6", "31"]);
|
|
179
179
|
}
|
|
180
180
|
static invalidTray(e = null) {
|
|
181
|
-
var t, n,
|
|
182
|
-
if (!a(t =
|
|
183
|
-
a(
|
|
181
|
+
var t, n, r;
|
|
182
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
183
|
+
a(r = i, s, o).call(r, ["6", "32"]);
|
|
184
184
|
}
|
|
185
185
|
static invalidChannel(e = null) {
|
|
186
|
-
var t, n,
|
|
187
|
-
if (!a(t =
|
|
188
|
-
a(
|
|
186
|
+
var t, n, r;
|
|
187
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
188
|
+
a(r = i, s, o).call(r, ["6", "33"]);
|
|
189
189
|
}
|
|
190
190
|
static emptyChannel(e = null) {
|
|
191
|
-
var t, n,
|
|
192
|
-
if (!a(t =
|
|
193
|
-
a(
|
|
191
|
+
var t, n, r;
|
|
192
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
193
|
+
a(r = i, s, o).call(r, ["6", "34"]);
|
|
194
194
|
}
|
|
195
195
|
static elevatorJam(e = null) {
|
|
196
|
-
var t, n,
|
|
197
|
-
if (!a(t =
|
|
198
|
-
a(
|
|
196
|
+
var t, n, r;
|
|
197
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
198
|
+
a(r = i, s, o).call(r, ["6", "35"]);
|
|
199
199
|
}
|
|
200
200
|
static elevatorMalfunction(e = null) {
|
|
201
|
-
var t, n,
|
|
202
|
-
if (!a(t =
|
|
203
|
-
a(
|
|
201
|
+
var t, n, r;
|
|
202
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
203
|
+
a(r = i, s, o).call(r, ["6", "36"]);
|
|
204
204
|
}
|
|
205
205
|
static phototransistorFailure(e = null) {
|
|
206
|
-
var t, n,
|
|
207
|
-
if (!a(t =
|
|
208
|
-
a(
|
|
206
|
+
var t, n, r;
|
|
207
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
208
|
+
a(r = i, s, o).call(r, ["6", "37"]);
|
|
209
209
|
}
|
|
210
210
|
static allChannelsEmpty(e = null) {
|
|
211
|
-
var t, n,
|
|
212
|
-
if (!a(t =
|
|
213
|
-
a(
|
|
211
|
+
var t, n, r;
|
|
212
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
213
|
+
a(r = i, s, o).call(r, ["6", "38"]);
|
|
214
214
|
}
|
|
215
215
|
static productDetectorFailure(e = null) {
|
|
216
|
-
var t, n,
|
|
217
|
-
if (!a(t =
|
|
218
|
-
a(
|
|
216
|
+
var t, n, r;
|
|
217
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
218
|
+
a(r = i, s, o).call(r, ["6", "39"]);
|
|
219
219
|
}
|
|
220
220
|
static displayDisconnected(e = null) {
|
|
221
|
-
var t, n,
|
|
222
|
-
if (!a(t =
|
|
223
|
-
a(
|
|
221
|
+
var t, n, r;
|
|
222
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
223
|
+
a(r = i, s, o).call(r, ["6", "41"]);
|
|
224
224
|
}
|
|
225
225
|
static productUnderElevator(e = null) {
|
|
226
|
-
var t, n,
|
|
227
|
-
if (!a(t =
|
|
228
|
-
a(
|
|
226
|
+
var t, n, r;
|
|
227
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
228
|
+
a(r = i, s, o).call(r, ["6", "42"]);
|
|
229
229
|
}
|
|
230
230
|
static elevatorSettingAlarm(e = null) {
|
|
231
|
-
var t, n,
|
|
232
|
-
if (!a(t =
|
|
233
|
-
a(
|
|
231
|
+
var t, n, r;
|
|
232
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
233
|
+
a(r = i, s, o).call(r, ["6", "43"]);
|
|
234
234
|
}
|
|
235
235
|
static buttonPanelFailure(e = null) {
|
|
236
|
-
var t, n,
|
|
237
|
-
if (!a(t =
|
|
238
|
-
a(
|
|
236
|
+
var t, n, r;
|
|
237
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
238
|
+
a(r = i, s, o).call(r, ["6", "44"]);
|
|
239
239
|
}
|
|
240
240
|
static errorWritingEeprom(e = null) {
|
|
241
|
-
var t, n,
|
|
242
|
-
if (!a(t =
|
|
243
|
-
a(
|
|
241
|
+
var t, n, r;
|
|
242
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
243
|
+
a(r = i, s, o).call(r, ["6", "45"]);
|
|
244
244
|
}
|
|
245
245
|
static errorControlTemperature(e = null) {
|
|
246
|
-
var t, n,
|
|
247
|
-
if (!a(t =
|
|
248
|
-
a(
|
|
246
|
+
var t, n, r;
|
|
247
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
248
|
+
a(r = i, s, o).call(r, ["6", "46"]);
|
|
249
249
|
}
|
|
250
250
|
static thermometerDisconnected(e = null) {
|
|
251
|
-
var t, n,
|
|
252
|
-
if (!a(t =
|
|
253
|
-
a(
|
|
251
|
+
var t, n, r;
|
|
252
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
253
|
+
a(r = i, s, o).call(r, ["6", "47"]);
|
|
254
254
|
}
|
|
255
255
|
static thermometerMisconfigured(e = null) {
|
|
256
|
-
var t, n,
|
|
257
|
-
if (!a(t =
|
|
258
|
-
a(
|
|
256
|
+
var t, n, r;
|
|
257
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
258
|
+
a(r = i, s, o).call(r, ["6", "48"]);
|
|
259
259
|
}
|
|
260
260
|
static thermometerFailure(e = null) {
|
|
261
|
-
var t, n,
|
|
262
|
-
if (!a(t =
|
|
263
|
-
a(
|
|
261
|
+
var t, n, r;
|
|
262
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
263
|
+
a(r = i, s, o).call(r, ["6", "49"]);
|
|
264
264
|
}
|
|
265
265
|
static errorExtractorConsumption(e = null) {
|
|
266
|
-
var t, n,
|
|
267
|
-
if (!a(t =
|
|
268
|
-
a(
|
|
266
|
+
var t, n, r;
|
|
267
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
268
|
+
a(r = i, s, o).call(r, ["6", "4A"]);
|
|
269
269
|
}
|
|
270
270
|
static channelSearchError(e = null) {
|
|
271
|
-
var t, n,
|
|
272
|
-
if (!a(t =
|
|
273
|
-
a(
|
|
271
|
+
var t, n, r;
|
|
272
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
273
|
+
a(r = i, s, o).call(r, ["6", "4B"]);
|
|
274
274
|
}
|
|
275
275
|
static productExitMouthSearchError(e = null) {
|
|
276
|
-
var t, n,
|
|
277
|
-
if (!a(t =
|
|
278
|
-
a(
|
|
276
|
+
var t, n, r;
|
|
277
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
278
|
+
a(r = i, s, o).call(r, ["6", "4C"]);
|
|
279
279
|
}
|
|
280
280
|
static elevatorInteriorLocked(e = null) {
|
|
281
|
-
var t, n,
|
|
282
|
-
if (!a(t =
|
|
283
|
-
a(
|
|
281
|
+
var t, n, r;
|
|
282
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
283
|
+
a(r = i, s, o).call(r, ["6", "4D"]);
|
|
284
284
|
}
|
|
285
285
|
static productDetectorVerifierError(e = null) {
|
|
286
|
-
var t, n,
|
|
287
|
-
if (!a(t =
|
|
288
|
-
a(
|
|
286
|
+
var t, n, r;
|
|
287
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
288
|
+
a(r = i, s, o).call(r, ["6", "4E"]);
|
|
289
289
|
}
|
|
290
290
|
static waitingForProductRecall(e = null) {
|
|
291
|
-
var t, n,
|
|
292
|
-
if (!a(t =
|
|
293
|
-
a(
|
|
291
|
+
var t, n, r;
|
|
292
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
293
|
+
a(r = i, s, o).call(r, ["6", "4F"]);
|
|
294
294
|
}
|
|
295
295
|
static productExpiredByTemperature(e = null) {
|
|
296
|
-
var t, n,
|
|
297
|
-
if (!a(t =
|
|
298
|
-
a(
|
|
296
|
+
var t, n, r;
|
|
297
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
298
|
+
a(r = i, s, o).call(r, ["6", "50"]);
|
|
299
299
|
}
|
|
300
300
|
static faultyAutomaticDoor(e = null) {
|
|
301
|
-
var t, n,
|
|
302
|
-
if (!a(t =
|
|
303
|
-
a(
|
|
301
|
+
var t, n, r;
|
|
302
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
303
|
+
a(r = i, s, o).call(r, ["6", "51"]);
|
|
304
304
|
}
|
|
305
305
|
static rejectLever(e = null) {
|
|
306
|
-
var t, n,
|
|
307
|
-
if (!a(t =
|
|
308
|
-
a(
|
|
306
|
+
var t, n, r;
|
|
307
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
308
|
+
a(r = i, s, o).call(r, ["2", "A0", "1"]);
|
|
309
309
|
}
|
|
310
310
|
static resetCoinPurse(e = null) {
|
|
311
|
-
var t, n,
|
|
312
|
-
if (!a(t =
|
|
313
|
-
a(
|
|
311
|
+
var t, n, r;
|
|
312
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
313
|
+
a(r = i, s, o).call(r, ["2", "A0", "2"]);
|
|
314
314
|
}
|
|
315
315
|
static coinInsertedBox(e = null, t = null) {
|
|
316
|
-
var
|
|
317
|
-
if (!a(
|
|
318
|
-
const n = ["40", "41", "42", "43", "44", "45"],
|
|
319
|
-
a(
|
|
316
|
+
var _, f, h, d;
|
|
317
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, m).call(f)) return !1;
|
|
318
|
+
const n = ["40", "41", "42", "43", "44", "45"], r = a(h = i, s, O).call(h, n, t);
|
|
319
|
+
a(d = i, s, o).call(d, ["2", "A0", r]);
|
|
320
320
|
}
|
|
321
321
|
static coinInsertedTube(e = null, t = null) {
|
|
322
|
-
var
|
|
323
|
-
if (!a(
|
|
324
|
-
const n = ["50", "51", "52", "53", "54", "55"],
|
|
325
|
-
a(
|
|
322
|
+
var _, f, h, d;
|
|
323
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, m).call(f)) return !1;
|
|
324
|
+
const n = ["50", "51", "52", "53", "54", "55"], r = a(h = i, s, O).call(h, n, t);
|
|
325
|
+
a(d = i, s, o).call(d, ["2", "A0", r]);
|
|
326
326
|
}
|
|
327
327
|
static banknoteInsertedStacker(e = null, t = null) {
|
|
328
|
-
var
|
|
329
|
-
if (!a(
|
|
330
|
-
const n = ["80", "81", "82", "83", "84"],
|
|
331
|
-
a(
|
|
328
|
+
var _, f, h, d;
|
|
329
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, m).call(f)) return !1;
|
|
330
|
+
const n = ["80", "81", "82", "83", "84"], r = a(h = i, s, M).call(h, n, t);
|
|
331
|
+
a(d = i, s, o).call(d, ["2", "B0", r]);
|
|
332
332
|
}
|
|
333
333
|
static banknoteInsertedEscrow(e = null, t = null) {
|
|
334
|
-
var
|
|
335
|
-
if (!a(
|
|
336
|
-
const n = ["90", "91", "92", "93", "94"],
|
|
337
|
-
a(
|
|
334
|
+
var _, f, h, d;
|
|
335
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, m).call(f)) return !1;
|
|
336
|
+
const n = ["90", "91", "92", "93", "94"], r = a(h = i, s, M).call(h, n, t);
|
|
337
|
+
a(d = i, s, o).call(d, ["2", "B0", r]);
|
|
338
338
|
}
|
|
339
339
|
static banknoteEjected(e = null, t = null) {
|
|
340
|
-
var
|
|
341
|
-
if (!a(
|
|
342
|
-
const n = ["A0", "A1", "A2", "A3", "A4"],
|
|
343
|
-
a(
|
|
340
|
+
var _, f, h, d;
|
|
341
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, m).call(f)) return !1;
|
|
342
|
+
const n = ["A0", "A1", "A2", "A3", "A4"], r = a(h = i, s, M).call(h, n, t);
|
|
343
|
+
a(d = i, s, o).call(d, ["2", "B0", r]);
|
|
344
344
|
}
|
|
345
345
|
static banknoteInsertedRecycler(e = null, t = null) {
|
|
346
|
-
var
|
|
347
|
-
if (!a(
|
|
348
|
-
const n = ["B0", "B1", "B2", "B3", "B4"],
|
|
349
|
-
a(
|
|
346
|
+
var _, f, h, d;
|
|
347
|
+
if (!a(_ = i, s, c).call(_, e) || !a(f = i, s, m).call(f)) return !1;
|
|
348
|
+
const n = ["B0", "B1", "B2", "B3", "B4"], r = a(h = i, s, M).call(h, n, t);
|
|
349
|
+
a(d = i, s, o).call(d, ["2", "B0", r]);
|
|
350
350
|
}
|
|
351
351
|
static banknoteTaken(e = null) {
|
|
352
|
-
var t, n,
|
|
353
|
-
if (!a(t =
|
|
354
|
-
a(
|
|
352
|
+
var t, n, r;
|
|
353
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
354
|
+
a(r = i, s, o).call(r, ["2", "B0", "2a"]);
|
|
355
355
|
}
|
|
356
356
|
static coinPurseEnabled(e = null) {
|
|
357
|
-
var t, n,
|
|
358
|
-
if (!a(t =
|
|
359
|
-
a(
|
|
357
|
+
var t, n, r;
|
|
358
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
359
|
+
a(r = i, s, o).call(r, ["2", "D0", "1"]);
|
|
360
360
|
}
|
|
361
361
|
static coinPurseDisabled(e = null) {
|
|
362
|
-
var t, n,
|
|
363
|
-
if (!a(t =
|
|
364
|
-
a(
|
|
362
|
+
var t, n, r;
|
|
363
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
364
|
+
a(r = i, s, o).call(r, ["2", "D0", "0"]);
|
|
365
365
|
}
|
|
366
366
|
static billPurseDisabled(e = null) {
|
|
367
|
-
var t, n,
|
|
368
|
-
if (!a(t =
|
|
369
|
-
a(
|
|
367
|
+
var t, n, r;
|
|
368
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
369
|
+
a(r = i, s, o).call(r, ["2", "D1", "0", "0"]);
|
|
370
370
|
}
|
|
371
371
|
static billPurseEnabled(e = null) {
|
|
372
|
-
var t, n,
|
|
373
|
-
if (!a(t =
|
|
374
|
-
a(
|
|
372
|
+
var t, n, r;
|
|
373
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
374
|
+
a(r = i, s, o).call(r, ["2", "D1", "1", "1"]);
|
|
375
375
|
}
|
|
376
376
|
static readTubes(e = null) {
|
|
377
|
-
var
|
|
378
|
-
if (!a(
|
|
377
|
+
var w, C, k;
|
|
378
|
+
if (!a(w = i, s, c).call(w, e) || !a(C = i, s, m).call(C)) return !1;
|
|
379
379
|
const t = [
|
|
380
380
|
"0",
|
|
381
381
|
"1",
|
|
@@ -409,7 +409,7 @@ const r = class r {
|
|
|
409
409
|
"1d",
|
|
410
410
|
"1e",
|
|
411
411
|
"1f"
|
|
412
|
-
], [n,
|
|
412
|
+
], [n, r, _, f, h, d] = [
|
|
413
413
|
t[Math.floor(Math.random() * 30)],
|
|
414
414
|
t[Math.floor(Math.random() * 30)],
|
|
415
415
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -417,11 +417,11 @@ const r = class r {
|
|
|
417
417
|
t[Math.floor(Math.random() * 30)],
|
|
418
418
|
t[Math.floor(Math.random() * 30)]
|
|
419
419
|
];
|
|
420
|
-
a(
|
|
420
|
+
a(k = i, s, o).call(k, ["2", "D2", n, r, _, f, h, d]);
|
|
421
421
|
}
|
|
422
422
|
static readBillPurse(e = null, t = null) {
|
|
423
|
-
var
|
|
424
|
-
if (!a(
|
|
423
|
+
var r, _, f, h;
|
|
424
|
+
if (!a(r = i, s, c).call(r, e) || !a(_ = i, s, m).call(_)) return !1;
|
|
425
425
|
let n = [
|
|
426
426
|
"0",
|
|
427
427
|
"1",
|
|
@@ -454,47 +454,47 @@ const r = class r {
|
|
|
454
454
|
"1c"
|
|
455
455
|
];
|
|
456
456
|
if (e._recycler.ict) {
|
|
457
|
-
const
|
|
458
|
-
let
|
|
457
|
+
const d = n[Math.floor(Math.random() * 31)];
|
|
458
|
+
let w = "0", C = "0", k = "0", D = "0", A = "0";
|
|
459
459
|
if (t !== null && !isNaN(parseInt(t)))
|
|
460
460
|
switch (t.toString()) {
|
|
461
461
|
case "20":
|
|
462
|
-
|
|
462
|
+
w = d;
|
|
463
463
|
break;
|
|
464
464
|
case "50":
|
|
465
|
-
C =
|
|
465
|
+
C = d;
|
|
466
466
|
break;
|
|
467
467
|
case "100":
|
|
468
|
-
|
|
468
|
+
k = d;
|
|
469
469
|
break;
|
|
470
470
|
case "200":
|
|
471
|
-
|
|
471
|
+
D = d;
|
|
472
472
|
break;
|
|
473
473
|
case "500":
|
|
474
|
-
|
|
474
|
+
A = d;
|
|
475
475
|
break;
|
|
476
476
|
}
|
|
477
477
|
else
|
|
478
478
|
switch (e._recycler.bill) {
|
|
479
479
|
case 0:
|
|
480
|
-
|
|
480
|
+
w = d;
|
|
481
481
|
break;
|
|
482
482
|
case 1:
|
|
483
|
-
C =
|
|
483
|
+
C = d;
|
|
484
484
|
break;
|
|
485
485
|
case 2:
|
|
486
|
-
|
|
486
|
+
k = d;
|
|
487
487
|
break;
|
|
488
488
|
case 3:
|
|
489
|
-
|
|
489
|
+
D = d;
|
|
490
490
|
break;
|
|
491
491
|
case 4:
|
|
492
|
-
|
|
492
|
+
A = d;
|
|
493
493
|
break;
|
|
494
494
|
}
|
|
495
|
-
a(
|
|
495
|
+
a(f = i, s, o).call(f, ["2", "D3", w, C, k, D, A, "0"]);
|
|
496
496
|
} else {
|
|
497
|
-
const [
|
|
497
|
+
const [d, w, C, k, D, A] = [
|
|
498
498
|
n[Math.floor(Math.random() * 30)],
|
|
499
499
|
n[Math.floor(Math.random() * 30)],
|
|
500
500
|
n[Math.floor(Math.random() * 30)],
|
|
@@ -502,22 +502,22 @@ const r = class r {
|
|
|
502
502
|
n[Math.floor(Math.random())],
|
|
503
503
|
n[Math.floor(Math.random())]
|
|
504
504
|
];
|
|
505
|
-
a(
|
|
505
|
+
a(h = i, s, o).call(h, ["2", "D3", d, w, C, k, D, A]);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
static banknoteAccepted(e = null) {
|
|
509
|
-
var t, n,
|
|
510
|
-
if (!a(t =
|
|
511
|
-
a(
|
|
509
|
+
var t, n, r;
|
|
510
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
511
|
+
a(r = i, s, o).call(r, ["2", "D4", "1"]);
|
|
512
512
|
}
|
|
513
513
|
static banknoteRejected(e = null) {
|
|
514
|
-
var t, n,
|
|
515
|
-
if (!a(t =
|
|
516
|
-
a(
|
|
514
|
+
var t, n, r;
|
|
515
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
516
|
+
a(r = i, s, o).call(r, ["2", "D4", "0"]);
|
|
517
517
|
}
|
|
518
518
|
static banknotesDispensed(e = null) {
|
|
519
|
-
var n,
|
|
520
|
-
if (!a(n =
|
|
519
|
+
var n, r, _, f;
|
|
520
|
+
if (!a(n = i, s, c).call(n, e) || !a(r = i, s, m).call(r)) return !1;
|
|
521
521
|
let t = [
|
|
522
522
|
"1",
|
|
523
523
|
"2",
|
|
@@ -549,28 +549,28 @@ const r = class r {
|
|
|
549
549
|
"1c"
|
|
550
550
|
];
|
|
551
551
|
if (e._recycler.ict) {
|
|
552
|
-
const
|
|
553
|
-
let
|
|
552
|
+
const h = t[Math.floor(Math.random() * 30)];
|
|
553
|
+
let d = "0", w = "0", C = "0", k = "0", D = "0";
|
|
554
554
|
switch (e._recycler.bill) {
|
|
555
555
|
case 0:
|
|
556
|
-
|
|
556
|
+
d = h;
|
|
557
557
|
break;
|
|
558
558
|
case 1:
|
|
559
|
-
|
|
559
|
+
w = h;
|
|
560
560
|
break;
|
|
561
561
|
case 2:
|
|
562
|
-
C =
|
|
562
|
+
C = h;
|
|
563
563
|
break;
|
|
564
564
|
case 3:
|
|
565
|
-
|
|
565
|
+
k = h;
|
|
566
566
|
break;
|
|
567
567
|
case 4:
|
|
568
|
-
|
|
568
|
+
D = h;
|
|
569
569
|
break;
|
|
570
570
|
}
|
|
571
|
-
a(
|
|
571
|
+
a(_ = i, s, o).call(_, ["2", "D5", d, w, C, k, D, "0"]);
|
|
572
572
|
} else {
|
|
573
|
-
const [
|
|
573
|
+
const [h, d, w, C, k, D] = [
|
|
574
574
|
t[Math.floor(Math.random() * 30)],
|
|
575
575
|
t[Math.floor(Math.random() * 30)],
|
|
576
576
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -578,111 +578,111 @@ const r = class r {
|
|
|
578
578
|
t[Math.floor(Math.random())],
|
|
579
579
|
t[Math.floor(Math.random())]
|
|
580
580
|
];
|
|
581
|
-
a(
|
|
581
|
+
a(f = i, s, o).call(f, ["2", "D5", h, d, w, C, k, D]);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
static coinsDispensed(e = null) {
|
|
585
|
-
var t, n,
|
|
586
|
-
if (!a(t =
|
|
587
|
-
a(
|
|
585
|
+
var t, n, r;
|
|
586
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
587
|
+
a(r = i, s, o).call(r, ["2", "D6"]);
|
|
588
588
|
}
|
|
589
589
|
static relayOn(e = null) {
|
|
590
|
-
var t, n,
|
|
591
|
-
if (!a(t =
|
|
592
|
-
a(
|
|
590
|
+
var t, n, r;
|
|
591
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
592
|
+
a(r = i, s, o).call(r, ["2", "DA", "1"]);
|
|
593
593
|
}
|
|
594
594
|
static relayOff(e = null) {
|
|
595
|
-
var t, n,
|
|
596
|
-
if (!a(t =
|
|
597
|
-
a(
|
|
595
|
+
var t, n, r;
|
|
596
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
597
|
+
a(r = i, s, o).call(r, ["2", "DA", "0"]);
|
|
598
598
|
}
|
|
599
599
|
static nayaxEnabled(e = null) {
|
|
600
|
-
var t, n,
|
|
601
|
-
if (!a(t =
|
|
602
|
-
a(
|
|
600
|
+
var t, n, r;
|
|
601
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
602
|
+
a(r = i, s, o).call(r, ["2", "DD", "1"]);
|
|
603
603
|
}
|
|
604
604
|
static nayaxDisabled(e = null) {
|
|
605
|
-
var t, n,
|
|
606
|
-
if (!a(t =
|
|
607
|
-
a(
|
|
605
|
+
var t, n, r;
|
|
606
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
607
|
+
a(r = i, s, o).call(r, ["2", "DD", "0"]);
|
|
608
608
|
}
|
|
609
609
|
static nayaxPreCreditAuthorized(e = null) {
|
|
610
|
-
var t, n,
|
|
611
|
-
if (!a(t =
|
|
612
|
-
a(
|
|
610
|
+
var t, n, r;
|
|
611
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
612
|
+
a(r = i, s, o).call(r, ["2", "DD", "3"]);
|
|
613
613
|
}
|
|
614
614
|
static nayaxCancelRequest(e = null) {
|
|
615
|
-
var t, n,
|
|
616
|
-
if (!a(t =
|
|
617
|
-
a(
|
|
615
|
+
var t, n, r;
|
|
616
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
617
|
+
a(r = i, s, o).call(r, ["2", "DD", "4"]);
|
|
618
618
|
}
|
|
619
619
|
static nayaxSellApproved(e = null) {
|
|
620
|
-
var t, n,
|
|
621
|
-
if (!a(t =
|
|
622
|
-
a(
|
|
620
|
+
var t, n, r;
|
|
621
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
622
|
+
a(r = i, s, o).call(r, ["2", "DD", "5"]);
|
|
623
623
|
}
|
|
624
624
|
static nayaxSellDenied(e = null) {
|
|
625
|
-
var t, n,
|
|
626
|
-
if (!a(t =
|
|
627
|
-
a(
|
|
625
|
+
var t, n, r;
|
|
626
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
627
|
+
a(r = i, s, o).call(r, ["2", "DD", "6"]);
|
|
628
628
|
}
|
|
629
629
|
static nayaxEndSession(e = null) {
|
|
630
|
-
var t, n,
|
|
631
|
-
if (!a(t =
|
|
632
|
-
a(
|
|
630
|
+
var t, n, r;
|
|
631
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
632
|
+
a(r = i, s, o).call(r, ["2", "DD", "7"]);
|
|
633
633
|
}
|
|
634
634
|
static nayaxCancelled(e = null) {
|
|
635
|
-
var t, n,
|
|
636
|
-
if (!a(t =
|
|
637
|
-
a(
|
|
635
|
+
var t, n, r;
|
|
636
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
637
|
+
a(r = i, s, o).call(r, ["2", "DD", "8"]);
|
|
638
638
|
}
|
|
639
639
|
static nayaxDispensed(e = null) {
|
|
640
|
-
var t, n,
|
|
641
|
-
if (!a(t =
|
|
642
|
-
a(
|
|
640
|
+
var t, n, r;
|
|
641
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
642
|
+
a(r = i, s, o).call(r, ["2", "DD", "A", "0"]);
|
|
643
643
|
}
|
|
644
644
|
static nayaxNotDispensed(e = null) {
|
|
645
|
-
var t, n,
|
|
646
|
-
if (!a(t =
|
|
647
|
-
a(
|
|
645
|
+
var t, n, r;
|
|
646
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, m).call(n)) return !1;
|
|
647
|
+
a(r = i, s, o).call(r, ["2", "DD", "A", "1"]);
|
|
648
648
|
}
|
|
649
649
|
static fullTray(e = null) {
|
|
650
|
-
var t, n,
|
|
651
|
-
if (!a(t =
|
|
652
|
-
a(
|
|
650
|
+
var t, n, r;
|
|
651
|
+
if (!a(t = i, s, c).call(t, e) || !a(n = i, s, p).call(n)) return !1;
|
|
652
|
+
a(r = i, s, o).call(r, ["6", "4F"]);
|
|
653
653
|
}
|
|
654
654
|
static setConnection(e = null) {
|
|
655
655
|
var t;
|
|
656
|
-
if (!a(t =
|
|
656
|
+
if (!a(t = i, s, c).call(t, e)) return !1;
|
|
657
657
|
e.__internal__.serial.connected = !0;
|
|
658
658
|
}
|
|
659
659
|
};
|
|
660
|
-
|
|
661
|
-
if (
|
|
662
|
-
return
|
|
663
|
-
},
|
|
664
|
-
if (typeof e != "object" || !(e instanceof
|
|
660
|
+
S = new WeakMap(), x = new WeakMap(), s = new WeakSet(), ee = function() {
|
|
661
|
+
if (i.enable === !1) throw new Error("Emulator is disabled");
|
|
662
|
+
return i.enable;
|
|
663
|
+
}, te = function(e) {
|
|
664
|
+
if (typeof e != "object" || !(e instanceof ve))
|
|
665
665
|
throw new Error(`Type ${e.typeDevice} is not supported`);
|
|
666
|
-
return
|
|
666
|
+
return i.instance = e, $(i, S, e.typeDevice), $(i, x, e.deviceNumber), !0;
|
|
667
667
|
}, c = function(e = null) {
|
|
668
668
|
var t, n;
|
|
669
|
-
return !a(t =
|
|
670
|
-
},
|
|
671
|
-
if (
|
|
669
|
+
return !a(t = i, s, ee).call(t) || e === null && i.instance === null ? !1 : (i.instance === null && a(n = i, s, te).call(n, e), !0);
|
|
670
|
+
}, j = function() {
|
|
671
|
+
if (v(i, S) !== "locker") throw new Error("This function is only available for Locker devices");
|
|
672
672
|
return !0;
|
|
673
|
-
},
|
|
674
|
-
if (
|
|
673
|
+
}, m = function() {
|
|
674
|
+
if (v(i, S) !== "boardroid")
|
|
675
675
|
throw new Error("This function is only available for Boardroid devices");
|
|
676
676
|
return !0;
|
|
677
|
-
},
|
|
678
|
-
if (
|
|
677
|
+
}, p = function() {
|
|
678
|
+
if (v(i, S) !== "jofemar") throw new Error("This function is only available for Jofemar devices");
|
|
679
679
|
return !0;
|
|
680
|
-
},
|
|
681
|
-
if (
|
|
680
|
+
}, L = function() {
|
|
681
|
+
if (v(i, S) === "locker") throw new Error("This function is not available for Locker devices");
|
|
682
682
|
return !0;
|
|
683
683
|
}, o = function(e) {
|
|
684
|
-
|
|
685
|
-
},
|
|
684
|
+
i.instance.__emulate({ code: e });
|
|
685
|
+
}, O = function(e, t = null) {
|
|
686
686
|
let n = e[Math.floor(Math.random() * 5)];
|
|
687
687
|
if (t !== null && !isNaN(parseFloat(t)))
|
|
688
688
|
switch (t.toString()) {
|
|
@@ -703,7 +703,7 @@ v = new WeakMap(), A = new WeakMap(), s = new WeakSet(), Y = function() {
|
|
|
703
703
|
break;
|
|
704
704
|
}
|
|
705
705
|
return n;
|
|
706
|
-
},
|
|
706
|
+
}, M = function(e, t = null) {
|
|
707
707
|
let n = e[Math.floor(Math.random() * 4)];
|
|
708
708
|
if (t !== null && !isNaN(parseFloat(t)))
|
|
709
709
|
switch (t.toString()) {
|
|
@@ -724,30 +724,30 @@ v = new WeakMap(), A = new WeakMap(), s = new WeakSet(), Y = function() {
|
|
|
724
724
|
break;
|
|
725
725
|
}
|
|
726
726
|
return n;
|
|
727
|
-
},
|
|
728
|
-
let
|
|
729
|
-
var
|
|
727
|
+
}, I(i, s), U(i, "enable", !1), U(i, "instance", null), I(i, S, null), I(i, x, 1);
|
|
728
|
+
let F = i;
|
|
729
|
+
var fe = Object.defineProperty, ne = (l) => {
|
|
730
730
|
throw TypeError(l);
|
|
731
|
-
},
|
|
732
|
-
class
|
|
731
|
+
}, pe = (l, e, t) => e in l ? fe(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, P = (l, e, t) => pe(l, typeof e != "symbol" ? e + "" : e, t), ge = (l, e, t) => e.has(l) || ne("Cannot " + t), me = (l, e, t) => e.has(l) ? ne("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t), y = (l, e, t) => (ge(l, e, "access private method"), t);
|
|
732
|
+
class J extends CustomEvent {
|
|
733
733
|
constructor(e, t) {
|
|
734
734
|
super(e, t);
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
class
|
|
737
|
+
class ie extends EventTarget {
|
|
738
738
|
constructor() {
|
|
739
|
-
super(...arguments),
|
|
739
|
+
super(...arguments), P(this, "__listeners__", {
|
|
740
740
|
debug: !1
|
|
741
|
-
}),
|
|
741
|
+
}), P(this, "__debug__", !1);
|
|
742
742
|
}
|
|
743
743
|
dispatch(e, t = null) {
|
|
744
|
-
const n = new
|
|
745
|
-
this.dispatchEvent(n), this.__debug__ && this.dispatchEvent(new
|
|
744
|
+
const n = new J(e, { detail: t });
|
|
745
|
+
this.dispatchEvent(n), this.__debug__ && this.dispatchEvent(new J("debug", { detail: { type: e, data: t } }));
|
|
746
746
|
}
|
|
747
747
|
dispatchAsync(e, t = null, n = 100) {
|
|
748
|
-
const
|
|
748
|
+
const r = this;
|
|
749
749
|
setTimeout(() => {
|
|
750
|
-
|
|
750
|
+
r.dispatch(e, t);
|
|
751
751
|
}, n);
|
|
752
752
|
}
|
|
753
753
|
on(e, t) {
|
|
@@ -766,58 +766,58 @@ class te extends EventTarget {
|
|
|
766
766
|
}));
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
const
|
|
769
|
+
const q = class b extends ie {
|
|
770
770
|
constructor() {
|
|
771
771
|
super(), ["change"].forEach((e) => {
|
|
772
772
|
this.serialRegisterAvailableListener(e);
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
static $dispatchChange(e = null) {
|
|
776
|
-
e && e.$checkAndDispatchConnection(),
|
|
776
|
+
e && e.$checkAndDispatchConnection(), b.instance.dispatch("change", { devices: b.devices, dispatcher: e });
|
|
777
777
|
}
|
|
778
778
|
static typeError(e) {
|
|
779
779
|
const t = new Error();
|
|
780
780
|
throw t.message = `Type ${e} is not supported`, t.name = "DeviceTypeError", t;
|
|
781
781
|
}
|
|
782
782
|
static registerType(e) {
|
|
783
|
-
typeof
|
|
783
|
+
typeof b.devices[e] > "u" && (b.devices[e] = {});
|
|
784
784
|
}
|
|
785
785
|
static add(e) {
|
|
786
786
|
const t = e.typeDevice;
|
|
787
|
-
typeof
|
|
787
|
+
typeof b.devices[t] > "u" && (b.devices[t] = {});
|
|
788
788
|
const n = e.uuid;
|
|
789
|
-
if (typeof
|
|
789
|
+
if (typeof b.devices[t] > "u" && b.typeError(t), b.devices[t][n])
|
|
790
790
|
throw new Error(`Device with id ${n} already exists`);
|
|
791
|
-
return
|
|
791
|
+
return b.devices[t][n] = e, b.$dispatchChange(e), Object.keys(b.devices[t]).indexOf(n);
|
|
792
792
|
}
|
|
793
793
|
static get(e, t) {
|
|
794
|
-
return typeof
|
|
794
|
+
return typeof b.devices[e] > "u" && (b.devices[e] = {}), typeof b.devices[e] > "u" && b.typeError(e), b.devices[e][t];
|
|
795
795
|
}
|
|
796
796
|
static getAll(e = null) {
|
|
797
|
-
return e === null ?
|
|
797
|
+
return e === null ? b.devices : (typeof b.devices[e] > "u" && b.typeError(e), b.devices[e]);
|
|
798
798
|
}
|
|
799
799
|
static getList() {
|
|
800
|
-
return Object.values(
|
|
800
|
+
return Object.values(b.devices).map((e) => Object.values(e)).flat();
|
|
801
801
|
}
|
|
802
802
|
static getByNumber(e, t) {
|
|
803
|
-
return typeof
|
|
803
|
+
return typeof b.devices[e] > "u" && b.typeError(e), Object.values(b.devices[e]).find((n) => n.deviceNumber === t) ?? null;
|
|
804
804
|
}
|
|
805
805
|
static getCustom(e, t = 1) {
|
|
806
|
-
return typeof
|
|
806
|
+
return typeof b.devices[e] > "u" && b.typeError(e), Object.values(b.devices[e]).find((n) => n.deviceNumber === t) ?? null;
|
|
807
807
|
}
|
|
808
808
|
};
|
|
809
|
-
|
|
810
|
-
let
|
|
811
|
-
|
|
812
|
-
function
|
|
809
|
+
P(q, "instance"), P(q, "devices", {});
|
|
810
|
+
let u = q;
|
|
811
|
+
u.instance || (u.instance = new u());
|
|
812
|
+
function H(l = 100) {
|
|
813
813
|
return new Promise(
|
|
814
814
|
(e) => setTimeout(() => e(), l)
|
|
815
815
|
);
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function ye() {
|
|
818
818
|
return "serial" in navigator;
|
|
819
819
|
}
|
|
820
|
-
const
|
|
820
|
+
const N = {
|
|
821
821
|
baudRate: 9600,
|
|
822
822
|
dataBits: 8,
|
|
823
823
|
stopBits: 1,
|
|
@@ -825,20 +825,23 @@ const q = {
|
|
|
825
825
|
bufferSize: 32768,
|
|
826
826
|
flowControl: "none"
|
|
827
827
|
};
|
|
828
|
-
var
|
|
829
|
-
class be extends
|
|
828
|
+
var g, T, B, W, V, E, re, z, G, K, X, se, ae, le, oe, Y, Z, ce, _e;
|
|
829
|
+
class be extends ie {
|
|
830
830
|
constructor({
|
|
831
831
|
filters: e = null,
|
|
832
|
-
config_port: t =
|
|
832
|
+
config_port: t = N,
|
|
833
833
|
no_device: n = 1,
|
|
834
|
-
device_listen_on_channel:
|
|
834
|
+
device_listen_on_channel: r = 1,
|
|
835
|
+
bypassSerialBytesConnection: _ = !1
|
|
835
836
|
} = {
|
|
836
837
|
filters: null,
|
|
837
|
-
config_port:
|
|
838
|
+
config_port: N,
|
|
838
839
|
no_device: 1,
|
|
839
|
-
device_listen_on_channel: 1
|
|
840
|
+
device_listen_on_channel: 1,
|
|
841
|
+
bypassSerialBytesConnection: !1
|
|
840
842
|
}) {
|
|
841
|
-
if (super(),
|
|
843
|
+
if (super(), me(this, g), P(this, "__internal__", {
|
|
844
|
+
bypassSerialBytesConnection: !1,
|
|
842
845
|
auto_response: !1,
|
|
843
846
|
device_number: 1,
|
|
844
847
|
aux_port_connector: 0,
|
|
@@ -857,7 +860,10 @@ class be extends te {
|
|
|
857
860
|
buffer: new Uint8Array([]),
|
|
858
861
|
as: "uint8",
|
|
859
862
|
replacer: /[\n\r]+/g,
|
|
860
|
-
limiter: null
|
|
863
|
+
limiter: null,
|
|
864
|
+
prefixLimiter: !1,
|
|
865
|
+
sufixLimiter: !0,
|
|
866
|
+
delimited: !1
|
|
861
867
|
},
|
|
862
868
|
reader: null,
|
|
863
869
|
input_done: null,
|
|
@@ -869,9 +875,13 @@ class be extends te {
|
|
|
869
875
|
delay_first_connection: 200,
|
|
870
876
|
bytes_connection: null,
|
|
871
877
|
filters: [],
|
|
872
|
-
config_port:
|
|
878
|
+
config_port: N,
|
|
873
879
|
queue: [],
|
|
874
|
-
auto_response: ["DD", "DD"]
|
|
880
|
+
auto_response: ["DD", "DD"],
|
|
881
|
+
free_timeout_ms: 50,
|
|
882
|
+
// In previous versions 400 was used
|
|
883
|
+
useRTSCTS: !1
|
|
884
|
+
// Use RTS/CTS flow control
|
|
875
885
|
},
|
|
876
886
|
device: {
|
|
877
887
|
type: "unknown",
|
|
@@ -890,12 +900,12 @@ class be extends te {
|
|
|
890
900
|
}
|
|
891
901
|
}), !("serial" in navigator))
|
|
892
902
|
throw new Error("Web Serial not supported");
|
|
893
|
-
e && (this.serialFilters = e), t && (this.serialConfigPort = t), n &&
|
|
903
|
+
e && (this.serialFilters = e), t && (this.serialConfigPort = t), _ && (this.__internal__.bypassSerialBytesConnection = _), n && y(this, g, ce).call(this, n), r && ["number", "string"].includes(typeof r) && (this.listenOnChannel = r), y(this, g, le).call(this), y(this, g, oe).call(this);
|
|
894
904
|
}
|
|
895
905
|
set listenOnChannel(e) {
|
|
896
906
|
if (typeof e == "string" && (e = parseInt(e)), isNaN(e) || e < 1 || e > 255)
|
|
897
907
|
throw new Error("Invalid port number");
|
|
898
|
-
this.__internal__.device.listen_on_port = e, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(e);
|
|
908
|
+
this.__internal__.device.listen_on_port = e, !this.__internal__.bypassSerialBytesConnection && (this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(e));
|
|
899
909
|
}
|
|
900
910
|
get lastAction() {
|
|
901
911
|
return this.__internal__.serial.last_action;
|
|
@@ -904,24 +914,32 @@ class be extends te {
|
|
|
904
914
|
return this.__internal__.device.listen_on_port ?? 1;
|
|
905
915
|
}
|
|
906
916
|
set serialFilters(e) {
|
|
917
|
+
if (this.isConnected) throw new Error("Cannot change serial filters while connected");
|
|
907
918
|
this.__internal__.serial.filters = e;
|
|
908
919
|
}
|
|
909
920
|
get serialFilters() {
|
|
910
921
|
return this.__internal__.serial.filters;
|
|
911
922
|
}
|
|
912
923
|
set serialConfigPort(e) {
|
|
924
|
+
if (this.isConnected) throw new Error("Cannot change serial filters while connected");
|
|
913
925
|
this.__internal__.serial.config_port = e;
|
|
914
926
|
}
|
|
915
927
|
get serialConfigPort() {
|
|
916
928
|
return this.__internal__.serial.config_port;
|
|
917
929
|
}
|
|
930
|
+
get useRTSCTS() {
|
|
931
|
+
return this.__internal__.serial.useRTSCTS;
|
|
932
|
+
}
|
|
933
|
+
set useRTSCTS(e) {
|
|
934
|
+
this.__internal__.serial.useRTSCTS = e;
|
|
935
|
+
}
|
|
918
936
|
get isConnected() {
|
|
919
|
-
const e = this.__internal__.serial.connected, t =
|
|
920
|
-
return e && !t &&
|
|
937
|
+
const e = this.__internal__.serial.connected, t = y(this, g, T).call(this, this.__internal__.serial.port);
|
|
938
|
+
return e && !t && y(this, g, B).call(this, { error: "Port is closed, not readable or writable." }), this.__internal__.serial.connected = t, this.__internal__.serial.connected;
|
|
921
939
|
}
|
|
922
940
|
get isDisconnected() {
|
|
923
|
-
const e = this.__internal__.serial.connected, t =
|
|
924
|
-
return !e && t && (this.dispatch("serial:connected"),
|
|
941
|
+
const e = this.__internal__.serial.connected, t = y(this, g, T).call(this, this.__internal__.serial.port);
|
|
942
|
+
return !e && t && (this.dispatch("serial:connected"), u.$dispatchChange(this)), this.__internal__.serial.connected = t, !this.__internal__.serial.connected;
|
|
925
943
|
}
|
|
926
944
|
get deviceNumber() {
|
|
927
945
|
return this.__internal__.device_number;
|
|
@@ -935,20 +953,76 @@ class be extends te {
|
|
|
935
953
|
get queue() {
|
|
936
954
|
return this.__internal__.serial.queue;
|
|
937
955
|
}
|
|
956
|
+
get responseDelimited() {
|
|
957
|
+
return this.__internal__.serial.response.delimited;
|
|
958
|
+
}
|
|
959
|
+
set responseDelimited(e) {
|
|
960
|
+
if (typeof e != "boolean")
|
|
961
|
+
throw new Error("responseDelimited must be a boolean");
|
|
962
|
+
this.__internal__.serial.response.delimited = e;
|
|
963
|
+
}
|
|
964
|
+
get responsePrefixLimited() {
|
|
965
|
+
return this.__internal__.serial.response.prefixLimiter;
|
|
966
|
+
}
|
|
967
|
+
set responsePrefixLimited(e) {
|
|
968
|
+
if (typeof e != "boolean")
|
|
969
|
+
throw new Error("responsePrefixLimited must be a boolean");
|
|
970
|
+
this.__internal__.serial.response.prefixLimiter = e;
|
|
971
|
+
}
|
|
972
|
+
get responseSufixLimited() {
|
|
973
|
+
return this.__internal__.serial.response.sufixLimiter;
|
|
974
|
+
}
|
|
975
|
+
set responseSufixLimited(e) {
|
|
976
|
+
if (typeof e != "boolean")
|
|
977
|
+
throw new Error("responseSufixLimited must be a boolean");
|
|
978
|
+
this.__internal__.serial.response.sufixLimiter = e;
|
|
979
|
+
}
|
|
980
|
+
get responseLimiter() {
|
|
981
|
+
return this.__internal__.serial.response.limiter;
|
|
982
|
+
}
|
|
983
|
+
set responseLimiter(e) {
|
|
984
|
+
if (typeof e != "string" && !(e instanceof RegExp))
|
|
985
|
+
throw new Error("responseLimiter must be a string or a RegExp");
|
|
986
|
+
this.__internal__.serial.response.limiter = e;
|
|
987
|
+
}
|
|
988
|
+
get fixedBytesMessage() {
|
|
989
|
+
return this.__internal__.serial.response.length;
|
|
990
|
+
}
|
|
991
|
+
set fixedBytesMessage(e) {
|
|
992
|
+
if (e !== null && (typeof e != "number" || e < 1))
|
|
993
|
+
throw new Error("Invalid length for fixed bytes message");
|
|
994
|
+
this.__internal__.serial.response.length = e;
|
|
995
|
+
}
|
|
996
|
+
get timeoutBeforeResponseBytes() {
|
|
997
|
+
return this.__internal__.serial.free_timeout_ms || 50;
|
|
998
|
+
}
|
|
999
|
+
set timeoutBeforeResponseBytes(e) {
|
|
1000
|
+
if (e !== void 0 && (typeof e != "number" || e < 1))
|
|
1001
|
+
throw new Error("Invalid timeout for response bytes");
|
|
1002
|
+
this.__internal__.serial.free_timeout_ms = e ?? 50;
|
|
1003
|
+
}
|
|
1004
|
+
get bypassSerialBytesConnection() {
|
|
1005
|
+
return this.__internal__.bypassSerialBytesConnection;
|
|
1006
|
+
}
|
|
1007
|
+
set bypassSerialBytesConnection(e) {
|
|
1008
|
+
if (typeof e != "boolean")
|
|
1009
|
+
throw new Error("bypassSerialBytesConnection must be a boolean");
|
|
1010
|
+
this.__internal__.bypassSerialBytesConnection = e;
|
|
1011
|
+
}
|
|
938
1012
|
async timeout(e, t) {
|
|
939
|
-
this.__internal__.last_error.message = "Operation response timed out.", this.__internal__.last_error.action = t, this.__internal__.last_error.code = e, this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0), t === "connect" ? (this.__internal__.serial.connected = !1, this.dispatch("serial:reconnect", {}),
|
|
1013
|
+
this.__internal__.last_error.message = "Operation response timed out.", this.__internal__.last_error.action = t, this.__internal__.last_error.code = e, this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0), t === "connect" ? (this.__internal__.serial.connected = !1, this.dispatch("serial:reconnect", {}), u.$dispatchChange(this)) : t === "connection:start" && (await this.serialDisconnect(), this.__internal__.serial.connected = !1, this.__internal__.aux_port_connector += 1, u.$dispatchChange(this), await this.serialConnect()), this.dispatch("serial:timeout", {
|
|
940
1014
|
...this.__internal__.last_error,
|
|
941
1015
|
bytes: e,
|
|
942
1016
|
action: t
|
|
943
1017
|
});
|
|
944
1018
|
}
|
|
945
1019
|
async disconnect(e = null) {
|
|
946
|
-
await this.serialDisconnect(),
|
|
1020
|
+
await this.serialDisconnect(), y(this, g, B).call(this, e);
|
|
947
1021
|
}
|
|
948
1022
|
async connect() {
|
|
949
|
-
return new Promise((e, t) => {
|
|
950
|
-
|
|
951
|
-
await
|
|
1023
|
+
return this.isConnected ? `${this.typeDevice} device ${this.deviceNumber} already connected` : new Promise((e, t) => {
|
|
1024
|
+
ye() || t("Web Serial not supported"), setTimeout(async () => {
|
|
1025
|
+
await H(499), await this.serialConnect(), this.isConnected ? e(`${this.typeDevice} device ${this.deviceNumber} connected`) : t(`${this.typeDevice} device ${this.deviceNumber} not connected`);
|
|
952
1026
|
}, 1);
|
|
953
1027
|
});
|
|
954
1028
|
}
|
|
@@ -959,7 +1033,7 @@ class be extends te {
|
|
|
959
1033
|
} catch (e) {
|
|
960
1034
|
this.serialErrors(e);
|
|
961
1035
|
} finally {
|
|
962
|
-
this.__internal__.serial.reader = null, this.__internal__.serial.input_done = null, this.__internal__.serial.output_stream = null, this.__internal__.serial.output_done = null, this.__internal__.serial.connected = !1, this.__internal__.serial.port = null,
|
|
1036
|
+
this.__internal__.serial.reader = null, this.__internal__.serial.input_done = null, this.__internal__.serial.output_stream = null, this.__internal__.serial.output_done = null, this.__internal__.serial.connected = !1, this.__internal__.serial.port = null, u.$dispatchChange(this);
|
|
963
1037
|
}
|
|
964
1038
|
}
|
|
965
1039
|
getResponseAsArrayBuffer() {
|
|
@@ -999,7 +1073,7 @@ class be extends te {
|
|
|
999
1073
|
case t.includes(
|
|
1000
1074
|
"this readable stream reader has been released and cannot be used to cancel its previous owner stream"
|
|
1001
1075
|
):
|
|
1002
|
-
this.dispatch("serial:need-permission", {}),
|
|
1076
|
+
this.dispatch("serial:need-permission", {}), u.$dispatchChange(this);
|
|
1003
1077
|
break;
|
|
1004
1078
|
case t.includes("the port is already open."):
|
|
1005
1079
|
case t.includes("failed to open serial port"):
|
|
@@ -1022,7 +1096,7 @@ class be extends te {
|
|
|
1022
1096
|
case t.includes("the port is already closed."):
|
|
1023
1097
|
break;
|
|
1024
1098
|
case t.includes("the device has been lost"):
|
|
1025
|
-
this.dispatch("serial:lost", {}),
|
|
1099
|
+
this.dispatch("serial:lost", {}), u.$dispatchChange(this);
|
|
1026
1100
|
break;
|
|
1027
1101
|
case t.includes("navigator.serial is undefined"):
|
|
1028
1102
|
this.dispatch("serial:unsupported", {});
|
|
@@ -1036,13 +1110,13 @@ class be extends te {
|
|
|
1036
1110
|
async serialConnect() {
|
|
1037
1111
|
try {
|
|
1038
1112
|
this.dispatch("serial:connecting", {});
|
|
1039
|
-
const e = await
|
|
1113
|
+
const e = await y(this, g, re).call(this);
|
|
1040
1114
|
if (e.length > 0)
|
|
1041
1115
|
await this.serialPortsSaved(e);
|
|
1042
1116
|
else {
|
|
1043
|
-
const
|
|
1117
|
+
const r = this.serialFilters;
|
|
1044
1118
|
this.__internal__.serial.port = await navigator.serial.requestPort({
|
|
1045
|
-
filters:
|
|
1119
|
+
filters: r
|
|
1046
1120
|
});
|
|
1047
1121
|
}
|
|
1048
1122
|
const t = this.__internal__.serial.port;
|
|
@@ -1050,22 +1124,22 @@ class be extends te {
|
|
|
1050
1124
|
throw new Error("No port selected by the user");
|
|
1051
1125
|
await t.open(this.serialConfigPort);
|
|
1052
1126
|
const n = this;
|
|
1053
|
-
t.onconnect = (
|
|
1054
|
-
console.log(
|
|
1127
|
+
t.onconnect = (r) => {
|
|
1128
|
+
console.log(r), n.dispatch("serial:connected", r), u.$dispatchChange(this), n.__internal__.serial.queue.length > 0 && n.dispatch("internal:queue", {});
|
|
1055
1129
|
}, t.ondisconnect = async () => {
|
|
1056
1130
|
await n.disconnect();
|
|
1057
|
-
}, await
|
|
1131
|
+
}, await H(this.__internal__.serial.delay_first_connection), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
1058
1132
|
await n.timeout(n.__internal__.serial.bytes_connection ?? [], "connection:start");
|
|
1059
|
-
}, this.__internal__.time.response_connection), this.__internal__.serial.last_action = "connect", await
|
|
1133
|
+
}, this.__internal__.time.response_connection), this.__internal__.serial.last_action = "connect", await y(this, g, W).call(this, this.__internal__.serial.bytes_connection ?? []), this.dispatch("serial:sent", {
|
|
1060
1134
|
action: "connect",
|
|
1061
1135
|
bytes: this.__internal__.serial.bytes_connection
|
|
1062
|
-
}), this.__internal__.auto_response &&
|
|
1136
|
+
}), this.__internal__.auto_response && y(this, g, E).call(this, this.__internal__.serial.auto_response), await y(this, g, se).call(this);
|
|
1063
1137
|
} catch (e) {
|
|
1064
1138
|
this.serialErrors(e);
|
|
1065
1139
|
}
|
|
1066
1140
|
}
|
|
1067
1141
|
async serialForget() {
|
|
1068
|
-
return await
|
|
1142
|
+
return await y(this, g, ae).call(this);
|
|
1069
1143
|
}
|
|
1070
1144
|
decToHex(e) {
|
|
1071
1145
|
return typeof e == "string" && (e = parseInt(e, 10)), e.toString(16);
|
|
@@ -1078,8 +1152,8 @@ class be extends te {
|
|
|
1078
1152
|
}
|
|
1079
1153
|
add0x(e) {
|
|
1080
1154
|
const t = [];
|
|
1081
|
-
return e.forEach((n,
|
|
1082
|
-
t[
|
|
1155
|
+
return e.forEach((n, r) => {
|
|
1156
|
+
t[r] = "0x" + n;
|
|
1083
1157
|
}), t;
|
|
1084
1158
|
}
|
|
1085
1159
|
bytesToHex(e) {
|
|
@@ -1109,13 +1183,14 @@ class be extends te {
|
|
|
1109
1183
|
this.__internal__.serial.queue.push({ bytes: n, action: t }), this.dispatch("internal:queue", {});
|
|
1110
1184
|
}
|
|
1111
1185
|
serialSetConnectionConstant(e = 1) {
|
|
1112
|
-
|
|
1186
|
+
if (this.__internal__.bypassSerialBytesConnection) return this.__internal__.serial.bytes_connection;
|
|
1187
|
+
throw console.warn("wtf?", this.bypassSerialBytesConnection), new Error(`Method not implemented 'serialSetConnectionConstant' to listen on channel ${e}`);
|
|
1113
1188
|
}
|
|
1114
1189
|
serialMessage(e) {
|
|
1115
|
-
throw console.log(e), new Error("Method not implemented 'serialMessage'");
|
|
1190
|
+
throw console.log(e), this.dispatch("serial:message", { code: e }), new Error("Method not implemented 'serialMessage'");
|
|
1116
1191
|
}
|
|
1117
|
-
serialCorruptMessage(e
|
|
1118
|
-
throw console.log(e,
|
|
1192
|
+
serialCorruptMessage(e) {
|
|
1193
|
+
throw console.log(e), this.dispatch("serial:corrupt-message", { code: e }), new Error("Method not implemented 'serialCorruptMessage'");
|
|
1119
1194
|
}
|
|
1120
1195
|
clearSerialQueue() {
|
|
1121
1196
|
this.__internal__.serial.queue = [];
|
|
@@ -1136,18 +1211,17 @@ class be extends te {
|
|
|
1136
1211
|
});
|
|
1137
1212
|
}
|
|
1138
1213
|
softReload() {
|
|
1139
|
-
|
|
1214
|
+
y(this, g, _e).call(this), this.dispatch("serial:soft-reload", {});
|
|
1140
1215
|
}
|
|
1141
1216
|
async sendConnect() {
|
|
1142
1217
|
if (!this.__internal__.serial.bytes_connection)
|
|
1143
1218
|
throw new Error("No connection bytes defined");
|
|
1144
1219
|
await this.appendToQueue(this.__internal__.serial.bytes_connection, "connect");
|
|
1145
1220
|
}
|
|
1146
|
-
// @ts-expect-error code is required but can be empty
|
|
1147
1221
|
async sendCustomCode({ code: e = [] } = { code: [] }) {
|
|
1148
|
-
if (e
|
|
1222
|
+
if (!e)
|
|
1149
1223
|
throw new Error("No data to send");
|
|
1150
|
-
await this.appendToQueue(e, "custom");
|
|
1224
|
+
this.__internal__.bypassSerialBytesConnection && (this.__internal__.serial.bytes_connection = this.validateBytes(e)), await this.appendToQueue(e, "custom");
|
|
1151
1225
|
}
|
|
1152
1226
|
stringToArrayHex(e) {
|
|
1153
1227
|
return Array.from(e).map((t) => t.charCodeAt(0).toString(16));
|
|
@@ -1164,7 +1238,7 @@ class be extends te {
|
|
|
1164
1238
|
parseStringToBytes(e = "", t = `
|
|
1165
1239
|
`) {
|
|
1166
1240
|
const n = this.parseStringToTextEncoder(e, t);
|
|
1167
|
-
return Array.from(n).map((
|
|
1241
|
+
return Array.from(n).map((r) => r.toString(16));
|
|
1168
1242
|
}
|
|
1169
1243
|
parseUint8ToHex(e) {
|
|
1170
1244
|
return Array.from(e).map((t) => t.toString(16));
|
|
@@ -1174,29 +1248,29 @@ class be extends te {
|
|
|
1174
1248
|
}
|
|
1175
1249
|
stringArrayToUint8Array(e) {
|
|
1176
1250
|
const t = [];
|
|
1177
|
-
return e.forEach((n) => {
|
|
1178
|
-
const
|
|
1179
|
-
t.push(parseInt(
|
|
1180
|
-
}), new Uint8Array(t);
|
|
1251
|
+
return typeof e == "string" ? this.parseStringToTextEncoder(e).buffer : (e.forEach((n) => {
|
|
1252
|
+
const r = n.replace("0x", "");
|
|
1253
|
+
t.push(parseInt(r, 16));
|
|
1254
|
+
}), new Uint8Array(t));
|
|
1181
1255
|
}
|
|
1182
1256
|
parseUint8ArrayToString(e) {
|
|
1183
1257
|
let t = new Uint8Array(0);
|
|
1184
1258
|
e instanceof Uint8Array ? t = e : t = this.stringArrayToUint8Array(e), e = this.parseUint8ToHex(t);
|
|
1185
|
-
const n = e.map((
|
|
1259
|
+
const n = e.map((r) => parseInt(r, 16));
|
|
1186
1260
|
return this.__internal__.serial.response.replacer ? String.fromCharCode(...n).replace(this.__internal__.serial.response.replacer, "") : String.fromCharCode(...n);
|
|
1187
1261
|
}
|
|
1188
1262
|
hexToAscii(e) {
|
|
1189
1263
|
const t = e.toString();
|
|
1190
1264
|
let n = "";
|
|
1191
|
-
for (let
|
|
1192
|
-
n += String.fromCharCode(parseInt(t.substring(
|
|
1265
|
+
for (let r = 0; r < t.length; r += 2)
|
|
1266
|
+
n += String.fromCharCode(parseInt(t.substring(r, 2), 16));
|
|
1193
1267
|
return n;
|
|
1194
1268
|
}
|
|
1195
1269
|
asciiToHex(e) {
|
|
1196
1270
|
const t = [];
|
|
1197
|
-
for (let n = 0,
|
|
1198
|
-
const
|
|
1199
|
-
t.push(
|
|
1271
|
+
for (let n = 0, r = e.length; n < r; n++) {
|
|
1272
|
+
const _ = Number(e.charCodeAt(n)).toString(16);
|
|
1273
|
+
t.push(_);
|
|
1200
1274
|
}
|
|
1201
1275
|
return t.join("");
|
|
1202
1276
|
}
|
|
@@ -1204,102 +1278,147 @@ class be extends te {
|
|
|
1204
1278
|
return this.isConnected;
|
|
1205
1279
|
}
|
|
1206
1280
|
}
|
|
1207
|
-
|
|
1281
|
+
g = /* @__PURE__ */ new WeakSet(), T = function(l) {
|
|
1208
1282
|
return !!(l && l.readable && l.writable);
|
|
1209
|
-
},
|
|
1210
|
-
this.__internal__.serial.connected = !1, this.__internal__.aux_port_connector = 0, this.dispatch("serial:disconnected", l),
|
|
1211
|
-
},
|
|
1283
|
+
}, B = function(l = null) {
|
|
1284
|
+
this.__internal__.serial.connected = !1, this.__internal__.aux_port_connector = 0, this.dispatch("serial:disconnected", l), u.$dispatchChange(this);
|
|
1285
|
+
}, W = async function(l) {
|
|
1212
1286
|
const e = this.__internal__.serial.port;
|
|
1213
1287
|
if (!e || e && (!e.readable || !e.writable))
|
|
1214
|
-
throw
|
|
1288
|
+
throw y(this, g, B).call(this, { error: "Port is closed, not readable or writable." }), new Error("The port is closed or is not readable/writable");
|
|
1215
1289
|
const t = this.validateBytes(l);
|
|
1216
|
-
if (e.writable === null) return;
|
|
1290
|
+
if (this.useRTSCTS && await y(this, g, V).call(this, e, 5e3), e.writable === null) return;
|
|
1217
1291
|
const n = e.writable.getWriter();
|
|
1218
1292
|
await n.write(t), n.releaseLock();
|
|
1219
|
-
},
|
|
1293
|
+
}, V = async function(l, e = 5e3) {
|
|
1294
|
+
const t = Date.now();
|
|
1295
|
+
for (; ; ) {
|
|
1296
|
+
if (Date.now() - t > e)
|
|
1297
|
+
throw new Error("Timeout waiting for clearToSend signal");
|
|
1298
|
+
const { clearToSend: n } = await l.getSignals();
|
|
1299
|
+
if (n) return;
|
|
1300
|
+
await H(100);
|
|
1301
|
+
}
|
|
1302
|
+
}, E = function(l = new Uint8Array([]), e = !1) {
|
|
1220
1303
|
if (l && l.length > 0) {
|
|
1221
1304
|
const t = this.__internal__.serial.connected;
|
|
1222
|
-
if (this.__internal__.serial.connected =
|
|
1223
|
-
this.serialMessage(this.parseUint8ToHex(l));
|
|
1305
|
+
if (this.__internal__.serial.connected = y(this, g, T).call(this, this.__internal__.serial.port), u.$dispatchChange(this), !t && this.__internal__.serial.connected && this.dispatch("serial:connected"), 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), this.__internal__.serial.response.as === "hex")
|
|
1306
|
+
e ? this.serialCorruptMessage(this.parseUint8ToHex(l)) : this.serialMessage(this.parseUint8ToHex(l));
|
|
1224
1307
|
else if (this.__internal__.serial.response.as === "uint8")
|
|
1225
|
-
this.serialMessage(l);
|
|
1308
|
+
e ? this.serialCorruptMessage(l) : this.serialMessage(l);
|
|
1226
1309
|
else if (this.__internal__.serial.response.as === "string") {
|
|
1227
1310
|
const n = this.parseUint8ArrayToString(l);
|
|
1228
1311
|
if (this.__internal__.serial.response.limiter !== null) {
|
|
1229
|
-
const
|
|
1230
|
-
for (const
|
|
1231
|
-
|
|
1312
|
+
const r = n.split(this.__internal__.serial.response.limiter);
|
|
1313
|
+
for (const _ in r)
|
|
1314
|
+
r[_] && (e ? this.serialCorruptMessage(r[_]) : this.serialMessage(r[_]));
|
|
1232
1315
|
} else
|
|
1233
|
-
this.serialMessage(n);
|
|
1316
|
+
e ? this.serialCorruptMessage(n) : this.serialMessage(n);
|
|
1234
1317
|
} else {
|
|
1235
1318
|
const n = this.stringToArrayBuffer(this.parseUint8ArrayToString(l));
|
|
1236
|
-
this.serialMessage(n);
|
|
1319
|
+
e ? this.serialCorruptMessage(n) : this.serialMessage(n);
|
|
1237
1320
|
}
|
|
1238
|
-
}
|
|
1239
|
-
this.serialCorruptMessage(l, e);
|
|
1321
|
+
}
|
|
1240
1322
|
this.__internal__.serial.queue.length !== 0 && this.dispatch("internal:queue", {});
|
|
1241
|
-
},
|
|
1323
|
+
}, re = async function() {
|
|
1242
1324
|
const l = this.serialFilters, e = await navigator.serial.getPorts({ filters: l });
|
|
1243
1325
|
return l.length === 0 ? e : e.filter((t) => {
|
|
1244
1326
|
const n = t.getInfo();
|
|
1245
|
-
return l.some((
|
|
1246
|
-
}).filter((t) => !
|
|
1247
|
-
},
|
|
1327
|
+
return l.some((r) => n.usbProductId === r.usbProductId && n.usbVendorId === r.usbVendorId);
|
|
1328
|
+
}).filter((t) => !y(this, g, T).call(this, t));
|
|
1329
|
+
}, z = function(l) {
|
|
1248
1330
|
if (l) {
|
|
1249
1331
|
const e = this.__internal__.serial.response.buffer, t = new Uint8Array(e.length + l.byteLength);
|
|
1250
1332
|
t.set(e, 0), t.set(new Uint8Array(l), e.length), this.__internal__.serial.response.buffer = t;
|
|
1251
1333
|
}
|
|
1252
|
-
},
|
|
1334
|
+
}, G = async function() {
|
|
1253
1335
|
this.__internal__.serial.time_until_send_bytes && (clearTimeout(this.__internal__.serial.time_until_send_bytes), this.__internal__.serial.time_until_send_bytes = 0), this.__internal__.serial.time_until_send_bytes = setTimeout(() => {
|
|
1254
|
-
this.__internal__.serial.response.buffer &&
|
|
1255
|
-
},
|
|
1336
|
+
this.__internal__.serial.response.buffer && y(this, g, E).call(this, this.__internal__.serial.response.buffer), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1337
|
+
}, this.__internal__.serial.free_timeout_ms || 50);
|
|
1256
1338
|
}, K = async function() {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
l[t] = this.__internal__.serial.response.buffer[t];
|
|
1264
|
-
if (l.length === this.__internal__.serial.response.length) {
|
|
1265
|
-
m(this, b, E).call(this, l), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
l = new Uint8Array(0);
|
|
1269
|
-
const e = this.__internal__.serial.response.length * 2;
|
|
1270
|
-
if (this.__internal__.serial.response.buffer.length === e) {
|
|
1271
|
-
for (let t = 14; t < e; t++)
|
|
1272
|
-
l[t - this.__internal__.serial.response.length] = this.__internal__.serial.response.buffer[t];
|
|
1273
|
-
l.length === this.__internal__.serial.response.length && (m(this, b, E).call(this, l), this.__internal__.serial.response.buffer = new Uint8Array(0));
|
|
1274
|
-
}
|
|
1339
|
+
const l = this.__internal__.serial.response.length;
|
|
1340
|
+
let e = this.__internal__.serial.response.buffer;
|
|
1341
|
+
if (this.__internal__.serial.time_until_send_bytes && (clearTimeout(this.__internal__.serial.time_until_send_bytes), this.__internal__.serial.time_until_send_bytes = 0), !(l === null || !e || e.length === 0)) {
|
|
1342
|
+
for (; e.length >= l; ) {
|
|
1343
|
+
const t = e.slice(0, l);
|
|
1344
|
+
y(this, g, E).call(this, t), e = e.slice(l);
|
|
1275
1345
|
}
|
|
1346
|
+
this.__internal__.serial.response.buffer = e, e.length > 0 && (this.__internal__.serial.time_until_send_bytes = setTimeout(() => {
|
|
1347
|
+
y(this, g, E).call(this, this.__internal__.serial.response.buffer, !0);
|
|
1348
|
+
}, this.__internal__.serial.free_timeout_ms || 50));
|
|
1276
1349
|
}
|
|
1277
|
-
},
|
|
1350
|
+
}, X = async function() {
|
|
1351
|
+
const {
|
|
1352
|
+
limiter: l,
|
|
1353
|
+
prefixLimiter: e = !1,
|
|
1354
|
+
sufixLimiter: t = !0
|
|
1355
|
+
} = this.__internal__.serial.response;
|
|
1356
|
+
if (!l)
|
|
1357
|
+
throw new Error("No limiter defined for delimited serial response");
|
|
1358
|
+
const n = this.__internal__.serial.response.buffer;
|
|
1359
|
+
if (!l || !n || n.length === 0) return;
|
|
1360
|
+
this.__internal__.serial.time_until_send_bytes && (clearTimeout(this.__internal__.serial.time_until_send_bytes), this.__internal__.serial.time_until_send_bytes = 0);
|
|
1361
|
+
let r = new TextDecoder().decode(n);
|
|
1362
|
+
const _ = [];
|
|
1363
|
+
if (typeof l == "string") {
|
|
1364
|
+
let h;
|
|
1365
|
+
if (e && t)
|
|
1366
|
+
h = new RegExp(`${l}([^${l}]+)${l}`, "g");
|
|
1367
|
+
else if (e)
|
|
1368
|
+
h = new RegExp(`${l}([^${l}]*)`, "g");
|
|
1369
|
+
else if (t)
|
|
1370
|
+
h = new RegExp(`([^${l}]+)${l}`, "g");
|
|
1371
|
+
else
|
|
1372
|
+
return;
|
|
1373
|
+
let d, w = 0;
|
|
1374
|
+
for (; (d = h.exec(r)) !== null; )
|
|
1375
|
+
_.push(new TextEncoder().encode(d[1])), w = h.lastIndex;
|
|
1376
|
+
r = r.slice(w);
|
|
1377
|
+
} else if (l instanceof RegExp) {
|
|
1378
|
+
let h, d = 0;
|
|
1379
|
+
if (e && t) {
|
|
1380
|
+
const w = new RegExp(`${l.source}(.*?)${l.source}`, "g");
|
|
1381
|
+
for (; (h = w.exec(r)) !== null; )
|
|
1382
|
+
_.push(new TextEncoder().encode(h[1])), d = w.lastIndex;
|
|
1383
|
+
} else if (t)
|
|
1384
|
+
for (; (h = l.exec(r)) !== null; ) {
|
|
1385
|
+
const w = h.index, C = r.slice(d, w);
|
|
1386
|
+
_.push(new TextEncoder().encode(C)), d = l.lastIndex;
|
|
1387
|
+
}
|
|
1388
|
+
else if (e) {
|
|
1389
|
+
const w = r.split(l);
|
|
1390
|
+
w.shift();
|
|
1391
|
+
for (const C of w)
|
|
1392
|
+
_.push(new TextEncoder().encode(C));
|
|
1393
|
+
r = "";
|
|
1394
|
+
}
|
|
1395
|
+
r = r.slice(d);
|
|
1396
|
+
}
|
|
1397
|
+
for (const h of _)
|
|
1398
|
+
y(this, g, E).call(this, h);
|
|
1399
|
+
const f = new TextEncoder().encode(r);
|
|
1400
|
+
this.__internal__.serial.response.buffer = f, f.length > 0 && (this.__internal__.serial.time_until_send_bytes = setTimeout(() => {
|
|
1401
|
+
y(this, g, E).call(this, this.__internal__.serial.response.buffer, !0), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1402
|
+
}, this.__internal__.serial.free_timeout_ms ?? 50));
|
|
1403
|
+
}, se = async function() {
|
|
1278
1404
|
const l = this.__internal__.serial.port;
|
|
1279
1405
|
if (!l || !l.readable) throw new Error("Port is not readable");
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
if (i) {
|
|
1288
|
-
e.releaseLock(), this.__internal__.serial.keep_reading = !1, t = !1;
|
|
1289
|
-
break;
|
|
1290
|
-
}
|
|
1291
|
-
m(this, b, V).call(this, n), this.__internal__.serial.response.length === null ? await m(this, b, z).call(this) : await m(this, b, K).call(this);
|
|
1292
|
-
}
|
|
1293
|
-
} catch (t) {
|
|
1294
|
-
this.serialErrors(t);
|
|
1295
|
-
} finally {
|
|
1296
|
-
e.releaseLock();
|
|
1406
|
+
const e = l.readable.getReader();
|
|
1407
|
+
this.__internal__.serial.reader = e;
|
|
1408
|
+
try {
|
|
1409
|
+
for (; this.__internal__.serial.keep_reading; ) {
|
|
1410
|
+
const { value: t, done: n } = await e.read();
|
|
1411
|
+
if (n) break;
|
|
1412
|
+
y(this, g, z).call(this, t), this.__internal__.serial.response.delimited ? await y(this, g, X).call(this) : this.__internal__.serial.response.length === null ? await y(this, g, G).call(this) : await y(this, g, K).call(this);
|
|
1297
1413
|
}
|
|
1414
|
+
} catch (t) {
|
|
1415
|
+
this.serialErrors(t);
|
|
1416
|
+
} finally {
|
|
1417
|
+
e.releaseLock(), this.__internal__.serial.keep_reading = !0, this.__internal__.serial.port && await this.__internal__.serial.port.close();
|
|
1298
1418
|
}
|
|
1299
|
-
|
|
1300
|
-
}, ie = async function() {
|
|
1419
|
+
}, ae = async function() {
|
|
1301
1420
|
return typeof window > "u" ? !1 : "serial" in navigator && "forget" in SerialPort.prototype && this.__internal__.serial.port ? (await this.__internal__.serial.port.forget(), !0) : !1;
|
|
1302
|
-
},
|
|
1421
|
+
}, le = function() {
|
|
1303
1422
|
[
|
|
1304
1423
|
"serial:connected",
|
|
1305
1424
|
"serial:connecting",
|
|
@@ -1309,6 +1428,7 @@ b = /* @__PURE__ */ new WeakSet(), x = function(l) {
|
|
|
1309
1428
|
"serial:sent",
|
|
1310
1429
|
"serial:soft-reload",
|
|
1311
1430
|
"serial:message",
|
|
1431
|
+
"serial:corrupt-message",
|
|
1312
1432
|
"unknown",
|
|
1313
1433
|
"serial:need-permission",
|
|
1314
1434
|
"serial:lost",
|
|
@@ -1318,21 +1438,21 @@ b = /* @__PURE__ */ new WeakSet(), x = function(l) {
|
|
|
1318
1438
|
].forEach((l) => {
|
|
1319
1439
|
this.serialRegisterAvailableListener(l);
|
|
1320
1440
|
});
|
|
1321
|
-
},
|
|
1441
|
+
}, oe = function() {
|
|
1322
1442
|
const l = this;
|
|
1323
1443
|
this.on("internal:queue", async () => {
|
|
1324
1444
|
var e;
|
|
1325
|
-
await
|
|
1326
|
-
}),
|
|
1327
|
-
},
|
|
1445
|
+
await y(e = l, g, Z).call(e);
|
|
1446
|
+
}), y(this, g, Y).call(this);
|
|
1447
|
+
}, Y = function() {
|
|
1328
1448
|
const l = this;
|
|
1329
1449
|
navigator.serial.addEventListener("connect", async () => {
|
|
1330
1450
|
l.isDisconnected && await l.serialConnect().catch(() => {
|
|
1331
1451
|
});
|
|
1332
1452
|
});
|
|
1333
|
-
},
|
|
1334
|
-
if (!
|
|
1335
|
-
|
|
1453
|
+
}, Z = async function() {
|
|
1454
|
+
if (!y(this, g, T).call(this, this.__internal__.serial.port)) {
|
|
1455
|
+
y(this, g, B).call(this, { error: "Port is closed, not readable or writable." }), await this.serialConnect();
|
|
1336
1456
|
return;
|
|
1337
1457
|
}
|
|
1338
1458
|
if (this.__internal__.timeout.until_response || this.__internal__.serial.queue.length === 0) return;
|
|
@@ -1340,23 +1460,23 @@ b = /* @__PURE__ */ new WeakSet(), x = function(l) {
|
|
|
1340
1460
|
let e = this.__internal__.time.response_general;
|
|
1341
1461
|
if (l.action === "connect" && (e = this.__internal__.time.response_connection), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
1342
1462
|
await this.timeout(l.bytes, l.action);
|
|
1343
|
-
}, e), this.__internal__.serial.last_action = l.action ?? "unknown", await
|
|
1463
|
+
}, e), this.__internal__.serial.last_action = l.action ?? "unknown", await y(this, g, W).call(this, l.bytes), this.dispatch("serial:sent", {
|
|
1344
1464
|
action: l.action,
|
|
1345
1465
|
bytes: l.bytes
|
|
1346
1466
|
}), this.__internal__.auto_response) {
|
|
1347
1467
|
let n = new Uint8Array(0);
|
|
1348
1468
|
try {
|
|
1349
1469
|
n = this.validateBytes(this.__internal__.serial.auto_response);
|
|
1350
|
-
} catch (
|
|
1351
|
-
this.serialErrors(
|
|
1470
|
+
} catch (r) {
|
|
1471
|
+
this.serialErrors(r);
|
|
1352
1472
|
}
|
|
1353
|
-
|
|
1473
|
+
y(this, g, E).call(this, n);
|
|
1354
1474
|
}
|
|
1355
1475
|
const t = [...this.__internal__.serial.queue];
|
|
1356
1476
|
this.__internal__.serial.queue = t.splice(1);
|
|
1357
|
-
},
|
|
1358
|
-
this.__internal__.device_number = l, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(l);
|
|
1359
|
-
},
|
|
1477
|
+
}, ce = function(l = 1) {
|
|
1478
|
+
this.__internal__.device_number = l, !this.__internal__.bypassSerialBytesConnection && (this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(l));
|
|
1479
|
+
}, _e = function() {
|
|
1360
1480
|
this.__internal__.last_error = {
|
|
1361
1481
|
message: null,
|
|
1362
1482
|
action: null,
|
|
@@ -1364,8 +1484,8 @@ b = /* @__PURE__ */ new WeakSet(), x = function(l) {
|
|
|
1364
1484
|
no_code: 0
|
|
1365
1485
|
};
|
|
1366
1486
|
};
|
|
1367
|
-
|
|
1368
|
-
const
|
|
1487
|
+
u.instance || (u.instance = new u());
|
|
1488
|
+
const we = {
|
|
1369
1489
|
relay: [],
|
|
1370
1490
|
locker: [],
|
|
1371
1491
|
jofemar: [],
|
|
@@ -1374,26 +1494,26 @@ const ye = {
|
|
|
1374
1494
|
pinpad: [],
|
|
1375
1495
|
pinpax: []
|
|
1376
1496
|
};
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1497
|
+
u.devices = { ...u.devices, ...we };
|
|
1498
|
+
u.addCustom = (l, e) => {
|
|
1499
|
+
u.registerType(l), u.add(e);
|
|
1380
1500
|
};
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
class
|
|
1501
|
+
u.getCustomByUuid = (l, e) => u.get(l, e);
|
|
1502
|
+
u.getJofemarByUuid = (l) => u.get("jofemar", l);
|
|
1503
|
+
u.getLockerByUuid = (l) => u.get("locker", l);
|
|
1504
|
+
u.getRelayByUuid = (l) => u.get("relay", l);
|
|
1505
|
+
u.getBoardroidByUuid = (l) => u.get("boardroid", l);
|
|
1506
|
+
u.getArduinoByUuid = (l) => u.get("arduino", l);
|
|
1507
|
+
u.getPinPadByUuid = (l) => u.get("pinpad", l);
|
|
1508
|
+
u.getPinPaxByUuid = (l) => u.get("pinpax", l);
|
|
1509
|
+
u.getJofemar = (l = 1) => u.getByNumber("jofemar", l);
|
|
1510
|
+
u.getBoardroid = (l = 1) => u.getByNumber("boardroid", l);
|
|
1511
|
+
u.getLocker = (l = 1) => u.getByNumber("locker", l);
|
|
1512
|
+
u.getRelay = (l = 1) => u.getByNumber("relay", l);
|
|
1513
|
+
u.getArduino = (l = 1) => u.getByNumber("arduino", l);
|
|
1514
|
+
u.getPinPad = (l = 1) => u.getByNumber("pinpad", l);
|
|
1515
|
+
u.getPinPax = (l = 1) => u.getByNumber("pinpax", l);
|
|
1516
|
+
class ve extends be {
|
|
1397
1517
|
constructor(e) {
|
|
1398
1518
|
super(e), 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 = {
|
|
1399
1519
|
must_response: !1,
|
|
@@ -1436,7 +1556,7 @@ class me extends be {
|
|
|
1436
1556
|
}), null);
|
|
1437
1557
|
}
|
|
1438
1558
|
async internalDispenseStatus() {
|
|
1439
|
-
if (this.__internal__.dispense.must_response && (await
|
|
1559
|
+
if (this.__internal__.dispense.must_response && (await de(this.__internal__.time.response_engines + 10), this.__internal__.dispense.status === "no-response"))
|
|
1440
1560
|
return this.internalClearSensing(), this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", { reason: "no-response" }), { status: !1, error: "no-response" };
|
|
1441
1561
|
this.__internal__.dispense.status = null, this.__internal__.dispense.dispensing = !0, this.dispatch("internal:dispense:running", {});
|
|
1442
1562
|
const e = this;
|
|
@@ -1464,14 +1584,14 @@ class me extends be {
|
|
|
1464
1584
|
}
|
|
1465
1585
|
async internalDispense(e) {
|
|
1466
1586
|
if (this.isDispensing) throw new Error("Another dispensing process is running");
|
|
1467
|
-
if (!
|
|
1587
|
+
if (!F.enable && !this.__internal__.serial.connected && (await this.serialConnect(), !this.__internal__.serial.connected))
|
|
1468
1588
|
throw new Error("Serial device not connected");
|
|
1469
1589
|
return this.__internal__.serial.queue.length === 0 ? (await this.appendToQueue(e, "dispense"), await this.internalDispenseStatus()) : new Promise((t) => {
|
|
1470
1590
|
const n = setInterval(async () => {
|
|
1471
1591
|
if (this.__internal__.serial.queue.length > 0) return;
|
|
1472
1592
|
clearInterval(n), await this.appendToQueue(e, "dispense");
|
|
1473
|
-
const
|
|
1474
|
-
t(
|
|
1593
|
+
const r = await this.internalDispenseStatus();
|
|
1594
|
+
t(r);
|
|
1475
1595
|
}, 100);
|
|
1476
1596
|
});
|
|
1477
1597
|
}
|
|
@@ -1480,7 +1600,7 @@ class me extends be {
|
|
|
1480
1600
|
console.error("Invalid data to make an emulation");
|
|
1481
1601
|
return;
|
|
1482
1602
|
}
|
|
1483
|
-
this.__internal__.serial.connected || (this.__internal__.serial.connected = !0, this.dispatch("serial:connected"),
|
|
1603
|
+
this.__internal__.serial.connected || (this.__internal__.serial.connected = !0, this.dispatch("serial:connected"), u.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);
|
|
1484
1604
|
const t = [];
|
|
1485
1605
|
for (const n in e.code)
|
|
1486
1606
|
t.push(e.code[n].toString().padStart(2, "0").toLowerCase());
|
|
@@ -1501,13 +1621,13 @@ class me extends be {
|
|
|
1501
1621
|
}
|
|
1502
1622
|
}
|
|
1503
1623
|
export {
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
Ce as a,
|
|
1624
|
+
F as E,
|
|
1625
|
+
ve as K,
|
|
1626
|
+
xe as a,
|
|
1508
1627
|
ke as b,
|
|
1509
1628
|
De as g,
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1629
|
+
u as h,
|
|
1630
|
+
Ee as i,
|
|
1631
|
+
Se as s,
|
|
1632
|
+
de as w
|
|
1513
1633
|
};
|