Coder Social home page Coder Social 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

danibram avatar jdivy avatar resqrobert avatar sandeepmistry avatar scapal 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  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

node-bleacon's Issues

Settings not updating on Estimote Beacons

From what I can tell, neither writeDeviceName nor writePowerLevel work. They seem to function properly but ultimately the values on the beacon remain unchanged. Also I'm pretty sure trying to change the name value has made one of my beacon undiscoverable by bleacon. I can still see it with the Estimote app but bleacon hasn't been able to find it since I tryed to change the name.

discoverAll() don't show Estimotes

Hello,

I'm working with a Rapsberry Pi 3 trying to connect with the Estimotes, but when I use the discoverAll() function they don't appear on the command line. Using the bluetoothctl scan they are detected.

The code is the following:
`var Estimote = require('bleacon').Estimote;

Estimote.discoverAll(function (estimote) {
console.log(JSON.stringfy(estimote));
});`

Is something wrong with the code?

Regards,

Scanning mor than one uuid

Hey,

it is possible to scan for multiple defined uuid's at the same time? Or can i only scan for all and for one uuid ?

thx

Retrieving Major ID from Stickers

I have been looking through the library's code for stickers, and it does not seem like there is a way to get the major ID for a sticker. Is this currently possible with the existing code?

Thanks!

Estimote Sticker Major/Minor

Looking at results for Bleacon.EstimoteSticker discover events and comparing to the Estimote app, what Estimote calls the Major and Minor on stickers is the last 4 bytes of the UUID returned by node-bleacon converted to decimal.

Ex:

Estimote app:
uuid:abababab-cdcd-efef-0101-232323232323
major:17733
minor:26471

node-bleacon.EstimoteSticker:
uuid:ababababcdcdefef010123232323232345456767

Also when using the evothings library (on Android anyway), it calls these last bytes the major and minor too. So it might be smart to break this out into major and minor (or have an option for it).

Also see #41

unable to run bleacon on Intel edison

When i run the my node application on Intel edison it throws me error Cannot find module 'bluetooth-hci-socket' . Let me know if I am missing something. I was able to use this on my local system .

I am trying to scan estomote stickers from Intel edison. please let me know if I can use any other library too.

Thanks
Krishna

mac address x uuid

I checked the lib noble read the mac address and bleacon not read the mac address. I would like to use two at the same time to read the mac address and the characteristics of the beacons. How can I do it?
Thank you!

Setting scanning interval

Hello
i am able to scan the beacons without duplicates, but i want to scan the beacons for every 10secs, even if there are same beacons i want to console log them for every 10 sec

for example

Bleacon.startScanning(); //setting interval for this
or chage in onDiscover event

raspberry pi Beacon not picked up.

I am trying to use the bleacon libary to scan for beacons. I have three estimotes who are picked up without any problems.

The Raspberry pi uses a bluetooth dongle and has been setup as follows:

sudo hciconfig hci0 up
sudo hciconfig hci0 leadv

The example android application from google (BLE device scan) picks it up without problems and gives it the name CSR8510 A10. This is actually the name of the chip :)

Running sudo hcitool lescan does pick it up:

00:1A:7D:DA:71:12 CSR8510 A10
00:1A:7D:DA:71:12 (unknown)
C7:23:ED:6A:87:F3 (unknown)
C7:23:ED:6A:87:F3 estimote

Does this require Bluetooth Low Energy Hardware?

Hi there;

I'm wondering if this requires Bluetooth Low Energy Hardware? I have an older MacBook pro that I'd like to test with, and it seems to me that I'm going to have to buy a USB dongle to support BTLE.

Is this correct?

Thanks,

Brad

not on npm

npm http GET https://registry.npmjs.org/bleacon
npm http 404 https://registry.npmjs.org/bleacon

readPowerLevel on Estimote doesn't work

readPowerLevel function for estimote does not work. Looks like you're trying to map the read from the POWER_LEVEL_UUID as if it were the SIGNAL_STRENGTH_UUID.

Bleacon occasionally stops reporting beacons with two Bluetooth devices installed

I ran this beacon scan on RPi 3 successfully for 11 days:

var Bleacon = require('bleacon');
Bleacon.startScanning();
Bleacon.on('discover', function (bleacon) {
    console.log(Date(), bleacon.uuid, bleacon.major, bleacon.minor,
        bleacon.measuredPower, bleacon.rssi, bleacon.proximity, bleacon.accuracy);
});

That test used the integrated Bluetooth hardware in RPi 3 (device hci0).

I installed the iogear GBU521 Bluetooth USB adapter (device hci1) and ran the same test above with NOBLE_HCI_DEVICE_ID=1. Bleacon reads beacons from the GBU521, but stops reporting beacons after a few minutes (beacon source is nearby, from another RPi3 that provided beacons for the 11 day test above).

If I Ctrl-C the test app and restart it, Bleacon reports beacons again, but eventually suspends.

I added code to stopScanning and startScanning if there are no discovered beacons for 5 seconds:

var Bleacon = require('bleacon');
Bleacon.startScanning();
var count = 1;
var timer = null;
Bleacon.on('discover', function (bleacon) {
    clearTimeout(timer);
    console.log(Date(), count, bleacon.uuid, bleacon.major, bleacon.minor,
        bleacon.measuredPower, bleacon.rssi, bleacon.proximity, bleacon.accuracy);
    timer = setTimeout(function () {
        console.log('TIMED OUT: count =', count);
        Bleacon.stopScanning();
        count++;
        Bleacon.startScanning();
    }, 5000);
});

That keeps the app running, and beacons are reported except for occasional 5 second quiet periods until the timer fires. I can see in the count logged to the console this happens perhaps 25 times in half a day or so.

If I run two instances of the app simultaneously, one using RPi 3 integrated Bluetooth and another using the GBU521, both experience the timeouts that are recoverable.

Since it ran for 11 days before installing the GBU521, there seems to be some issue that surfaces when two Bluetooth receivers are active.

I can live with the restart logic, but wanted to mention this in case it is of interest.

For the latter test above with restart logic, I am running:

  • Raspberry Pi 3
  • Raspian GNU/Linux 8 (jessie)
  • Linux kernel 4.1.19-v7+
  • bluez 5.23-2+rpi1
  • Node.js 6.1.0
  • bleacon 0.4.0
  • iogear GBU521

Really appreciate this excellent open source Bluetooth software for Node.js.

Scanning and broadcasting simultaneously?

Hi,

(This is more of a question than an issue... if you've got a preferred means for addressing questions, let me know.)

Does Bleacon / iBeacon / BLE support simultaneously scanning for iBeacons and also broadcasting an iBeacon? My experience seems to indicate that after I call Bleacon.startScanning(), any in-process broadcasts are terminated.

If this is a limitation, I'd be interested in knowing where in the stack it comes from. Can I get around it by running multiple processes on the same machine to address the same BLE chip, for example?

Thanks,

-Patrick

Big gaps between estimote stickers package reception on Macbook

Hi everyone!

When I run a simple code on my macbook air to detect the sticker package, there are big gap of 2 or 3 minutes during which I don’t receive anything, and I then receive packages each 2 or 3 seconds, and then there is an other gap… I precise that there is only one sticker in range when I run my code.
How can we explain it? And how is it possible to delete those gaps?
Other question: Why does the package are not received regularly (1, 2 or 3 seconds) when there is no gap instead of the amount of time specified in the package interval setting of nearable package (when it is not in motion) ?

Thank you !

Guillaume


Here are the emission settings of my stickers:
Nearable:
Advertising interval (still): 1487ms
Advertising interval (motion): 743ms

Estimote:
Advertising interval (still): 5948ms
Advertising interval (motion): 2974ms


Here is the code I’m running: (Node.js)

var i=0;

var EstimoteSticker = require('./estimote-sticker');

EstimoteSticker.on('discover', function(estimoteSticker) {
if(estimoteSticker.id == "dd1abfef45fe6614")
{
i++;
console.log("");
console.log(Date());
console.log(i);
}
});

var uuid = "D0D3FA86-CA76-45EC-9BD9-6AF4659A0A3D";
EstimoteSticker.startScanning(uuid);


And here is the log I obtain after running my code for a couple of minutes:

Mon Jun 13 2016 14:43:33 GMT-0500 (PET)

1

Mon Jun 13 2016 14:43:35 GMT-0500 (PET)

2

Mon Jun 13 2016 14:43:36 GMT-0500 (PET)

3

Mon Jun 13 2016 14:43:40 GMT-0500 (PET)

4

Mon Jun 13 2016 14:43:41 GMT-0500 (PET)

5

Mon Jun 13 2016 14:43:43 GMT-0500 (PET)

6

Mon Jun 13 2016 14:43:45 GMT-0500 (PET)

7

Mon Jun 13 2016 14:43:47 GMT-0500 (PET)

8

Mon Jun 13 2016 14:43:49 GMT-0500 (PET)

9

Mon Jun 13 2016 14:43:52 GMT-0500 (PET)

10

Mon Jun 13 2016 14:43:53 GMT-0500 (PET)

11

Mon Jun 13 2016 14:44:00 GMT-0500 (PET)

12

Mon Jun 13 2016 14:47:03 GMT-0500 (PET)

13

Mon Jun 13 2016 14:47:05 GMT-0500 (PET)

14

Mon Jun 13 2016 14:47:06 GMT-0500 (PET)

15

Mon Jun 13 2016 14:47:09 GMT-0500 (PET)

16

Mon Jun 13 2016 14:47:11 GMT-0500 (PET)

17

Mon Jun 13 2016 14:47:12 GMT-0500 (PET)

18

Mon Jun 13 2016 14:47:15 GMT-0500 (PET)

19

Mon Jun 13 2016 14:47:17 GMT-0500 (PET)

20

Mon Jun 13 2016 14:47:18 GMT-0500 (PET)

21

Mon Jun 13 2016 14:50:12 GMT-0500 (PET)

22

Mon Jun 13 2016 14:50:15 GMT-0500 (PET)

23

Mon Jun 13 2016 14:50:16 GMT-0500 (PET)

24

Mon Jun 13 2016 14:50:18 GMT-0500 (PET)

25

Mon Jun 13 2016 14:50:21 GMT-0500 (PET)

26

Mon Jun 13 2016 14:50:22 GMT-0500 (PET)

27

Mon Jun 13 2016 14:50:24 GMT-0500 (PET)

28

Mon Jun 13 2016 14:50:27 GMT-0500 (PET)

29

Mon Jun 13 2016 14:50:28 GMT-0500 (PET)

30

Mon Jun 13 2016 14:50:30 GMT-0500 (PET)

31

Mon Jun 13 2016 14:50:33 GMT-0500 (PET)

32

Mon Jun 13 2016 14:50:34 GMT-0500 (PET)

33

Mon Jun 13 2016 14:50:36 GMT-0500 (PET)

34

Mon Jun 13 2016 14:50:42 GMT-0500 (PET)

35

—> We can observe big lacks between:

  • 14:44:00 and 14:47:03
  • 14:47:18 and 14:50:12

————————————————————————————————————————————

I tried to run my code on a macbook pro at the same time and obtained that log:

Mon Jun 13 2016 14:43:24 GMT-0500 (PET)

3

Mon Jun 13 2016 14:43:29 GMT-0500 (PET)

4

Mon Jun 13 2016 14:43:33 GMT-0500 (PET)

5

Mon Jun 13 2016 14:43:35 GMT-0500 (PET)

6

Mon Jun 13 2016 14:43:36 GMT-0500 (PET)

7

Mon Jun 13 2016 14:43:39 GMT-0500 (PET)

8

Mon Jun 13 2016 14:43:41 GMT-0500 (PET)

9

Mon Jun 13 2016 14:43:45 GMT-0500 (PET)

10

Mon Jun 13 2016 14:43:47 GMT-0500 (PET)

11

Mon Jun 13 2016 14:43:48 GMT-0500 (PET)

12

Mon Jun 13 2016 14:43:51 GMT-0500 (PET)

13

Mon Jun 13 2016 14:43:57 GMT-0500 (PET)

14

Mon Jun 13 2016 14:44:09 GMT-0500 (PET)

15

Mon Jun 13 2016 14:45:58 GMT-0500 (PET)

16

Mon Jun 13 2016 14:46:03 GMT-0500 (PET)

17

Mon Jun 13 2016 14:46:12 GMT-0500 (PET)

18

Mon Jun 13 2016 14:46:21 GMT-0500 (PET)

19

Mon Jun 13 2016 14:46:45 GMT-0500 (PET)

20

Mon Jun 13 2016 14:46:48 GMT-0500 (PET)

21

Mon Jun 13 2016 14:46:54 GMT-0500 (PET)

22

Mon Jun 13 2016 14:46:57 GMT-0500 (PET)

23

Mon Jun 13 2016 14:47:03 GMT-0500 (PET)

24

Mon Jun 13 2016 14:47:04 GMT-0500 (PET)

25

Mon Jun 13 2016 14:47:09 GMT-0500 (PET)

26

Mon Jun 13 2016 14:47:12 GMT-0500 (PET)

27

Mon Jun 13 2016 14:49:34 GMT-0500 (PET)

28

Mon Jun 13 2016 14:49:41 GMT-0500 (PET)

29

Mon Jun 13 2016 14:49:44 GMT-0500 (PET)

30

Mon Jun 13 2016 14:49:46 GMT-0500 (PET)

31

Mon Jun 13 2016 14:49:47 GMT-0500 (PET)

32

Mon Jun 13 2016 14:49:52 GMT-0500 (PET)

33

Mon Jun 13 2016 14:49:53 GMT-0500 (PET)

34

Mon Jun 13 2016 14:49:56 GMT-0500 (PET)

35

Mon Jun 13 2016 14:49:59 GMT-0500 (PET)

36

Mon Jun 13 2016 14:50:02 GMT-0500 (PET)

37

Mon Jun 13 2016 14:50:10 GMT-0500 (PET)

38

Mon Jun 13 2016 14:50:34 GMT-0500 (PET)

39

—> We can observe big lacks between:

  • 14:44:09 and 14:45:58
  • 14:47:12 and 14:49:34

rssi / accuracy issues

This is what I get when scanning. I don't see any change in accuracy and when the ibeacon (at full power fresh battery) is right on top of my laptop I get proximity as far.

{ uuid: 'a495ffffc5b14b44b5121370f02d74de',
  major: 1,
  minor: 0,
  measuredPower: -59,
  rssi: 
   { localName: 'ZAPP',
     txPowerLevel: 4,
     manufacturerData: undefined,
     serviceData: [],
     serviceUuids: [ 'a495ff10c5b14b44b5121370f02d74de' ] },
  accuracy: NaN,
  proximity: 'far' }

Also RSSI shows as an object. So I think the issue is here


  var accuracy = Math.pow(12.0, 1.5 * ((rssi / measuredPower) - 1));
      var proximity = null;

      if (accuracy < 0) {
        proximity = 'unknown';
      } else if (accuracy < 0.5) {
        proximity = 'immediate';
      } else if (accuracy < 4.0) {
        proximity = 'near';
      } else {
        proximity = 'far';
      }

Gigaset G-Tag can't be found

Hi,

ive bought the Gigaset G-Tag and it is invisible for Bleacon.. ive tested

  1. Bleacon on Raspberry (as receiver) with my iPhone (as tranceiver)
  2. G-Tag (as tranceiver) with iPhone (as receiver)
  3. G-Tag (as tranceiver) with LightBlue from MacAppStore (as receiver) (it shows also the RSSI correctly)
    and everything works!

until i try to find G-Tag (tranceiver) on my raspberry (receiver)...
where is the issue?

startAdvertising sometimes fail

Hi I am using bleacon on the intel edison.

Most of the time when i do startAdvertising it does. However, there are cases (as i am running the program for a long time) then the advertising stops, then if i restart the program it starts again.

is there any way to check if it is advertising? like a callback function? also is there anycases where you think this problem might happen? I am trying to debug this

this is the part of my code,

// start tcp
connect();

// start bluetooth scanning
Bleacon.startScanning(uuid);

// transmit ibeacon every 100ms
Bleacon.startAdvertising(uuid, major, minor, measuredPower);

// check battery every 60 seconds
setInterval(checkBattery, 60000);

// send status every 10 seconds
setInterval(sendStatus, 10000)

i also have a service file that restarts my program when the TCP connection is down, so expect that the program will be restarted many times over weeks. Im wondering if its because of unsafe exits that the bleacon library does not take into account?

just in case you are wondering, bluetooth is setup using

rfkill unblock bluetooth
hciconfig hci0 up

on systemctl status bluetooth i do get this

Refusing storage path for private addressed device /org/bluez/hci0/dev_60_01_6C_43_40_98

Thx

Bleacon.StartAdvertising help needed! (raspberry emulating iBeacon)

Hi!

I'm trying to build something that emulates an iBeacon on a raspberry PI using node-bleacon.

Using Bleacon.StartAdvertising() I can get the raspberry's usb dongle to activate the BLE radio. It shows up in BLE Scanner and LightBlue scanner (IOS). But when interrogating the device more closely there is no "advertisement" UUID (ie. the ibeacon uuid) present. It will not show up in the Estimote ios app for example...

What am I doing wrong / missing here?

Sending data between beacons?

Should I use blecon for detection and monitoring proximity and then use noble for sending data between beacons?

Thanks for the great libs!

Raspberry Pi support

Any idea if this can be implemented in a Node.js environment inside a Raspberry Pi?

Bleacons not detected by iOS 7.1

It seems that an iBeacon advertised by bleacon is not detected by iOS 7.1 devices.

I have an iPad running 7.0.6 and an iPhone 5 running 7.1, both running the same app (which basically just detects iBeacons). The iBeacon is picked up by the iPad but not by the iPhone. Any idea as to why that is?

Node issue with MAC OS X El Capitain

Note: This works perfectly well in Yosemite MAC OS X
Problem: I have used test.js to make mac os x advertise an IBeacon which is detectable by an iOS application. When I try to use it on MAC OS X El Capitain via below command
node /Users/parvezqureshi/Downloads/node-bleacon-master/test.js
then it is giving errors:

`throw error;
^

Error: Could not start advertising, state is unsupported (not poweredOn)
at Bleno.startAdvertisingIBeacon (/Users/parvezqureshi/node_modules/bleno/lib/bleno.js:121:17)
at Bleno. (/Users/parvezqureshi/Downloads/node-bleacon-master/lib/bleacon.js:33:13)
at emitOne (events.js:77:13)
at Bleno.emit (events.js:169:7)
at Bleno.onStateChange (/Users/parvezqureshi/node_modules/bleno/lib/bleno.js:66:8)
at emitOne (events.js:77:13)
at emit (events.js:169:7)
at null. (/Users/parvezqureshi/node_modules/bleno/lib/mac/bindings.js:98:8)
at emitOne (events.js:77:13)
at emit (events.js:169:7)`

I have checked that Bluetooth is already on on the Mac OS X machine
What has changed from Yosemite to El Capitain that is causing this issue ? Version of El Capitain is 10.11.1
@sandeepmistry Can you please tell what can be the cause of this issue?

The contents of test.js are as below:

`var Bleacon = require('./index');

Bleacon.startAdvertising('e2c56db5dffb48d2b060d0f5a71096e0', 0, 0, -59);

Bleacon.on('discover', function(bleacon) {
console.log('bleacon found: ' + JSON.stringify(bleacon));
});

Bleacon.startScanning(/'e2c56db5dffb48d2b060d0f5a71096e0', 0, 0/);

`

Is node-bleacon always passive? (node-bleacon battery life implications?)

Hi,

Sorry, I'm relatively new to how Bluetooth LE works. But since I saw lines like "state = disconnected" in the source code and as there is an option to passively or actively scan for BLE devices via "hcitool lescan", I thought I'd ask.

Does node-bleacon not only receive, but also send packets via BLE? Are there any active connections or handshakes with BLE devices?

We are currently having many estimote stickers dying one after another way before the one year period, without much sticker movement involved. I was just wondering whether something like this could potentially be caused via software bugs in node-bleacon. Or whether a bug in the estimote sticker firmware or a hardware issue is more likely.

Any idea to implement didExit?

I have moved issue from noble
I have a simple question.
I want to implement a function didExit which detects a beacon moves from monitoring region to outside of that.
If you have any idea to implement above function, please tell me!

@sandeepmistry

My suggestion, would be to store which beacons are discovered with a time stamp. Then have a timer, that checks if the beacon has been discovered in the last 1 second, if not you have most likely exited the "region".

Thank you for your suggestion, I will try it.

Estimote sticker battery level

Hi!
When looking at the way battery level is calculated, I get the impression that there is something not right...
On line 88 (estimate-sticker.js), the first byte is rotated 8 bits and added to the second byte, after it is left rotated 4 bits, in which the first 6 bit (in 16) are cleared. Is this ok? The last part is irrelevant, right?

Cheers,
/rp

HCI hardware

Can one choose the hardware interface you want to use to communicate with the beacon?

Best practices

Hi,

Sorry I have 3 stupids questions:

  • Does this library works with Windows and/or RPi ? And so what USB BLE device work best ?
  • If I understood the API track mobile but also other iBeacon ?
  • What iBeacon devices works best with this library ?

More than one Bluetooth dongle

Is it possible to use this library in combination with mode than one Bluetooth dongles, i.e. more than one Bluetooth radios? For instance, I would like to connect to USB Bluetooth dongles to a Raspberry Pi an then know which of those two receives what kind of beacon data.

Learning Curve

Hi Sandeep,

I am currently learning the process of Core Bluetooth, I have created an SDK using the Estimote SDK, but would like to remove the Estimote SDK completely.

Could you advise me how to implement your node.js into a iOS project please, currently I am complete baffled with the process!

Thank You :)

Estimote.writePowerLevel error (value is out of bounds)

Hello,

When i try to use Estimote.writePowerLevel passing a value other than 7 or 8 i get the following error:

...
function(callback) {
    var powerLevel = 4;
        estimote.writePowerLevel(powerLevel, function(error){
            console.log(error);
            callback();
        });
      },
...

buffer.js:969
    throw new TypeError('value is out of bounds');
    ^
TypeError: value is out of bounds
    at checkInt (buffer.js:969:11)
    at Buffer.writeUInt8 (buffer.js:1017:5)
    at NobleDevice.writeUInt8Characteristic (/home/vendo/node_modules/noble-device/lib/noble-device.js:189:10)
    at Estimote.writePowerLevel (/home/vendo/node_modules/bleacon/estimote/estimote.js:263:8)
    at /home/vendo/Code/write_pl_test.js:23:18
    at /home/vendo/node_modules/async/dist/async.js:3326:13
    at replenish (/home/vendo/node_modules/async/dist/async.js:808:21)
    at /home/vendo/node_modules/async/dist/async.js:814:29
    at /home/vendo/node_modules/async/dist/async.js:776:16
    at /home/vendo/node_modules/async/dist/async.js:3331:17

I noticed that power levels 7 and 8 are the only one mapped with >= 0 values and the error is thrown when triyng to write the value to buffer in writeUInt8Characteristic.

Estimote.prototype.writePowerLevel = function(powerLevel, callback) {
  if (powerLevel < 1) {
    powerLevel = 1;
  } else if (powerLevel > 8) {
    powerLevel = 8;
  }

  var POWER_LEVEL_MAPPER = {
    1: -30,
    2: -20,
    3: -16,
    4: -12,
    5:  -8,
    6:  -4,
    7:   0,
    8:   4
  };

  var rawLevel = POWER_LEVEL_MAPPER[powerLevel];

  this.writeUInt8Characteristic(ESTIMOTE_SERVICE_UUID, POWER_LEVEL_UUID, rawLevel, callback);
};
NobleDevice.prototype.writeUInt8Characteristic = function(serviceUuid, characteristicUuid, value, callback) {
  var buffer = new Buffer(1);
  buffer.writeUInt8(value, 0); 
  this.writeDataCharacteristic(serviceUuid, characteristicUuid, buffer, callback);
};

So i'm wondering if are negative values causing the problem (missing conversion?) or there is something wrong with my code ?

Thank you in advance.

Can't discover Punchthrough LightBean or Estimote Stickers

Hi, I have an Estimote Sticker and a Punchthrough LightBean but I can't discover them.

If I use noble I'm able to see the LightBean as this device:

{ _noble: 
   { state: 'poweredOn',
     _bindings: 
      { _xpcConnection: [Object],
        _peripherals: [Object],
        _events: [Object],
        sendCBMsg: [Function],
        init: [Function],
        startScanning: [Function],
        stopScanning: [Function],
        connect: [Function],
        disconnect: [Function],
        updateRssi: [Function],
        discoverServices: [Function],
        discoverIncludedServices: [Function],
        discoverCharacteristics: [Function],
        read: [Function],
        write: [Function],
        broadcast: [Function],
        notify: [Function],
        discoverDescriptors: [Function],
        readValue: [Function],
        writeValue: [Function],
        readHandle: [Function],
        writeHandle: [Function],
        timer: [Object] },
     _peripherals: { '9c8fbe377a694ca698cb68f74fff5975': [Circular] },
     _services: { '9c8fbe377a694ca698cb68f74fff5975': {} },
     _characteristics: { '9c8fbe377a694ca698cb68f74fff5975': {} },
     _descriptors: { '9c8fbe377a694ca698cb68f74fff5975': {} },
     _events: { discover: [Object] },
     _discoveredPeripheralUUids: [ '9c8fbe377a694ca698cb68f74fff5975' ],
     _allowDuplicates: true },
  uuid: '9c8fbe377a694ca698cb68f74fff5975',
  advertisement: 
   { localName: 'Bean',
     txPowerLevel: 4,
     manufacturerData: undefined,
     serviceData: [],
     serviceUuids: [ 'a495ff10c5b14b44b5121370f02d74de' ] },
  rssi: -55,
  services: null,
  state: 'disconnected' }

Can you help me discover these with Bleacon?

Any way to send an identifier?

I just noticed that the iOS API for iBeacon supports "identifiers" when creating and scanning for iBeacons - which are basically strings that seem to be transmitted from one device to another.

Is something like this possible with bleacon? Or is there a specific reason this is not supported?

Mac OS X support?

Hi,

I'm trying to run a simple experiment to play with bleacon. I've written a small nodejs script that both listens and broadcasts, and run it on my MacBook Air (running 10.9.2). It correctly picks up iBeacons that are broadcasting nearby, but I do not see the beacon that is configured in the script. I've tested with both an iPhone 5 running iOS 7.1.1 and a Nexus 5 running Android 4.4.2.

Is it expected that Bleacon should work on a laptop, or does it depend on particular hardware configurations? If the former, any debugging pointers would be greatly appreciated.

https://gist.github.com/pcl/2b556fcb88e7f2ab06c8

Thanks,

-Patrick

Accelerometer

Did you find a way to retrieve accelerometer data ? It seems there is an update few month ago ?
According to their forum accelerometer only tells moving or not.

state is poweredOff

Apologies for this (probably) silly question. I am new to bluetooth. I'm trying to get started using this library on Mac OSX (10.9.5) on a 2013 macbook pro 13". Simply trying to bleacon.startScanning() for devices. I get the error that "state is poweredOff". Bluetooth is turned on and I can see it lists my iphone as a device, so it seems to be up and working properly. What am I missing?

index out of range when discovering estimote

Hi I did a small test to see how this project works. I tried running the following code:
var Estimote = require('bleacon').Estimote;
Estimote.discover(function(estimote){
console.log('working', estimote);
});

each time I run it with my estimote i get the following. Any ideas how to work around this?

buffer.js:506
throw new RangeError('index out of range');
^
RangeError: index out of range
at checkOffset (buffer.js:506:11)
at Buffer.readUInt16LE (buffer.js:552:5)
at new Estimote (/Users/aperritano/Box Sync/dev/uic-phd/NodeBeacon/node_modules/bleacon/estimote/estimote.js:47:28)
at Noble.Util.inherits.constructor.onDiscover (/Users/aperritano/Box Sync/dev/uic-phd/NodeBeacon/node_modules/bleacon/node_modules/noble-device/lib/util.js:28:22)
at Noble.emit (events.js:129:20)
at Noble.onDiscover (/Users/aperritano/Box Sync/dev/uic-phd/NodeBeacon/node_modules/bleacon/node_modules/noble/lib/noble.js:141:10)
at emit (events.js:118:17)
at null. (/Users/aperritano/Box Sync/dev/uic-phd/NodeBeacon/node_modules/bleacon/node_modules/noble/lib/mac/yosemite.js:174:12)
at /Users/aperritano/Box Sync/dev/uic-phd/NodeBeacon/node_modules/bleacon/node_modules/noble/lib/mac/uuid-to-address.js:22:5
at tryParseBuffer (/Users/aperritano/Box Sync/dev/uic-phd/NodeBeacon/node_modules/bleacon/node_modules/noble/node_modules/bplist-p

estimote-sticker real time

Hello every one,

I was wondering if it is poiible to connect to the sticker (like the estimote APP does) and have the readings in real time.

In the estimote app it is pretty insane how fast the motion values are being updated.

If any one has tried it, what is the battery impact?

Thank you in advance,

Regards ,

Morgan

temperature at estimote

Thanks for the great library!

I have three Estimote beacons and found them with Estimote.discoverAll().
They must have different temperatures but each result of readTemperature() is 255.99609375.
It looks weird. Do you have any idea to fix it?

Feature request: Windows support

Here is my output when tring to install on windows.

C:\Users\sblowes\Desktop\beacon>npm install bleacon
/
> [email protected] install C:\Users\sblowes\Desktop\beacon\node_modules\bleacon\node
_modules\bignum
> node-gyp configure build


C:\Users\sblowes\Desktop\beacon\node_modules\bleacon\node_modules\bignum>if not
defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\np
m\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build
 )  else (configure build )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  bignum.cc
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc [C:\Users\sblowes\Desktop\beacon\node_modules\bleacon\node_module
s\bignum\build\bignum.vcxproj]
..\bignum.cc(9): fatal error C1083: Cannot open include file: 'openssl/bn.h': N
o such file or directory [C:\Users\sblowes\Desktop\beacon\node_modules\bleacon\
node_modules\bignum\build\bignum.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_mo
dules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\nod
e_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build"
gyp ERR! cwd C:\Users\sblowes\Desktop\beacon\node_modules\bleacon\node_modules\b
ignum
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (
x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bleacon"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: bleno
@0.1.13
npm ERR! notsup Valid OS:    darwin,linux
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: ia32

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\sblowes\Desktop\beacon\npm-debug.log

Estimote.discoverAll() leaks and misses discovering devices

Estimote.discoverAll () leaks as it repeatedly discovers the same devices over and over again. Setting SCANDUPLICATES to false causes it to miss when a device goes out of range and returns.

Would be more useful if it returned an array of all currently visible estimote devices as some of the other noble functions do.

beacon communication between 2 galileo

Hi i am trying to connect two galileos using beacon but discover and adverting dont fing ench other... how can i use to communicate beetwhenn galileos? this is my code in both galileos:

var Bleacon = require('bleacon');
console.log("START");

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

Bleacon.startScanning();
console.log("start scaning");
//Bleacon.startScanning('e2c56db5dffb48d2b060d0f5a71096e0', 0, 0);
console.log("start adverting");
Bleacon.startAdvertising(uuid, major, minor, measuredPower);
Bleacon.on('discover', function (bleacon) {
console.log("discover");
console.log(bleacon);
});

Estimote sticker movement

I noticed that the regular estimote has a way to subscribe to motion changes ...

estimote.subscribeMotion(callback(error));

I tried to use this with the estimote stickers, but that didn't work. I expected this since I noticed there is separate code for estimote stickers. That code however does not include any way to subscribe to motion events. Is there a way to do this with estimote stickers?

Memoryleak with EstimoteSticker?

Here is a small, minimal test script which seems to expose a memory leak:

https://gist.github.com/T-X/99b18a3bb1667568245f823dcd19149f

I am running it via:

$ NOBLE_REPORT_ALL_HCI_EVENTS=1 node --expose-gc ./test-leak.js

Resulting in heapdump files like these:

http://metameute.de/~tux/bugreport/node-bleacon/heapdump-2016-06-25/

The first one is from after one minute of runtime, the second one at 30min. runtime, the last one at 60min.

Looking at them via the chromium profiler, it seems that after one hour there are more than 110'000 objects which look like:

{ advertisement, __proto__, address, addressType }

The heapUsed console log output grows constantly, too (one line per minute):

xxx heapUsed:5583776
xxx heapUsed:6281624
xxx heapUsed:6588352
xxx heapUsed:6953632
xxx heapUsed:7267560
xxx heapUsed:7628656
xxx heapUsed:8016104
xxx heapUsed:10719920
xxx heapUsed:11081072
xxx heapUsed:11426216
xxx heapUsed:11775760
xxx heapUsed:12042152
xxx heapUsed:12422480
...

The phyisical setup contains 21 Estimote stickers in range of the bluetooth dongle.

Beacons no longer detected on El Capitan

A script using bleacon working perfectly no longer works on El Capitan GM.

When running the following

Bleacon.on('discover', function(bleacon){
  console.log("monkey");
  console.log(bleacon.uuid);
});
Bleacon.startScanning("3ddd37e386d1487e9f4aba1dbf64d274");

nothing is detected on OS X El Capitan, while the exact same script (verified via git) on a raspberry detects the correct iBeacon immediately.

The script worked fine on Yosemite and Maverick.

Specs

I am curious, where did you find the iBeacon protocol/specs?

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.