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

Unified Diff: device/bluetooth/bluetooth_gatt_connection_chromeos.cc

Issue 1341103004: Handle change of BLE address after pairing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ***ADDED BY MISTAKE, OMMIT *** Created 5 years, 3 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 | « device/bluetooth/bluetooth_gatt_connection_chromeos.h ('k') | device/bluetooth/test/bluetooth_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_gatt_connection_chromeos.cc
diff --git a/device/bluetooth/bluetooth_gatt_connection_chromeos.cc b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
index 57aaa4d399ad5248704e5076bfd979ed8094bc62..b01389454dc839d7e6f8e2fae62ee5937a0a30ab 100644
--- a/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
@@ -15,8 +15,9 @@ namespace chromeos {
BluetoothGattConnectionChromeOS::BluetoothGattConnectionChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter,
const std::string& device_address,
- const dbus::ObjectPath& object_path)
- : BluetoothGattConnection(adapter.get(), device_address),
+ const dbus::ObjectPath& object_path,
+ bool in_progress)
+ : BluetoothGattConnection(adapter.get(), device_address, in_progress),
connected_(true),
object_path_(object_path) {
DCHECK(adapter_.get());
@@ -51,18 +52,17 @@ bool BluetoothGattConnectionChromeOS::IsConnected() {
}
void BluetoothGattConnectionChromeOS::Disconnect() {
- if (!connected_) {
+ if (!connected_ && in_progress_) {
+ VLOG(1) << "Connection aborted during establishment.";
+ return;
+ }
+
+ if (!connected_ && !in_progress_) {
VLOG(1) << "Connection already inactive.";
return;
}
- // TODO(armansito): There isn't currently a good way to manage the ownership
- // of a connection between Chrome and bluetoothd plugins/profiles. Until
- // a proper reference count is kept by bluetoothd, we might unwittingly kill
- // a connection that is managed by the daemon (e.g. HoG). For now, just return
- // success to indicate that this BluetoothGattConnection is no longer active,
- // even though the underlying connection won't actually be disconnected. This
- // technically doesn't violate the contract put forth by this API.
+ BluetoothGattConnection::Disconnect();
connected_ = false;
}
@@ -92,9 +92,14 @@ void BluetoothGattConnectionChromeOS::DevicePropertyChanged(
return;
}
- if (property_name == properties->connected.name() &&
- !properties->connected.value())
- connected_ = false;
+ if (property_name == properties->connected.name()) {
+ if (properties->connected.value()) {
+ connected_ = true;
+ in_progress_ = false;
+ } else {
+ connected_ = false;
+ }
+ }
// The remote device's bluetooth address may change if it is paired while
// connected.
« no previous file with comments | « device/bluetooth/bluetooth_gatt_connection_chromeos.h ('k') | device/bluetooth/test/bluetooth_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698