Commit e068840a authored by Jan Wilken Doerrie's avatar Jan Wilken Doerrie Committed by Commit Bot

[Bluetooth][WinRT] Perform Explicit Connection Check

This change contains a small fix to perform an explicit connection check
after receiving a BluetoothLEDevice instance. This is necessary for
paired devices, where the connection handler gets registered too late to
get notified of the initial GATT connection initiated by the OS.

Bug: 821766
Change-Id: Ic022035f101324daa9a0772940740550e948e5fb
Reviewed-on: https://chromium-review.googlesource.com/1154920Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579338}
parent 1daa0d78
......@@ -344,6 +344,13 @@ void BluetoothDeviceWinrt::OnFromBluetoothAddress(
base::BindRepeating(&BluetoothDeviceWinrt::OnConnectionStatusChanged,
weak_ptr_factory_.GetWeakPtr()));
// For paired devices the OS immediately establishes a GATT connection after
// the first advertisement. In this case our handler is registered too late to
// catch the initial connection changed event, and we need to perform an
// explicit check ourselves.
if (IsGattConnected())
DidConnectGatt();
if (gatt_services_changed_token_) {
RemoveGattServicesChangedHandler(ble_device_.Get(),
*gatt_services_changed_token_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment