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.
@@ -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,9 +13495,15 @@ class NobleConnectionManager extends BluetoothConnectionManager {
13493
13495
  if (!canConnect) {
13494
13496
  return false;
13495
13497
  }
13496
- console.log("FUCK");
13497
- await this.#noblePeripheral.connectAsync();
13498
- console.log("YEA");
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
+ }
13499
13507
  return true;
13500
13508
  }
13501
13509
  async disconnect() {
@@ -13503,7 +13511,9 @@ class NobleConnectionManager extends BluetoothConnectionManager {
13503
13511
  if (!canContinue) {
13504
13512
  return false;
13505
13513
  }
13514
+ _console$6.log("noblePeripheral.disconnectAsync");
13506
13515
  await this.#noblePeripheral.disconnectAsync();
13516
+ _console$6.log("noblePeripheral.disconnectAsync done");
13507
13517
  return true;
13508
13518
  }
13509
13519
  async writeCharacteristic(characteristicName, data) {
@@ -13726,9 +13736,11 @@ const _console$5 = createConsole("NobleScanner", { log: false });
13726
13736
  let isSupported = false;
13727
13737
  let filterManually = true;
13728
13738
  const filterServiceUuid = serviceUUIDs[0].replaceAll("-", "");
13739
+ let isLinux = false;
13729
13740
  isSupported = true;
13730
13741
  const platform = os.platform();
13731
- filterManually = platform == "linux";
13742
+ isLinux = platform == "linux";
13743
+ filterManually = isLinux;
13732
13744
  _console$5.log({ platform, filterManually, filterServiceUuid });
13733
13745
  class NobleScanner extends BaseScanner {
13734
13746
  static get isSupported() {
@@ -13784,7 +13796,8 @@ class NobleScanner extends BaseScanner {
13784
13796
  _console$5.log("onNobleStateChange", state);
13785
13797
  this.#nobleState = state;
13786
13798
  }
13787
- #onNobleDiscover(noblePeripheral) {
13799
+ #isBusy = false;
13800
+ async #onNobleDiscover(noblePeripheral) {
13788
13801
  _console$5.log("advertisement", noblePeripheral.advertisement);
13789
13802
  if (filterManually) {
13790
13803
  const serviceUuid = noblePeripheral.advertisement.serviceUuids?.[0];
@@ -13798,6 +13811,20 @@ class NobleScanner extends BaseScanner {
13798
13811
  noblePeripheral.scanner = this;
13799
13812
  this.#noblePeripherals[noblePeripheral.id] = noblePeripheral;
13800
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
+ }
13801
13828
  _console$5.log("advertisement", noblePeripheral.advertisement);
13802
13829
  let deviceType;
13803
13830
  let ipAddress;
@@ -13855,6 +13882,7 @@ class NobleScanner extends BaseScanner {
13855
13882
  if (!super.startScan()) {
13856
13883
  return false;
13857
13884
  }
13885
+ _console$5.log("noble.startScan");
13858
13886
  noble.startScanningAsync(filterManually ? [] : serviceUUIDs, true);
13859
13887
  return true;
13860
13888
  }
@@ -13862,6 +13890,7 @@ class NobleScanner extends BaseScanner {
13862
13890
  if (!super.stopScan()) {
13863
13891
  return false;
13864
13892
  }
13893
+ _console$5.log("noble.stopScan");
13865
13894
  noble.stopScanningAsync();
13866
13895
  return true;
13867
13896
  }