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

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

Powered by Google App Engine
This is Rietveld 408576698