brilliantsole 0.0.46 → 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 -7
- package/build/brilliantsole.cjs.map +1 -1
- package/build/brilliantsole.node.module.js +36 -7
- 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 -3
- 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
package/build/brilliantsole.cjs
CHANGED
|
@@ -13400,6 +13400,7 @@ class BaseScanner {
|
|
|
13400
13400
|
_console$7.log("already scanning");
|
|
13401
13401
|
return false;
|
|
13402
13402
|
}
|
|
13403
|
+
_console$7.log("startScan");
|
|
13403
13404
|
return true;
|
|
13404
13405
|
}
|
|
13405
13406
|
stopScan() {
|
|
@@ -13407,6 +13408,7 @@ class BaseScanner {
|
|
|
13407
13408
|
_console$7.log("already not scanning");
|
|
13408
13409
|
return false;
|
|
13409
13410
|
}
|
|
13411
|
+
_console$7.log("stopScan");
|
|
13410
13412
|
return true;
|
|
13411
13413
|
}
|
|
13412
13414
|
#onIsScanning(event) {
|
|
@@ -13491,8 +13493,8 @@ _a$1 = BaseScanner;
|
|
|
13491
13493
|
|
|
13492
13494
|
const _console$6 = createConsole("NobleConnectionManager", { log: false });
|
|
13493
13495
|
let filterUUIDs = true;
|
|
13494
|
-
const isLinux = os.platform() == "linux";
|
|
13495
|
-
filterUUIDs = !isLinux;
|
|
13496
|
+
const isLinux$1 = os.platform() == "linux";
|
|
13497
|
+
filterUUIDs = !isLinux$1;
|
|
13496
13498
|
class NobleConnectionManager extends BluetoothConnectionManager {
|
|
13497
13499
|
get bluetoothId() {
|
|
13498
13500
|
return this.#noblePeripheral.id;
|
|
@@ -13515,9 +13517,15 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
13515
13517
|
if (!canConnect) {
|
|
13516
13518
|
return false;
|
|
13517
13519
|
}
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13520
|
+
if (isLinux$1) {
|
|
13521
|
+
_console$6.log("setting noblePeripheral.shouldConnect");
|
|
13522
|
+
this.#noblePeripheral.shouldConnect = true;
|
|
13523
|
+
}
|
|
13524
|
+
else {
|
|
13525
|
+
_console$6.log("noblePeripheral.connectAsync");
|
|
13526
|
+
await this.#noblePeripheral.connectAsync();
|
|
13527
|
+
_console$6.log("noblePeripheral.connectAsync done");
|
|
13528
|
+
}
|
|
13521
13529
|
return true;
|
|
13522
13530
|
}
|
|
13523
13531
|
async disconnect() {
|
|
@@ -13525,7 +13533,9 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
13525
13533
|
if (!canContinue) {
|
|
13526
13534
|
return false;
|
|
13527
13535
|
}
|
|
13536
|
+
_console$6.log("noblePeripheral.disconnectAsync");
|
|
13528
13537
|
await this.#noblePeripheral.disconnectAsync();
|
|
13538
|
+
_console$6.log("noblePeripheral.disconnectAsync done");
|
|
13529
13539
|
return true;
|
|
13530
13540
|
}
|
|
13531
13541
|
async writeCharacteristic(characteristicName, data) {
|
|
@@ -13748,9 +13758,11 @@ const _console$5 = createConsole("NobleScanner", { log: false });
|
|
|
13748
13758
|
let isSupported = false;
|
|
13749
13759
|
let filterManually = true;
|
|
13750
13760
|
const filterServiceUuid = serviceUUIDs[0].replaceAll("-", "");
|
|
13761
|
+
let isLinux = false;
|
|
13751
13762
|
isSupported = true;
|
|
13752
13763
|
const platform = os.platform();
|
|
13753
|
-
|
|
13764
|
+
isLinux = platform == "linux";
|
|
13765
|
+
filterManually = isLinux;
|
|
13754
13766
|
_console$5.log({ platform, filterManually, filterServiceUuid });
|
|
13755
13767
|
class NobleScanner extends BaseScanner {
|
|
13756
13768
|
static get isSupported() {
|
|
@@ -13806,7 +13818,8 @@ class NobleScanner extends BaseScanner {
|
|
|
13806
13818
|
_console$5.log("onNobleStateChange", state);
|
|
13807
13819
|
this.#nobleState = state;
|
|
13808
13820
|
}
|
|
13809
|
-
#
|
|
13821
|
+
#isBusy = false;
|
|
13822
|
+
async #onNobleDiscover(noblePeripheral) {
|
|
13810
13823
|
_console$5.log("advertisement", noblePeripheral.advertisement);
|
|
13811
13824
|
if (filterManually) {
|
|
13812
13825
|
const serviceUuid = noblePeripheral.advertisement.serviceUuids?.[0];
|
|
@@ -13820,6 +13833,20 @@ class NobleScanner extends BaseScanner {
|
|
|
13820
13833
|
noblePeripheral.scanner = this;
|
|
13821
13834
|
this.#noblePeripherals[noblePeripheral.id] = noblePeripheral;
|
|
13822
13835
|
}
|
|
13836
|
+
else {
|
|
13837
|
+
const _noblePeripheral = this.#noblePeripherals[noblePeripheral.id];
|
|
13838
|
+
if (isLinux &&
|
|
13839
|
+
_noblePeripheral.shouldConnect &&
|
|
13840
|
+
!this.#isBusy &&
|
|
13841
|
+
_noblePeripheral.state == "disconnected") {
|
|
13842
|
+
this.#isBusy = true;
|
|
13843
|
+
_noblePeripheral.shouldConnect = false;
|
|
13844
|
+
_console$5.log("noblePeripheral.connectAsync");
|
|
13845
|
+
await _noblePeripheral.connectAsync();
|
|
13846
|
+
_console$5.log("noblePeripheral.connectAsync done");
|
|
13847
|
+
this.#isBusy = false;
|
|
13848
|
+
}
|
|
13849
|
+
}
|
|
13823
13850
|
_console$5.log("advertisement", noblePeripheral.advertisement);
|
|
13824
13851
|
let deviceType;
|
|
13825
13852
|
let ipAddress;
|
|
@@ -13877,6 +13904,7 @@ class NobleScanner extends BaseScanner {
|
|
|
13877
13904
|
if (!super.startScan()) {
|
|
13878
13905
|
return false;
|
|
13879
13906
|
}
|
|
13907
|
+
_console$5.log("noble.startScan");
|
|
13880
13908
|
noble.startScanningAsync(filterManually ? [] : serviceUUIDs, true);
|
|
13881
13909
|
return true;
|
|
13882
13910
|
}
|
|
@@ -13884,6 +13912,7 @@ class NobleScanner extends BaseScanner {
|
|
|
13884
13912
|
if (!super.stopScan()) {
|
|
13885
13913
|
return false;
|
|
13886
13914
|
}
|
|
13915
|
+
_console$5.log("noble.stopScan");
|
|
13887
13916
|
noble.stopScanningAsync();
|
|
13888
13917
|
return true;
|
|
13889
13918
|
}
|