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

Side by Side Diff: device/bluetooth/bluetooth_gatt_characteristic_bluez.h

Issue 1872943002: Add support for local services/characteristics/descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
ortuno 2016/04/14 17:42:34 It's 2016!
rkc 2016/04/14 19:27:26 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_BLUEZ_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_BLUEZ_H_
7
8 #include <stddef.h>
ortuno 2016/04/14 17:42:34 Don't see any NULLs or size_ts.
rkc 2016/04/14 19:27:26 Done.
9 #include <stdint.h>
ortuno 2016/04/14 17:42:35 Same here no ints.
rkc 2016/04/14 19:27:26 Done.
10
11 #include <map>
ortuno 2016/04/14 17:42:34 Some of these are no longer needed as well. Please
rkc 2016/04/14 19:27:26 Done.
12 #include <queue>
13 #include <string>
14 #include <utility>
15 #include <vector>
16
17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h"
19 #include "dbus/object_path.h"
20 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
21 #include "device/bluetooth/bluetooth_uuid.h"
ortuno 2016/04/14 17:42:34 No UUIDs.
rkc 2016/04/14 19:27:26 Done.
22
23 namespace device {
24
25 class BluetoothGattDescriptor;
26 class BluetoothGattService;
27
28 } // namespace device
29
30 namespace bluez {
31
32 class BluetoothGattDescriptorBlueZ;
33 class BluetoothGattServiceBlueZ;
34
35 // The BluetoothGattCharacteristicBlueZ class implements
36 // BluetoothGattCharacteristic for GATT characteristics for platforms
37 // that use BlueZ.
ortuno 2016/04/14 17:42:35 Could you mention that this class implements commo
rkc 2016/04/14 19:27:26 Seems like a superfluous comment. To implement com
38 class BluetoothGattCharacteristicBlueZ
39 : public device::BluetoothGattCharacteristic {
40 public:
41 // device::BluetoothGattCharacteristic overrides.
42 std::string GetIdentifier() const override;
43 device::BluetoothGattService* GetService() const override;
44 Permissions GetPermissions() const override;
45 std::vector<device::BluetoothGattDescriptor*> GetDescriptors() const override;
46 device::BluetoothGattDescriptor* GetDescriptor(
47 const std::string& identifier) const override;
48
49 // Object path of the underlying D-Bus characteristic.
50 const dbus::ObjectPath& object_path() const { return object_path_; }
51
52 protected:
53 BluetoothGattCharacteristicBlueZ(BluetoothGattServiceBlueZ* service,
54 const dbus::ObjectPath& object_path);
55 ~BluetoothGattCharacteristicBlueZ() override;
56
57 // Mapping from GATT descriptor object paths to descriptor objects owned by
58 // this characteristic. Since the BlueZ implementation uses object paths
59 // as unique identifiers, we also use this mapping to return descriptors by
60 // identifier.
61 using DescriptorMap =
62 std::map<dbus::ObjectPath, BluetoothGattDescriptorBlueZ*>;
ortuno 2016/04/14 17:42:34 optional: Any reason why you leave the deletion of
rkc 2016/04/14 19:27:26 This is a refactor. The purpose is to try to move
ortuno 2016/04/14 21:17:38 OK. I still think a comment that points out that i
rkc 2016/04/14 21:59:38 Done.
63 DescriptorMap descriptors_;
64
65 // The GATT service this GATT characteristic belongs to.
ortuno 2016/04/14 17:42:34 nit: The GATT service that owns this characteristi
rkc 2016/04/14 19:27:26 Done.
66 BluetoothGattServiceBlueZ* service_;
67
68 private:
69 friend class BluetoothRemoteGattServiceBlueZ;
70
71 // Object path of the D-Bus characteristic object.
72 dbus::ObjectPath object_path_;
73
74 // Note: This should remain the last member so it'll be destroyed and
75 // invalidate its weak pointers before any other members are destroyed.
76 base::WeakPtrFactory<BluetoothGattCharacteristicBlueZ> weak_ptr_factory_;
ortuno 2016/04/14 17:42:34 Do you still need this for the general implementat
rkc 2016/04/14 19:27:27 I do not, thanks for catching this. Done.
77
78 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicBlueZ);
79 };
80
81 } // namespace bluez
82
83 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698