@danidoble/webserial 4.2.16 → 4.3.1

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/kernel.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-BxvweHTG.cjs");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-BTqvt4pt.cjs"),r=require("./webserial-core-DlH0cFSH.cjs");/**
2
2
  * @license Webserial
3
3
  * webserial
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */const r="4.1.9";exports.Devices=e.h;exports.Kernel=e.Kernel;exports.version=r;
9
+ */const n="4.1.9";exports.Kernel=e.Kernel;exports.Devices=r.h;exports.version=n;
package/dist/kernel.js CHANGED
@@ -1,4 +1,5 @@
1
- import { h as s, K as n } from "./kernel-C4PiwwCb.js";
1
+ import { K as s } from "./kernel-lcvN8cY0.js";
2
+ import { h as n } from "./webserial-core-DGKQCs5a.js";
2
3
  /**
3
4
  * @license Webserial
4
5
  * webserial
@@ -10,7 +11,7 @@ import { h as s, K as n } from "./kernel-C4PiwwCb.js";
10
11
  */
11
12
  const e = "4.1.9";
12
13
  export {
13
- s as Devices,
14
- n as Kernel,
14
+ n as Devices,
15
+ s as Kernel,
15
16
  e as version
16
17
  };
package/dist/locker.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var y=l=>{throw TypeError(l)};var m=(l,c,e)=>c.has(l)||y("Cannot "+e);var r=(l,c,e)=>(m(l,c,"read from private field"),e?e.call(l):c.get(l)),u=(l,c,e)=>c.has(l)?y("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(l):c.set(l,e),i=(l,c,e,s)=>(m(l,c,"write to private field"),s?s.call(l,e):c.set(l,e),e),n=(l,c,e)=>(m(l,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./kernel-BxvweHTG.cjs"),d=require("./relay-BsUsBpOv.cjs");var h,a,o,t,v,_,g,b,w,k,C;class q extends f.Kernel{constructor({filters:e=null,config_port:s=null,no_device:p=1,device_listen_on_port:T=3}={}){super({filters:e,config_port:s,no_device:p,device_listen_on_port:T});u(this,t);u(this,h,!1);u(this,a,0);u(this,o,0);if(this.__internal__.device.type="locker",f.h.getCustom(this.typeDevice,p))throw new Error(`Device ${this.typeDevice} ${p} already exists`);this.__internal__.time.response_engines=1e3,this.__internal__.device.milliseconds=666,this.__internal__.dispense.limit_counter=1,f.h.add(this),n(this,t,v).call(this)}serialMessage(e){const s={code:e,name:null,description:null,request:null,no_code:0};switch(e[1]){case"08":s.name="Connection with the serial device completed.",s.description="Your connection with the serial device was successfully completed.",s.request="connect",s.no_code=100;break;case"07":switch(e[4]){case"00":s.name="Cell closed.",s.description="The selected cell is closed.",s.request="dispense",s.no_code=1102,this.__internal__.dispense.status=!1,this.dispatch("dispensed",{}),r(this,h)&&r(this,a)>=89?(s.finished_test=!0,i(this,h,!1),i(this,a,0)):r(this,h)&&(s.finished_test=!1);break;case"01":case"04":s.name="Cell open.",s.description="The selected cell was open successfully.",s.request="dispense",s.no_code=102,this.__internal__.dispense.status=!0,this.dispatch("dispensed",{}),r(this,h)&&r(this,a)>=89?(s.finished_test=!0,i(this,h,!1),i(this,a,0)):r(this,h)&&(s.finished_test=!1);break;case"05":s.name="Cell inactive.",s.description="The selected cell is inactive or doesn't exist.",s.request="dispense",s.no_code=101,this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{}),r(this,h)&&r(this,a)>=89?(s.finished_test=!0,i(this,h,!1),i(this,a,0)):r(this,h)&&(s.finished_test=!1);break}break;case"06":s.name="Configuration applied.",s.description="The configuration was successfully applied.",s.request="configure cell",s.no_code=103;break;default:s.request="undefined",s.name="Response unrecognized",s.description="The response of application was received, but dont identify with any of current parameters",s.no_code=400;break}this.dispatch("serial:message",s)}serialSetConnectionConstant(e=3){return d.u.connection({channel:e})}async dispense({cell:e=1,status:s=!0}={}){return setTimeout(()=>{s===!0?n(this,t,k).call(this):n(this,t,C).call(this)},this.__internal__.time.response_engines/2),await this.internalDispense(d.u.openCell({cell:e,channel:this.__internal__.device.listen_on_port}))}async status({cell:e=1}={}){return await this.appendToQueue(d.u.statusCell({cell:e,channel:this.__internal__.device.listen_on_port}),"status")}async lightScan({since:e=0,until:s=10}={}){return await this.appendToQueue(d.u.lightScan({channel:this.__internal__.device.listen_on_port,since:e,until:s}),"light-scan")}async enable({cell:e=1}={}){return await this.appendToQueue(d.u.enableCell({cell:e,channel:this.__internal__.device.listen_on_port}),"activate")}async disable({cell:e=1}={}){await this.appendToQueue(d.u.disableCell({cell:e,channel:this.__internal__.device.listen_on_port}),"disable")}async openAll(){if(this.isDispensing)throw new Error("Another dispensing process is running");n(this,t,_).call(this),i(this,h,!0),n(this,t,g).call(this);const e=[];for(let s=1;s<=80;s++){const p=await this.dispense({cell:s,status:!0});e.push(p),i(this,a,s),n(this,t,g).call(this)}i(this,a,80),n(this,t,g).call(this,e),n(this,t,_).call(this)}async enableAll(){n(this,t,_).call(this),i(this,h,!0),n(this,t,b).call(this);for(let e=1;e<=80;e++)await this.enable({cell:e}),await f.wait(100),i(this,a,e),n(this,t,b).call(this);i(this,a,80),n(this,t,b).call(this),n(this,t,_).call(this)}async disableAll(){n(this,t,_).call(this),i(this,h,!0),n(this,t,w).call(this);for(let e=1;e<=80;e++)await this.disable({cell:e}),await f.wait(100),i(this,a,e),n(this,t,w).call(this);i(this,a,80),n(this,t,w).call(this),n(this,t,_).call(this)}}h=new WeakMap,a=new WeakMap,o=new WeakMap,t=new WeakSet,v=function(){const e=["percentage:disable","percentage:enable","percentage:open"];for(const s of e)this.serialRegisterAvailableListener(s)},_=function(){i(this,h,!1),i(this,a,0),i(this,o,0)},g=function(e=null){i(this,o,Math.round(r(this,a)*100/80)),this.dispatch("percentage:open",{percentage:r(this,o),dispensed:e})},b=function(){i(this,o,Math.round(r(this,a)*100/80)),this.dispatch("percentage:enable",{percentage:r(this,o)})},w=function(){i(this,o,Math.round(r(this,a)*100/80)),this.dispatch("percentage:disable",{percentage:r(this,o)})},k=function(){this.__internal__.dispense.dispensing&&(this.__internal__.dispense.status=!0)},C=function(){this.__internal__.dispense.dispensing&&(this.__internal__.dispense.status=!1)};exports.Locker=q;
1
+ "use strict";var y=l=>{throw TypeError(l)};var w=(l,c,e)=>c.has(l)||y("Cannot "+e);var r=(l,c,e)=>(w(l,c,"read from private field"),e?e.call(l):c.get(l)),u=(l,c,e)=>c.has(l)?y("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(l):c.set(l,e),i=(l,c,e,s)=>(w(l,c,"write to private field"),s?s.call(l,e):c.set(l,e),e),n=(l,c,e)=>(w(l,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./kernel-BTqvt4pt.cjs"),d=require("./relay-BsUsBpOv.cjs"),v=require("./webserial-core-DlH0cFSH.cjs");var h,a,o,t,C,_,f,g,b,k,T;class A extends m.Kernel{constructor({filters:e=null,config_port:s=null,no_device:p=1,device_listen_on_port:q=3}={}){super({filters:e,config_port:s,no_device:p,device_listen_on_port:q});u(this,t);u(this,h,!1);u(this,a,0);u(this,o,0);if(this.__internal__.device.type="locker",v.h.getCustom(this.typeDevice,p))throw new Error(`Device ${this.typeDevice} ${p} already exists`);this.__internal__.time.response_engines=1e3,this.__internal__.device.milliseconds=666,this.__internal__.dispense.limit_counter=1,v.h.add(this),n(this,t,C).call(this)}serialMessage(e){const s={code:e,name:null,description:null,request:null,no_code:0};switch(e[1]){case"08":s.name="Connection with the serial device completed.",s.description="Your connection with the serial device was successfully completed.",s.request="connect",s.no_code=100;break;case"07":switch(e[4]){case"00":s.name="Cell closed.",s.description="The selected cell is closed.",s.request="dispense",s.no_code=1102,this.__internal__.dispense.status=!1,this.dispatch("dispensed",{}),r(this,h)&&r(this,a)>=89?(s.finished_test=!0,i(this,h,!1),i(this,a,0)):r(this,h)&&(s.finished_test=!1);break;case"01":case"04":s.name="Cell open.",s.description="The selected cell was open successfully.",s.request="dispense",s.no_code=102,this.__internal__.dispense.status=!0,this.dispatch("dispensed",{}),r(this,h)&&r(this,a)>=89?(s.finished_test=!0,i(this,h,!1),i(this,a,0)):r(this,h)&&(s.finished_test=!1);break;case"05":s.name="Cell inactive.",s.description="The selected cell is inactive or doesn't exist.",s.request="dispense",s.no_code=101,this.__internal__.dispense.status=!1,this.dispatch("not-dispensed",{}),r(this,h)&&r(this,a)>=89?(s.finished_test=!0,i(this,h,!1),i(this,a,0)):r(this,h)&&(s.finished_test=!1);break}break;case"06":s.name="Configuration applied.",s.description="The configuration was successfully applied.",s.request="configure cell",s.no_code=103;break;default:s.request="undefined",s.name="Response unrecognized",s.description="The response of application was received, but dont identify with any of current parameters",s.no_code=400;break}this.dispatch("serial:message",s)}serialSetConnectionConstant(e=3){return d.u.connection({channel:e})}async dispense({cell:e=1,status:s=!0}={}){return setTimeout(()=>{s===!0?n(this,t,k).call(this):n(this,t,T).call(this)},this.__internal__.time.response_engines/2),await this.internalDispense(d.u.openCell({cell:e,channel:this.__internal__.device.listen_on_port}))}async status({cell:e=1}={}){return await this.appendToQueue(d.u.statusCell({cell:e,channel:this.__internal__.device.listen_on_port}),"status")}async lightScan({since:e=0,until:s=10}={}){return await this.appendToQueue(d.u.lightScan({channel:this.__internal__.device.listen_on_port,since:e,until:s}),"light-scan")}async enable({cell:e=1}={}){return await this.appendToQueue(d.u.enableCell({cell:e,channel:this.__internal__.device.listen_on_port}),"activate")}async disable({cell:e=1}={}){await this.appendToQueue(d.u.disableCell({cell:e,channel:this.__internal__.device.listen_on_port}),"disable")}async openAll(){if(this.isDispensing)throw new Error("Another dispensing process is running");n(this,t,_).call(this),i(this,h,!0),n(this,t,f).call(this);const e=[];for(let s=1;s<=80;s++){const p=await this.dispense({cell:s,status:!0});e.push(p),i(this,a,s),n(this,t,f).call(this)}i(this,a,80),n(this,t,f).call(this,e),n(this,t,_).call(this)}async enableAll(){n(this,t,_).call(this),i(this,h,!0),n(this,t,g).call(this);for(let e=1;e<=80;e++)await this.enable({cell:e}),await m.wait(100),i(this,a,e),n(this,t,g).call(this);i(this,a,80),n(this,t,g).call(this),n(this,t,_).call(this)}async disableAll(){n(this,t,_).call(this),i(this,h,!0),n(this,t,b).call(this);for(let e=1;e<=80;e++)await this.disable({cell:e}),await m.wait(100),i(this,a,e),n(this,t,b).call(this);i(this,a,80),n(this,t,b).call(this),n(this,t,_).call(this)}}h=new WeakMap,a=new WeakMap,o=new WeakMap,t=new WeakSet,C=function(){const e=["percentage:disable","percentage:enable","percentage:open"];for(const s of e)this.serialRegisterAvailableListener(s)},_=function(){i(this,h,!1),i(this,a,0),i(this,o,0)},f=function(e=null){i(this,o,Math.round(r(this,a)*100/80)),this.dispatch("percentage:open",{percentage:r(this,o),dispensed:e})},g=function(){i(this,o,Math.round(r(this,a)*100/80)),this.dispatch("percentage:enable",{percentage:r(this,o)})},b=function(){i(this,o,Math.round(r(this,a)*100/80)),this.dispatch("percentage:disable",{percentage:r(this,o)})},k=function(){this.__internal__.dispense.dispensing&&(this.__internal__.dispense.status=!0)},T=function(){this.__internal__.dispense.dispensing&&(this.__internal__.dispense.status=!1)};exports.Locker=A;
package/dist/locker.js CHANGED
@@ -1,21 +1,22 @@
1
1
  var w = (l) => {
2
2
  throw TypeError(l);
3
3
  };
4
- var m = (l, c, e) => c.has(l) || w("Cannot " + e);
5
- var r = (l, c, e) => (m(l, c, "read from private field"), e ? e.call(l) : c.get(l)), u = (l, c, e) => c.has(l) ? w("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(l) : c.set(l, e), i = (l, c, e, s) => (m(l, c, "write to private field"), s ? s.call(l, e) : c.set(l, e), e), n = (l, c, e) => (m(l, c, "access private method"), e);
6
- import { K as D, h as v, w as y } from "./kernel-C4PiwwCb.js";
4
+ var b = (l, c, e) => c.has(l) || w("Cannot " + e);
5
+ var r = (l, c, e) => (b(l, c, "read from private field"), e ? e.call(l) : c.get(l)), u = (l, c, e) => c.has(l) ? w("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(l) : c.set(l, e), i = (l, c, e, s) => (b(l, c, "write to private field"), s ? s.call(l, e) : c.set(l, e), e), n = (l, c, e) => (b(l, c, "access private method"), e);
6
+ import { K as D, w as v } from "./kernel-lcvN8cY0.js";
7
7
  import { u as p } from "./relay-Dop4mFk-.js";
8
- var h, a, o, t, C, _, f, g, b, T, k;
9
- class L extends D {
8
+ import { h as y } from "./webserial-core-DGKQCs5a.js";
9
+ var h, a, o, t, C, _, f, g, m, T, k;
10
+ class Q extends D {
10
11
  constructor({ filters: e = null, config_port: s = null, no_device: d = 1, device_listen_on_port: A = 3 } = {}) {
11
12
  super({ filters: e, config_port: s, no_device: d, device_listen_on_port: A });
12
13
  u(this, t);
13
14
  u(this, h, !1);
14
15
  u(this, a, 0);
15
16
  u(this, o, 0);
16
- if (this.__internal__.device.type = "locker", v.getCustom(this.typeDevice, d))
17
+ if (this.__internal__.device.type = "locker", y.getCustom(this.typeDevice, d))
17
18
  throw new Error(`Device ${this.typeDevice} ${d} already exists`);
18
- this.__internal__.time.response_engines = 1e3, this.__internal__.device.milliseconds = 666, this.__internal__.dispense.limit_counter = 1, v.add(this), n(this, t, C).call(this);
19
+ this.__internal__.time.response_engines = 1e3, this.__internal__.device.milliseconds = 666, this.__internal__.dispense.limit_counter = 1, y.add(this), n(this, t, C).call(this);
19
20
  }
20
21
  serialMessage(e) {
21
22
  const s = {
@@ -116,14 +117,14 @@ class L extends D {
116
117
  async enableAll() {
117
118
  n(this, t, _).call(this), i(this, h, !0), n(this, t, g).call(this);
118
119
  for (let e = 1; e <= 80; e++)
119
- await this.enable({ cell: e }), await y(100), i(this, a, e), n(this, t, g).call(this);
120
+ await this.enable({ cell: e }), await v(100), i(this, a, e), n(this, t, g).call(this);
120
121
  i(this, a, 80), n(this, t, g).call(this), n(this, t, _).call(this);
121
122
  }
122
123
  async disableAll() {
123
- n(this, t, _).call(this), i(this, h, !0), n(this, t, b).call(this);
124
+ n(this, t, _).call(this), i(this, h, !0), n(this, t, m).call(this);
124
125
  for (let e = 1; e <= 80; e++)
125
- await this.disable({ cell: e }), await y(100), i(this, a, e), n(this, t, b).call(this);
126
- i(this, a, 80), n(this, t, b).call(this), n(this, t, _).call(this);
126
+ await this.disable({ cell: e }), await v(100), i(this, a, e), n(this, t, m).call(this);
127
+ i(this, a, 80), n(this, t, m).call(this), n(this, t, _).call(this);
127
128
  }
128
129
  }
129
130
  h = new WeakMap(), a = new WeakMap(), o = new WeakMap(), t = new WeakSet(), C = function() {
@@ -136,7 +137,7 @@ h = new WeakMap(), a = new WeakMap(), o = new WeakMap(), t = new WeakSet(), C =
136
137
  i(this, o, Math.round(r(this, a) * 100 / 80)), this.dispatch("percentage:open", { percentage: r(this, o), dispensed: e });
137
138
  }, g = function() {
138
139
  i(this, o, Math.round(r(this, a) * 100 / 80)), this.dispatch("percentage:enable", { percentage: r(this, o) });
139
- }, b = function() {
140
+ }, m = function() {
140
141
  i(this, o, Math.round(r(this, a) * 100 / 80)), this.dispatch("percentage:disable", { percentage: r(this, o) });
141
142
  }, T = function() {
142
143
  this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = !0);
@@ -144,5 +145,5 @@ h = new WeakMap(), a = new WeakMap(), o = new WeakMap(), t = new WeakSet(), C =
144
145
  this.__internal__.dispense.dispensing && (this.__internal__.dispense.status = !1);
145
146
  };
146
147
  export {
147
- L as Locker
148
+ Q as Locker
148
149
  };