@danidoble/webserial 4.3.4 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boardroid.cjs +1 -1
- package/dist/boardroid.js +506 -478
- package/dist/hopper.cjs +2 -2
- package/dist/hopper.js +117 -114
- package/dist/jofemar.cjs +1 -1
- package/dist/jofemar.js +732 -705
- package/dist/kernel-D8A562gb.cjs +1 -0
- package/dist/kernel-DAtdBEi3.js +815 -0
- package/dist/kernel.cjs +1 -1
- package/dist/kernel.js +2 -2
- package/dist/locker.cjs +1 -1
- package/dist/locker.js +81 -83
- package/dist/pinpad.cjs +21 -21
- package/dist/pinpad.js +3386 -3278
- package/dist/pinpax.cjs +4 -4
- package/dist/pinpax.js +112 -116
- package/dist/relay.cjs +1 -1
- package/dist/relay.js +2 -2
- package/dist/{webserial-core-ByrJ7tlu.js → webserial-core-BjytHor1.js} +179 -182
- package/dist/webserial-core-N14HUamr.cjs +4 -0
- package/dist/webserial.cjs +1 -1
- package/dist/webserial.js +3 -3
- package/package.json +3 -3
- package/dist/kernel-BblykfpT.js +0 -875
- package/dist/kernel-CzkmE_OW.cjs +0 -1
- package/dist/webserial-core-5B5nYtyR.cjs +0 -4
package/dist/kernel.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-D8A562gb.cjs"),r=require("./webserial-core-N14HUamr.cjs");/**
|
|
2
2
|
* @license Webserial
|
|
3
3
|
* webserial
|
|
4
4
|
*
|
package/dist/kernel.js
CHANGED
package/dist/locker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./kernel-D8A562gb.cjs"),t=require("./relay-DGFymXOw.cjs"),a=require("./webserial-core-N14HUamr.cjs");class r extends n.Kernel{#s=!1;#e=0;#t=0;constructor({filters:s=null,config_port:e=null,no_device:i=1,device_listen_on_port:l=3}={}){if(super({filters:s,config_port:e,no_device:i,device_listen_on_port:l}),this.__internal__.device.type="locker",a.h.getCustom(this.typeDevice,i))throw new Error(`Device ${this.typeDevice} ${i} already exists`);this.__internal__.time.response_engines=1e3,this.__internal__.device.milliseconds=666,this.__internal__.dispense.limit_counter=1,a.h.add(this),this.#r()}#r(){const s=["percentage:disable","percentage:enable","percentage:open"];for(const e of s)this.serialRegisterAvailableListener(e)}serialMessage(s){const e={code:s,name:null,description:null,request:null,no_code:0};switch(s[1]){case"08":e.name="Connection with the serial device completed.",e.description="Your connection with the serial device was successfully completed.",e.request="connect",e.no_code=100;break;case"07":switch(s[4]){case"00":e.name="Cell closed.",e.description="The selected cell is closed.",e.request="dispense",e.no_code=1102,this.__internal__.dispense.status=!1,this.dispatch("dispensed",{}),this.#s&&this.#e>=89?(e.finished_test=!0,this.#s=!1,this.#e=0):this.#s&&(e.finished_test=!1);break;case"01":case"04":e.name="Cell open.",e.description="The selected cell was open successfully.",e.request="dispense",e.no_code=102,this.__internal__.dispense.status=!0,this.dispatch("dispensed",{}),this.#s&&this.#e>=89?(e.finished_test=!0,this.#s=!1,this.#e=0):this.#s&&(e.finished_test=!1);break;case"05":e.name="Cell inactive.",e.description="The selected cell is inactive or doesn't exist.",e.request="dispense",e.no_code=101,this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{}),this.#s&&this.#e>=89?(e.finished_test=!0,this.#s=!1,this.#e=0):this.#s&&(e.finished_test=!1);break}break;case"06":e.name="Configuration applied.",e.description="The configuration was successfully applied.",e.request="configure cell",e.no_code=103;break;default:e.request="undefined",e.name="Response unrecognized",e.description="The response of application was received, but dont identify with any of current parameters",e.no_code=400;break}this.dispatch("serial:message",e)}serialSetConnectionConstant(s=3){return t.u.connection({channel:s})}#i(){this.#s=!1,this.#e=0,this.#t=0}#n(s=null){this.#t=Math.round(this.#e*100/80),this.dispatch("percentage:open",{percentage:this.#t,dispensed:s})}#a(){this.#t=Math.round(this.#e*100/80),this.dispatch("percentage:enable",{percentage:this.#t})}#l(){this.#t=Math.round(this.#e*100/80),this.dispatch("percentage:disable",{percentage:this.#t})}async dispense({cell:s=1,status:e=!0}={}){return setTimeout(()=>{e===!0?this.#h():this.#c()},this.__internal__.time.response_engines/2),await this.internalDispense(t.u.openCell({cell:s,channel:this.__internal__.device.listen_on_port}))}#h(){this.__internal__.dispense.dispensing&&(this.__internal__.dispense.status=!0)}#c(){this.__internal__.dispense.dispensing&&(this.__internal__.dispense.status=!1)}async status({cell:s=1}={}){return await this.appendToQueue(t.u.statusCell({cell:s,channel:this.__internal__.device.listen_on_port}),"status")}async lightScan({since:s=0,until:e=10}={}){return await this.appendToQueue(t.u.lightScan({channel:this.__internal__.device.listen_on_port,since:s,until:e}),"light-scan")}async enable({cell:s=1}={}){return await this.appendToQueue(t.u.enableCell({cell:s,channel:this.__internal__.device.listen_on_port}),"activate")}async disable({cell:s=1}={}){await this.appendToQueue(t.u.disableCell({cell:s,channel:this.__internal__.device.listen_on_port}),"disable")}async openAll(){if(this.isDispensing)throw new Error("Another dispensing process is running");this.#i(),this.#s=!0,this.#n();const s=[];for(let e=1;e<=80;e++){const i=await this.dispense({cell:e,status:!0});s.push(i),this.#e=e,this.#n()}this.#e=80,this.#n(s),this.#i()}async enableAll(){this.#i(),this.#s=!0,this.#a();for(let s=1;s<=80;s++)await this.enable({cell:s}),await n.wait(100),this.#e=s,this.#a();this.#e=80,this.#a(),this.#i()}async disableAll(){this.#i(),this.#s=!0,this.#l();for(let s=1;s<=80;s++)await this.disable({cell:s}),await n.wait(100),this.#e=s,this.#l();this.#e=80,this.#l(),this.#i()}}exports.Locker=r;
|
package/dist/locker.js
CHANGED
|
@@ -1,104 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
serialMessage(e) {
|
|
22
|
-
const s = {
|
|
23
|
-
code: e,
|
|
1
|
+
import { K as r, w as n } from "./kernel-DAtdBEi3.js";
|
|
2
|
+
import { u as t } from "./relay-CsdB0FSa.js";
|
|
3
|
+
import { h as a } from "./webserial-core-BjytHor1.js";
|
|
4
|
+
class p extends r {
|
|
5
|
+
#s = !1;
|
|
6
|
+
#e = 0;
|
|
7
|
+
#t = 0;
|
|
8
|
+
constructor({ filters: s = null, config_port: e = null, no_device: i = 1, device_listen_on_port: l = 3 } = {}) {
|
|
9
|
+
if (super({ filters: s, config_port: e, no_device: i, device_listen_on_port: l }), this.__internal__.device.type = "locker", a.getCustom(this.typeDevice, i))
|
|
10
|
+
throw new Error(`Device ${this.typeDevice} ${i} already exists`);
|
|
11
|
+
this.__internal__.time.response_engines = 1e3, this.__internal__.device.milliseconds = 666, this.__internal__.dispense.limit_counter = 1, a.add(this), this.#r();
|
|
12
|
+
}
|
|
13
|
+
#r() {
|
|
14
|
+
const s = ["percentage:disable", "percentage:enable", "percentage:open"];
|
|
15
|
+
for (const e of s)
|
|
16
|
+
this.serialRegisterAvailableListener(e);
|
|
17
|
+
}
|
|
18
|
+
serialMessage(s) {
|
|
19
|
+
const e = {
|
|
20
|
+
code: s,
|
|
24
21
|
name: null,
|
|
25
22
|
description: null,
|
|
26
23
|
request: null,
|
|
27
24
|
no_code: 0
|
|
28
25
|
};
|
|
29
|
-
switch (
|
|
26
|
+
switch (s[1]) {
|
|
30
27
|
case "08":
|
|
31
|
-
|
|
28
|
+
e.name = "Connection with the serial device completed.", e.description = "Your connection with the serial device was successfully completed.", e.request = "connect", e.no_code = 100;
|
|
32
29
|
break;
|
|
33
30
|
case "07":
|
|
34
|
-
switch (
|
|
31
|
+
switch (s[4]) {
|
|
35
32
|
case "00":
|
|
36
|
-
|
|
33
|
+
e.name = "Cell closed.", e.description = "The selected cell is closed.", e.request = "dispense", e.no_code = 1102, this.__internal__.dispense.status = !1, this.dispatch("dispensed", {}), this.#s && this.#e >= 89 ? (e.finished_test = !0, this.#s = !1, this.#e = 0) : this.#s && (e.finished_test = !1);
|
|
37
34
|
break;
|
|
38
35
|
case "01":
|
|
39
36
|
// cell open by status
|
|
40
37
|
case "04":
|
|
41
|
-
|
|
38
|
+
e.name = "Cell open.", e.description = "The selected cell was open successfully.", e.request = "dispense", e.no_code = 102, this.__internal__.dispense.status = !0, this.dispatch("dispensed", {}), this.#s && this.#e >= 89 ? (e.finished_test = !0, this.#s = !1, this.#e = 0) : this.#s && (e.finished_test = !1);
|
|
42
39
|
break;
|
|
43
40
|
case "05":
|
|
44
|
-
|
|
41
|
+
e.name = "Cell inactive.", e.description = "The selected cell is inactive or doesn't exist.", e.request = "dispense", e.no_code = 101, this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", {}), this.#s && this.#e >= 89 ? (e.finished_test = !0, this.#s = !1, this.#e = 0) : this.#s && (e.finished_test = !1);
|
|
45
42
|
break;
|
|
46
43
|
}
|
|
47
44
|
break;
|
|
48
45
|
case "06":
|
|
49
|
-
|
|
46
|
+
e.name = "Configuration applied.", e.description = "The configuration was successfully applied.", e.request = "configure cell", e.no_code = 103;
|
|
50
47
|
break;
|
|
51
48
|
default:
|
|
52
|
-
|
|
49
|
+
e.request = "undefined", e.name = "Response unrecognized", e.description = "The response of application was received, but dont identify with any of current parameters", e.no_code = 400;
|
|
53
50
|
break;
|
|
54
51
|
}
|
|
55
|
-
this.dispatch("serial:message",
|
|
52
|
+
this.dispatch("serial:message", e);
|
|
53
|
+
}
|
|
54
|
+
serialSetConnectionConstant(s = 3) {
|
|
55
|
+
return t.connection({ channel: s });
|
|
56
|
+
}
|
|
57
|
+
#i() {
|
|
58
|
+
this.#s = !1, this.#e = 0, this.#t = 0;
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
#n(s = null) {
|
|
61
|
+
this.#t = Math.round(this.#e * 100 / 80), this.dispatch("percentage:open", { percentage: this.#t, dispensed: s });
|
|
59
62
|
}
|
|
60
|
-
|
|
63
|
+
#a() {
|
|
64
|
+
this.#t = Math.round(this.#e * 100 / 80), this.dispatch("percentage:enable", { percentage: this.#t });
|
|
65
|
+
}
|
|
66
|
+
#l() {
|
|
67
|
+
this.#t = Math.round(this.#e * 100 / 80), this.dispatch("percentage:disable", { percentage: this.#t });
|
|
68
|
+
}
|
|
69
|
+
async dispense({ cell: s = 1, status: e = !0 } = {}) {
|
|
61
70
|
return setTimeout(() => {
|
|
62
|
-
|
|
71
|
+
e === !0 ? this.#h() : this.#c();
|
|
63
72
|
}, this.__internal__.time.response_engines / 2), await this.internalDispense(
|
|
64
|
-
|
|
65
|
-
cell:
|
|
73
|
+
t.openCell({
|
|
74
|
+
cell: s,
|
|
66
75
|
channel: this.__internal__.device.listen_on_port
|
|
67
76
|
})
|
|
68
77
|
);
|
|
69
78
|
}
|
|
70
|
-
|
|
79
|
+
#h() {
|
|
80
|
+
this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = !0);
|
|
81
|
+
}
|
|
82
|
+
#c() {
|
|
83
|
+
this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = !1);
|
|
84
|
+
}
|
|
85
|
+
async status({ cell: s = 1 } = {}) {
|
|
71
86
|
return await this.appendToQueue(
|
|
72
|
-
|
|
73
|
-
cell:
|
|
87
|
+
t.statusCell({
|
|
88
|
+
cell: s,
|
|
74
89
|
channel: this.__internal__.device.listen_on_port
|
|
75
90
|
}),
|
|
76
91
|
"status"
|
|
77
92
|
);
|
|
78
93
|
}
|
|
79
|
-
async lightScan({ since:
|
|
94
|
+
async lightScan({ since: s = 0, until: e = 10 } = {}) {
|
|
80
95
|
return await this.appendToQueue(
|
|
81
|
-
|
|
96
|
+
t.lightScan({
|
|
82
97
|
channel: this.__internal__.device.listen_on_port,
|
|
83
|
-
since:
|
|
84
|
-
until:
|
|
98
|
+
since: s,
|
|
99
|
+
until: e
|
|
85
100
|
}),
|
|
86
101
|
"light-scan"
|
|
87
102
|
);
|
|
88
103
|
}
|
|
89
|
-
async enable({ cell:
|
|
104
|
+
async enable({ cell: s = 1 } = {}) {
|
|
90
105
|
return await this.appendToQueue(
|
|
91
|
-
|
|
92
|
-
cell:
|
|
106
|
+
t.enableCell({
|
|
107
|
+
cell: s,
|
|
93
108
|
channel: this.__internal__.device.listen_on_port
|
|
94
109
|
}),
|
|
95
110
|
"activate"
|
|
96
111
|
);
|
|
97
112
|
}
|
|
98
|
-
async disable({ cell:
|
|
113
|
+
async disable({ cell: s = 1 } = {}) {
|
|
99
114
|
await this.appendToQueue(
|
|
100
|
-
|
|
101
|
-
cell:
|
|
115
|
+
t.disableCell({
|
|
116
|
+
cell: s,
|
|
102
117
|
channel: this.__internal__.device.listen_on_port
|
|
103
118
|
}),
|
|
104
119
|
"disable"
|
|
@@ -106,44 +121,27 @@ class Q extends D {
|
|
|
106
121
|
}
|
|
107
122
|
async openAll() {
|
|
108
123
|
if (this.isDispensing) throw new Error("Another dispensing process is running");
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
for (let
|
|
112
|
-
const
|
|
113
|
-
|
|
124
|
+
this.#i(), this.#s = !0, this.#n();
|
|
125
|
+
const s = [];
|
|
126
|
+
for (let e = 1; e <= 80; e++) {
|
|
127
|
+
const i = await this.dispense({ cell: e, status: !0 });
|
|
128
|
+
s.push(i), this.#e = e, this.#n();
|
|
114
129
|
}
|
|
115
|
-
|
|
130
|
+
this.#e = 80, this.#n(s), this.#i();
|
|
116
131
|
}
|
|
117
132
|
async enableAll() {
|
|
118
|
-
|
|
119
|
-
for (let
|
|
120
|
-
await this.enable({ cell:
|
|
121
|
-
|
|
133
|
+
this.#i(), this.#s = !0, this.#a();
|
|
134
|
+
for (let s = 1; s <= 80; s++)
|
|
135
|
+
await this.enable({ cell: s }), await n(100), this.#e = s, this.#a();
|
|
136
|
+
this.#e = 80, this.#a(), this.#i();
|
|
122
137
|
}
|
|
123
138
|
async disableAll() {
|
|
124
|
-
|
|
125
|
-
for (let
|
|
126
|
-
await this.disable({ cell:
|
|
127
|
-
|
|
139
|
+
this.#i(), this.#s = !0, this.#l();
|
|
140
|
+
for (let s = 1; s <= 80; s++)
|
|
141
|
+
await this.disable({ cell: s }), await n(100), this.#e = s, this.#l();
|
|
142
|
+
this.#e = 80, this.#l(), this.#i();
|
|
128
143
|
}
|
|
129
144
|
}
|
|
130
|
-
h = new WeakMap(), a = new WeakMap(), o = new WeakMap(), t = new WeakSet(), C = function() {
|
|
131
|
-
const e = ["percentage:disable", "percentage:enable", "percentage:open"];
|
|
132
|
-
for (const s of e)
|
|
133
|
-
this.serialRegisterAvailableListener(s);
|
|
134
|
-
}, _ = function() {
|
|
135
|
-
i(this, h, !1), i(this, a, 0), i(this, o, 0);
|
|
136
|
-
}, f = function(e = null) {
|
|
137
|
-
i(this, o, Math.round(r(this, a) * 100 / 80)), this.dispatch("percentage:open", { percentage: r(this, o), dispensed: e });
|
|
138
|
-
}, g = function() {
|
|
139
|
-
i(this, o, Math.round(r(this, a) * 100 / 80)), this.dispatch("percentage:enable", { percentage: r(this, o) });
|
|
140
|
-
}, m = function() {
|
|
141
|
-
i(this, o, Math.round(r(this, a) * 100 / 80)), this.dispatch("percentage:disable", { percentage: r(this, o) });
|
|
142
|
-
}, T = function() {
|
|
143
|
-
this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = !0);
|
|
144
|
-
}, k = function() {
|
|
145
|
-
this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = !1);
|
|
146
|
-
};
|
|
147
145
|
export {
|
|
148
|
-
|
|
146
|
+
p as Locker
|
|
149
147
|
};
|