[quoted lines by Robert Pösel on 2018/03/06 at 10:15 +0100] >while reading Android documentation I come to this recommendation: > >"Note: You should always call cancelDiscovery() to ensure that the >device isn't performing device discovery before you call connect(). >If discovery is in progress, then the connection attempt is >significantly slowed, and it's more likely to fail." >(https://developer.android.com/guide/topics/connectivity/bluetooth.html)
Since brltty doesn't do discovery (it only connects to already-paired devices), and since discovery is a rare action, arbitrarily cancelling discovery is a surprise that I don't believe we should be inflicting on people. :-) I think it's rather unlikely that someone would be trying to connect to a braille device and doing Bluetooth discovery at the same time. >I don't see any call to BluetoothAdapter.cancelDiscovery() so it >might be good idea to add it? On the other hand, since you are >calling the connect() method repeatedly every few seconds, it would >mean that bluetooth discovery will never have a chance to finish (as >cancelling it has global effect for whole system). So unless this >automatic repeated connection will be rewritten somehow, current way >without cancelDiscovery() is perhaps okay? Yes, I think cancelling discovery wouldn't be a good thing to do. >what about power consumption and battery life regarding these >repeated connection attempts? Do you know if it has any impact or is >it "safe" to use this way? I agree with you that retrying every few seconds isn't nice, but I haven't yet come up with a better way to do it. There's no obvious way for brltty to know that a new Bluetooth device has been turned on, come within range, etc. Note that brltty doesn't try while the Android device is locked. This itself goes a long way to not needlessly draining the battery, although the main reason it's done that way is to allow a person to switch between devices (lock one, awaken another). So, the only time when brltty is retrying is when it isn't yet connected to a braille device while the Android device is awake. -- I believe the Bible to be the very Word of God: http://Mielke.cc/bible/ Dave Mielke | 2213 Fox Crescent | WebHome: http://Mielke.cc/ EMail: [email protected] | Ottawa, Ontario | Twitter: @Dave_Mielke Phone: 1-613-726-0014 | Canada K2A 1H7 | _______________________________________________ This message was sent via the BRLTTY mailing list. To post a message, send an e-mail to: [email protected] For general information, go to: http://brltty.com/mailman/listinfo/brltty
