How to use the @abandonware/noble.startScanning function in @abandonware/noble

To help you get started, we’ve selected a few @abandonware/noble examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thegecko / webbluetooth / src / adapter.ts View on Github external
function stateCB() {
                if (this.state === true) {
                    // Noble doesn't correctly match short and canonical UUIDs on Linux, so we need to check ourselves
                    // Continually scan to pick up all advertised UUIDs
                    noble.startScanning([], true, this.checkForError(errorFn, completeFn));
                } else {
                    errorFn("adapter not enabled");
                }
            }
github icanos / hassio-plejd / plejd / plejd.js View on Github external
async scan() {
    const self = this;
    this.isScanning = true;
    noble.startScanning([PLEJD_SERVICE]);

    setTimeout(() => {
      noble.stopScanning();
      this.isScanning = false;

      self.peripherals.sort((a, b) => a.rssi > b.rssi);
      this.emit('scanComplete', self.peripherals);

    }, 5000);
  }
github urish / real-trex-runner / firmware / src / button.js View on Github external
function scanButton() {
  console.log('Scanning...');
  noble.startScanning([buttonService], true);
}
github mKeRix / room-assistant / services / ble.service.js View on Github external
handleStateChange(state) {
            if (state === 'poweredOn') {
                noble.startScanning([], true);
            } else {
                noble.stopScanning();
            }
        },
github CANDY-LINE / node-red-contrib-generic-ble / src / generic-ble.js View on Github external
function startBLEScanning(RED) {
  RED.log.info(`[GenericBLE] Start BLE scanning`);
  if (!onDiscover) {
    onDiscover = onDiscoverFunc(RED);
  }
  noble.removeListener('stateChange', onStateChange);
  noble.removeListener('discover', onDiscover);
  noble.addListener('stateChange', onStateChange);
  noble.addListener('discover', onDiscover);
  if (noble.state === 'poweredOn') {
    noble.startScanning([], true);
  }
}
github mKeRix / room-assistant / services / bluetooth.service.js View on Github external
handleScanStateChange(state) {
            if (this.shouldScanLE && state === 'poweredOn') {
                if (!this.isScanning) {
                    noble.startScanning([], true);
                    this.isScanning = true;
                }
            } else {
                if (this.isScanning) {
                    noble.stopScanning();
                    this.isScanning = false;
                }
            }
        },
github LedgerHQ / ledgerjs / packages / hw-transport-node-ble / src / platform.js View on Github external
const { uuid: id } = peripheral;
      const { localName } = peripheral.advertisement;
      const name =
        localName ||
        (discoveredDevices[id] ? discoveredDevices[id].name : null);
      discoveredDevices[id] = { peripheral, name };
      log("ble-advertisement", id + " (" + String(name) + ")");
      observer.next({
        type: "add",
        descriptor: peripheral,
        device: { id, name }
      });
    };

    noble.addListener("discover", onDiscover);
    noble.startScanning(getBluetoothServiceUuids(), true);

    return () => {
      noble.removeListener("discover", onDiscover);
      noble.stopScanning();
    };
  });