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

Side by Side Diff: device/bluetooth/bluetooth_local_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_LOCAL_GATT_SERVICE_BLUEZ_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_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 "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h"
18 #include "dbus/object_path.h"
19 #include "device/bluetooth/bluetooth_gatt_service_bluez.h"
20 #include "device/bluetooth/bluetooth_uuid.h"
21 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
22 #include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
23
24 namespace device {
25
26 class BluetoothAdapter;
27 class BluetoothGattCharacteristic;
28
29 } // namespace device
30
31 namespace bluez {
32
33 class BluetoothAdapterBlueZ;
34 class BluetoothDeviceBlueZ;
35 class BluetoothLocalGattCharacteristicBlueZ;
36 class BluetoothLocalGattDescriptorBlueZ;
37
38 // The BluetoothLocalGattServiceBlueZ class implements BluetootGattService
39 // for local GATT services for platforms that use BlueZ.
40 class BluetoothLocalGattServiceBlueZ : public BluetoothGattServiceBlueZ {
41 public:
42 // device::BluetoothGattService overrides.
43 bool IsLocal() const override;
44 bool AddCharacteristic(
45 device::BluetoothGattCharacteristic* characteristic) override;
46 bool AddIncludedService(device::BluetoothGattService* service) override;
47 void Register(const base::Closure& callback,
48 const ErrorCallback& error_callback) override;
49 void Unregister(const base::Closure& callback,
50 const ErrorCallback& error_callback) override;
51
52 private:
53 friend class BluetoothDeviceBlueZ;
54
55 typedef std::map<dbus::ObjectPath, BluetoothLocalGattCharacteristicBlueZ*>
56 CharacteristicMap;
57
58 BluetoothLocalGattServiceBlueZ(BluetoothAdapterBlueZ* adapter,
59 BluetoothDeviceBlueZ* device,
60 const dbus::ObjectPath& object_path);
61 ~BluetoothLocalGattServiceBlueZ() override;
62
63 // Mapping from GATT characteristic object paths to characteristic objects.
64 // owned by this service. Since the BlueZ implementation uses object
65 // paths as unique identifiers, we also use this mapping to return
66 // characteristics by identifier.
67 CharacteristicMap characteristics_;
68
69 // Note: This should remain the last member so it'll be destroyed and
70 // invalidate its weak pointers before any other members are destroyed.
71 base::WeakPtrFactory<BluetoothLocalGattServiceBlueZ> weak_ptr_factory_;
72
73 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattServiceBlueZ);
74 };
75
76 } // namespace bluez
77
78 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698