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

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

Issue 1898643002: Refactor device::BluetoothGattXXX classes to split into remote/local. (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
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_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "dbus/object_path.h" 13 #include "dbus/object_path.h"
14 #include "device/bluetooth/bluetooth_gatt_service.h" 14 #include "device/bluetooth/bluetooth_gatt_service.h"
15 15
16 namespace device {
17
18 class BluetoothGattCharacteristic;
19
20 } // namespace device
21
22 namespace bluez { 16 namespace bluez {
23 17
24 class BluetoothAdapterBlueZ; 18 class BluetoothAdapterBlueZ;
25 class BluetoothDeviceBlueZ; 19 class BluetoothDeviceBlueZ;
26 class BluetoothGattCharacteristicBlueZ;
27 20
28 // The BluetoothGattServiceBlueZ class implements BluetootGattService 21 // The BluetoothGattServiceBlueZ class implements BluetootGattService
29 // for GATT services on platforms that use BlueZ. 22 // for GATT services on platforms that use BlueZ.
30 class BluetoothGattServiceBlueZ : public device::BluetoothGattService { 23 class BluetoothGattServiceBlueZ : public virtual device::BluetoothGattService {
31 public: 24 public:
32 // device::BluetoothGattService overrides. 25 // device::BluetoothGattService overrides.
33 std::string GetIdentifier() const override; 26 std::string GetIdentifier() const override;
34 std::vector<device::BluetoothGattCharacteristic*> GetCharacteristics()
35 const override;
36 std::vector<device::BluetoothGattService*> GetIncludedServices()
37 const override;
38 device::BluetoothGattCharacteristic* GetCharacteristic(
39 const std::string& identifier) const override;
40 27
41 // Object path of the underlying service. 28 // Object path of the underlying service.
42 const dbus::ObjectPath& object_path() const { return object_path_; } 29 const dbus::ObjectPath& object_path() const { return object_path_; }
43 30
44 // Parses a named D-Bus error into a service error code. 31 // Parses a named D-Bus error into a service error code.
45 static device::BluetoothGattService::GattErrorCode DBusErrorToServiceError( 32 static device::BluetoothGattService::GattErrorCode DBusErrorToServiceError(
46 const std::string error_name); 33 const std::string error_name);
47 34
48 // Returns the adapter associated with this service. 35 // Returns the adapter associated with this service.
49 BluetoothAdapterBlueZ* GetAdapter() const; 36 BluetoothAdapterBlueZ* GetAdapter() const;
50 37
51 protected: 38 protected:
52 BluetoothGattServiceBlueZ(BluetoothAdapterBlueZ* adapter, 39 BluetoothGattServiceBlueZ(BluetoothAdapterBlueZ* adapter,
53 const dbus::ObjectPath& object_path); 40 const dbus::ObjectPath& object_path);
54 ~BluetoothGattServiceBlueZ() override; 41 ~BluetoothGattServiceBlueZ() override;
55 42
56 // Does not take ownership of the characteristic object.
57 using CharacteristicMap =
58 std::map<dbus::ObjectPath, BluetoothGattCharacteristicBlueZ*>;
59
60 // Mapping from GATT characteristic object paths to characteristic objects.
61 // owned by this service. Since the BlueZ implementation uses object
62 // paths as unique identifiers, we also use this mapping to return
63 // characteristics by identifier.
64 CharacteristicMap characteristics_;
65
66 private: 43 private:
67 friend class BluetoothDeviceBlueZ; 44 friend class BluetoothDeviceBlueZ;
68 45
69 // The adapter associated with this service. It's ok to store a raw pointer 46 // The adapter associated with this service. It's ok to store a raw pointer
70 // here since |adapter_| indirectly owns this instance. 47 // here since |adapter_| indirectly owns this instance.
71 BluetoothAdapterBlueZ* adapter_; 48 BluetoothAdapterBlueZ* adapter_;
72 49
73 // Object path of the GATT service. 50 // Object path of the GATT service.
74 dbus::ObjectPath object_path_; 51 dbus::ObjectPath object_path_;
75 52
76 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceBlueZ); 53 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceBlueZ);
77 }; 54 };
78 55
79 } // namespace bluez 56 } // namespace bluez
80 57
81 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ 58 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_gatt_notify_session_bluez.cc ('k') | device/bluetooth/bluez/bluetooth_gatt_service_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698