Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h

Issue 1113793002: Fix discovery of Smart Lock service in Proximity Auth over Blutooth Low Energy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eu_4
Patch Set: Nit Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
index 47c57279da2e3c37566cce3df8270825b333e35e..56ffc9d6171f299d1c60453d6218e44bdb3dd548 100644
--- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
+++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_CONNECTION_FINDER_H
#define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_CONNECTION_FINDER_H
+#include <set>
#include <string>
#include "base/callback.h"
@@ -34,10 +35,17 @@ class BluetoothLowEnergyConnectionFinder
connection_callback);
void Find(const ConnectionCallback& connection_callback) override;
+ // Closes the connection and forgets the device.
+ void CloseConnection(scoped_ptr<device::BluetoothGattConnection> connection);
+
protected:
// device::BluetoothAdapter::Observer:
void DeviceAdded(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) override;
+ void DeviceChanged(device::BluetoothAdapter* adapter,
+ device::BluetoothDevice* device) override;
+ void DeviceRemoved(device::BluetoothAdapter* adapter,
+ device::BluetoothDevice* device) override;
private:
// Callback to be called when the Bluetooth adapter is initialized.
@@ -45,7 +53,7 @@ class BluetoothLowEnergyConnectionFinder
// Checks if |remote_device| contains |remote_service_uuid| and creates a
// connection in that case.
- void HandleDeviceAdded(device::BluetoothDevice* remote_device);
+ void HandleDeviceUpdated(device::BluetoothDevice* remote_device);
// Callback called when a new discovery session is started.
void OnDiscoverySessionStarted(
@@ -71,6 +79,7 @@ class BluetoothLowEnergyConnectionFinder
// Callback called when there is an error creating the connection.
void OnCreateConnectionError(
+ std::string device_address,
device::BluetoothDevice::ConnectErrorCode error_code);
// Callback called when the connection is created.
@@ -90,12 +99,16 @@ class BluetoothLowEnergyConnectionFinder
// The discovery session associated to this object.
scoped_ptr<device::BluetoothDiscoverySession> discovery_session_;
- // True if there is a connection.
+ // True if a connection was established to a remote device that has the
+ // service |remote_service_uuid|.
bool connected_;
// Callback called when the connection is established.
device::BluetoothDevice::GattConnectionCallback connection_callback_;
+ // The set of devices this connection finder has tried to connect to.
+ std::set<device::BluetoothDevice*> pending_connections_;
+
base::WeakPtrFactory<BluetoothLowEnergyConnectionFinder> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnectionFinder);
« no previous file with comments | « no previous file | components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698