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

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.
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>
9 #include <stdint.h>
10
11 #include <map>
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"
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.
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*>;
63 DescriptorMap descriptors_;
64
65 private:
66 friend class BluetoothGattServiceBlueZ;
67 friend class BluetoothRemoteGattServiceBlueZ;
scheib 2016/04/13 23:06:28 Instead of friending, just make the members protec
rkc 2016/04/14 00:23:48 The classes aren't in this class's hierarchy. I di
68 friend class BluetoothLocalGattServiceBlueZ;
69
70 // Object path of the D-Bus characteristic object.
71 dbus::ObjectPath object_path_;
72
73 // The GATT service this GATT characteristic belongs to.
74 BluetoothGattServiceBlueZ* service_;
75
76 // Note: This should remain the last member so it'll be destroyed and
77 // invalidate its weak pointers before any other members are destroyed.
78 base::WeakPtrFactory<BluetoothGattCharacteristicBlueZ> weak_ptr_factory_;
79
80 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicBlueZ);
81 };
82
83 } // namespace bluez
84
85 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CHARACTERISTIC_BLUEZ_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_bluez.h ('k') | device/bluetooth/bluetooth_gatt_characteristic_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698