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

Unified Diff: device/bluetooth/bluez/bluetooth_remote_gatt_descriptor_bluez.h

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
Index: device/bluetooth/bluez/bluetooth_remote_gatt_descriptor_bluez.h
diff --git a/device/bluetooth/bluetooth_gatt_descriptor_bluez.h b/device/bluetooth/bluez/bluetooth_remote_gatt_descriptor_bluez.h
similarity index 46%
rename from device/bluetooth/bluetooth_gatt_descriptor_bluez.h
rename to device/bluetooth/bluez/bluetooth_remote_gatt_descriptor_bluez.h
index 388cf8b7cbfbb7767934f28074742f36a6d5f346..29114d109fbfd6e829b86a7d81a5cfea14ed05fe 100644
--- a/device/bluetooth/bluetooth_gatt_descriptor_bluez.h
+++ b/device/bluetooth/bluez/bluetooth_remote_gatt_descriptor_bluez.h
@@ -1,43 +1,38 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 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.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
+#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
#include <stdint.h>
-
#include <string>
#include <vector>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_gatt_descriptor.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
#include "device/bluetooth/bluetooth_uuid.h"
-
-namespace device {
-
-class BluetoothGattCharacteristic;
-
-} // namespace device
+#include "device/bluetooth/bluez/bluetooth_gatt_descriptor_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h"
namespace bluez {
-class BluetoothGattCharacteristicBlueZ;
-
// The BluetoothGattDescriptorBlueZ class implements
-// BluetoothGattDescriptor for remote and local GATT characteristic descriptors
-// for platforms that use BlueZ.
-class BluetoothGattDescriptorBlueZ : public device::BluetoothGattDescriptor {
+// BluetoothRemoteGattDescriptor for remote GATT characteristic descriptors for
+// platforms that use BlueZ.
+class BluetoothRemoteGattDescriptorBlueZ
+ : public BluetoothGattDescriptorBlueZ,
+ public device::BluetoothRemoteGattDescriptor {
public:
- // device::BluetoothGattDescriptor overrides.
- std::string GetIdentifier() const override;
+ // device::BluetoothRemoteGattDescriptor overrides.
device::BluetoothUUID GetUUID() const override;
- bool IsLocal() const override;
const std::vector<uint8_t>& GetValue() const override;
- device::BluetoothGattCharacteristic* GetCharacteristic() const override;
- device::BluetoothGattCharacteristic::Permissions GetPermissions()
+ device::BluetoothRemoteGattCharacteristic* GetCharacteristic() const override;
+ device::BluetoothRemoteGattCharacteristic::Permissions GetPermissions()
const override;
void ReadRemoteDescriptor(const ValueCallback& callback,
const ErrorCallback& error_callback) override;
@@ -45,16 +40,13 @@ class BluetoothGattDescriptorBlueZ : public device::BluetoothGattDescriptor {
const base::Closure& callback,
const ErrorCallback& error_callback) override;
- // Object path of the underlying D-Bus characteristic.
- const dbus::ObjectPath& object_path() const { return object_path_; }
-
private:
friend class BluetoothRemoteGattCharacteristicBlueZ;
- BluetoothGattDescriptorBlueZ(BluetoothGattCharacteristicBlueZ* characteristic,
- const dbus::ObjectPath& object_path,
- bool is_local);
- ~BluetoothGattDescriptorBlueZ() override;
+ BluetoothRemoteGattDescriptorBlueZ(
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic,
+ const dbus::ObjectPath& object_path);
+ ~BluetoothRemoteGattDescriptorBlueZ() override;
// Called by dbus:: on unsuccessful completion of a request to read or write
// the descriptor value.
@@ -62,22 +54,16 @@ class BluetoothGattDescriptorBlueZ : public device::BluetoothGattDescriptor {
const std::string& error_name,
const std::string& error_message);
- // Object path of the D-Bus descriptor object.
- dbus::ObjectPath object_path_;
-
// The GATT characteristic this descriptor belongs to.
- BluetoothGattCharacteristicBlueZ* characteristic_;
-
- // Is this a remote or local descriptor.
- bool is_local_;
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothGattDescriptorBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattDescriptorBlueZ> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorBlueZ);
};
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_

Powered by Google App Engine
This is Rietveld 408576698