Chromium Code Reviews| Index: device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h |
| diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h b/device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h |
| similarity index 72% |
| rename from device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h |
| rename to device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h |
| index 4f9d1227bfd407e05ce77d71b0363143a2fd97b8..470a2551d030ec03d67c97508ac28dff254c0d9f 100644 |
| --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h |
| +++ b/device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h |
| @@ -1,12 +1,13 @@ |
| -// 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_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ |
| -#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ |
| +#ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ |
| +#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ |
| #include <stddef.h> |
| #include <stdint.h> |
| +#include <map> |
| #include <queue> |
| #include <string> |
| #include <utility> |
| @@ -17,37 +18,43 @@ |
| #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_remote_gatt_service.h" |
| #include "device/bluetooth/bluetooth_uuid.h" |
| +#include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h" |
| #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h" |
| namespace device { |
| -class BluetoothGattDescriptor; |
| -class BluetoothGattService; |
| +class BluetoothRemoteGattDescriptor; |
| +class BluetoothRemoteGattService; |
| } // namespace device |
| namespace bluez { |
| -class BluetoothGattDescriptorBlueZ; |
| +class BluetoothRemoteGattDescriptorBlueZ; |
| class BluetoothRemoteGattServiceBlueZ; |
| // The BluetoothRemoteGattCharacteristicBlueZ class implements |
| -// BluetoothGattCharacteristic for remote GATT characteristics for platforms |
| +// BluetoothRemoteGattCharacteristic for remote GATT characteristics for |
| +// platforms |
| // that use BlueZ. |
| class BluetoothRemoteGattCharacteristicBlueZ |
| : public BluetoothGattCharacteristicBlueZ, |
| - public BluetoothGattDescriptorClient::Observer { |
| + public BluetoothGattDescriptorClient::Observer, |
| + public device::BluetoothRemoteGattCharacteristic { |
| public: |
| - // device::BluetoothGattCharacteristic overrides. |
| + // device::BluetoothRemoteGattCharacteristic overrides. |
| + device::BluetoothRemoteGattService* GetService() const override; |
|
scheib
2016/04/20 01:23:30
Order these to match bluetooth_remote_gatt_charact
rkc
2016/04/20 16:31:54
Done.
|
| + Permissions GetPermissions() const override; |
| + std::vector<device::BluetoothRemoteGattDescriptor*> GetDescriptors() |
| + const override; |
| + device::BluetoothRemoteGattDescriptor* GetDescriptor( |
| + const std::string& identifier) const override; |
| device::BluetoothUUID GetUUID() const override; |
| - bool IsLocal() const override; |
| const std::vector<uint8_t>& GetValue() const override; |
| Properties GetProperties() const override; |
| bool IsNotifying() 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, |
| @@ -118,6 +125,20 @@ class BluetoothRemoteGattCharacteristicBlueZ |
| // True, if a Start or Stop notify call to bluetoothd is currently pending. |
| bool notify_call_pending_; |
| + // TODO(rkc): Investigate and fix ownership of the descriptor objects in this |
| + // map. See crbug.com/604166. |
| + using DescriptorMap = |
| + std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorBlueZ*>; |
| + |
| + // 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. |
| + DescriptorMap descriptors_; |
| + |
| + // The GATT service this GATT characteristic belongs to. |
| + BluetoothRemoteGattServiceBlueZ* service_; |
| + |
| // 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> |
| @@ -128,4 +149,4 @@ class BluetoothRemoteGattCharacteristicBlueZ |
| } // namespace bluez |
| -#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ |
| +#endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ |