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; | |
scheib
2016/04/28 01:06:24
GetUUID: either make not implemented, test in this
rkc
2016/04/28 02:06:58
Added code to test this for characteristics and de
| |
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; |
27 | 52 |
28 BluetoothLocalGattCharacteristicBlueZ(BluetoothLocalGattServiceBlueZ* service, | 53 // Adds a descriptor to this characteristic. |
29 const dbus::ObjectPath& object_path); | 54 void AddDescriptor( |
30 ~BluetoothLocalGattCharacteristicBlueZ() override; | 55 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor); |
56 | |
57 // UUID of this characteristic. | |
58 device::BluetoothUUID uuid_; | |
59 | |
60 // Service that contains this characteristic. | |
61 BluetoothLocalGattServiceBlueZ* service_; | |
62 | |
63 // Descriptors contained by this characteristic. | |
64 std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>> descriptors_; | |
31 | 65 |
32 // Note: This should remain the last member so it'll be destroyed and | 66 // Note: This should remain the last member so it'll be destroyed and |
33 // invalidate its weak pointers before any other members are destroyed. | 67 // invalidate its weak pointers before any other members are destroyed. |
34 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; | 68 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; |
35 | 69 |
36 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); | 70 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); |
37 }; | 71 }; |
38 | 72 |
39 } // namespace bluez | 73 } // namespace bluez |
40 | 74 |
41 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | 75 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ |
OLD | NEW |