Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h

Issue 1947353002: //device/bluetooth support for attribute properties and permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@properties
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #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" 13 #include "device/bluetooth/bluetooth_local_gatt_service.h"
14 #include "device/bluetooth/bluetooth_uuid.h" 14 #include "device/bluetooth/bluetooth_uuid.h"
15 #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" 16 #include "device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.h"
17 17
18 namespace bluez { 18 namespace bluez {
19 19
20 class BluetoothLocalGattServiceBlueZ; 20 class BluetoothLocalGattServiceBlueZ;
21 21
22 // The BluetoothLocalGattCharacteristicBlueZ class implements 22 // The BluetoothLocalGattCharacteristicBlueZ class implements
23 // BluetoothLocalGattCharacteristic for local GATT characteristics for 23 // BluetoothLocalGattCharacteristic for local GATT characteristics for
24 // platforms that use BlueZ. 24 // platforms that use BlueZ.
25 class BluetoothLocalGattCharacteristicBlueZ 25 class BluetoothLocalGattCharacteristicBlueZ
26 : public BluetoothGattCharacteristicBlueZ, 26 : public BluetoothGattCharacteristicBlueZ,
27 public device::BluetoothLocalGattCharacteristic { 27 public device::BluetoothLocalGattCharacteristic {
28 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( 29 BluetoothLocalGattCharacteristicBlueZ(
36 const device::BluetoothUUID& uuid, 30 const device::BluetoothUUID& uuid,
31 Properties properties,
37 BluetoothLocalGattServiceBlueZ* service); 32 BluetoothLocalGattServiceBlueZ* service);
38 ~BluetoothLocalGattCharacteristicBlueZ() override; 33 ~BluetoothLocalGattCharacteristicBlueZ() override;
39 34
40 // device::BluetoothLocalGattCharacteristic overrides. 35 // device::BluetoothLocalGattCharacteristic overrides.
41 device::BluetoothUUID GetUUID() const override; 36 device::BluetoothUUID GetUUID() const override;
42 Properties GetProperties() const override; 37 Properties GetProperties() const override;
43 Permissions GetPermissions() const override; 38 Permissions GetPermissions() const override;
44 39
45 BluetoothLocalGattServiceBlueZ* GetService(); 40 BluetoothLocalGattServiceBlueZ* GetService();
46 41
47 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& 42 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>&
48 GetDescriptors() const; 43 GetDescriptors() const;
49 44
50 private: 45 private:
51 friend class BluetoothLocalGattDescriptorBlueZ; 46 friend class BluetoothLocalGattDescriptorBlueZ;
52 // Needs access to weak_ptr_factory_. 47 // Needs access to weak_ptr_factory_.
53 friend device::BluetoothLocalGattCharacteristic; 48 friend device::BluetoothLocalGattCharacteristic;
54 49
55 // Adds a descriptor to this characteristic. 50 // Adds a descriptor to this characteristic.
56 void AddDescriptor( 51 void AddDescriptor(
57 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor); 52 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor);
58 53
59 // UUID of this characteristic. 54 // UUID of this characteristic.
60 device::BluetoothUUID uuid_; 55 device::BluetoothUUID uuid_;
61 56
57 // Properties of this characteristic.
58 Properties properties_;
59
62 // Service that contains this characteristic. 60 // Service that contains this characteristic.
63 BluetoothLocalGattServiceBlueZ* service_; 61 BluetoothLocalGattServiceBlueZ* service_;
64 62
65 // Descriptors contained by this characteristic. 63 // Descriptors contained by this characteristic.
66 std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>> descriptors_; 64 std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>> descriptors_;
67 65
68 // 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
69 // invalidate its weak pointers before any other members are destroyed. 67 // invalidate its weak pointers before any other members are destroyed.
70 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; 68 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_;
71 69
72 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); 70 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ);
73 }; 71 };
74 72
75 } // namespace bluez 73 } // namespace bluez
76 74
77 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ 75 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698