brilliantsole 0.0.48 → 0.0.49
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/build/brilliantsole.cjs +36 -5
- package/build/brilliantsole.cjs.map +1 -1
- package/build/brilliantsole.node.module.js +36 -5
- package/build/brilliantsole.node.module.js.map +1 -1
- package/build/dts/connection/bluetooth/NobleConnectionManager.d.ts +1 -0
- package/examples/basic/script.js +3 -3
- package/package.json +1 -1
- package/src/connection/bluetooth/NobleConnectionManager.ts +11 -1
- package/src/scanner/BaseScanner.ts +2 -0
- package/src/scanner/NobleScanner.ts +23 -2
- package/build/dts/BS-output.d.ts +0 -10
- package/build/dts/connection/WebSocketClientConnectionManager.d.ts +0 -23
- package/build/dts/connection/bluetooth/BluetoothUUID.d.ts +0 -12
- package/build/dts/connection/webSocket/ClientConnectionManager.d.ts +0 -23
- package/build/dts/connection/webSocket/WebSocketClientConnectionManager.d.ts +0 -23
- package/build/dts/utils/BitmapUtils.d.ts +0 -17
- package/build/dts/utils/SpriteSheetUtils.d.ts +0 -20
- package/build/dts/utils/SvgUtils copy 2.d.ts +0 -8
- package/build/dts/utils/SvgUtils copy.d.ts +0 -9
- /package/build/dts/connection/{webSocket → websocket}/WebSocketConnectionManager.d.ts +0 -0
|
@@ -13378,6 +13378,7 @@ class BaseScanner {
|
|
|
13378
13378
|
_console$7.log("already scanning");
|
|
13379
13379
|
return false;
|
|
13380
13380
|
}
|
|
13381
|
+
_console$7.log("startScan");
|
|
13381
13382
|
return true;
|
|
13382
13383
|
}
|
|
13383
13384
|
stopScan() {
|
|
@@ -13385,6 +13386,7 @@ class BaseScanner {
|
|
|
13385
13386
|
_console$7.log("already not scanning");
|
|
13386
13387
|
return false;
|
|
13387
13388
|
}
|
|
13389
|
+
_console$7.log("stopScan");
|
|
13388
13390
|
return true;
|
|
13389
13391
|
}
|
|
13390
13392
|
#onIsScanning(event) {
|
|
@@ -13469,8 +13471,8 @@ _a$1 = BaseScanner;
|
|
|
13469
13471
|
|
|
13470
13472
|
const _console$6 = createConsole("NobleConnectionManager", { log: false });
|
|
13471
13473
|
let filterUUIDs = true;
|
|
13472
|
-
const isLinux = os.platform() == "linux";
|
|
13473
|
-
filterUUIDs = !isLinux;
|
|
13474
|
+
const isLinux$1 = os.platform() == "linux";
|
|
13475
|
+
filterUUIDs = !isLinux$1;
|
|
13474
13476
|
class NobleConnectionManager extends BluetoothConnectionManager {
|
|
13475
13477
|
get bluetoothId() {
|
|
13476
13478
|
return this.#noblePeripheral.id;
|
|
@@ -13493,7 +13495,15 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
13493
13495
|
if (!canConnect) {
|
|
13494
13496
|
return false;
|
|
13495
13497
|
}
|
|
13496
|
-
|
|
13498
|
+
if (isLinux$1) {
|
|
13499
|
+
_console$6.log("setting noblePeripheral.shouldConnect");
|
|
13500
|
+
this.#noblePeripheral.shouldConnect = true;
|
|
13501
|
+
}
|
|
13502
|
+
else {
|
|
13503
|
+
_console$6.log("noblePeripheral.connectAsync");
|
|
13504
|
+
await this.#noblePeripheral.connectAsync();
|
|
13505
|
+
_console$6.log("noblePeripheral.connectAsync done");
|
|
13506
|
+
}
|
|
13497
13507
|
return true;
|
|
13498
13508
|
}
|
|
13499
13509
|
async disconnect() {
|
|
@@ -13501,7 +13511,9 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
13501
13511
|
if (!canContinue) {
|
|
13502
13512
|
return false;
|
|
13503
13513
|
}
|
|
13514
|
+
_console$6.log("noblePeripheral.disconnectAsync");
|
|
13504
13515
|
await this.#noblePeripheral.disconnectAsync();
|
|
13516
|
+
_console$6.log("noblePeripheral.disconnectAsync done");
|
|
13505
13517
|
return true;
|
|
13506
13518
|
}
|
|
13507
13519
|
async writeCharacteristic(characteristicName, data) {
|
|
@@ -13724,9 +13736,11 @@ const _console$5 = createConsole("NobleScanner", { log: false });
|
|
|
13724
13736
|
let isSupported = false;
|
|
13725
13737
|
let filterManually = true;
|
|
13726
13738
|
const filterServiceUuid = serviceUUIDs[0].replaceAll("-", "");
|
|
13739
|
+
let isLinux = false;
|
|
13727
13740
|
isSupported = true;
|
|
13728
13741
|
const platform = os.platform();
|
|
13729
|
-
|
|
13742
|
+
isLinux = platform == "linux";
|
|
13743
|
+
filterManually = isLinux;
|
|
13730
13744
|
_console$5.log({ platform, filterManually, filterServiceUuid });
|
|
13731
13745
|
class NobleScanner extends BaseScanner {
|
|
13732
13746
|
static get isSupported() {
|
|
@@ -13782,7 +13796,8 @@ class NobleScanner extends BaseScanner {
|
|
|
13782
13796
|
_console$5.log("onNobleStateChange", state);
|
|
13783
13797
|
this.#nobleState = state;
|
|
13784
13798
|
}
|
|
13785
|
-
#
|
|
13799
|
+
#isBusy = false;
|
|
13800
|
+
async #onNobleDiscover(noblePeripheral) {
|
|
13786
13801
|
_console$5.log("advertisement", noblePeripheral.advertisement);
|
|
13787
13802
|
if (filterManually) {
|
|
13788
13803
|
const serviceUuid = noblePeripheral.advertisement.serviceUuids?.[0];
|
|
@@ -13796,6 +13811,20 @@ class NobleScanner extends BaseScanner {
|
|
|
13796
13811
|
noblePeripheral.scanner = this;
|
|
13797
13812
|
this.#noblePeripherals[noblePeripheral.id] = noblePeripheral;
|
|
13798
13813
|
}
|
|
13814
|
+
else {
|
|
13815
|
+
const _noblePeripheral = this.#noblePeripherals[noblePeripheral.id];
|
|
13816
|
+
if (isLinux &&
|
|
13817
|
+
_noblePeripheral.shouldConnect &&
|
|
13818
|
+
!this.#isBusy &&
|
|
13819
|
+
_noblePeripheral.state == "disconnected") {
|
|
13820
|
+
this.#isBusy = true;
|
|
13821
|
+
_noblePeripheral.shouldConnect = false;
|
|
13822
|
+
_console$5.log("noblePeripheral.connectAsync");
|
|
13823
|
+
await _noblePeripheral.connectAsync();
|
|
13824
|
+
_console$5.log("noblePeripheral.connectAsync done");
|
|
13825
|
+
this.#isBusy = false;
|
|
13826
|
+
}
|
|
13827
|
+
}
|
|
13799
13828
|
_console$5.log("advertisement", noblePeripheral.advertisement);
|
|
13800
13829
|
let deviceType;
|
|
13801
13830
|
let ipAddress;
|
|
@@ -13853,6 +13882,7 @@ class NobleScanner extends BaseScanner {
|
|
|
13853
13882
|
if (!super.startScan()) {
|
|
13854
13883
|
return false;
|
|
13855
13884
|
}
|
|
13885
|
+
_console$5.log("noble.startScan");
|
|
13856
13886
|
noble.startScanningAsync(filterManually ? [] : serviceUUIDs, true);
|
|
13857
13887
|
return true;
|
|
13858
13888
|
}
|
|
@@ -13860,6 +13890,7 @@ class NobleScanner extends BaseScanner {
|
|
|
13860
13890
|
if (!super.stopScan()) {
|
|
13861
13891
|
return false;
|
|
13862
13892
|
}
|
|
13893
|
+
_console$5.log("noble.stopScan");
|
|
13863
13894
|
noble.stopScanningAsync();
|
|
13864
13895
|
return true;
|
|
13865
13896
|
}
|