function disconnectCurrentPeripheral(){ currentPeripheral.disconnect(); console.log( currentPeripheral.advertisement.localName + ' disconnected'); currentPeripheral = null; noble.startScanning([], true); state = 'scanning'; }
noble.on('stateChange', function (state) { console.log('STATE: ' + state); if (state === 'poweredOn') { noble.startScanning(['a495ff10c5b14b44b5121370f02d74de'], false); } });
noble.on('stateChange', function(state) { console.log('Noble -> stateChange: ' + state); if(state==='poweredOn'){ noble.startScanning([], true); } });
noble.on('stateChange', function(state) { console.log('Noble -> stateChange: ' + state); if (state === 'poweredOn') { noble.startScanning([], true); // start scanning with repeated UUIDs setupSerial(); } });
BlueYeast.prototype._handleStatechanged = function() { if (noble.state == 'poweredOn') { noble.startScanning(); noble.on('discover', this._handleDevicefound.bind(this)); //noble.removeEventListener('stateChange', this._handleStatechanged); } };
function startScanHelper() { if (shuttingDown || scanning) return; scanning = true; if (noble.state === 'poweredOn') noble.startScanning([], true); }
this.ddbstateChange = function( state ){ if (state === 'poweredOn') { noble.startScanning(); } else { noble.stopScanning(); } }
var startScanningOnPowerOn = function() { if (noble.state === 'poweredOn') { noble.startScanning([SERVICE_UUID], allowDuplicates); } else { noble.once('stateChange', startScanningOnPowerOn); } };
Device.prototype.handleDisconnect = function (peripheral) { var device = this; console.log('DISCONNECTING'); device.disconnected = true; console.log('start scanning!'); noble.startScanning([Device.Primary_Service_UUID]); }
BlePeripherals.prototype._handleStateChanges = function(state){ if(state === 'poweredOn'){ noble.startScanning(); }else{ noble.stopScanning(); } };
Proxy.prototype.acquireTarget = function(config) { console.log(('[status] Acquiring target ' + this.target).bold); /* Track BLE advertisement reports. */ if (this.le_adv_handler != null) noble._bindings._gap._hci.removeListener( 'leAdvertisingReport', this.le_adv_handler ) this.le_adv_handler = function(status, type, address, addressType, report, rssi){ this.discoverDeviceAdv(address, report, rssi); }.bind(this); noble._bindings._gap._hci.on( 'leAdvertisingReport', this.le_adv_handler ); /* noble._bindings._gap._hci.on( 'leAdvertisingReport', function(status, type, address, addressType, report, rssi){ this.discoverDeviceAdv(address, report, rssi); }.bind(this)); */ /* Track BLE advertisement reports. */ noble.on('discover', function(peripheral){ if (peripheral.address.toLowerCase() === this.target.toLowerCase()) { noble.stopScanning(); this.connectDevice(peripheral, config); } }.bind(this) ); /* Start scanning when ble device is ready. */ noble.startScanning(); };
noble.on('stateChange', function(state){ console.log('stateChange:', state); if(state === 'poweredOn'){ console.log('scan: started'); noble.startScanning(); } });
module.exports = function (timeout, serviceUuid, peripherals, done) { noble.on('discover', discover.bind({peripherals:peripherals})); noble.startScanning([serviceUuid]); console.log('Scanning for BLE devices...'); setTimeout(stopandreturn.bind({done:done, peripherals:peripherals}), timeout); };
noble.on('stateChange', function(state) { if (state === 'poweredOn') { noble.startScanning(); } else { noble.stopScanning(); } });
EventEmitter.call(self); // make a copy of EventEmitter so you can emit events // The scanning function: function scan(state) { if (state === 'poweredOn') { // if the radio's on, scan for this service noble.startScanning([serviceUUID], false); } // emit a 'scanning' event: self.emit('scanning', state); }
var startScanningOnPowerOn = function() { if (noble.state === 'poweredOn') { noble.startScanning(['39e1fa0084a811e2afba0002a5d5c51b'], true); } else { noble.once('stateChange', startScanningOnPowerOn); } };
noble.on('stateChange', function (state) { console.log('stateChange >>> Device went to ' + state); if (state === 'poweredOn') { console.log('stateChange >>> Device is powered on, starting scanning...') noble.startScanning(); } })
_onStateChange: function(state) { if (state === 'poweredOn') { noble.startScanning(["180d"]); } else { noble.stopScanning(); } },
noble.on('stateChange', function(state) { if (state === 'poweredOn'){ noble.startScanning([self.serviceId], false); }else{ noble.stopScanning(); } });
BTProximity.prototype.init = function() { console.log("Initing..."); noble.startScanning([], true); if (!this.lastSeen) { this.lastSeen = new Date().getTime(); // Pretend we're here. this.present = true; } };
noble.on('stateChange', function(state) { if (state === 'poweredOn') { noble.startScanning(SCAN_UUIDS, false); } else { noble.stopScanning(); reject('bluetooth fff?'); } });
noble.on('stateChange', function(state) { if (state === 'poweredOn') { noble.startScanning(deviceClass.SCAN_UUIDS | [], this.SCAN_DUPLICATES); } else { noble.stopScanning(); reject('bluetooth off?'); } });
BrickBLE_server.prototype.startScanning = function(continuousScan) { console.log( "BrickBLE_server::startScanning", continuousScan ); this.BLE_server.continuousScan = continuousScan?true:false; if( !this.BLE_server.scanning && noble.state === "poweredOn") { noble.startScanning(); } this.emit( "update_BrickBLE_sever", {continuousScan: this.BLE_server.continuousScan} ); }
noble.on('scanStop', function() { if(server.BLE_server.continuousScan && server.BLE_server.scanning) { noble.startScanning(); } else { server.BLE_server.scanning = false; server.emit("update_BrickBLE_sever", {scanning: server.BLE_server.scanning} ); } });
noble.on('stateChange', function(state) { if (state === 'poweredOn') { console.log("Starting scan..."); noble.startScanning([], true); } else { noble.stopScanning(); } });
noble.on('stateChange', function (state) { console.log('state change', state); if (state === 'poweredOn') { noble.startScanning(); } else { noble.stopScanning(); } });
noble.on('stateChange',function(state){ if(state == 'poweredOn'){ console.log("Bluetooth stateChange, start scanning..."); noble.startScanning([],true); }else{ noble.stopScanning(); } });
noble.on('stateChange', function(state) { if (state === 'poweredOn') { noble.startScanning(['bbb0']); } else { noble.stopScanning(); alert('Please enable Bluetooth'); } });
function onDisconnect() { beacon.removeListener('disconnect', onDisconnect); console.log('disconnected!'); noble.on('discover', onDiscover); noble.startScanning(); }
noble.on('stateChange', function(state) { if (state === 'poweredOn') { noble.startScanning(); console.log('Searching for Angel Sensor') } else { noble.stopScanning(); } });