| Index: device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h
|
| diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h
|
| index e46ddf9903974678918644e827f1c24e7e5d862b..4f9d1227bfd407e05ce77d71b0363143a2fd97b8 100644
|
| --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h
|
| +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h
|
| @@ -7,17 +7,17 @@
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| -
|
| -#include <map>
|
| #include <queue>
|
| #include <string>
|
| #include <utility>
|
| #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_characteristic.h"
|
| +#include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h"
|
| #include "device/bluetooth/bluetooth_uuid.h"
|
| #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
|
|
|
| @@ -30,37 +30,31 @@ class BluetoothGattService;
|
|
|
| namespace bluez {
|
|
|
| -class BluetoothRemoteGattDescriptorBlueZ;
|
| +class BluetoothGattDescriptorBlueZ;
|
| class BluetoothRemoteGattServiceBlueZ;
|
|
|
| // The BluetoothRemoteGattCharacteristicBlueZ class implements
|
| // BluetoothGattCharacteristic for remote GATT characteristics for platforms
|
| // that use BlueZ.
|
| class BluetoothRemoteGattCharacteristicBlueZ
|
| - : public device::BluetoothGattCharacteristic,
|
| - public bluez::BluetoothGattDescriptorClient::Observer {
|
| + : public BluetoothGattCharacteristicBlueZ,
|
| + public BluetoothGattDescriptorClient::Observer {
|
| public:
|
| // device::BluetoothGattCharacteristic overrides.
|
| - std::string GetIdentifier() const override;
|
| device::BluetoothUUID GetUUID() const override;
|
| bool IsLocal() const override;
|
| const std::vector<uint8_t>& GetValue() const override;
|
| - device::BluetoothGattService* GetService() const override;
|
| Properties GetProperties() const override;
|
| - Permissions GetPermissions() const override;
|
| bool IsNotifying() const override;
|
| - std::vector<device::BluetoothGattDescriptor*> GetDescriptors() const override;
|
| - device::BluetoothGattDescriptor* GetDescriptor(
|
| - const std::string& identifier) const override;
|
| bool AddDescriptor(device::BluetoothGattDescriptor* descriptor) override;
|
| bool UpdateValue(const std::vector<uint8_t>& value) override;
|
| + void StartNotifySession(const NotifySessionCallback& callback,
|
| + const ErrorCallback& error_callback) override;
|
| void ReadRemoteCharacteristic(const ValueCallback& callback,
|
| const ErrorCallback& error_callback) override;
|
| void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override;
|
| - void StartNotifySession(const NotifySessionCallback& callback,
|
| - const ErrorCallback& error_callback) override;
|
|
|
| // Removes one value update session and invokes |callback| on completion. This
|
| // decrements the session reference count by 1 and if the number reaches 0,
|
| @@ -68,14 +62,11 @@ class BluetoothRemoteGattCharacteristicBlueZ
|
| // characteristic.
|
| void RemoveNotifySession(const base::Closure& callback);
|
|
|
| - // Object path of the underlying D-Bus characteristic.
|
| - const dbus::ObjectPath& object_path() const { return object_path_; }
|
| -
|
| private:
|
| friend class BluetoothRemoteGattServiceBlueZ;
|
|
|
| - typedef std::pair<NotifySessionCallback, ErrorCallback>
|
| - PendingStartNotifyCall;
|
| + using PendingStartNotifyCall =
|
| + std::pair<NotifySessionCallback, ErrorCallback>;
|
|
|
| BluetoothRemoteGattCharacteristicBlueZ(
|
| BluetoothRemoteGattServiceBlueZ* service,
|
| @@ -88,12 +79,6 @@ class BluetoothRemoteGattCharacteristicBlueZ
|
| void GattDescriptorPropertyChanged(const dbus::ObjectPath& object_path,
|
| const std::string& property_name) override;
|
|
|
| - // Called by dbus:: on unsuccessful completion of a request to read or write
|
| - // the characteristic value.
|
| - void OnError(const ErrorCallback& error_callback,
|
| - const std::string& error_name,
|
| - const std::string& error_message);
|
| -
|
| // Called by dbus:: on successful completion of a request to start
|
| // notifications.
|
| void OnStartNotifySuccess(const NotifySessionCallback& callback);
|
| @@ -117,11 +102,11 @@ class BluetoothRemoteGattCharacteristicBlueZ
|
| // Calls StartNotifySession for each queued request.
|
| void ProcessStartNotifyQueue();
|
|
|
| - // Object path of the D-Bus characteristic object.
|
| - dbus::ObjectPath object_path_;
|
| -
|
| - // The GATT service this GATT characteristic belongs to.
|
| - BluetoothRemoteGattServiceBlueZ* service_;
|
| + // Called by dbus:: on unsuccessful completion of a request to read or write
|
| + // the characteristic value.
|
| + void OnError(const ErrorCallback& error_callback,
|
| + const std::string& error_name,
|
| + const std::string& error_message);
|
|
|
| // The total number of currently active value update sessions.
|
| size_t num_notify_sessions_;
|
| @@ -133,14 +118,6 @@ class BluetoothRemoteGattCharacteristicBlueZ
|
| // True, if a Start or Stop notify call to bluetoothd is currently pending.
|
| bool notify_call_pending_;
|
|
|
| - // Mapping from GATT descriptor object paths to descriptor objects owned by
|
| - // this characteristic. Since the BlueZ implementation uses object paths
|
| - // as unique identifiers, we also use this mapping to return descriptors by
|
| - // identifier.
|
| - typedef std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorBlueZ*>
|
| - DescriptorMap;
|
| - DescriptorMap descriptors_;
|
| -
|
| // 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<BluetoothRemoteGattCharacteristicBlueZ>
|
|
|