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

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

Issue 1915803002: Bluetooth class changes for implementing local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: magic values fix 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>
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 // device::BluetoothLocalGattCharacteristic overrides.
30 device::BluetoothUUID GetUUID() const override;
31 Properties GetProperties() const override;
32 Permissions GetPermissions() const override;
33
34 static base::WeakPtr<device::BluetoothLocalGattCharacteristic> Create(
scheib 2016/04/26 06:03:32 Usually Create / constructors before overrides of
rkc 2016/04/26 18:23:59 Done.
scheib 2016/04/27 05:13:00 Here and BluetoothLocalGattDescriptorBlueZ are not
rkc 2016/04/27 19:41:06 Whoops. Done and matched order of functions in all
35 const device::BluetoothUUID& uuid,
36 BluetoothGattCharacteristic::Properties properties,
37 BluetoothGattCharacteristic::Permissions permissions,
38 device::BluetoothLocalGattService* service);
39
40 BluetoothLocalGattServiceBlueZ* GetService();
41
42 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>&
43 GetDescriptors() const;
44
45 BluetoothLocalGattCharacteristicBlueZ(
46 const device::BluetoothUUID& uuid,
47 BluetoothLocalGattServiceBlueZ* service);
48 ~BluetoothLocalGattCharacteristicBlueZ() override;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698