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

Unified Diff: device/bluetooth/bluetooth_gatt_connection_bluez.cc

Issue 1898643002: Refactor device::BluetoothGattXXX classes to split into remote/local. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « device/bluetooth/bluetooth_gatt_connection_bluez.h ('k') | device/bluetooth/bluetooth_gatt_descriptor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_gatt_connection_bluez.cc
diff --git a/device/bluetooth/bluetooth_gatt_connection_bluez.cc b/device/bluetooth/bluetooth_gatt_connection_bluez.cc
deleted file mode 100644
index 5b99b124aec378465a9272ec7ee43a5dd367829c..0000000000000000000000000000000000000000
--- a/device/bluetooth/bluetooth_gatt_connection_bluez.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/bluetooth/bluetooth_gatt_connection_bluez.h"
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-
-namespace bluez {
-
-BluetoothGattConnectionBlueZ::BluetoothGattConnectionBlueZ(
- scoped_refptr<device::BluetoothAdapter> adapter,
- const std::string& device_address,
- const dbus::ObjectPath& object_path)
- : BluetoothGattConnection(adapter.get(), device_address),
- connected_(true),
- object_path_(object_path) {
- DCHECK(adapter_.get());
- DCHECK(!device_address_.empty());
- DCHECK(object_path_.IsValid());
-
- bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
-}
-
-BluetoothGattConnectionBlueZ::~BluetoothGattConnectionBlueZ() {
- bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
- this);
- Disconnect();
-}
-
-bool BluetoothGattConnectionBlueZ::IsConnected() {
- // Lazily determine the activity state of the connection. If already
- // marked as inactive, then return false. Otherwise, explicitly mark
- // |connected_| as false if the device is removed or disconnected. We do this,
- // so that if this method is called during a call to DeviceRemoved or
- // DeviceChanged somewhere else, it returns the correct status.
- if (!connected_)
- return false;
-
- bluez::BluetoothDeviceClient::Properties* properties =
- bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
- object_path_);
- if (!properties || !properties->connected.value())
- connected_ = false;
-
- return connected_;
-}
-
-void BluetoothGattConnectionBlueZ::Disconnect() {
- if (!connected_) {
- VLOG(1) << "Connection already inactive.";
- return;
- }
-
- connected_ = false;
- BluetoothGattConnection::Disconnect();
-}
-
-void BluetoothGattConnectionBlueZ::DeviceRemoved(
- const dbus::ObjectPath& object_path) {
- if (object_path != object_path_)
- return;
-
- connected_ = false;
-}
-
-void BluetoothGattConnectionBlueZ::DevicePropertyChanged(
- const dbus::ObjectPath& object_path,
- const std::string& property_name) {
- if (object_path != object_path_)
- return;
-
- if (!connected_)
- return;
-
- bluez::BluetoothDeviceClient::Properties* properties =
- bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
- object_path_);
-
- if (!properties) {
- connected_ = false;
- return;
- }
-
- if (property_name == properties->connected.name() &&
- !properties->connected.value())
- connected_ = false;
-
- // The remote device's bluetooth address may change if it is paired while
- // connected.
- if (property_name == properties->address.name())
- device_address_ = properties->address.value();
-}
-
-} // namespace bluez
« no previous file with comments | « device/bluetooth/bluetooth_gatt_connection_bluez.h ('k') | device/bluetooth/bluetooth_gatt_descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698