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.
@@ -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,7 +13517,15 @@ class NobleConnectionManager extends BluetoothConnectionManager {
13515
13517
  if (!canConnect) {
13516
13518
  return false;
13517
13519
  }
13518
- await this.#noblePeripheral.connectAsync();
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
+ }
13519
13529
  return true;
13520
13530
  }
13521
13531
  async disconnect() {
@@ -13523,7 +13533,9 @@ class NobleConnectionManager extends BluetoothConnectionManager {
13523
13533
  if (!canContinue) {
13524
13534
  return false;
13525
13535
  }
13536
+ _console$6.log("noblePeripheral.disconnectAsync");
13526
13537
  await this.#noblePeripheral.disconnectAsync();
13538
+ _console$6.log("noblePeripheral.disconnectAsync done");
13527
13539
  return true;
13528
13540
  }
13529
13541
  async writeCharacteristic(characteristicName, data) {
@@ -13746,9 +13758,11 @@ const _console$5 = createConsole("NobleScanner", { log: false });
13746
13758
  let isSupported = false;
13747
13759
  let filterManually = true;
13748
13760
  const filterServiceUuid = serviceUUIDs[0].replaceAll("-", "");
13761
+ let isLinux = false;
13749
13762
  isSupported = true;
13750
13763
  const platform = os.platform();
13751
- filterManually = platform == "linux";
13764
+ isLinux = platform == "linux";
13765
+ filterManually = isLinux;
13752
13766
  _console$5.log({ platform, filterManually, filterServiceUuid });
13753
13767
  class NobleScanner extends BaseScanner {
13754
13768
  static get isSupported() {
@@ -13804,7 +13818,8 @@ class NobleScanner extends BaseScanner {
13804
13818
  _console$5.log("onNobleStateChange", state);
13805
13819
  this.#nobleState = state;
13806
13820
  }
13807
- #onNobleDiscover(noblePeripheral) {
13821
+ #isBusy = false;
13822
+ async #onNobleDiscover(noblePeripheral) {
13808
13823
  _console$5.log("advertisement", noblePeripheral.advertisement);
13809
13824
  if (filterManually) {
13810
13825
  const serviceUuid = noblePeripheral.advertisement.serviceUuids?.[0];
@@ -13818,6 +13833,20 @@ class NobleScanner extends BaseScanner {
13818
13833
  noblePeripheral.scanner = this;
13819
13834
  this.#noblePeripherals[noblePeripheral.id] = noblePeripheral;
13820
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
+ }
13821
13850
  _console$5.log("advertisement", noblePeripheral.advertisement);
13822
13851
  let deviceType;
13823
13852
  let ipAddress;
@@ -13875,6 +13904,7 @@ class NobleScanner extends BaseScanner {
13875
13904
  if (!super.startScan()) {
13876
13905
  return false;
13877
13906
  }
13907
+ _console$5.log("noble.startScan");
13878
13908
  noble.startScanningAsync(filterManually ? [] : serviceUUIDs, true);
13879
13909
  return true;
13880
13910
  }
@@ -13882,6 +13912,7 @@ class NobleScanner extends BaseScanner {
13882
13912
  if (!super.stopScan()) {
13883
13913
  return false;
13884
13914
  }
13915
+ _console$5.log("noble.stopScan");
13885
13916
  noble.stopScanningAsync();
13886
13917
  return true;
13887
13918
  }