Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 10 #include "dbus/object_path.h" | |
| 11 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" | 12 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| 13 #include "device/bluetooth/bluetooth_local_gatt_service.h" | |
| 14 #include "device/bluetooth/bluetooth_uuid.h" | |
| 12 #include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h" | 15 #include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h" |
| 16 #include "device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.h" | |
| 13 | 17 |
| 14 namespace bluez { | 18 namespace bluez { |
| 15 | 19 |
| 16 class BluetoothLocalGattServiceBlueZ; | 20 class BluetoothLocalGattServiceBlueZ; |
| 17 | 21 |
| 18 // The BluetoothLocalGattCharacteristicBlueZ class implements | 22 // The BluetoothLocalGattCharacteristicBlueZ class implements |
| 19 // BluetoothLocalGattCharacteristic for local GATT characteristics for | 23 // BluetoothLocalGattCharacteristic for local GATT characteristics for |
| 20 // platforms that use BlueZ. | 24 // platforms that use BlueZ. |
| 21 class BluetoothLocalGattCharacteristicBlueZ | 25 class BluetoothLocalGattCharacteristicBlueZ |
| 22 : public BluetoothGattCharacteristicBlueZ, | 26 : public BluetoothGattCharacteristicBlueZ, |
| 23 public device::BluetoothLocalGattCharacteristic { | 27 public device::BluetoothLocalGattCharacteristic { |
| 24 public: | 28 public: |
| 29 static base::WeakPtr<device::BluetoothLocalGattCharacteristic> Create( | |
| 30 const device::BluetoothUUID& uuid, | |
| 31 BluetoothGattCharacteristic::Properties properties, | |
| 32 BluetoothGattCharacteristic::Permissions permissions, | |
| 33 device::BluetoothLocalGattService* service); | |
| 34 | |
| 35 BluetoothLocalGattCharacteristicBlueZ( | |
| 36 const device::BluetoothUUID& uuid, | |
| 37 BluetoothLocalGattServiceBlueZ* service); | |
| 38 ~BluetoothLocalGattCharacteristicBlueZ() override; | |
| 39 | |
| 40 // device::BluetoothLocalGattCharacteristic overrides. | |
| 41 device::BluetoothUUID GetUUID() const override; | |
| 42 Properties GetProperties() const override; | |
| 43 Permissions GetPermissions() const override; | |
| 44 | |
| 45 BluetoothLocalGattServiceBlueZ* GetService(); | |
| 46 | |
| 47 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& | |
| 48 GetDescriptors() const; | |
| 49 | |
| 25 private: | 50 private: |
| 26 friend class BluetoothLocalGattServiceBlueZ; | 51 friend class BluetoothLocalGattDescriptorBlueZ; |
| 52 friend device::BluetoothLocalGattCharacteristic; | |
|
scheib
2016/04/28 04:34:07
Why do the platform independent classes need frien
rkc
2016/04/28 05:07:23
Explained in comments.
Done.
| |
| 27 | 53 |
| 28 BluetoothLocalGattCharacteristicBlueZ(BluetoothLocalGattServiceBlueZ* service, | 54 // Adds a descriptor to this characteristic. |
| 29 const dbus::ObjectPath& object_path); | 55 void AddDescriptor( |
| 30 ~BluetoothLocalGattCharacteristicBlueZ() override; | 56 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor); |
| 57 | |
| 58 // UUID of this characteristic. | |
| 59 device::BluetoothUUID uuid_; | |
| 60 | |
| 61 // Service that contains this characteristic. | |
| 62 BluetoothLocalGattServiceBlueZ* service_; | |
| 63 | |
| 64 // Descriptors contained by this characteristic. | |
| 65 std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>> descriptors_; | |
| 31 | 66 |
| 32 // Note: This should remain the last member so it'll be destroyed and | 67 // Note: This should remain the last member so it'll be destroyed and |
| 33 // invalidate its weak pointers before any other members are destroyed. | 68 // invalidate its weak pointers before any other members are destroyed. |
| 34 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; | 69 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; |
| 35 | 70 |
| 36 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); | 71 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); |
| 37 }; | 72 }; |
| 38 | 73 |
| 39 } // namespace bluez | 74 } // namespace bluez |
| 40 | 75 |
| 41 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | 76 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ |
| OLD | NEW |