Chromium Code Reviews| Index: device/bluetooth/bluetooth_gatt_characteristic.h |
| diff --git a/device/bluetooth/bluetooth_gatt_characteristic.h b/device/bluetooth/bluetooth_gatt_characteristic.h |
| index 6426c6df8f8c01d0a1a9dd944f918006252e0f4b..f280f682131a670b3c525d995a00172bd1cac2fe 100644 |
| --- a/device/bluetooth/bluetooth_gatt_characteristic.h |
| +++ b/device/bluetooth/bluetooth_gatt_characteristic.h |
| @@ -6,34 +6,24 @@ |
| #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_H_ |
| #include <stdint.h> |
| - |
| -#include <memory> |
| #include <string> |
| -#include <vector> |
| #include "base/callback.h" |
| +#include "base/callback_forward.h" |
| #include "base/macros.h" |
| #include "device/bluetooth/bluetooth_export.h" |
| #include "device/bluetooth/bluetooth_gatt_service.h" |
| -#include "device/bluetooth/bluetooth_uuid.h" |
| namespace device { |
| -class BluetoothGattDescriptor; |
| +class BluetoothRemoteGattDescriptor; |
| class BluetoothGattNotifySession; |
| // BluetoothGattCharacteristic represents a local or remote GATT characteristic. |
| // A GATT characteristic is a basic data element used to construct a GATT |
| // service. Hence, instances of a BluetoothGattCharacteristic are associated |
| -// with a BluetoothGattService. There are two ways in which this class is used: |
| -// |
| -// 1. To represent GATT characteristics that belong to a service hosted by a |
| -// remote device. In this case the characteristic will be constructed by |
| -// the subsystem. |
| -// 2. To represent GATT characteristics that belong to a locally hosted |
| -// service. To achieve this, users can construct instances of |
| -// BluetoothGattCharacteristic directly and add it to the desired |
| -// BluetoothGattService instance that represents a local service. |
| +// with a BluetoothRemoteGattService. There are two ways in which this class is |
| +// used: |
|
scheib
2016/04/20 01:23:30
Complete comment.
rkc
2016/04/20 16:31:53
Done.
|
| class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristic { |
| public: |
| // Values representing the possible properties of a characteristic, which |
| @@ -84,38 +74,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristic { |
| typedef base::Callback<void(BluetoothGattService::GattErrorCode)> |
| ErrorCallback; |
| - // The ValueCallback is used to return the value of a remote characteristic |
| - // upon a read request. |
| - typedef base::Callback<void(const std::vector<uint8_t>&)> ValueCallback; |
| - |
| - // The NotifySessionCallback is used to return sessions after they have |
| - // been successfully started. |
| - typedef base::Callback<void(std::unique_ptr<BluetoothGattNotifySession>)> |
| - NotifySessionCallback; |
| - |
| - // Constructs a BluetoothGattCharacteristic that can be associated with a |
| - // local GATT service when the adapter is in the peripheral role. To |
| - // associate the returned characteristic with a service, add it to a local |
| - // service by calling BluetoothGattService::AddCharacteristic. |
| - // |
| - // This method constructs a characteristic with UUID |uuid|, initial cached |
| - // value |value|, properties |properties|, and permissions |permissions|. |
| - // |value| will be cached and returned for read requests and automatically set |
| - // 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 read |
| - // and write requests. |
| - // |
| - // NOTE: Don't explicitly set |PROPERTY_EXTENDED_PROPERTIES| in |properties|. |
| - // Instead, create and add a BluetoothGattDescriptor that represents the |
| - // "Characteristic Extended Properties" descriptor and this will automatically |
| - // set the correspoding bit in the characteristic's properties field. If |
| - // |properties| has |PROPERTY_EXTENDED_PROPERTIES| set, it will be ignored. |
| - static BluetoothGattCharacteristic* Create(const BluetoothUUID& uuid, |
| - const std::vector<uint8_t>& value, |
| - Properties properties, |
| - Permissions permissions); |
| - |
| // Identifier used to uniquely identify a GATT characteristic object. This is |
| // different from the characteristic UUID: while multiple characteristics with |
| // the same UUID can exist on a Bluetooth device, the identifier returned from |
| @@ -123,96 +81,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristic { |
| // contents of the identifier are platform specific. |
| virtual std::string GetIdentifier() const = 0; |
| - // The Bluetooth-specific UUID of the characteristic. |
| - virtual BluetoothUUID GetUUID() const = 0; |
| - |
| - // Returns true, if this characteristic is hosted locally. If false, then this |
| - // instance represents a remote GATT characteristic. |
| - virtual bool IsLocal() const = 0; |
| - |
| - // Returns the value of the characteristic. For remote characteristics, this |
| - // is the most recently cached value. For local characteristics, 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 service this characteristic belongs to. |
| - virtual BluetoothGattService* GetService() const = 0; |
| - |
| - // Returns the bitmask of characteristic properties. |
| - virtual Properties GetProperties() const = 0; |
| - |
| - // Returns the bitmask of characteristic attribute permissions. |
| - virtual Permissions GetPermissions() const = 0; |
| - |
| - // Returns whether or not this characteristic is currently sending value |
| - // updates in the form of a notification or indication. |
| - virtual bool IsNotifying() const = 0; |
| - |
| - // Returns the list of GATT characteristic descriptors that provide more |
| - // information about this characteristic. |
| - virtual std::vector<BluetoothGattDescriptor*> |
| - GetDescriptors() const = 0; |
| - |
| - // Returns the GATT characteristic descriptor with identifier |identifier| if |
| - // it belongs to this GATT characteristic. |
| - virtual BluetoothGattDescriptor* GetDescriptor( |
| - const std::string& identifier) const = 0; |
| - |
| - // Returns the GATT characteristic descriptors that match |uuid|. There may be |
| - // multiple, as illustrated by Core Bluetooth Specification [V4.2 Vol 3 Part G |
| - // 3.3.3.5 Characteristic Presentation Format]. |
| - std::vector<BluetoothGattDescriptor*> GetDescriptorsByUUID( |
| - const BluetoothUUID& uuid); |
| - |
| - // Adds a characteristic descriptor to the locally hosted characteristic |
| - // represented by this instance. This method only makes sense for local |
| - // characteristics and won't have an effect if this instance represents a |
| - // remote GATT service and will return false. This method takes ownership |
| - // of |descriptor|. |
| - virtual bool AddDescriptor(BluetoothGattDescriptor* descriptor) = 0; |
| - |
| - // For locally hosted characteristics, updates the characteristic's value. |
| - // This will update the value that is visible to remote devices and send out |
| - // any notifications and indications that have been configured. This method |
| - // can be used in place of, and in conjunction with, |
| - // BluetoothGattService::Delegate methods to send updates to remote devices, |
| - // or simply to set update the cached value for read requests without having |
| - // to implement the delegate methods. |
| - // |
| - // This method only makes sense for local characteristics and does nothing and |
| - // returns false if this instance represents a remote characteristic. |
| - virtual bool UpdateValue(const std::vector<uint8_t>& value) = 0; |
| - |
| - // Starts a notify session for the remote characteristic, if it supports |
| - // notifications/indications. On success, the characteristic starts sending |
| - // value notifications and |callback| is called with a session object whose |
| - // ownership belongs to the caller. |error_callback| is called on errors. |
| - // |
| - // Writes to the Client Characteristic Configuration descriptor to enable |
| - // notifications/indications. Core Bluetooth Specification [V4.2 Vol 3 Part G |
| - // Section 3.3.1.1. Characteristic Properties] requires this descriptor to be |
| - // present when notifications/indications are supported. If the descriptor is |
| - // not present |error_callback| will be run. |
| - virtual void StartNotifySession(const NotifySessionCallback& callback, |
| - const ErrorCallback& error_callback) = 0; |
| - |
| - // Sends a read request to a remote characteristic to read its value. |
| - // |callback| is called to return the read value on success and |
| - // |error_callback| is called for failures. |
| - virtual void ReadRemoteCharacteristic( |
| - const ValueCallback& callback, |
| - const ErrorCallback& error_callback) = 0; |
| - |
| - // Sends a write request to a remote characteristic, to modify the |
| - // characteristic's value with the new value |new_value|. |callback| is |
| - // called to signal success and |error_callback| for failures. This method |
| - // only applies to remote characteristics and will fail for those that are |
| - // locally hosted. |
| - virtual void WriteRemoteCharacteristic( |
| - const std::vector<uint8_t>& new_value, |
| - const base::Closure& callback, |
| - const ErrorCallback& error_callback) = 0; |
| - |
| protected: |
| BluetoothGattCharacteristic(); |
| virtual ~BluetoothGattCharacteristic(); |