Giter Site home page Giter Site logo

node-bleacon's Introduction

node-bleacon

Gitter

A Node.js library for creating, discovering, and configuring iBeacons

Prerequisites

Install

npm install bleacon

Usage

var Bleacon = require('bleacon');

Start advertising

"Create" an iBeacon

var uuid = 'e2c56db5dffb48d2b060d0f5a71096e0';
var major = 0; // 0 - 65535
var minor = 0; // 0 - 65535
var measuredPower = -59; // -128 - 127 (measured RSSI at 1 meter)

Bleacon.startAdvertising(uuid, major, minor, measuredPower);

Stop advertising

Stop your iBeacon

Bleacon.stopAdvertising();

Start scanning

var uuid = 'e2c56db5dffb48d2b060d0f5a71096e0';
var major = 0; // 0 - 65535
var minor = 0; // 0 - 65535

Bleacon.startScanning([uuid], [major], [minor]);

Examples

Bleacon.startScanning(); // scan for any bleacons

Bleacon.startScanning(uuid); // scan for bleacons with a particular uuid

Bleacon.startScanning(uuid, major); // scan for bleacons with a particular uuid and major

Bleacon.startScanning(uuid, major, minor); // scan for bleacons with a particular uuid. major, and minor

Stop scanning

Bleacon.stopScanning();

Events

Bleacon.on('discover', function(bleacon) {
    // ...
});

bleacon properties:

  • uuid
    • advertised uuid
  • major
    • advertised major
  • minor
    • advertised minor
  • measuredPower
    • advertised measured RSSI at 1 meter away
  • rssi
    • current RSSI
  • accuracy
    • +/- meters, based on measuredPower and RSSI
  • proximity
    • current proximity ('unknown', 'immediate', 'near', or 'far')

Configuring

iBeacon Advertisement format

Note: not official, determined using noble, and the AirLocate example.

Following data is in the manufacturer data section of the advertisment data

<company identifier (2 bytes)> <type (1 byte)> <data length (1 byte)> <uuid (16 bytes)> <major (2 bytes)> <minor (2 bytes)> <RSSI @ 1m>

Example:

4C00 02 15 585CDE931B0142CC9A1325009BEDC65E 0000 0000 C5
  • Apple Company Identifier (Little Endian)
  • data type, 0x02 => iBeacon
  • data length, 0x15 = 21
  • uuid: 585CDE931B0142CC9A1325009BEDC65E
  • major: 0000
  • minor: 0000
  • meaured power at 1 meter: 0xc5 = -59

Analytics

node-bleacon's People

Contributors

sandeepmistry avatar danibram avatar frm avatar jdivy avatar scapal avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.