Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

lebon

0.1.0 • Public • Published

Lebon

A tiny, convenient wrapper around Noble to easily scan BLE peripherals

Build Status codecov.io

Lebon peripheral discovered

peripheral = {
  name: "Name",
  uuid: "UUID",
  address: "BT address",
  noblePeripheral: <Noble Peripheral Object>
};

Start scanning devices

lebon.startScan(timeout);

Example:

var lebon = require('lebon');

lebon.on('discover', function(device) {
  console.log('New device discovered! ' + device.name);
});

lebon.startScan(20000);

Stop scanning devices

lebon.stopScan();

Example:

var lebon = require('lebon');

var start = function(device) {
  console.log(device.uuid)
}

lebon.on('discover', function(device) {
  if (device.name === 'BB-191') {
    lebon.stopScan();
    start(device);
  }
});

lebon.startScan(20000);

Get latest devices scanned

peripherals = lebon.getDiscoveredPeripherals()

License

MIT © 2016 Andrea Stagi

Install

npm i lebon

DownloadsWeekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • avatar