comboctl-android: Remove some obsolete / unnecessary / solved TODOs

* device is unpaired while discovery is ongoing" does not happen because
  discovery only occurs if no device is paired.
* Using the second offered BluetoothDevice works reliably on all tested
  phones so far.
* AndroidBluetoothDevice throws a BluetoothException if all of its
  internal connect attempts fail.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
Carlos Rafael Giani 2022-12-10 18:49:12 +01:00
parent 6ecc1073df
commit e06ecaa7d8
2 changed files with 3 additions and 9 deletions

View file

@ -67,8 +67,9 @@ class AndroidBluetoothDevice(
// just yet (for example because the UI is still shown on the LCD), while
// the retryBlocking loop here is in place because the _Android device_
// may not be ready to connect right away.
// TODO: Test and define what happens when all attempts failed.
// The user needs to be informed and given the choice to try again.
// When all attempts fail, retryBlocking() lets the exception pass through.
// That exception is wrapped in BluetoothException, which then needs to be
// handled by the caller.
val totalNumAttempts = 5
retryBlocking(numberOfRetries = totalNumAttempts, delayBetweenRetries = 100) { attemptNumber, previousException ->
if (abortConnectAttempt)

View file

@ -381,13 +381,6 @@ class AndroidBluetoothInterface(private val androidContext: Context) : Bluetooth
// instance was already processed. This check here instead
// verifies if we have seen the same Bluetooth address on
// *different* Android Bluetooth device instances.
// TODO: Test how AndroidBluetoothInterface behaves if the
// device is unpaired while discovery is ongoing (manually by
// the user for example). In theory, this should be handled
// properly by the onBondStateChanged function below.
// TODO: This check may not be necessary on all Android
// devices. On some, it seems to also work if we use the
// first offered BluetoothDevice.
if (comboctlBtAddress !in previouslyDiscoveredDevices) {
previouslyDiscoveredDevices[comboctlBtAddress] = androidBtDevice
logger(LogLevel.DEBUG) {