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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc

Issue 1367663002: Add Linux support for the Bluetooth API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor_dbus
Patch Set: rebase 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
Index: device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc
similarity index 65%
rename from device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
rename to device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc
index f864c3be1464f91fdcd9a9a2038c567c3bab0e31..4bf9ab053ef53eb3f063e3d12f529268ab8f1426 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
-#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-namespace chromeos {
+namespace bluez {
namespace {
@@ -28,8 +28,8 @@ std::ostream& operator<<(std::ostream& out, const std::vector<uint8> bytes) {
} // namespace
-BluetoothRemoteGattDescriptorChromeOS::BluetoothRemoteGattDescriptorChromeOS(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+BluetoothRemoteGattDescriptorBlueZ::BluetoothRemoteGattDescriptorBlueZ(
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic,
const dbus::ObjectPath& object_path)
: object_path_(object_path),
characteristic_(characteristic),
@@ -38,15 +38,13 @@ BluetoothRemoteGattDescriptorChromeOS::BluetoothRemoteGattDescriptorChromeOS(
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
}
-BluetoothRemoteGattDescriptorChromeOS::
- ~BluetoothRemoteGattDescriptorChromeOS() {
-}
+BluetoothRemoteGattDescriptorBlueZ::~BluetoothRemoteGattDescriptorBlueZ() {}
-std::string BluetoothRemoteGattDescriptorChromeOS::GetIdentifier() const {
+std::string BluetoothRemoteGattDescriptorBlueZ::GetIdentifier() const {
return object_path_.value();
}
-device::BluetoothUUID BluetoothRemoteGattDescriptorChromeOS::GetUUID() const {
+device::BluetoothUUID BluetoothRemoteGattDescriptorBlueZ::GetUUID() const {
bluez::BluetoothGattDescriptorClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
@@ -55,12 +53,11 @@ device::BluetoothUUID BluetoothRemoteGattDescriptorChromeOS::GetUUID() const {
return device::BluetoothUUID(properties->uuid.value());
}
-bool BluetoothRemoteGattDescriptorChromeOS::IsLocal() const {
+bool BluetoothRemoteGattDescriptorBlueZ::IsLocal() const {
return false;
}
-const std::vector<uint8>&
-BluetoothRemoteGattDescriptorChromeOS::GetValue() const {
+const std::vector<uint8>& BluetoothRemoteGattDescriptorBlueZ::GetValue() const {
bluez::BluetoothGattDescriptorClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
@@ -72,47 +69,47 @@ BluetoothRemoteGattDescriptorChromeOS::GetValue() const {
}
device::BluetoothGattCharacteristic*
-BluetoothRemoteGattDescriptorChromeOS::GetCharacteristic() const {
+BluetoothRemoteGattDescriptorBlueZ::GetCharacteristic() const {
return characteristic_;
}
device::BluetoothGattCharacteristic::Permissions
-BluetoothRemoteGattDescriptorChromeOS::GetPermissions() const {
+BluetoothRemoteGattDescriptorBlueZ::GetPermissions() const {
// TODO(armansito): Once BlueZ defines the permissions, return the correct
// values here.
return device::BluetoothGattCharacteristic::PERMISSION_NONE;
}
-void BluetoothRemoteGattDescriptorChromeOS::ReadRemoteDescriptor(
+void BluetoothRemoteGattDescriptorBlueZ::ReadRemoteDescriptor(
const ValueCallback& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "Sending GATT characteristic descriptor read request to "
- << "descriptor: " << GetIdentifier() << ", UUID: "
- << GetUUID().canonical_value();
+ << "descriptor: " << GetIdentifier()
+ << ", UUID: " << GetUUID().canonical_value();
bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
object_path_, callback,
- base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
+ base::Bind(&BluetoothRemoteGattDescriptorBlueZ::OnError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattDescriptorChromeOS::WriteRemoteDescriptor(
+void BluetoothRemoteGattDescriptorBlueZ::WriteRemoteDescriptor(
const std::vector<uint8>& new_value,
const base::Closure& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "Sending GATT characteristic descriptor write request to "
- << "characteristic: " << GetIdentifier() << ", UUID: "
- << GetUUID().canonical_value() << ", with value: "
- << new_value << ".";
+ << "characteristic: " << GetIdentifier()
+ << ", UUID: " << GetUUID().canonical_value()
+ << ", with value: " << new_value << ".";
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
->WriteValue(object_path_, new_value, callback,
- base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
+ base::Bind(&BluetoothRemoteGattDescriptorBlueZ::OnError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattDescriptorChromeOS::OnError(
+void BluetoothRemoteGattDescriptorBlueZ::OnError(
const ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -120,7 +117,7 @@ void BluetoothRemoteGattDescriptorChromeOS::OnError(
<< ", message: " << error_message;
error_callback.Run(
- BluetoothRemoteGattServiceChromeOS::DBusErrorToServiceError(error_name));
+ BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(error_name));
}
-} // namespace chromeos
+} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698