| 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..19e040f64e78eda06bfe795db58f57c12e4a826f 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,45 @@
|
| #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::BluetoothUUID GetUUID() const override;
|
| - bool IsLocal() const override;
|
| - const std::vector<uint8_t>& GetValue() const override;
|
| Properties GetProperties() const override;
|
| + Permissions GetPermissions() const override;
|
| +
|
| + // device::BluetoothRemoteGattCharacteristic overrides.
|
| + const std::vector<uint8_t>& GetValue() const override;
|
| + device::BluetoothRemoteGattService* GetService() const override;
|
| bool IsNotifying() const override;
|
| - bool AddDescriptor(device::BluetoothGattDescriptor* descriptor) override;
|
| - bool UpdateValue(const std::vector<uint8_t>& value) override;
|
| + std::vector<device::BluetoothRemoteGattDescriptor*> GetDescriptors()
|
| + const override;
|
| + device::BluetoothRemoteGattDescriptor* GetDescriptor(
|
| + const std::string& identifier) const override;
|
| void StartNotifySession(const NotifySessionCallback& callback,
|
| const ErrorCallback& error_callback) override;
|
| void ReadRemoteCharacteristic(const ValueCallback& callback,
|
| @@ -118,6 +127,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 +151,4 @@ class BluetoothRemoteGattCharacteristicBlueZ
|
|
|
| } // namespace bluez
|
|
|
| -#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
|
| +#endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
|
|
|