fix: init local device handlers even when connected to Socket Server
This commit is contained in:
@@ -1,20 +1,20 @@
|
|||||||
goog.loadJs('web', () => {
|
goog.loadJs('web', () => {
|
||||||
|
|
||||||
goog.require('path');
|
goog.require('path');
|
||||||
goog.require('Mixly.Config');
|
goog.require('Mixly.Config');
|
||||||
goog.require('Mixly.Env');
|
goog.require('Mixly.Env');
|
||||||
goog.require('Mixly.Msg');
|
goog.require('Mixly.Msg');
|
||||||
goog.require('Mixly.Registry');
|
goog.require('Mixly.Registry');
|
||||||
goog.require('Mixly.Serial');
|
goog.require('Mixly.Serial');
|
||||||
goog.require('Mixly.LayerExt');
|
goog.require('Mixly.LayerExt');
|
||||||
goog.require('Mixly.HTMLTemplate');
|
goog.require('Mixly.HTMLTemplate');
|
||||||
goog.require('Mixly.Web.SerialPort');
|
goog.require('Mixly.Web.SerialPort');
|
||||||
goog.require('Mixly.Web.USB');
|
goog.require('Mixly.Web.USB');
|
||||||
goog.require('Mixly.Web.USBMini');
|
goog.require('Mixly.Web.USBMini');
|
||||||
goog.require('Mixly.Web.HID');
|
goog.require('Mixly.Web.HID');
|
||||||
goog.provide('Mixly.Web.Serial');
|
goog.provide('Mixly.Web.Serial');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Config,
|
Config,
|
||||||
Env,
|
Env,
|
||||||
Msg,
|
Msg,
|
||||||
@@ -23,22 +23,22 @@ const {
|
|||||||
LayerExt,
|
LayerExt,
|
||||||
HTMLTemplate,
|
HTMLTemplate,
|
||||||
Web
|
Web
|
||||||
} = Mixly;
|
} = Mixly;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
SerialPort,
|
SerialPort,
|
||||||
USB,
|
USB,
|
||||||
USBMini,
|
USBMini,
|
||||||
HID
|
HID
|
||||||
} = Web;
|
} = Web;
|
||||||
|
|
||||||
const { BOARD } = Config;
|
const { BOARD } = Config;
|
||||||
|
|
||||||
const platform = goog.platform();
|
const platform = goog.platform();
|
||||||
const fullPlatform = goog.fullPlatform();
|
const fullPlatform = goog.fullPlatform();
|
||||||
|
|
||||||
|
|
||||||
class WebSerial extends Serial {
|
class WebSerial extends Serial {
|
||||||
static {
|
static {
|
||||||
this.devicesRegistry = new Registry();
|
this.devicesRegistry = new Registry();
|
||||||
this.type = Serial.type;
|
this.type = Serial.type;
|
||||||
@@ -147,12 +147,12 @@ class WebSerial extends Serial {
|
|||||||
handler.removePort(device);
|
handler.removePort(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addEventsListener = function () {}
|
this.addEventsListener = function () { }
|
||||||
|
|
||||||
this.init = function () {
|
this.init = function () {
|
||||||
if (Env.hasSocketServer) {
|
// if (Env.hasSocketServer) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (platform === 'win32' && fullPlatform !== 'win10') {
|
if (platform === 'win32' && fullPlatform !== 'win10') {
|
||||||
if (BOARD?.web?.devices?.hid) {
|
if (BOARD?.web?.devices?.hid) {
|
||||||
this.devicesRegistry.register('hid', HID);
|
this.devicesRegistry.register('hid', HID);
|
||||||
@@ -207,9 +207,9 @@ class WebSerial extends Serial {
|
|||||||
}
|
}
|
||||||
return new handler(port);
|
return new handler(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Web.Serial = WebSerial;
|
Web.Serial = WebSerial;
|
||||||
|
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user