Skip to content

Instantly share code, notes, and snippets.

@cgreening
Last active August 29, 2015 14:22
Show Gist options
  • Save cgreening/7f4f3837846ce875f8d7 to your computer and use it in GitHub Desktop.
Save cgreening/7f4f3837846ce875f8d7 to your computer and use it in GitHub Desktop.
Scanning for devices
// start nodule scanning for devices advertising these services
nodule.startScanning([['uuid1', 'uuid2'], ['uuid3', 'uuid4']]);
nodule.on('scan', function(devices) {
// devices is an array of devices that are advertising the requested services
/*
devices = [
{
deviceName: 'TI Sensor Tag',
advertisedServices: ['uuid1', 'uuid2'],
RSSI: -56,
deviceId: _opaque_id_
},
{
deviceName: 'Chris\'s Tile',
advertisedServices: ['uuid3', 'uuid4'],
RSSI: -70,
deviceId: _opaque_id_
},
{
deviceName: 'TI Sensor Tag',
advertisedServices: ['uuid1', 'uuid2'],
RSSI: -56,
deviceId: _opaque_id_
},
];
*/
// stop scanning as we have found some devices
nodule.stopScanning();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment