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

Unified Diff: device/bluetooth/bluetooth_gatt_descriptor.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
« no previous file with comments | « device/bluetooth/bluetooth_gatt_connection_bluez.cc ('k') | device/bluetooth/bluetooth_gatt_descriptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_gatt_descriptor.h
diff --git a/device/bluetooth/bluetooth_gatt_descriptor.h b/device/bluetooth/bluetooth_gatt_descriptor.h
index 317026885c8990319142b43ca701d0cca93f4913..b47b4a113fe0251a56aa8f3f0dd214463fae03bc 100644
--- a/device/bluetooth/bluetooth_gatt_descriptor.h
+++ b/device/bluetooth/bluetooth_gatt_descriptor.h
@@ -5,14 +5,14 @@
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_
#define DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_
-#include <stdint.h>
-
-#include <vector>
+#include <string>
#include "base/callback.h"
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_gatt_characteristic.h"
+#include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h"
namespace device {
@@ -27,10 +27,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptor {
typedef base::Callback<void(BluetoothGattService::GattErrorCode)>
ErrorCallback;
- // The ValueCallback is used to return the value of a remote characteristic
- // descriptor upon a read request.
- typedef base::Callback<void(const std::vector<uint8_t>&)> ValueCallback;
-
// The Bluetooth Specification declares several predefined descriptors that
// profiles can use. The following are definitions for the list of UUIDs
// and descriptions of the characteristic descriptors that they represent.
@@ -110,33 +106,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptor {
// characteristic.
// The API will construct a BluetoothGattDescriptor object for each instance
// of "Characteristic Presentation Format" descriptor per instance of
- // BluetoothGattCharacteristic that represents a remote characteristic.
+ // BluetoothRemoteGattCharacteristic that represents a remote characteristic.
// Similarly for local characteristics, implementations DO NOT need to create
// an instance of BluetoothGattDescriptor for this descriptor as this will be
// handled by the subsystem.
static const BluetoothUUID& CharacteristicAggregateFormatUuid();
- // Constructs a BluetoothGattDescriptor that can be associated with a local
- // GATT characteristic when the adapter is in the peripheral role. To
- // associate the returned descriptor with a characteristic, add it to a local
- // characteristic by calling BluetoothGattCharacteristic::AddDescriptor.
- //
- // This method constructs a characteristic descriptor with UUID |uuid| and the
- // initial cached value |value|. |value| will be cached and returned for read
- // requests and automatically modified for write requests by default, unless
- // an instance of BluetoothGattService::Delegate has been provided to the
- // associated BluetoothGattService instance, in which case the delegate will
- // handle the read and write requests.
- //
- // Currently, only custom UUIDs, |kCharacteristicDescriptionUuid|, and
- // |kCharacteristicPresentationFormat| are supported for locally hosted
- // descriptors. This method will return NULL if |uuid| is any one of the
- // unsupported predefined descriptor UUIDs.
- static BluetoothGattDescriptor* Create(
- const BluetoothUUID& uuid,
- const std::vector<uint8_t>& value,
- BluetoothGattCharacteristic::Permissions permissions);
-
// Identifier used to uniquely identify a GATT descriptor object. This is
// different from the descriptor UUID: while multiple descriptors with the
// same UUID can exist on a Bluetooth device, the identifier returned from
@@ -147,38 +122,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptor {
// The Bluetooth-specific UUID of the characteristic descriptor.
virtual BluetoothUUID GetUUID() const = 0;
- // Returns true, if this characteristic descriptor is hosted locally. If
- // false, then this instance represents a remote descriptor.
- virtual bool IsLocal() const = 0;
-
- // Returns the value of the descriptor. For remote descriptors, this is the
- // most recently cached value of the remote descriptor. For local descriptors
- // this is the most recently updated value or the value retrieved from the
- // delegate.
- virtual const std::vector<uint8_t>& GetValue() const = 0;
-
- // Returns a pointer to the GATT characteristic that this characteristic
- // descriptor belongs to.
- virtual BluetoothGattCharacteristic* GetCharacteristic() const = 0;
-
// Returns the bitmask of characteristic descriptor attribute permissions.
virtual BluetoothGattCharacteristic::Permissions GetPermissions() const = 0;
- // Sends a read request to a remote characteristic descriptor to read its
- // value. |callback| is called to return the read value on success and
- // |error_callback| is called for failures.
- virtual void ReadRemoteDescriptor(const ValueCallback& callback,
- const ErrorCallback& error_callback) = 0;
-
- // Sends a write request to a remote characteristic descriptor, to modify the
- // value of the descriptor with the new value |new_value|. |callback| is
- // called to signal success and |error_callback| for failures. This method
- // only applies to remote descriptors and will fail for those that are locally
- // hosted.
- virtual void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value,
- const base::Closure& callback,
- const ErrorCallback& error_callback) = 0;
-
protected:
BluetoothGattDescriptor();
virtual ~BluetoothGattDescriptor();
« no previous file with comments | « device/bluetooth/bluetooth_gatt_connection_bluez.cc ('k') | device/bluetooth/bluetooth_gatt_descriptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698