Forked from eklimcz-zz/gist:225d4617cc10e40b3053
Last active
August 29, 2015 14:27
-
-
Save JT5D/7c02b8ece5aa6cf39351 to your computer and use it in GitHub Desktop.
Basic scanning with Noble
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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