简体   繁体   中英

Bluetooth Discovery vs Connection

So in my quest to obtain a constantly updating RSSI value, I have been forced to resort to this inefficient method. I've tried using bluecove 2.1.1, but it's given me some library errors and runtime errors that I do not want to waste anymore time dealing with. The developers guide defines discovery as the process of scanning for nearby, discoverable devices.

Is calling the method Intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE); during this time possible?

Or must the two devices establish a connection first for the above method to have any significance?

That is, for my poll() method, could I first save the MAC address of the device in question to some variable mac_addr, save the RSSI value to some variable my_rssi, then every time poll() is called, a new scan is run, and the device whose mac address matches that of mac_addr is targeted and updates the my_rssi field?

Exactly or better, you can only get the RSSI value during a device discovery scan. My MSc research thesis was about that topic. This is because an RSSI value during an active connection is not reliable (due to the nature of the RSSI value itself) and hence Google Android engineers did not expose it through the API.

Advantage of this:

  • You don't need an active connection and hence no pairing is required
  • Since there is no "piconet" involved, the number of devices you scan is possibly infinite

Disadvantages

  • Other bluetooth devices need to be discoverable (this is an issue, especially if you want to find other Android devices which have a max discoverability interval)
  • Continuous device discovery scans are a heavy process -> costs a lot of battery

The problem however with constantly executing a device discovery is that it consumes a lot of battery on the mobile device...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM