| 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_DESCRIPTOR_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" | 10 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| 11 #include "device/bluetooth/bluetooth_local_gatt_descriptor.h" | 11 #include "device/bluetooth/bluetooth_local_gatt_descriptor.h" |
| 12 #include "device/bluetooth/bluetooth_uuid.h" | 12 #include "device/bluetooth/bluetooth_uuid.h" |
| 13 #include "device/bluetooth/bluez/bluetooth_gatt_descriptor_bluez.h" | 13 #include "device/bluetooth/bluez/bluetooth_gatt_descriptor_bluez.h" |
| 14 | 14 |
| 15 namespace bluez { | 15 namespace bluez { |
| 16 | 16 |
| 17 class BluetoothLocalGattCharacteristicBlueZ; | 17 class BluetoothLocalGattCharacteristicBlueZ; |
| 18 | 18 |
| 19 // The BluetoothLocalGattDescriptorBlueZ class implements | 19 // The BluetoothLocalGattDescriptorBlueZ class implements |
| 20 // BluetoothRemoteGattDescriptor for remote and local GATT characteristic | 20 // BluetoothRemoteGattDescriptor for remote and local GATT characteristic |
| 21 // descriptors for platforms that use BlueZ. | 21 // descriptors for platforms that use BlueZ. |
| 22 class BluetoothLocalGattDescriptorBlueZ | 22 class BluetoothLocalGattDescriptorBlueZ |
| 23 : public BluetoothGattDescriptorBlueZ, | 23 : public BluetoothGattDescriptorBlueZ, |
| 24 public device::BluetoothLocalGattDescriptor { | 24 public device::BluetoothLocalGattDescriptor { |
| 25 public: | 25 public: |
| 26 static base::WeakPtr<BluetoothLocalGattDescriptor> Create( | 26 BluetoothLocalGattDescriptorBlueZ( |
| 27 const device::BluetoothUUID& uuid, | 27 const device::BluetoothUUID& uuid, |
| 28 device::BluetoothGattCharacteristic::Permissions permissions, | 28 device::BluetoothGattCharacteristic::Permissions permissions, |
| 29 device::BluetoothLocalGattCharacteristic* characteristic); | |
| 30 | |
| 31 BluetoothLocalGattDescriptorBlueZ( | |
| 32 const device::BluetoothUUID& uuid, | |
| 33 BluetoothLocalGattCharacteristicBlueZ* characteristic); | 29 BluetoothLocalGattCharacteristicBlueZ* characteristic); |
| 34 ~BluetoothLocalGattDescriptorBlueZ() override; | 30 ~BluetoothLocalGattDescriptorBlueZ() override; |
| 35 | 31 |
| 36 // device::BluetoothLocalGattDescriptor overrides. | 32 // device::BluetoothLocalGattDescriptor overrides. |
| 37 device::BluetoothUUID GetUUID() const override; | 33 device::BluetoothUUID GetUUID() const override; |
| 38 device::BluetoothGattCharacteristic::Permissions GetPermissions() | 34 device::BluetoothGattCharacteristic::Permissions GetPermissions() |
| 39 const override; | 35 const override; |
| 40 | 36 |
| 41 BluetoothLocalGattCharacteristicBlueZ* GetCharacteristic() const; | 37 BluetoothLocalGattCharacteristicBlueZ* GetCharacteristic() const; |
| 42 | 38 |
| 43 private: | 39 private: |
| 44 // Needs access to weak_ptr_factory_. | 40 // Needs access to weak_ptr_factory_. |
| 45 friend class device::BluetoothLocalGattDescriptor; | 41 friend class device::BluetoothLocalGattDescriptor; |
| 42 |
| 46 // UUID of this descriptor. | 43 // UUID of this descriptor. |
| 47 device::BluetoothUUID uuid_; | 44 device::BluetoothUUID uuid_; |
| 48 | 45 |
| 46 // Permissions of this descriptor. |
| 47 device::BluetoothGattCharacteristic::Permissions permissions_; |
| 48 |
| 49 // Characteristic that contains this descriptor. | 49 // Characteristic that contains this descriptor. |
| 50 BluetoothLocalGattCharacteristicBlueZ* characteristic_; | 50 BluetoothLocalGattCharacteristicBlueZ* characteristic_; |
| 51 | 51 |
| 52 // Note: This should remain the last member so it'll be destroyed and | 52 // Note: This should remain the last member so it'll be destroyed and |
| 53 // invalidate its weak pointers before any other members are destroyed. | 53 // invalidate its weak pointers before any other members are destroyed. |
| 54 base::WeakPtrFactory<BluetoothLocalGattDescriptorBlueZ> weak_ptr_factory_; | 54 base::WeakPtrFactory<BluetoothLocalGattDescriptorBlueZ> weak_ptr_factory_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattDescriptorBlueZ); | 56 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattDescriptorBlueZ); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace bluez | 59 } // namespace bluez |
| 60 | 60 |
| 61 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_ | 61 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_BLUEZ_H_ |
| OLD | NEW |