Skip to content

Instantly share code, notes, and snippets.

@JT5D
Forked from eklimcz-zz/gist:225d4617cc10e40b3053
Last active August 29, 2015 14:27
Show Gist options
  • Save JT5D/7c02b8ece5aa6cf39351 to your computer and use it in GitHub Desktop.
Save JT5D/7c02b8ece5aa6cf39351 to your computer and use it in GitHub Desktop.
Basic scanning with Noble
var noble = require('noble');
//replace localhost with your server's IP;
var socket = require('socket.io-client')('http://localhost/scanner');
//replace with your hardware address
var addressToTrack = '7c669d9b2dda';
socket.on('connect', function(){
console.log('connected to server');
});
noble.on('discover', function(peripheral){
if(peripheral.uuid == addressToTrack){
socket.emit('deviceData', {mac: peripheral.uuid, rssi:peripheral.rssi});
}
});
noble.startScanning([], true) //allows dubplicates while scanning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment