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

Unified Diff: device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc

Issue 1914893002: DBus changes for implementing local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_classes
Patch Set: test leak fix 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
Index: device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
index 4e60936116640cd75356427cbc00cc3244769bf9..d30a9e059bc036adccfec08df3797eced37ad925 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
@@ -4,6 +4,7 @@
#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
+#include "base/callback.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
@@ -14,7 +15,7 @@ namespace bluez {
FakeBluetoothGattCharacteristicServiceProvider::
FakeBluetoothGattCharacteristicServiceProvider(
const dbus::ObjectPath& object_path,
- Delegate* delegate,
+ std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate,
const std::string& uuid,
const std::vector<std::string>& flags,
const std::vector<std::string>& permissions,
@@ -22,7 +23,7 @@ FakeBluetoothGattCharacteristicServiceProvider::
: object_path_(object_path),
uuid_(uuid),
service_path_(service_path),
- delegate_(delegate) {
+ delegate_(std::move(delegate)) {
VLOG(1) << "Creating Bluetooth GATT characteristic: " << object_path_.value();
DCHECK(object_path_.IsValid());
@@ -33,7 +34,6 @@ FakeBluetoothGattCharacteristicServiceProvider::
base::CompareCase::SENSITIVE));
// TODO(armansito): Do something with |flags| and |permissions|.
-
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
@@ -45,7 +45,6 @@ FakeBluetoothGattCharacteristicServiceProvider::
~FakeBluetoothGattCharacteristicServiceProvider() {
VLOG(1) << "Cleaning up Bluetooth GATT characteristic: "
<< object_path_.value();
-
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
@@ -60,11 +59,11 @@ void FakeBluetoothGattCharacteristicServiceProvider::SendValueChanged(
}
void FakeBluetoothGattCharacteristicServiceProvider::GetValue(
- const Delegate::ValueCallback& callback,
- const Delegate::ErrorCallback& error_callback) {
+ const device::BluetoothLocalGattService::Delegate::ValueCallback& callback,
+ const device::BluetoothLocalGattService::Delegate::ErrorCallback&
+ error_callback) {
VLOG(1) << "GATT characteristic value Get request: " << object_path_.value()
<< " UUID: " << uuid_;
-
// Check if this characteristic is registered.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
@@ -77,16 +76,16 @@ void FakeBluetoothGattCharacteristicServiceProvider::GetValue(
// Pass on to the delegate.
DCHECK(delegate_);
- delegate_->GetCharacteristicValue(callback, error_callback);
+ delegate_->GetValue(callback, error_callback);
}
void FakeBluetoothGattCharacteristicServiceProvider::SetValue(
const std::vector<uint8_t>& value,
const base::Closure& callback,
- const Delegate::ErrorCallback& error_callback) {
+ const device::BluetoothLocalGattService::Delegate::ErrorCallback&
+ error_callback) {
VLOG(1) << "GATT characteristic value Set request: " << object_path_.value()
<< " UUID: " << uuid_;
-
// Check if this characteristic is registered.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
@@ -99,7 +98,12 @@ void FakeBluetoothGattCharacteristicServiceProvider::SetValue(
// Pass on to the delegate.
DCHECK(delegate_);
- delegate_->SetCharacteristicValue(value, callback, error_callback);
+ delegate_->SetValue(value, callback, error_callback);
+}
+
+const dbus::ObjectPath&
+FakeBluetoothGattCharacteristicServiceProvider::object_path() const {
+ return object_path_;
}
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698