New issue
Advanced search Search tips

Issue 728897 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug

Blocked on:
issue 728870

Blocking:
issue 630581


Show other hotlists

Hotlists containing this issue:
web-bluetooth


Sign in to add a comment

bluetooth: Use RetrieveGattConnectedDevices and fix Test interface

Project Member Reported by ortuno@chromium.org, Jun 2 2017

Issue description

Current State:

Usually once a device connects it stops advertising, which means we can't find the connected device anymore. For this reason Step 2 of "Scan for Devices"[1] requires us to retrieve all connected devices but there is currently no function to do so.

The best we can currently do is iterate over known devices and add the ones that are connected[2] which misses devices that have connected outside of Chrome.

The FakeBluetooth testing interface needs to:

1. Fake system connected devices, and
2. Accommodate Web Bluetooth's impl given that it is the interface's only client.

For this reason, when faking system connected devices the FakePeripheral will return true for IsGattConnected() even though the real implementation wouldn't. This allows for Web Bluetooth's impl to find these devices.

But this causes problems when Web Bluetooth tries to connect to the device: because IsGattConnected() returns true, our cross platform implementation of CreateGattConnection will skip the connection step and immediately succeed[3].

To avoid this issue and still allow Web Bluetooth to find these devices, FakePeripheral:

1. Marks peripherals as "system_connected" when a fake peripheral is added through SimulatePreconnectedPeripheral. "gatt_connected" stays false.
2. IsGattConnected() returns true if "system_connected" or "gatt_connected" are true.
3. Override CreateGattConnection to perform a connection if "gatt_connected" is false.

=======================================================

To resolve this issue:

1. Change WebBluetooth's impl to use RetrieveGattConnectedDevices.
2. Remove "system_connected" from FakePeripheral and return fake peripherals added through SimualtePreconnectedPeripheral when RetrieveGattConnectedDevices is called.
3. Remove FakePeripheral::CreateGattConnection now that IsGattConnected() no longer needs to return true for system connected devices.

[1] https://webbluetoothcg.github.io/web-bluetooth/#scan-for-devices
[2] https://cs.chromium.org/chromium/src/content/browser/bluetooth/bluetooth_device_chooser_controller.cc?sq=package:chromium&dr=C&l=493
[3] https://cs.chromium.org/chromium/src/device/bluetooth/bluetooth_device.cc?l=349
 
Description: Show this description
Project Member

Comment 2 by sheriffbot@chromium.org, Jun 4 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)
Hi guys, where are we on this issue?

On Mac, I still don't see paired devices in device chooser

Seems old patch sets (https://codereview.chromium.org/2513323002/ and https://codereview.chromium.org/2499913002/) are still open
see https://chromium.googlesource.com/chromium/src/+/master/content/browser/bluetooth/bluetooth_device_chooser_controller.cc#497

void BluetoothDeviceChooserController::PopulateConnectedDevices() {
  // TODO(crbug.com/728897): Use RetrieveGattConnectedDevices once implemented.
  for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
    if (device->IsGattConnected()) {
      AddFilteredDevice(*device);
    }
  }
}

Sign in to add a comment