sandeepmistry / node-bleacon

A Node.js library for creating, discovering, and configuring iBeacons
MIT License
498 stars 88 forks source link

rssi / accuracy issues #26

Closed virgilvox closed 9 years ago

virgilvox commented 9 years ago

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';
      }
virgilvox commented 9 years ago

I just tested by install previous version of bleacon. I'm getting rssi now. The problem is advertisement object is being passed to rssi for some reason :/ Might be an issue in noble not bleacon.

sandeepmistry commented 9 years ago

@virgilvox I've corrected and published a new version of noble to npm.