Code Monkey home page Code Monkey logo

node-eddystone-beacon-scanner's Introduction

node-eddystone-beacon-scanner

Scan for Eddystone beacons using Node.js

Uses noble for BLE peripheral scanning, then attempts to parse discovered peripherals using the Eddystone Protocol Specification.

Setup

npm install eddystone-beacon-scanner

Examples

See examples folder.

Usage

var EddystoneBeaconScanner = require('eddystone-beacon-scanner');

Register event handlers

Found

Triggered when a beacon is first found.

EddystoneBeaconScanner.on('found', function(beacon) {
  // ...
});

Updated

Triggered when a beacon advertisement detected.

EddystoneBeaconScanner.on('updated', function(beacon) {
  // ...
});

Lost

Triggered when a beacon has not been detected for 5 seconds.

EddystoneBeaconScanner.on('lost', function(beacon) {
  // ...
});

The beacon object will have the following properties depending on the frame type:

URL
  • type - Eddystone type
  • txPower - Measured received power at 0 m in dBm
  • url - (expanded) URL the beacon is broadcasting
  • tlm - TLM data, only present when interleaved broadcasts are used by the beacon
  • rssi - RSSI of discovered beacon
  • distance - Approximate distance from beacon
UID
  • type - Eddystone type
  • txPower - Measured received power at 0 m in dBm
  • namespace - 10-byte ID Namespace
  • instance - 6-byte ID Instance
  • tlm - TLM data, only present when interleaved broadcasts are used by the beacon
  • rssi - RSSI of discovered beacon
  • distance - Approximate distance from beacon
TLM
  • tlm
    • version - TLM version
    • vbatt - Battery voltage
    • temp - Temperature
    • advCnt - Advertising PDU count
    • secCnt - Time since power-on or reboot
  • rssi - RSSI of discovered beacon
  • distance - Approximate distance from beacon

Start scanning

Start scanning for Eddystone beacons, you can specify whether to allow duplicates (default is false).

You can also specify the grace period (time to wait before declaring the beacon as lost). Default is 5000 ms.

EddystoneBeaconScanner.startScanning(allowDuplicates, gracePeriod);

Note: the lost event will only be triggered when allowDuplicates is set to true.

Stop scanning

Stop scanning for Eddystone beacons.

EddystoneBeaconScanner.stopScanning();

node-eddystone-beacon-scanner's People

Contributors

christopherdro avatar edent avatar pgaubatz avatar sandeepmistry avatar ukbaz avatar valentingot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-eddystone-beacon-scanner's Issues

Not finding beacon after it's lost

I'm running the scanner and it shows my beacon the first time it finds it, it shows the updates, and when I turn the beacon off, it will show that it's been lost. Though when I turn the beacon back on it doesn't show the beacon to the found or updated again. Is this possible?

what is the key 'id' appearing in the scan

Hi,
I am getting a packet like this from the scan:

{ "txPower": -34, "url": "https://<validurl>", "id": "9576265a6c5142ee9f1c8dfc53b50358", "type": "url", "rssi": -68, "distance": 0.44668359215096315, "lastSeen": 1488489996658, "tlm": { "version": 0, "vbatt": 2934, "temp": 5, "advCnt": 813815, "secCnt": 1745318 } }

What is the field id appearing in the scan ? I do not have my UID / ibeacon mode switched on and neither do they map to this id....

Any clue ...thanks...

It stops scanning after a few minutes in my Pi3.

Hi there. I'm using a node-red node based on this module and noticed that after about 10 minutes the last signal is a "lost" and then no more updates of any sorts.

Tested this nodejs node using the basic example, same behavior. It stops scanning after a couple of lost signals.

Both, the NR module and this work again if i restart them.

So my question is, does this scanner stops after X amount of time?

If not, i believe something is going on between this and my Raspberry PI3 with latest updates.

I'm using a a bacon a Sony XZ1 Compact and the program Beacon Toy.

Make the grace period configurable

Hi,

Would you be ok if i made a quick PR to make the grace periode configurable ?
Something like:

EddystoneBeaconScanner.startScanning(true, 30000); // Increase the grace period to 30s

Of course the default grace period would always be of 5 seconds.

Very nice job btw :)

Eddystone TLM message not showing

Hello,

I am trying to get the Telemetry message from an Estimote tag (estimote OS A.3.2.0 & Hardware D3.4 configured as an eddystone), on an Edison Board, and the message does not show up.

I found a workaround in the noble project (flag NOBLE_REPORT_ALL_HCI_EVENTS=1), but wanted to raise the issue since it does impact the functionnality of this project.

Using the project basic.js exemple, the board manage to find the UID frame :

found Eddystone Beacon:
 {
  "txPower": -50,
  "namespace": "edd1ebeac04e5defa017",
  "instance": "f4c683198fb6",
  "id": "f4c683198fb6",
  "type": "uid",
  "rssi": -71,
  "distance": 0.1,
  "lastSeen": 1451735137624
}

Following by several "updated" then a "Lost" (even thought I did not move the tag)

And I never get any TLM frame (when, with my phone, I can get the info with the estimote app).

Searching in the noble project I found in hci-socket/gap.js that adding "gap" debug flag, that I do get the TLM frame but as soon as I get a TLM frame, I don't get any Discover until I get the "Lost" response.

gap advertisement = {"localName":"EST","serviceData":[{"uuid":"feaa","data":[0,206,237,209,235,234,192,78,93,239,160,23,244,198,131,25,143,182]}],"serviceUuids":["feaa"]} +2s
  gap advertisement = {"localName":"EST","serviceData":[{"uuid":"feaa","data":[32,0,11,247,26,192,0,0,141,216,0,6,88,56]}],"serviceUuids":["feaa"]} +990ms
  gap advertisement = {"localName":"EST","serviceData":[{"uuid":"feaa","data":[0,206,237,209,235,234,192,78,93,239,160,23,244,198,131,25,143,182]}],"serviceUuids":["feaa"]} +1s
  gap advertisement = {"localName":"EST","serviceData":[{"uuid":"feaa","data":[0,206,237,209,235,234,192,78,93,239,160,23,244,198,131,25,143,182]}],"serviceUuids":["feaa"]} +2s
lost Eddystone beacon:
 {
  "txPower": -50,
  "namespace": "edd1ebeac04e5defa017",
[...]

And watching the gap.js code I found the NOBLE_REPORT_ALL_HCI_EVENTS flag and indeed launching my project prefixed by NOBLE_REPORT_ALL_HCI_EVENTS=1 I do get both messages.

Thank

Cannot find module '../build/Release/binding.node'

While I run basic.js, I get the following error:
rror: Cannot find module '../build/Release/binding.node'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/home/pi/noble/node-eddystone-beacon-scanner/node_modules/noble/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)

Can you please help.

Units for Distance?

Hi, we are using the 'Distance' from Eddystone URL to do some calculations, and we were wondering what units are used?

We though in Meters, but it didn't seem to be the case.

basic.js giving no output

Hello,

When I run examples/basic.js I'm not getting any output.
I have some beacons that I can successfully see with the ios app. and when I run the noble.js example I get an output so I think my hardware is OK both on the beacons and on the Pi.
Below is the output from the noble.js example.

Any ideas what might be wrong with the uri-beacon-scanner example?

Thanks,
Barry

pi@raspberrypi ~/node_modules/noble/examples $ node advertisement-discovery.js 
peripheral discovered (0350322574ff with address <03:50:32:25:74:ff>:
    hello my local name is:
        undefined
    can I interest you in any of the following advertised services:
        ["fed8"]
    here is my service data:
        "fed8": "00b80063737200"
        "fed8": "00b80063737200"

peripheral discovered (34b1f7ce77de with address <34:b1:f7:ce:77:de>:
    hello my local name is:
        undefined
    can I interest you in any of the following advertised services:
        ["fed8"]
    here is my service data:
        "fed8": "00f2006c7564696f6e73007572692f"
        "fed8": "00f2006c7564696f6e73007572692f"

Typo in the readme

Hey Sandeep,

You need to change
EddystoneBeaconScanner.startScannning

to

EddystoneBeaconScanner.startScanning

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.