evothings / cordova-ble

Bluetooth Low Energy plugin for Cordova
http://www.evothings.com/
Apache License 2.0
243 stars 103 forks source link

one device is being polled more than the others #56

Closed userfive closed 9 years ago

userfive commented 9 years ago

I'm trying to find the closest beacons, and I've ran into an issue where one device is being found more than the others. In the following:

evothings.ble.startScan(function(device) {
  if (device.rssi <= 0) callbackFun(device, null)

device.address tends to not change. Has this issue been discovered before, and how did you get around it? If it hasn't been seen before, what are some ways that I might get around it?

Thank you.

userfive commented 9 years ago

To make it a little more clear, the device is being scanned way, way more than the others, so my code isn't giving me an accurate reading of which devices are closest since the rssi of other devices is rarely read.

fredrikeldh commented 9 years ago

BLE scanning does not work by polling. The scanner is a passive listener that listens to advertisements from the scannees. Your "one device" may be set to advertise more often than the others. Alternatively, it may be closer to your scanning device, so that advertisements from the other devices are being lost in radio noise.

It is also worth mentioning that BLE and WiFi operates on the same 2.4Ghz band, and will interfere with each other.